Scripting

The ADF modeling suite includes several scripting environments, each with a specific scope and purpose.

Most elemental are adfprepare, adfreport, and similar tools meant to be called from a console shell such as bash. Through various command line options these tools allow for the automatized preparation of series of input files.

More advanced scripting environments are based on the Python programming language. As a consistently object oriented language Python can be employed for flexible and rapid scripting solutions for the quantum chemical problem at hand.

To this end, the quantum chemistry programs ADF, BAND, DFTB, and ReaxFF were interfaced to the popular, external Python scripting library Atomic Simulation Environment (ASE). ASE can be used for the automatized manipulation of chemical systems and quantum chemical calculation prescriptions to compute a large variety of different chemical and physical properties.

FlexMD is a python library that is specifically intended for scripting solutions in the field of molecular dynamics simulations. Indeed, FlexMD features implementations of a variety of approaches to multi-scale simulations and especially adaptive QM/MM methods, which are interfaced to the aforementioned ASE library.

The Python Library for Automating Molecular Simulations (PLAMS) represents another flexible and extendable Python interface to several quantum chemical programs. In contrast to the other scripting environments mentioned above, PLAMS focuses on easing the input preparation, job execution, file management, and output processing. It thereby allows one to automatize even very advanced data workflows.

Also the PyADF library pursues the concept of automatizing the workflows required for multi-scale simulations. PyADF is currently not part of the ADF modeling suite but can be readily retrieved from an external source.

Notes on Python in the ADF modeling suite

All python related scripts in the ADF modeling suite are supposed to be called with:

$ADFBIN/startpython scriptname.py

To avoid collisions with other python installations on the system, we unload PYTHONPATH and PYTHONHOME from the environment when launching the shipped python. This can be disabled in $ADFBIN/startpython, and should be done if the user wishes to use his personal python libraries from within the shipped python stack.

Scripting under Windows

First double click the script:

adf_command_line.bat

located in your ADF installation directory. This sets the required environment variables and starts a commandline shell. Within this shell type then:

sh

to get into a minimal Unix-type shell, which can be used to invoke python scripts just like from a Linux environment, e.g.:

startpython scriptname.py