MLatom 3.16.1 release with DFTB+ interface
The new release of MLatom, version 3.16.1, provides an interface to DFTB+ and performance improvements. So even if you are not interested in DFTB, please upgrade your MLatom installation for faster calculations via pip:
pip install --upgrade mlatom
New release allows seamless execution of DFTB and TD-DFTB calculations within the MLatom framework enabling efficient electronic structure calculations and facilitating the modeling of complex systems with reduced computational cost.
First, we need to install DFTB+. Using the conda command is the recommended installation method:
conda install conda-forge::dftbplus
Alternatively, you can also install it by downloading the binary from https://www.dftbplus.org/download/stable.html or compiling from source:
git clone https://github.com/dftbplus/dftbplus.git
cmake --build _build -- -j
cmake --install _build
After installation, we need to download the DFTB+ parameter files (also called Slater–Koster files). Once downloaded, extract the files and add their path to your environment variable as (in bash):
export skfiles=/path/to/SK/files
We can now use DFTB+ for ground-state calculations with DFTB and excited-state calculations with TD-DFTB in MLatom. After importing MLatom, you can select and use the DFTB method as any other electronic-structure method or ML model interfaced to MLatom, i.e., for single-point calculations, geometry optimizations or molecular dynamics. For excited-state calculations, you only need to provide the number of electronic states and the index of the state you are interested in:
import mlatom as ml
dftb = ml.models.methods(method="DFTB") # Could work for both DFTB and TD-DFTB
# Predict molecule ground-state with DFTB:
dftb.predict(molecular_database=my_db, calculate_energy=True, calculate_energy_gradients=True)
# or for a single molecule:
dftb.predict(molecule=mymol, calculate_energy=True, calculate_energy_gradients=True)
# Predict molecule excited-state properties with TD-DFTB:
dftb.predict(molecular_database=my_db, calculate_energy=True, calculate_energy_gradients=True,
nstates=20, # Will calculate 20 electronic states.
current_state=10) # Will calculate energy and gradients of the 10th state.
Leave a Reply