Running calculations

Here we provide some examples of how to use the calculator, ranging from very basic to more advanced. That all scripts here have been written in such a fashion that they will run regardless of whether you have set mode = 'run' or mode = 'queue' in your .vasprc. Thus, if you are in queue mode on the cluster a small job will be submitted.

Basics - relaxing a water molecule

This example illustrates how to relax a water molecule using VASP’s internal relaxation routines.

from ase.build import molecule
from storq import Vasp

# set up atomic configuration
atoms = molecule('H2O')
atoms.center(vacuum=4.0)

# set up calculator
calc = Vasp('water',
            atoms=atoms,
            xc='pbe',
            encut=300,
            ibrion=1,
            nsw=20,
            isif=2,
            ismear=0,
            sigma=0.05)

# set submission options
calc.configure(walltime='00:05:00', cores=4)

# run vasp
calc.get_potential_energy()

The first argument of the Vasp constructor is the run directory where all VASP IO files will be created. The configuration (ASE Atoms-object) is passed as a keyword argument. (Note: The calculator is internally attached to the atomic configuration scuh that calling atoms.get_potential_energy() still works. The exchange-correlation functional is set via the special keyword argument xc where only the name of the functional is needed. Any other INCAR parameters will be set automatically. Options pertaining to job submission are set using the configure() method of the calculator.

When submitting jobs via a queuing system, the results are not immediately available to the script. The calculator handles this by simply returning None if the calculation has not finished. After the job is finished one can simply rerun the script. This causes the calculator to restart and read the results without performing another calculation, after which additional analyses can be carried out.