update for more recent MDI and PySCF versions

This commit is contained in:
Axel Kohlmeyer
2023-03-14 13:52:56 -04:00
parent 04dfda9952
commit c3dba53040
3 changed files with 22 additions and 34 deletions

View File

@ -11,11 +11,11 @@ Step 4: Perform test runs in any of 3 modes
Step 0: What PySCF currently supports Step 0: What PySCF currently supports
LATTE can be used with fix mdi/qmmm for QMMM simulations, but not with PySCF can be used with fix mdi/qmmm for QM/MM simulations, but not with fix
fix mdi/qm to perform QM calculations of an entire system. For QMMM mdi/qm to perform QM calculations of an entire system. For QM/MM it can use
it can use the direct mode of fix mdi/qmmm, but not the potential the direct mode of fix mdi/qmmm, but not the plugin mode. PySCF can calculate
mode. PySCF can calculate a QM energy and QM forces on each atom, but a QM energy and QM forces on each atom, but it cannot compute a QM stress
it cannot compute a QM stress tensor. tensor.
PySCF does not support MPI parallelism, so run it on a single MPI task. PySCF does not support MPI parallelism, so run it on a single MPI task.
But it does support multi-threading via OpenMP. By default it will use But it does support multi-threading via OpenMP. By default it will use
@ -66,32 +66,18 @@ CMake:
--------------------------------- ---------------------------------
--------------------------------- ---------------------------------
Step 2: Download/build MDI code coupling package Step 2: Install MDI code coupling python module
(a) clone the MDI Git repo You can install MDI in your Python environment via conda:
% mkdir mdi; cd mdi % conda install -c conda-forge pymdi=1.4.16
% git clone git@github.com:MolSSI-MDI/MDI_Library.git git
(b) build MDI or via pip:
% cd mdi/git % pip install 'pymdi>=1.4.14'
% mkdir build; cd build
% cmake ..
% make -j
(c) Add a line like this to your ~/.bashrc or ~/.cshrc file so that It is likely fine to leave off the version number, to get the latest
Python can find MDI: MDI version. 1.4.16 is the version LAMMPS is currently using.
For bash:
% export PYTHONPATH="$PYTHONPATH:/home/sjplimp/mdi/git/build"
% hash -r
For (t)csh:
% setenv PYTHONPATH ${PYTHONPATH}:/home/sjplimp/mdi/git/build
% rehash
--------------------------------- ---------------------------------
--------------------------------- ---------------------------------
@ -101,7 +87,7 @@ Step 3: Download/build PySCF
See https://pyscf.org/install.html for install options. See https://pyscf.org/install.html for install options.
This describes building PySCF from source code. This describes building PySCF from source code.
(a) clone the PySCI Git repo (a) clone the PySCF Git repo
% mkdir pyscf; cd pyscf % mkdir pyscf; cd pyscf
% git clone https://github.com/pyscf/pyscf.git git % git clone https://github.com/pyscf/pyscf.git git
@ -134,7 +120,7 @@ will need:
% python % python
>>> import numpy as np >>> import numpy as np
>>> from mpi4py import MPI >>> from mpi4py import MPI
>>> import MDI_Library as mdi >>> import mdi
>>> import pyscf >>> import pyscf
--------------------------------- ---------------------------------
@ -149,9 +135,9 @@ in.mixture = QMMM of mixture, QM small molecule in MM water
** run LAMMPS-only versions of mixture problem ** run LAMMPS-only versions of mixture problem
lmp_mpi -log log.mixture.mm.1 < in.mixture.mm lmp_mpi -log log.mixture.mm.1 -in in.mixture.mm
** run LAMMPS and LATTE with TCP/IP, 1 proc each ** run LAMMPS and PySCF with TCP/IP, 1 proc each
lmp_mpi -mdi "-name LMP -role DRIVER -method TCP -port 8021" -log log.water.qmmm.tcp.1 -in in.water.qmmm & lmp_mpi -mdi "-name LMP -role DRIVER -method TCP -port 8021" -log log.water.qmmm.tcp.1 -in in.water.qmmm &
python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method TCP -port 8021 -hostname localhost" python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method TCP -port 8021 -hostname localhost"

View File

@ -36,7 +36,7 @@ velocity all create 300.0 87287 loop geom
timestep 2.0 timestep 2.0
fix 1 all nve fix 1 all nve
fix 2 qm mdi/qmmm direct elements O H fix 2 qm mdi/qmmm direct elements O H
fix_modify 2 energy yes fix_modify 2 energy yes
@ -45,4 +45,4 @@ thermo_style custom step cpu temp ke evdwl ecoul epair emol elong &
f_2 pe etotal press f_2 pe etotal press
thermo 1 thermo 1
run 10 run 10

View File

@ -532,12 +532,14 @@ def evaluate():
if periodic: if periodic:
cell = Cell() cell = Cell()
cell.verbose = 4
cell.atom = atom_str cell.atom = atom_str
cell.a = box_str cell.a = box_str
cell.basis = basis cell.basis = basis
cell.build() cell.build()
else: else:
mol = Mole() mol = Mole()
mol.verbose = 4
mol.atom = atom_str mol.atom = atom_str
mol.basis = basis mol.basis = basis
#mol.max_memory = 10000 #mol.max_memory = 10000
@ -555,8 +557,8 @@ def evaluate():
if mode == QMMM: if mode == QMMM:
if periodic: mf = RKS_pbc(cell,xc=xcstr) if periodic: mf = RKS_pbc(cell,xc=xcstr)
else: mf = RKS_nonpbc(mol,xc=xcstr) else: mf = RKS_nonpbc(mol,xc=xcstr)
mf = qmmm.mm_charge(mf,mm_coords,mm_charges,mm_radii) mf = qmmm.mm_charge(mf,mm_coords,mm_charges)
if dm_previous_exists: if dm_previous_exists:
qm_pe = mf.kernel(dm0=dm_previous) qm_pe = mf.kernel(dm0=dm_previous)
else: else: