from ase.calculators.vasp import Vaspfrom ase.io import read# Read in the structure to make an Atoms objectatoms = read("Fe.cif")# Set up the VASP calculatorcalc = Vasp(encut=520, # plane-wave kinetic energy cutoff (convergence parameter)kpts=[10, 10, 10], # k-points in each dimensionxc="PBE", # exchange-correlation functional ("level of theory"); sets GGA = PE herealgo="fast", # SCF convergence algorithmediff=1e-5, # SCF convergence criterion (eV)ismear=0, # smearing method (0 = Gaussian smearing)sigma=0.05, # smearing width (eV)lasph=True, # non-spherical corrections for 3d elementsprec="accurate", # high-precision calculationsediffg=-0.03, # relaxation convergence criterion (eV/A)ibrion=2, # relaxation algorithm (2 = conjugate-gradient)isif=3, # relaxation degrees of freedom (3 = relax positions+cell shape+cell volume)nsw=100, # maximum number of relaxation stepslorbit=11, # print out magnetic momentsefermi="midgap", # recommended by VASPgga_compat=False, # recommended by VASP)# Set the calculator for the Atoms objectatoms.calc = calc# Set the initial magnetic moments (will auto-set ISPIN and MAGMOM)atoms.set_initial_magnetic_moments([4.0, 4.0])# Run the VASP calculationatoms.get_potential_energy()
Vasp calculator is available with the quacc package . It serves as (mostly) a drop-in replacement for the ASE calculator and comes with several benefits, including: 1) Useful automatic updates to input parameters via the "incar copilot"; 2) Automated error correction handling via Custodian ; 3) Several additional keyword arguments to simplify calculator setup. In general, there is no reason not to use this supercharged calculator.Vasp calculator, simply replace from ase.calculators.vasp import Vasp with from quacc.calculators.vasp import Vasp. You can use all the same ASE Vasp calculator input arguments except now the first positional argument to the calculator is the Atoms object. For instance:from quacc.calculators.vasp import Vaspfrom ase.io import read# Read in the structure to make an Atoms objectatoms = read("Fe.cif")# Set up the VASP calculatorcalc = Vasp(atoms, # input Atoms objectencut=520, # plane-wave kinetic energy cutoff (convergence parameter)kpts=[10, 10, 10], # k-points in each dimensionxc="PBE", # exchange-correlation functional ("level of theory"); sets GGA = PE herealgo="fast", # SCF convergence algorithmediff=1e-5, # SCF convergence criterion (eV)ismear=0, # smearing method (0 = Gaussian smearing)sigma=0.05, # smearing width (eV)lasph=True, # non-spherical corrections for 3d elementsprec="accurate", # high-precision calculationsediffg=-0.03, # relaxation convergence criterion (eV/A)ibrion=2, # relaxation algorithm (2 = conjugate-gradient)isif=3, # relaxation degrees of freedom (3 = relax positions+cell shape+cell volume)nsw=100, # maximum number of relaxation stepslorbit=11, # print out magnetic momentsefermi="midgap", # recommended by VASPgga_compat=False, # recommended by VASP)# Set the calculator for the Atoms objectatoms.calc = calc# Set the initial magnetic moments (will auto-set ISPIN and MAGMOM)atoms.set_initial_magnetic_moments([4.0, 4.0])# Run the VASP calculationatoms.get_potential_energy()
quacc.calculators.vasp.Vasp module also has a keyword argument preset to use pre-defined parameter sets. For instance, preset="DefaultSetGGA" will select the DefaultSetGGA.yaml from here and provides sensible defaults.from quacc.calculators.vasp import Vaspfrom ase.io import read# Read in the structure to make an Atoms objectatoms = read("Fe.cif")# Set up the VASP calculatorcalc = Vasp(atoms, preset="DefaultSetGGA")# Set the calculator for the Atoms objectatoms.calc = calc# Set the initial magnetic moments (will auto-set ISPIN and MAGMOM)atoms.set_initial_magnetic_moments([4.0, 4.0])# Run the VASP calculationatoms.get_potential_energy()