Jump to content

Mod:Hunt Research Group/SAPT

From ChemWiki

Run SAPT calculations using Psi4

Installing Psi4 on the HPC

Psi4 comes as a pyhton module, thus we can use conda to create personal versions of Psi4 on the HPC.


1. Create your personal conda

Have a look at the HPC webpage.

The command to install your personal conda is:


anaconda-setup


2. Create a Psi4 environment

Load conda via:


module load anaconda3/personal


Create a Psi4 environment of the latest stable Psi4 release which will be called p4env via:


conda create -n p4env psi4 -c psi4


3. Check the installation


Load the environment you just created:


conda activate p4env


Check the version you installed:


psi4 --version


PBS submission script

Copy the submission script below into a file called p4run.sh

#!/bin/bash
#PBS -N psi4job
#PBS -q pqph
#PBS -l walltime=5:00:00
#PBS -l select=1:ncpus=20:mem=5gb
#PBS -j oe
# Load relevant modules
module load anaconda3/personal
source activate p4env
#export MYSCRATCH=/scratch/user/psi4.$PBS_JOBID
#foreach i (`sort $PBS_NODEFILE | uniq`)
#    echo "Creating scratch directory " ${MYSCRATCH} " on " $i
#    ssh $i rm -rf ${MYSCRATCH}
#    ssh $i mkdir -p ${MYSCRATCH}
#end
#unsetenv PSIDATADIR
# Change directory and set scratch directory
cd $PBS_O_WORKDIR
export PSI_SCRATCH=$TMPDIR
#if ! ( $?PSIPATH ) setenv PSIPATH ""
#setenv PSIPATH /path/to/external/modules:${PSIPATH}
# Execute psi4 job
psi4 -i ${in}.in -o ${in}.out -n 20
#foreach i (`sort $PBS_NODEFILE | uniq`)
#    echo "Removing scratch directory " ${MYSCRATCH} " on " $i
#    ssh $i rm -rf ${MYSCRATCH}
#end


IMPORTANT: You need to specify the memory and number of CPUs as usual in the submission script (#PBS -l select=1:ncpus=20:mem=30gb). You still need to take care that these numbers match the number of CPUs you give in the fifth row from the bottom (psi4 -i ${in}.in -o ${in}.out -n 20) and the memory specified in the actual input file. If you have mismatching parameters the job still might start running but not with the full capacity of the recourses you requested. For example if you request 20 cores and 30 GB of memory in the submission script but you only submit the job with 4 cores and 5 GB, you will have 16 cores and 20 GB which are not used during the computation.


Example Input

Here is an examplpe input file for the SAPT(2) calculation of the H3N-HCl dimer. Copy the content into a file called NH4Cl.in

memory 16 GB

molecule mol {
0 1
N        1.876377    0.000001   -0.000006
H        2.237648    0.661745   -0.680615
H        2.237486    0.258575    0.913443
H        2.237570   -0.920339   -0.232740
--
0 1
Cl      -1.177795    0.000000   -0.000001
H        0.175168    0.000012   -0.000026

units angstrom
symmetry c1
no_reorient
}

set basis         6-311+G(d,p)

energy('sapt2')

Assuming that both the PBS script and the input file are located in the same directory, submit the job via:


qsub -N SAPT2 -v in=NH4Cl p4run.sh


The results of the SAPT(2) calculation is a .out file. At the end of the NH4Cl.out file you will find the results of the SAPT(2) analysis which should be similar to this (slight differences might occur depending on the version of Psi4 you used):


    SAPT Results
  --------------------------------------------------------------------------------------------------------
    Electrostatics                -36.32899016 [mEh]     -22.79678645 [kcal/mol]     -95.38176366 [kJ/mol]
      Elst10,r                    -36.63905676 [mEh]     -22.99135619 [kcal/mol]     -96.19584351 [kJ/mol]
      Elst12,r                      0.31006660 [mEh]       0.19456974 [kcal/mol]       0.81407985 [kJ/mol]

    Exchange                       51.13218109 [mEh]      32.08592939 [kcal/mol]     134.24754146 [kJ/mol]
      Exch10                       48.11718409 [mEh]      30.19399013 [kcal/mol]     126.33166682 [kJ/mol]
      Exch10(S^2)                  46.43751367 [mEh]      29.13998098 [kcal/mol]     121.92169213 [kJ/mol]
      Exch11(S^2)                   0.99070562 [mEh]       0.62167719 [kcal/mol]       2.60109761 [kJ/mol]
      Exch12(S^2)                   2.02429139 [mEh]       1.27026208 [kcal/mol]       5.31477704 [kJ/mol]

    Induction                     -22.98775238 [mEh]     -14.42503300 [kcal/mol]     -60.35434386 [kJ/mol]
      Ind20,r                     -25.00378267 [mEh]     -15.69011116 [kcal/mol]     -65.64743140 [kJ/mol]
      Ind22                        -1.93327324 [mEh]      -1.21314732 [kcal/mol]      -5.07580888 [kJ/mol]
      Exch-Ind20,r                 14.66201899 [mEh]       9.20055621 [kcal/mol]      38.49513087 [kJ/mol]
      Exch-Ind22                    1.13365603 [mEh]       0.71137993 [kcal/mol]       2.97641390 [kJ/mol]
      delta HF,r (2)              -11.84637149 [mEh]      -7.43371065 [kcal/mol]     -31.10264835 [kJ/mol]

    Dispersion                     -7.02240313 [mEh]      -4.40662468 [kcal/mol]     -18.43731942 [kJ/mol]
      Disp20                       -9.19384826 [mEh]      -5.76922712 [kcal/mol]     -24.13844860 [kJ/mol]
      Exch-Disp20                   2.17144513 [mEh]       1.36260245 [kcal/mol]       5.70112918 [kJ/mol]

  Total HF                        -10.71000784 [mEh]      -6.72063166 [kcal/mol]     -28.11912557 [kJ/mol]
  Total SAPT0                     -17.73241096 [mEh]     -11.12725634 [kcal/mol]     -46.55644499 [kJ/mol]
  Total SAPT2                     -15.20696457 [mEh]      -9.54251473 [kcal/mol]     -39.92588548 [kJ/mol]

  Special recipe for scaled SAPT0 (see Manual):
    Electrostatics sSAPT0         -36.63905676 [mEh]     -22.99135619 [kcal/mol]     -96.19584351 [kJ/mol]
    Exchange sSAPT0                48.11718409 [mEh]      30.19399013 [kcal/mol]     126.33166682 [kJ/mol]
    Induction sSAPT0              -20.53889410 [mEh]     -12.88835117 [kcal/mol]     -53.92486646 [kJ/mol]
    Dispersion sSAPT0              -6.77815052 [mEh]      -4.25335384 [kcal/mol]     -17.79603418 [kJ/mol]
  Total sSAPT0                    -15.83891729 [mEh]      -9.93907107 [kcal/mol]     -41.58507733 [kJ/mol]
  --------------------------------------------------------------------------------------------------------