Engine ASE: AMS geometry optimizer with forces from any ASE calculatorΒΆ

Note: This example requires AMS2023 or later.

This example illustrates how set up an AMS calculation using any external ASE calculator as the engine.

In this example, the EMT calculator included with ASE is used.


In this example, the AMS engine is replaced by an ASE calculator.

In the AMSCalculator: ASE geometry optimizer with AMS forces, i-PI path integral MD with AMS, and Sella transition state search with AMS examples, the AMS driver is replaced by external codes that use the AMS engine energies and forces.

Example usage: (Download CustomASECalculator.py)

#!/usr/bin/env amspython
import os

from ase.calculators.emt import EMT
from scm.plams import *

def get_calculator():
    Return an ASE calculator for use with Engine ASE.

    The function must be called "get_calculator"

    return EMT()

def main():

    mol = from_smiles("O")
    mol.lattice = [
        [0.0, 3.0, 0.0],
        [0.0, 0.0, 3.0],

    s = Settings()
    s.runscript.nproc = 1
    s.input.ams.task = "GeometryOptimization"
    s.input.ams.GeometryOptimization.Convergence.Gradients = 0.01  # hartree/ang
    # get the get_calculator function, which returns an initialized ASE Calculator,
    # from the current file
    s.input.ASE.File = os.path.abspath(__file__)
    # to call get_calculator(my_argument = my_value) with arguments use:
    # s.input.ASE.Arguments._1 = "my_argument = my_value"

    job = AMSJob(settings=s, molecule=mol, name="ams_with_custom_ase_calculator")

    energy = job.results.get_energy(unit="eV")
    print(f"AMS with custom ASE calculator (Engine ASE), EMT potential: final energy {energy:.3f} eV")


if __name__ == "__main__":