Updated 2023-04-10

Run PSI4 on the Cluster

Overview

  • PSI4 provides a wide variety of quantum chemical methods using state-of-the-art numerical methods and algorithms. Several parts of the code feature shared-memory parallelization to run efficiently on multi-core machines. An advanced parser written in Python allows the user input to have a very simple style for routine computations, but it can also automate very complex tasks with ease

Running PSI4 Executable

Allocating Resources

  • In order to run PSI4 interactivley we can use the salloc command to specify the account, partitions, time, and queue

  • Here is an example of an salloc command you can use: salloc -A [Account] -N 1 -n 8 -t 15 -q embers

  • This will allocate the proper resources to run PSI4

Using Hartree-Fock Calculation Example

  • The following example will show running PSI4 interactively using a Hartree-Fock example

  • Here is what the input.dat script should look like:

# Any line starting with the # character is a comment line
#! Sample HF/cc-pVDZ H2O computation

memory 600 mb

molecule h2o {
  O
  H 1 0.96
  H 1 0.96 2 104.5
}

set basis cc-pVDZ
energy('scf')
  • We can do the following in order to run this script with PSI4:

  • Load module: module load psi4/1.6.1

  • Run Script: srun psi4 input.dat

  • Your output should look something like this that will give you the Hartree-Fock Calculation:


@DF-RHF Final Energy:   -76.02663273509029

   => Energetics <=

    Nuclear Repulsion Energy =              9.1681932964243487
    One-Electron Energy =                -123.1035077420448545
    Two-Electron Energy =                  37.9086817105302245
    Total Energy =                        -76.0266327350902884

Computation Completed

Running PSI4 in Batch Mode

  • We can also test this in a normal batch mode. Here is an example batch script:
#!/bin/bash
#SBATCH -J psi4-test
#SBATCH -A [Account]
#SBATCH -N 1 -n 8
#SBATCH -t 15
#SBATCH -q embers
#SBATCH -o Report-%j.out
#SBATCH -e Report-%j.err

cd $SLURM_SUBMIT_DIR

module load psi4

srun input.dat

Submitting job and collecting results

  • Make sure your're in the folder where the SBATCH Script is located, and run
sbatch <scriptName.sbatch>  #ex: sbatch ex_psi4.sbatch
  • If successful, this will print something like Submitted batch job 1280063

  • The number in the beginning is the job id, useful for checking predicted wait time in queue or job status

  • After a couple seconds, find estimated wait time in queue and job status with squeue -u ACCOUNTNAME

  • Any files created by the script will show up in the folder where the script was ran (unless otherwise programmed)

  • The output file will be found by typing ls and looking for the output file you named in the SBATCH script, in this case something like Report-1280063.out
  • To see the contents of the out file, run vi <output file name> #ex: vi psi4-test.out

  • Here is a condensed version of what the Report-1280063.out file should look like:

---------------------------------------
Begin Slurm Prolog: Mar-27-2023 01:21:43
Job ID:    1412087
User ID:   gburdell3
Account:   [Account]
Job name:  psi4-test
Partition: cpu-small
QOS:       embers
---------------------------------------

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu

*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs


    ...


    @DF-RHF Final Energy:   -76.02663273509029

   => Energetics <=

    Nuclear Repulsion Energy =              9.1681932964243487
    One-Electron Energy =                -123.1035077420448545
    Two-Electron Energy =                  37.9086817105302245
   => Energetics <=


    ...


    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            :          0.0000000            0.0000000            0.0000000
 Dipole Y            :          0.0000000            0.0000000            0.0000000
 Dipole Z            :         -0.1680325            0.9783140            0.8102815
 Magnitude           :                                                    0.8102815

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

*** tstop() called on atl1-1-03-002-12-1.pace.gatech.edu at Mon Mar 27 01:21:48 2023
Module time:
        user time   =       0.82 seconds =       0.01 minutes
        system time =       0.05 seconds =       0.00 minutes
        total time  =          1 seconds =       0.02 minutes
Total time:
        user time   =       0.82 seconds =       0.01 minutes
        system time =       0.05 seconds =       0.00 minutes
        total time  =          1 seconds =       0.02 minutes
---------------------------------------
Begin Slurm Epilog: Mar-27-2023 01:21:49
Job ID:        1412087
Array Job ID:  _4294967294
User ID:       gburdell3
Account:       [Account]
Job name:      psi4-test
Resources:     cpu=8,mem=8G,node=1
Rsrc Used:     cput=00:00:56,vmem=252K,walltime=00:00:07,mem=0,energy_used=0
Partition:     cpu-small
QOS:           embers
Nodes:         atl1-1-03-002-12-1
---------------------------------------


Running PSI4 Python

Running PSI4 Interactivley

Allocating Resources

  • In order to run PSI4 interactivley we can use the salloc command to specify the account, partitions, time, and queue

  • Here is an example of an salloc command you can use: salloc -A [Account] -N 1 -n 8 -t 15 -q embers

  • This will allocate the proper resources to run PSI4

Using Hartree-Fock Calculation Example

  • The following example will show running PSI4 interactively using a Hartree-Fock example

  • Here is what the hartree_fock.py script should look like:

import psi4

#! Sample HF/cc-pVDZ H2O Computation

psi4.set_memory('500 MB')

h2o = psi4.geometry("""
O
H 1 0.96
H 1 0.96 2 104.5
""")

psi4.energy('scf/cc-pvdz')
  • If you would like the output in a separate file, you can add the following line after the import statement: psi4.core.set_output_file('output.dat', False)

  • We can do the following in order to run this script with PSI4:

  • Load module: module load psi4/1.6.1

  • Run Script: srun python hartree_fock.py

  • Your output should look something like this that will give you the Hartree-Fock Calculation:


@DF-RHF Final Energy:   -76.02663273509029

   => Energetics <=

    Nuclear Repulsion Energy =              9.1681932964243487
    One-Electron Energy =                -123.1035077420448545
    Two-Electron Energy =                  37.9086817105302245
    Total Energy =                        -76.0266327350902884

Computation Completed

Running PSI4 in Batch Mode

  • We can also test this in a normal batch mode. Here is an example batch script:
#!/bin/bash
#SBATCH -J psi4-test
#SBATCH -A [Account]
#SBATCH -N 1 -n 8
#SBATCH -t 15
#SBATCH -q embers
#SBATCH -o Report-%j.out
#SBATCH -e Report-%j.err

cd $SLURM_SUBMIT_DIR

module load psi4

srun python hartree_fock.py

Submitting job and collecting results

  • Make sure your're in the folder where the SBATCH Script is located, and run
sbatch <scriptName.sbatch>  #ex: sbatch ex_psi4.sbatch
  • If successful, this will print something like Submitted batch job 1280063

  • The number in the beginning is the job id, useful for checking predicted wait time in queue or job status

  • After a couple seconds, find estimated wait time in queue and job status with squeue -u ACCOUNTNAME

  • Any files created by the script will show up in the folder where the script was ran (unless otherwise programmed)

  • The output file will be found by typing ls and looking for the output file you named in the SBATCH script, in this case something like Report-1280063.out
  • To see the contents of the out file, run vi <output file name> #ex: vi psi4-test.out

  • Here is a condensed version of what the Report-1280063.out file should look like:

---------------------------------------
Begin Slurm Prolog: Mar-27-2023 01:21:43
Job ID:    1412087
User ID:   gburdell3
Account:   [Account]
Job name:  psi4-test
Partition: cpu-small
QOS:       embers
---------------------------------------

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

  Memory set to 476.837 MiB by Python driver.

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

Scratch directory: /tmp/

*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu

*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023


*** tstart() called on atl1-1-03-002-12-1.pace.gatech.edu
*** at Mon Mar 27 01:21:47 2023

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs

   => Loading Basis Set <=

    Name: CC-PVDZ
    Role: ORBITAL
    Keyword: BASIS
    atoms 1   entry O          line   198 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs
    atoms 2-3 entry H          line    22 file /usr/local/pace-apps/manual/packages/psi4/1.6.1/Core/share/psi4/basis/cc-pvdz.gbs


    ...


    @DF-RHF Final Energy:   -76.02663273509029

   => Energetics <=

    Nuclear Repulsion Energy =              9.1681932964243487
    One-Electron Energy =                -123.1035077420448545
    Two-Electron Energy =                  37.9086817105302245
   => Energetics <=


    ...


    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            :          0.0000000            0.0000000            0.0000000
 Dipole Y            :          0.0000000            0.0000000            0.0000000
 Dipole Z            :         -0.1680325            0.9783140            0.8102815
 Magnitude           :                                                    0.8102815

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

*** tstop() called on atl1-1-03-002-12-1.pace.gatech.edu at Mon Mar 27 01:21:48 2023
Module time:
        user time   =       0.82 seconds =       0.01 minutes
        system time =       0.05 seconds =       0.00 minutes
        total time  =          1 seconds =       0.02 minutes
Total time:
        user time   =       0.82 seconds =       0.01 minutes
        system time =       0.05 seconds =       0.00 minutes
        total time  =          1 seconds =       0.02 minutes
---------------------------------------
Begin Slurm Epilog: Mar-27-2023 01:21:49
Job ID:        1412087
Array Job ID:  _4294967294
User ID:       gburdell3
Account:       [Account]
Job name:      psi4-test
Resources:     cpu=8,mem=8G,node=1
Rsrc Used:     cput=00:00:56,vmem=252K,walltime=00:00:07,mem=0,energy_used=0
Partition:     cpu-small
QOS:           embers
Nodes:         atl1-1-03-002-12-1
---------------------------------------