The following example can be used as a job script for running Gaussian jobs:
#!/bin/bash #SBATCH --job-name=gaussian #SBATCH --time=0-24:00:00 #SBATCH --partition=regular #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --cpus-per-task=8 #SBATCH --mem=4gb module load Gaussian/16.B.01 srun g16 inputfile.inp outputfile.out
Gaussian can only do shared memory parallel calculations, i.e. using processors within the same node, so --nodes should always be 1. Furthermore, it is important to start only one Gaussian process/task, which itself will make use of the available cores. This is achieved by settings --ntasks to 1, while --cpus-per-task can vary: srun will then launch only one Gaussian process.
Finally, make sure to use the same number of requested cores and same amount of memory in your Gaussian input file, e.g.:
%Mem=4096MB %NProcShared=8 #P MP2 aug-cc-pVTZ SCF=Tight methanol dimer MP2 0 1 6 0.754746 -0.733607 -0.191063 1 -0.033607 -1.456810 -0.395634 1 1.007890 -0.778160 0.867678 1 1.635910 -0.998198 -0.774627 8 0.317192 0.576306 -0.534002 1 1.033100 1.188210 -0.342355 6 1.513038 3.469264 0.971885 1 1.118398 2.910304 1.819367 1 0.680743 3.818664 0.361783 1 2.062618 4.333044 1.344537 8 2.372298 2.640544 0.197416 1 2.702458 3.161614 -0.539550