For large systems (> 1000 atoms), DFT or other high-level wave functional theory methods are not feasible, while the widely used force fields are not accurate enough.
python install .
xtb-python
has been separated from xtb
since version 6.3.0.
The installation of xtb-python
relies on a shared python library (i.e. libpython3.6m.so).
It causes some troubles for platforms where a shared python library is not available like Grendel-S (only having libpython3.6m.a).
There are two options to solve this problem:
-fPIC
.(agox) [tang@grendel-s-s81n11:xtb]$ git clone https://github.com/grimme-lab/xtb-python xtb-python-20211001 (agox) [tang@grendel-s-s81n11:xtb]$ cd xtb-python-20211001 (agox) [tang@grendel-s-s81n11:xtb-python-20211001]$ git submodule update --init (agox) [tang@grendel-s-s81n11:xtb-python-20211001]$ ml load python/3.8.3 (agox) [tang@grendel-s-s81n11:xtb-python-20211001]$ ml load intel/2018.1.163 (agox) [tang@grendel-s-s81n11:xtb-python-20211001]$ cd subprojects/xtb/ (agox) [tang@grendel-s-s81n11:xtb]$ export FC=ifort CC=icc (agox) [tang@grendel-s-s81n11:xtb]$ meson setup build --buildtype release --optimization 2 --prefix=/home/tang/opt/xtb/xtb-python-20211001/subprojects/xtb/install (agox) [tang@grendel-s-s81n11:xtb]$ ninja -C build test (agox) [tang@grendel-s-s81n11:xtb]$ ninja -C build install (agox) [tang@grendel-s-s81n11:xtb]$ cd /home/tang/opt/xtb/xtb-python-20211001 (agox) [tang@grendel-s-s81n11:xtb]$ export PKG_CONFIG_PATH=/home/tang/opt/xtb/xtb-python-20211001/subprojects/xtb/install/lib64/pkgconfig:$PKG_CONFIG_PATH (agox) [tang@grendel-s-s81n11:xtb-python-20211001]$ meson setup build --prefix=$PWD --default-library=shared (agox) [tang@grendel-s-s81n11:xtb-python-20211001]$ ninja -C build install
The first step is to compile tblite
binary file.
git clone https://github.com/tblite/tblite.git git-20221017 cd git-20221017 module load python/3.8.3 module load gcc/10.1.0 module load cmake/3.19.0 py38 export CC=gcc export FC=gfortran meson setup _build --prefix=/home/tang/opt/tblite/git-20221017/build meson compile -C _build meson install -C _build
Then, one needs to prepare a environment variable file for tblite
, such as
#!/usr/bin/env bash XTBHOME=/home/tang/opt/tblite/git-20221017/build # to include the documentation we include our man pages in the users manpath MANPATH=${MANPATH}:${XTBHOME}/share/man # finally we have to make the binaries and scripts accessable PATH=${PATH}:${XTBHOME}/bin LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${XTBHOME}/lib64 PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${XTBHOME}/lib64/pkgconfig PYTHONPATH=${PYTHONPATH}:${XTBHOME}/lib/python3.8/site-packages module load python/3.8.3 module load gcc/10.1.0 export PATH XTBPATH MANPATH LD_LIBRARY_PATH PKG_CONFIG_PATH PYTHONPATH
After loading those variables, tblite
python interface can be compiled.
source /home/tang/lib/tblite-py38-22Oct meson setup _build_python python -Dpython_version=$(which python3) --prefix=/home/tang/opt/tblite/git-20221017/build meson compile -C _build_python meson install -C _build_python
xtb v6.2.3 has a built-in python module which has PBC support for GFN0
.
This is simple script to try the PBC features of xtb.
from ase.build import fcc111 from ase.optimize import BFGS from xtb.calculators import GFN0 slab = fcc111('Pt', (2, 2, 4), vacuum=10, orthogonal=True) slab.set_calculator(GFN0()) opt = BFGS(slab, logfile='log.txt', trajectory='opt.traj') opt.run(fmax=0.1)
If you set slab.set_pbc([0, 0, 0])
, the system will be treated as an isolated system.
If one of the three dimensions is periodic, the xtb python will regard the system as periodic.
The periodic GFN0
seems unstable when the size of the system is large.
For example, slab = fcc111('Pt', (2, 2, 4), vacuum=10, orthogonal=True)
will lead to Segmentation fault
................................................... : SETUP : :.................................................: : # basis functions 1440 : : # atomic orbitals 1296 : : # shells 432 : : # electrons 1440 : : PBC by CCM true : : electronic temp. 300.0000000 K : : accuracy 1.0000000 : : -> integral cutoff 0.2500000E+02 : : -> integral neglect 0.1000000E-07 : ................................................... /var/spool/slurmd/job5343886/slurm_script: line 36: 34902 Segmentation fault (core dumped) $command
Taking H2O as an example, dipole moment in xtb
is in line full (x, y, z):
with atomic units.
1 Debye = 2.541746473 au.
molecular dipole: x y z tot (Debye) q only: 0.000 0.000 -0.632 full: -0.000 0.000 -0.900 2.286
In ase-xtb
, atoms.get_dipole_moment()
has the unit (e Å)
, while atoms.get_dipole_moment()/Bohr
has the atomic unit (e Bohr)
.