# Test runs of QMMM with LAMMPS and PySCF
Step 1: build LAMMPS
Step 2: download/build the MDI code coupling package
Step 3: download/build or install PySCF
Step 4: run 2-water QMMM problem for a few steps
---------------------------------
---------------------------------
Step 1: build LAMMPS
The molecule and kspace packages are needed for the 2-water test
problem. Copy the final LAMMPS executable into the
examples/QUANTUM/PySCF directory.
Traditional make:
% cd ~/lammps/lib/mdi
% python Install.py -m mpi
% cd ~/lammps/src
% make yes-mdi yes-molecule yes-kspace
% make -j mpi
% cp lmp_mpi ~/lammps/examples/QUANTUM/PySCF
CMake:
% cd ~/lammps
% mkdir build; cd build
% cmake -D PKG_MDI=yes -D PKG_MOLECULE=yes -D PKG_KSPACE=yes ../cmake
% make -j
% cp lmp ~/lammps/examples/QUANTUM/PySCF/lmp_mpi
---------------------------------
---------------------------------
Step 2: install the MDI code coupling package
(a) grab the MDI Git repo
% mkdir git; cd mdi
% git clone git@github.com:MolSSI-MDI/MDI_Library.git git
(b) build MDI
% cd mdi/git
% mkdir build; cd build
% cmake ..
% make -j
(c) Add something similar to the following to your .bashrc or .cshrc
file so that Python can find MDI:
For bash:
% export PYTHONPATH="$PYTHONPATH:/home/sjplimp/mdi/git"
% hash -r
For (t)csh:
% setenv PYTHONPATH ${PYTHONPATH}:/home/sjplimp/mdi/git
% rehash
---------------------------------
---------------------------------
Step 3: install PySCF
(a) download/build or install PySCF on your box
NOTE: add instructions here
(b) Add something similar to the following to your .bashrc or .cshrc
file so that Python can find PySCF:
For bash:
% export PYTHONPATH="$PYTHONPATH:/home/sjplimp/pyscf/git"
% hash -r
For (t)csh:
% setenv PYTHONPATH ${PYTHONPATH}:/home/sjplimp/pyscf/git
% rehash
(c) Check that you can import the 4 Python modules which the script
that wraps PySCF will need:
% python
>>> import numpy as np
>>> from mpi4py import MPI
>>> import MDI_Library as mdi
>>> import pyscf
---------------------------------
---------------------------------
Step 4: run the 2-water QMMM problem for a few steps
% cd ~/lammps/examples/QUANTUM/PySCF
# Run with TCP: 1 proc each
% lmp_mpi -mdi "-name LMP -role DRIVER -method TCP -port 8021" -log log.water.pyscf.qmmm.tcp.1 -in in.water.pyscf.qmmm &
% python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method TCP -port 8021 -hostname localhost"
# Run with MPI: 1 proc each
% mpirun -np 1 lmp_mpi -mdi "-name LMP -role DRIVER -method MPI" -log log.water.pyscf.qmmm.mpi.1 -in in.water.pyscf.qmmm : -np 1 python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method MPI" -pbc no
# Run in plugin mode: 1 proc
% lmp_mpi -mdi "-name LMP -role DRIVER -method LINK -plugin_path /home/sjplimp/lammps/git/examples/QUANTUM/PySCF" -log log.water.pyscf.qmmm.plugin.1 -in in.water.pyscf.qmmm.plugin
---------------------------------
---------------------------------
Step 5: run the mixture QMMM problem for a few steps
% cd ~/lammps/examples/QUANTUM/PySCF
# Run with TCP: 1 proc each
% lmp_mpi -mdi "-name LMP -role DRIVER -method TCP -port 8021" -log log.mixture.pyscf.qmmm.tcp.1 -in in.mixture.pyscf.qmmm &
% python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method TCP -port 8021 -hostname localhost"
# Run with MPI: 1 proc each
% mpirun -np 1 lmp_mpi -mdi "-name LMP -role DRIVER -method MPI" -log log.mixture.pyscf.qmmm.mpi.1 -in in.mixture.pyscf.qmmm : -np 1 python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method MPI" -pbc no
# Run in plugin mode: 1 proc
% lmp_mpi -mdi "-name LMP -role DRIVER -method LINK -plugin_path /home/sjplimp/lammps/git/examples/QUANTUM/PySCF" -log log.mixture.pyscf.qmmm.plugin.1 -in in.mixture.pyscf.qmmm.plugin