Examples¶
the following examples work with all calculators of the ADF modeling suite. Any python script using these libraries should be launched using the “$ADFBIN/startpython” binary.
Geometry Relaxation via ADF Drivers¶
# Required imports
from ase.calculators.scm import ADF
from ase.io import read
# Read molecular geometry from xyz file
mol = read('some_mol.xyz')
# Create calculator object with calculation details. Note the job argument
calc = ADF(label = 'some_mol',
job = 'GeometryOptimization',
basis = 'DZP',
xc = 'GGA:BP',
core = 'Small')
# Assign calculator to system object
mol.set_calculator(calc)
# Due to the requested ``job`` the final energy of a geometry optimization results,
# which is internally performed by ADF
e = mol.get_potential_energy()
Geometry Relaxation with ASE¶
# Required imports
from ase.calculators.scm import ADF
from ase.optimize.bfgs import BFGS
from ase.io import read
# Read molecular geometry from xyz file
mol = read('some_mol.xyz')
# Create calculator object with calculation details. Note the job argument
calc = ADF(label = 'some_mol',
job = 'SinglePoint',
basis = 'DZP',
xc = 'GGA:BP',
core = 'Small')
# Assign calculator to system object
mol.set_calculator(calc)
# For this ``job`` type the potential energy calculation only yields
# a single point energy at this stage
e_init = mol.get_potential_energy()
# Geometry optimisation requires a driver object (here BFGS) from ``ase.optimize``
driver = BFGS(mol, trajectory='some_mol.traj')
# Invoce optimiser run to converge nuclear forces below 0.05 eV/Angstrom
# within 200 steps at most
driver.run(fmax=0.05, steps=200)
Nudged Elastic Band transition state search¶
For analysis of the results, see the excellent tutorials on the web : ASE examples for NEB
# Required imports
from ase.calculators.scm import ADF
from ase.io import read
from ase.neb import NEB
from ase.optimize import FIRE
# st endpoints of reaction path
initial = read('initial.xyz')
final = read('final.xyz')
# create a list of Atoms objects (images) with initial and final structures at the beginning and end,
# respectively, and <num_images> placeholder copies in-between
num_images = 3
images = [initial] + [initial.copy() for i in range(num_images)] + [final]
# set calculators for each entry in the list. Note the SinglePoint Job type
index=0
for image in images:
image.set_calculator(ADF(label = 'neb.{0}'.format(index),
job = 'SinglePoint',
basis = 'DZ',
xc = 'LDA',
core = 'None',
relativity = 'Scalar'))
index += 1
# form NEB object from the list.
# The images between initial and final will then be changed during the NEB interpolation
neb = NEB(images)
# Interpolate linearly the positions of the middle images:
neb.interpolate()
# optimize the neb object with robust algorithm like FIRE:
driver = FIRE(neb, trajectory='neb.traj')
driver.run(fmax=0.05, steps=200)
A command line utility can also be called directly using the startpython binary. The following is a reproduction of the NEB run found in the ADFHOME/examples/scmlib/neb_ase_halogenexchange/ directory.
$ADFBIN/startpython $ADFHOME/scripting/ase/neb.py -p ADF -i initial.xyz -f final.xyz -u "charge -1 frozencore None" --images 1 --logfile "NEB.LOGFILE"
A complete list of options can be obtained using the standard help (“-h”) argument:
$ADFBIN/startpython $ADFHOME/scripting/ase/neb.py -h
usage: NEB [-h] -p P -i I -f F [-c] [-o] [-u U] [-m M] [--template TEMPLATE]
[--forcefield FORCEFIELD] [--fmax FMAX] [--images IMAGES]
[--steps STEPS] [--spring SPRING] [--logfile LOGFILE]
Nudged Elastic Band transition state search
optional arguments:
-h, --help show this help message and exit
-p P Program that is used in the calculations. implemented:
BAND, ADF, DFTB, REAXFF
-i I Initial geometry in ASE readable format
-f F Final geometry in ASE readable format
-c If used, does not implement the climbing image method
-o If used, initial and final geometries are not
optimised
-u U All options in this string will be passed litterally
to the ADF calculator
-m M Constraint. All atoms whose symbols are passed here
will be fixed. ex: -mask CuAlO will fix all copper,
Aluminium and oxygens during optimisation
--template TEMPLATE Template file from adf GUI, for bells and whistles
--forcefield FORCEFIELD
Force field to use in case of REAXFF
--fmax FMAX Maximum force limit for optimisation convergence (in
eV/Angstroms)
--images IMAGES Number of images in the interpolation
--steps STEPS Iteration limit for optimisation convergence
--spring SPRING Spring constant used between images
--logfile LOGFILE Logfile of the NEB calculation