Installing and running Psi4 on a HPC cluster.
Psi4 is a open source quantum chemistry software similar to Gaussian. It is used to mainly calculate energies and optimize geometries of isolated molecules, among other possible outputs.
Psi4 can be installed by first creating a Conda environment and then installing Psi4 using Conda install:
spack load miniconda3
conda create -n dft
conda activate dft
conda install -c psi4 psi4
You can verify that the installation was successful using:
psi4 --test
After this, we are ready for our first calculation. Here, we will optimize the geometry of methanol in a hypothetical solvent that has a static permittivity of 30 and dynamic permittivity of 2. The input file can be made using the software vim. The extension .in can be used. See the input file below:
# Methanol b3lyp opt pcm 6-311++G(2df,2pd)
molecule Methanol {
0 1
C -6.11036 2.62726 0.00000
O -5.04036 2.62726 0.00000
H -6.46703 2.09091 -0.85441
H -6.46703 3.63537 -0.03729
H -6.46703 2.15549 0.89170
H -4.71703 3.05493 -0.80836
}
memory 2000 mb
set basis 6-311++G(2df,2pd)
set pcm true
pcm = {
Units = Angstrom
Medium {
SolverType = IEFPCM
Solvent = Explicit
Proberadius = 1.5
GREEN<INSIDE>
{
TYPE=VACUUM
}
GREEN<OUTSIDE>
{
TYPE=UNIFORMDIELECTRIC
eps=30
epsdyn=2.0
}
}
Cavity {
RadiiSet = UFF
Type = GePol
Scaling = False
Area = 0.3
Mode = Implicit
}
}
optimize('b3lyp')
The above input file as four section: 1) The geometry, charge and multiplicity of the molecule, 2) The memory needed and the basis set used, 3) The PCM section and the 4) optimization section which also include the functional being used. For the first section, methanol is neutral and as a multiplicity of one so we input 0 1. For more information, visit the Psi4 website: https://psicode.org/.
Then we can create a slurm shell script that will run the input file on the cluster using 16 cores and 2 GB of memory within one node:
#!/bin/bash
#SBATCH -J test # Job name
#SBATCH -n 16 # Number of total cores
#SBATCH -N 1 # Number of nodes
#SBATCH -A accountname
#SBATCH -p cpu
#SBATCH -t 2-00:00:00
#SBATCH --mem-per-cpu=2000 # Memory pool for all cores in MB
#SBATCH -e test_%j.err
#SBATCH -o test_%j.out # File to which STDOUT will be written %j is the job #
echo "Job started on `hostname` at `date`"
#source activate envname
psi4 -i Methanol.in -o Methanol.out -n 16
echo " "
echo "Job Ended at `date`"
This gives us an output file named Methanol.out. The file contain many different sections including the following (here for a different molecule):
The energetics:
=> Energetics <=
Nuclear Repulsion Energy = 246.2616948092595237
One-Electron Energy = -955.2363591967575758
Two-Electron Energy = 401.7398237144908535
DFT Exchange-Correlation Energy = -35.2864968681339377
Empirical Dispersion Energy = 0.0000000000000000
VV10 Nonlocal Energy = 0.0000000000000000
PCM Polarization Energy = -0.0205233877998851
Total Energy = -342.5418609289409915
Computation Completed
The multipole moment:
Multipole Moments:
------------------------------------------------------------------------------------
Multipole Electronic (a.u.) Nuclear (a.u.) Total (a.u.)
------------------------------------------------------------------------------------
L = 1. Multiply by 2.5417464519 to convert [e a0] to [Debye]
Dipole X : 3.3167002 -6.2663852 -2.9496850
Dipole Y : -0.0029510 0.0031883 0.0002373
Dipole Z : -0.0083102 0.0113474 0.0030372
Magnitude : 2.9496866
------------------------------------------------------------------------------------
As well as the optimized geometry. This is very useful for a multiple list of scientific tasks.