EON安装ASE Interface

EON安装

我的eon路径于/eon/。

则环境为

export PYTHONPATH=/eon/:$PYTHONPATH
export PATH=/eon/bin:$PATH

source: https://theory.cm.utexas.edu/eon/installation.html

ASE

测试系统ubuntu。如果你python2和python3总是纠缠不清,可以sudo apt install python-is-python3直接解决。

经检查,我PC的
python地址为:
/usr/include/python3.8/

pybind11地址为:
/usr/include/pybind11/

已确认python地址下存有python.h,pybind11地址下存有pybind.h。

即得到

CXXFLAGS += -DASE_POT -I/usr/include/pybind11/ -I/usr/include/python3.8/

第二部分,libpython3.8.so地址在:
/usr/lib/x86_64-linux-gnu/libpython3.8.so

得到

LDFLAGS += -L/usr/lib/x86_64-linux-gnu/ -lpython3.8

如果什么都找不到可以通过以下代码搜索:
find / -name libpython3.8.so

vim 位于$EON_DIR/client/的Rules.mk,修改即可。

此时在client目录下make ASE_POT=1即可查看结果。
在这里插入图片描述

使用

教程表示要eon client可以连到Python dynamic library,就是LDFLAGS上的地址

export LD_LIBRARY_PATH=/path/to/python/rootdir/lib:$LD_LIBRARY_PATH

在程序的config.ini里面添加如下内容即可让EON利用ASE。

[Potential]
potential = ase
ext_pot_path = /full/path/to/the/ase_script.py

不过我觉得我系统已经有类似export LD_LIBRARY_PATH=/path/to/python/rootdir/lib:$LD_LIBRARY_PATH这样的操作了,便跳过了这一步。

这里最好用absolute path而不是relative path。
在这里插入图片描述然后这个python code我则放到了eon的位置。
在这里插入图片描述

from ase import Atoms
from ase.calculators.lj import LennardJones

def ase_calc():
    # MODIFY THIS SECTION
    calc = LennardJones(epsilon=0.0103, sigma=3.40, rc=10.0, ro=0.0, smooth=True)
    return calc

#=======================================================================
# DO NOT EDIT
def _calculate(R, atomicNrs, box, calc):
    system = Atoms(symbols=atomicNrs, positions=R, pbc=True, cell=box)
    system.calc = calc
    forces = system.get_forces()
    energy = system.get_potential_energy()
    return energy, forces
#=======================================================================


if __name__ == '__main__':
    # This is just to verify that the script runs properly with `python3 <this_script>`
    from ase.io import read
    atoms = read("...")  # structure file name
    pos = atoms.positions  # array of positions (n x 3)
    atomicNrs = atoms.get_atomic_numbers()  # array of atomic numbers (n)
    cell = atoms.cell  # cell array (3 x 3)
    calc = ase_calc()
    e, f = _calculate(pos, atomicNrs, cell, calc)
    print(f"E = {e}")
    print("F =")
    print(f)

测试

Source

https://theory.cm.utexas.edu/eon/ase_interface.html#ase-interface

相关推荐

  1. PHP之EOF定界符

    2024-06-10 09:48:01       38 阅读
  2. PHP之EOF定界符

    2024-06-10 09:48:01       9 阅读
  3. RabbitMQ Transport indicated EOF 总结

    2024-06-10 09:48:01       16 阅读
  4. 控制工程学 en

    2024-06-10 09:48:01       23 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-10 09:48:01       5 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-10 09:48:01       5 阅读
  3. 在Django里面运行非项目文件

    2024-06-10 09:48:01       4 阅读
  4. Python语言-面向对象

    2024-06-10 09:48:01       6 阅读

热门阅读

  1. 爬山算法详细介绍

    2024-06-10 09:48:01       19 阅读
  2. 4. 流程控制语句

    2024-06-10 09:48:01       17 阅读
  3. vscode 好用的插件

    2024-06-10 09:48:01       19 阅读
  4. 23种设计模式——创建型模式

    2024-06-10 09:48:01       19 阅读
  5. 2024年6月10日--6月16日(渲染+ue独立游戏)

    2024-06-10 09:48:01       22 阅读
  6. Terminal Multiplexer的使用

    2024-06-10 09:48:01       24 阅读
  7. 什么情况下需要用到动态IP

    2024-06-10 09:48:01       20 阅读
  8. node-mysql中占位符?的使用

    2024-06-10 09:48:01       19 阅读
  9. 007 CentOS 7.9 apache-tomcat-9.0.89安装及配置

    2024-06-10 09:48:01       18 阅读
  10. 设计模式-策略模式

    2024-06-10 09:48:01       19 阅读
  11. 密码学及其应用——安全邮件、公钥密码学和PKI

    2024-06-10 09:48:01       23 阅读
  12. 语法、语义、语用与向量化

    2024-06-10 09:48:01       21 阅读