Psi4 - shannonhouck/mayhall-lab-manual GitHub Wiki
Introduction
Psi4 is an open-source quantum chemistry package. You can explore its GitHub here and its documentation here. Its main interface is Python-based. There are two ways to use Psi4. You can construct a Psi4 input file in the format expected by the parser and run it with the Psi4 program. Alternately, you can import and use Psi4 as a Python module; this approach is often referred to as Psi4API and, since it’s generally more flexible, is the approach we’ll be focusing on here.
Setting Up A Psi4 File
A simple SCF calculation can be run as follows:
import psi4
h2o = psi4.core.Molecule.from_string("""
0 1
O
H 1 1
H 1 1 2 104.5
""")
opts = {'basis': 'sto-3g'}
psi4.set_options(opts)
E = psi4.energy('scf', molecule=h2o)
There are multitudes of methods and options to choose from, most of which are covered thoroughly in the Psi4 documentation and samples. Once you’ve created the input file, the program can then be run from the command line:
$ psi4 [filename].dat
Running Psi4 On The Cluster
Our group has a Psi4 installed in the group folder (/groups/nmayhall_lab/psi4
). In order to run on the cluster, load the conda environment as follows:
module load Anaconda
. /groups/nmayhall_lab/psi4/psi4conda/etc/profile.d/conda.sh
conda activate
You’ll have to do this every time you log in or start an interactive job, and you should include it in the submission script of every Psi4 job you submit. If you want, you can add these lines to your .bashrc
to load the environment by default. In any case, once the environment has been activated, you should be able to run Psi4 jobs!
Note that because Anaconda has its own Python version, you may have to remove any other Pythons you may have loaded to avoid errors. Doing a module purge before you start the process should do the trick.
Updating Psi4 on the cluster
The Psi4 version on the cluster has been installed using Anaconda. To update it, follow the instructions here for updating the Psi4 binary. (Note that the version on the cluster uses the nightly developer build.)
Sample Psi4 Job Submission Script (ARC)
A full sample PBS job submission script for Psi4 on the ARC clusters is shown below:
#PBS -l walltime=00:00:10:00
#PBS -l nodes=1:ppn=24
#PBS -l mem=120GB
#PBS -q nmayhall_lab
#PBS -A qcvt_doe
#PBS -W group_list=nmayhall_lab
# load conda environment (use if it’s not loaded by default)
module purge
module load Anaconda
. /groups/nmayhall_lab/psi4/psi4conda/etc/profile.d/conda.sh
conda activate
# filename to run
export FILE=”input”
# set up Psi4 scratch directory
mkdir $TMPDIR/$PBS_JOBID
export PSI_SCRATCH=$TMPDIR/$PBS_JOBID
# copy over input file to running node
cd $TMPDIR/
cp $PBS_O_WORKDIR/$FILE.py .
# run Psi4 job
python $FILE.py >> $FILE.out
# copy output file back and do cleanup
cp ./$FILE.out $PBS_O_WORKDIR/$FILE.out
rm -rf $PSI_SCRATCH
exit;