Files
lammps/examples/QUANTUM/PySCF
2023-02-24 13:32:58 -07:00
..
2023-02-03 15:20:18 -07:00
2023-02-03 15:20:18 -07:00
2023-02-09 14:05:47 -07:00
2023-02-09 14:05:47 -07:00
2023-02-09 14:05:47 -07:00
2023-02-09 14:05:47 -07:00
2023-02-09 14:05:47 -07:00
2023-02-24 13:32:58 -07:00

# Test runs with copuling of LAMMPS and PySCF

Step 0: What PySCF currently supports
Step 1: Build LAMMPS
Step 2: Download/build MDI code coupling package
Step 3: Download/build PySCF
Step 4: Perform test runs in any of 3 modes

---------------------------------
---------------------------------

Step 0: What PySCF currently supports

LATTE can be used with fix mdi/qmmm for QMMM simulations, but not with
fix mdi/qm to perform QM calculations of an entire system.  For QMMM
it can use the direct mode of fix mdi/qmmm, but not the potential
mode.  PySCF can calculate a QM energy and QM forces on each atom, but
it cannot compute a QM stress tensor.

---------------------------------
---------------------------------

Step 1: Build LAMMPS

The MDI, molecule, and kspace packages are needed.  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 -DPKG_MDI=yes -DPKG_MOLECULE=yes -DPKG_KSPACE=yes ../cmake
% make -j
% cp lmp ~/lammps/examples/QUANTUM/PySCF/lmp_mpi

---------------------------------
---------------------------------

Step 2: Download/build MDI code coupling package

(a) clone the MDI Git repo

% mkdir mdi; 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 a line like this to your ~/.bashrc or ~/.cshrc file so that
Python can find MDI:

For bash:

% export PYTHONPATH="$PYTHONPATH:/home/sjplimp/mdi/git/build"
% hash -r

For (t)csh:

% setenv PYTHONPATH ${PYTHONPATH}:/home/sjplimp/mdi/git/build
% rehash

---------------------------------
---------------------------------

Step 3: Download/build PySCF

See https://pyscf.org/install.html for install options.
This describes building PySCF from source code.

(a) clone the PySCI Git repo

% mkdir pyscf; cd pyscf
% git clone https://github.com/pyscf/pyscf.git git

(b) build PySCF

NOTE: you will also need numpy, scipy, h5py in your python

% cd pyscf/git/lib
% mkdir build; cd build
% cmake ..
% make -j

(c) Add a line like this 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

(d) Check import of 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: Perform test runs in any of 3 modes

These tests are in lammps/examples/QUANTUM/PySCF

in.water = QMMM of two-water system, 1 QM + 1 MM
in.mixture = QMMM of mixture, QM small molecule in MM water

** run LAMMPS-only versions of mixture problem

lmp_mpi -log log.mixture.mm.1 < in.mixture.mm

** run LAMMPS and LATTE 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 &
python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method TCP -port 8021 -hostname localhost"

lmp_mpi -mdi "-name LMP -role DRIVER -method TCP -port 8021" -log log.mixture.qmmm.tcp.1 -in in.mixture.qmmm &
python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method TCP -port 8021 -hostname localhost"

** run LAMMPS and PySCF with MPI, 1 proc each

mpirun -np 1 lmp_mpi -mdi "-name LMP -role DRIVER -method MPI" -log log.water.qmmm.mpi.1 -in in.water.qmmm : -np 1 python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method MPI" -pbc no

mpirun -np 1 lmp_mpi -mdi "-name LMP -role DRIVER -method MPI" -log log.mixture.qmmm.mpi.1 -in in.mixture.qmmm : -np 1 python pyscf_mdi.py -mdi "-name PYSCF -role ENGINE -method MPI" -pbc no

** run PySCF as plugin MDI engine, 1 proc

lmp_mpi -mdi "-name LMP -role DRIVER -method LINK -plugin_path /home/sjplimp/lammps/git/examples/QUANTUM/PySCF" -log log.water.qmmm.plugin.1 -in in.water.qmmm.plugin

lmp_mpi -mdi "-name LMP -role DRIVER -method LINK -plugin_path /home/sjplimp/lammps/git/examples/QUANTUM/PySCF" -log log.mixture.qmmm.plugin.1 -in in.mixture.qmmm.plugin