Abinit是國外常用的開源軟體,當然國內使用付費軟體比較多,例如VASP等,我初步使用摸索這個軟體是在國外,下面介紹我的使用流程,首先我要用的abinit已在叢集上,它可以用於DFT計算包括總能、電荷密度、電子結構、弛豫、分子動力學模擬、介電張量等…
1.為了連線叢集,提交任務,需要寫一個slurm指令碼,定義了節點數、任務名稱、slurm分割槽、實際時間、環境變數等資訊,例如:$ cat seq.sh
#!/bin/bash
#SBATCH --job-name=seq
#SBATCH --output=%x.o%j
#SBATCH --ntasks=1
#SBATCH --time=01:00:00
##SBATCH --partition=<cpu_short|cpu_med|cpu_prod|cpu_long> (see available partitions)
# To clean and load modules defined at the compile and link phases
module purge
module load ...
# echo of commands
set -x
# To compute in the submission directory
cd ${SLURM_SUBMIT_DIR}
# execution
./a.out
還有些例子: https://gitlab-research.centralesupelec.fr/mesocentre-public/ruche_examples
不同環境下的指令碼可能不一樣。
2.有了提交作業的指令碼,接下來就是建立輸入檔案了,包括
**.in
**.files(指定了輸入輸出檔案和贗勢檔案)
**.sh(提交作業的檔案)
檔案的具體設定參考abinit官網:https://docs.abinit.org/guide/abinit/
(我還在嘗試中,不同計算需要不同的變數設定)
3.計算結束就需要後處理資料了,官網給了一個Abipy程式,其安裝和使用祥見:https://github.com/abinit/abipy#id1
它要在Python/conda環境下執行,所以要先有這個,copy一個conda例子如下:
[username@ruche ~]$ module load anaconda3/2020.02/gcc-9.2.0
[username@ruche ~]$ conda create -n myenv
Solving environment: done
## Package Plan ##
environment location: /home/username/.conda/envs/myenv
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate myenv
#
# To deactivate an active environment, use:
# > source deactivate
#
[username@ruche ~]$ source activate myenv
(myenv) [username@ruche ~]$ conda install mpi4py
Solving environment: done
## Package Plan ##
environment location: /home/username/.conda/envs/myenv
added / updated specs:
- mpi4py
The following packages will be downloaded:
package | build
---------------------------|-----------------
(...)
mpi4py-3.0.3 | py38h028fd6f_0 572 KB
mpich-3.3.2 | hc856adb_0 3.8 MB
python-3.8.3 | hcff3b4d_0 49.1 MB
(...)
------------------------------------------------------------
Total: 37.9 MB
The following NEW packages will be INSTALLED:
(...)
mpi4py pkgs/main/linux-64::mpi4py-3.0.3-py38h028fd6f_0
mpich pkgs/main/linux-64::mpich-3.3.2-hc856adb_0
python pkgs/main/linux-64::python-3.8.3-hcff3b4d_0
(...)
Proceed ([y]/n)? y
Downloading and Extracting Packages
(...)
mpi4py-3.0.3 | 572 KB | ##################################### | 100%
(...)
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(myenv) [username@ruche ~]$ conda list
# packages in environment at /home/username/.conda/envs/myenv:
#
# Name Version Build Channel
(...)
mpi4py 3.0.3 py38h028fd6f_0
mpich 3.3.2 hc856adb_0
(...)
python 3.8.3 hcff3b4d_0
(...)
接著就可以使用啦,一些命令工具如下:
abiopen.py Open file inside ipython.abistruct.py Swiss knife to operate on structures.abiview.py Visualize results from file.abicomp.py Compare results extracted from multiple files.abicheck.py Validate integration between AbiPy and Abinitabirun.py Execute AbiPy flow from terminal.abidoc.py Document Abinit input variables and Abipy configuration files.abinp.py Build input files (simplified interface for the AbiPy factory functions).使用方法可參考:http://abinit.github.io/abipy/scripts/abiview.html#abiview-py
我想先用其來視覺化結構檔案,結果卻是這樣的檔案:
估計是計算錯了,後續更新…
另外當下次連線伺服器時,還要再啟用conda環境使用:source activate myenv