运行crystal17代码的aiida插件
aiida-crystal17的Python项目详细描述
AIIDA-晶体17
用于运行CRYSTAL17代码的aiida插件。 代码主要是根据Crystal17测试的, 但是输出解析也已经过Crystal14的测试。
文档:https://readthedocs.org/projects/aiida-crystal17
安装
从pypi安装:
>> pip install aiida-crystal17
要安装开发版本:
>> git clone https://github.com/chrisjsewell/aiida-crystal17 . >> cd aiida-crystal17 >> pip install -e . # also installs aiida, if missing (but not postgres) >> #pip install -e .[pre-commit,testing] # install extras for more features >> verdi quicksetup # set up a new profile >> verdi calculation plugins # should now show the calclulation plugins (with prefix crystal17.)
用法
基本计算
crystal17.basic
是最简单的计算插件。
它接受一个预先编写的.d12文件作为输入
(可选)一个带有几何图形的.gui文件,用于包含EXTERNAL
关键字的.d12输入。
假设aiida已配置并且数据库正在运行:
>> verdi daemon start # make sure the daemon is running >> cd examples >> verdi run test_submit_basic.py # submit test calculation submitted calculation;calc=Calculation(PK=5) >> verdi calculation list -a # check status of calculation PK Creation State Sched. state Computer Type ---- ---------- -------------- ------------- ---------- --------------------------- 5 1m ago WITHSCHEDULER localhost crystal17.basic >> verdi calculation list -a # after a few seconds PK Creation State Sched. state Computer Type ---- ---------- -------------- ------------- ---------- --------------------------- 5 1m ago FINISHED DONE localhost crystal17.basic
计算运行后,它将链接到输入节点和多个输出节点:
>> verdi calculation show 5 ----------- --------------------------------------------------- type CryBasicCalculation pk 5 uuid 3d9f804b-84db-443a-b6f8-69c15d96d244 label aiida_crystal17 test description Test job submission with the aiida_crystal17 plugin ctime 2018-08-27 15:23:38.670705+00:00 mtime 2018-08-27 15:24:26.516127+00:00 computer [2] localhost code runcry17 ----------- --------------------------------------------------- ##### INPUTS: Link label PK Type --------------- ---- -------------- input_external 3 SinglefileData input_file 4 SinglefileData ##### OUTPUTS: Link label PK Type ----------------- ---- ------------- remote_folder 6 RemoteData retrieved 7 FolderData output_parameters 8 ParameterData output_settings 9 StructSettingsData output_structure 10 StructureData ##### LOGS: There are 1 log messages for this calculation Run 'verdi calculation logshow 5' to see them
输出代表:
remote_folder
提供指向工作目录的符号链接 计算运行的位置。retrieved
存储包含runcry17
(作为main.out)output_parameters
在 数据库,供以后查询output_structure
存储计算的最终几何图形output_settings
存储有关结构的附加信息, 比如对称运算。
为了兼容,参数的命名与
aiida-quantumespresso
:
代码::外壳
>> verdi data parameter show 8
{
"calculation_spin": false,
"calculation_type": "restricted closed shell",
"ejplugins_version": "0.9.7",
"energy": -7380.22160519032,
"energy_units": "eV",
"errors": [],
"mulliken_charges": [
0.776999999999999,
-0.776999999999999
],
"mulliken_electrons": [
11.223,
8.777
],
"number_of_assymetric": 2,
"number_of_atoms": 2,
"parser_class": "CryBasicParser",
"parser_version": "0.3.0a0",
"parser_warnings": [
"no initial structure available, creating new kinds for atoms"
],
"scf_iterations": 7,
"volume": 18.65461525,
"wall_time_seconds": 5,
"warnings": []
}
可以通过以下方式查看结构设置内容
(使用-c
查看对称操作):
>> verdi data cry17-settings show 9 centring_code: 1 crystal_type: 1 num_symops: 48 space_group: 1
最终的结构可以由许多不同的 程序(假设可执行文件可用):
>> verdi data structure show --format xcrysden 10
主要计算
这个crystal17.main
插件是用一个更编程的
输入接口它创建输入.d12
和.gui
文件,
从一组aiida节点。
>> verdi daemon start # make sure the daemon is running >> cd examples >> verdi run test_submit_main.py # submit test calculation submitted calculation;calc=Calculation(PK=1) >> verdi calculation list -a # check status of calculation PK Creation State Sched. state Computer Type ---- ---------- -------------- ------------- -------------- ----------------- 1 1m ago WITHSCHEDULER RUNNING localhost-test crystal17.main >> verdi calculation list -a # after completion (~30 minutes if using runcry17) PK Creation State Sched. state Computer Type ---- ---------- -------------- ------------- -------------- ----------------- 1 4m ago FINISHED DONE localhost-test crystal17.main
计算运行后,它将链接到输入节点和 输出节点数:
verdi calculation show 1 ----------- --------------------------------------------------- type CryMainCalculation pk 1 uuid 3d9f804b-84db-443a-b6f8-69c15d96d244 label aiida_crystal17 test description Test job submission with the aiida_crystal17 plugin ctime 2018-08-27 15:23:38.670705+00:00 mtime 2018-08-27 15:24:26.516127+00:00 computer [1] localhost-test code runcry17 ----------- --------------------------------------------------- ##### INPUTS: Link label PK Type ------------ ---- ------------- parameters 4 ParameterData settings 5 StructSettingsData basis_Ni 2 BasisSetData basis_O 3 BasisSetData structure 6 StructureData ##### OUTPUTS: Link label PK Type ----------------- ---- ------------- remote_folder 7 RemoteData retrieved 8 FolderData output_parameters 9 ParameterData output_structure 10 StructureData ##### LOGS: There are 1 log messages for this calculation Run 'verdi calculation logshow 1' to see them
输入表示:
parameters
是(结构无关的)数据字典, 用于创建main.d12文件structure
存储计算的初始原子配置。settings
存储与初始原子相关的附加数据 构型,如对称运算和初始自旋。basis_
存储每个元素的基集。
测试
以下将发现并运行所有单元测试:
>> pip install -e .[testing] >> reentry scan -r aiida >> pytest -v
省略调用runcry17
的测试:
>> pytest -v -m "not process_execution"
或者调用mock_runcry17
可执行文件,
首先设置全局环境变量:
>> exportMOCK_EXECUTABLES=true
开发和测试说明
原始插件模板是从 aiida-plugin-cutter
编码风格要求
使用prospector测试代码样式,
在.prospector.yaml
和yapf中设置配置
使用aiida-crystal17[pre-commit]
安装使pre-commit
包可用,它将通过重新格式化代码来确保这些测试通过
以及在提交提交之前测试lint错误。
可通过以下方式设置:
>> cd aiida-crystal17
>> pre-commit install
也可以分别运行yapf
和prospector
:
>> yapf -r -i . # recusivel find and format files in-place
>> prospector
像PyCharm这样的编辑器也有自动的代码重新格式化实用程序,它应该遵循这个标准
针对模拟晶体17可执行文件进行测试
由于CRYSTAL17是许可软件,因此无法在Travis CI上获取可执行文件的副本。
因此,一个模拟可执行文件(mock_runcry17
)已经被创建用于测试目的(这也加快了测试运行)。
此可执行文件计算所提供输入文件的md5哈希,并尝试将其与
预先计算的散列。如果找到,可执行文件将把匹配的输出(从test/output_files
)写入stdout。
要在运行测试时使用此模拟可执行文件,请设置全局变量MOCK_EXECUTABLES=true
。
局部设置晶体17
在上设置Crystal17的本地版本Mac(从分发服务器下载副本后),我必须:
从可执行权限中删除隔离区:
xattr -c crystal xattr -c properties
在预期文件夹中创建lapack/blas库的版本:
sudo port install lapack sudo cp /opt/local/lib/lapack/liblapack.3.dylib /usr/local/opt/lapack/lib/liblapack.3.dylib sudo cp /opt/local/lib/lapack/libblas.3.dylib /usr/local/opt/lapack/lib/libblas.3.dylib
在
~/.bashrc
中定义环境变量,详见cry17_scripts/cry17.bashrc
将
cry17_scripts/runcry17
脚本复制或符号链接到/usr/local/bin/
许可证
麻省理工学院