Specifying Energy Methods
This tutorial sets out how to specify energy methods throughout
Specifying energy methods through the Python API
In the Python API, energy methods are expressed through objects that encode both the method type as well as computational details:
from sierra.inputs import *
my_hf = HFMethod(ao="def2-tzvp")
my_dft = DFTMethod(xc="wb97xc", ao="def2-tzvp")
my_xtb = XTBMethod(model="gfn1")
my_orbnet = OrbNetMethod(model="fuji")
Warning
While OrbNet can be specified here, it might not be installed. If python -c "import orbnet"
from the command line evaluates cleanly then orbnet is installed in your environment.
Such energy method objects can be dropped into many workflows to specify the level of theory for evaluation of energies.
For example, to obtain butane conformers ranked using OrbNet energies, we can type:
import sierra
from sierra.inputs import *
inp = ConformersInput(
smiles='CCCC',
energy_method=OrbNetMethod(model="fuji")
)
result = sierra.run(inp, stream_output=True)
print(result.energies)
Alternatively, dictionaries can be supplied to provide the same information, for example:
import sierra
from sierra.inputs import *
inp = ConformersInput(
smiles='CCCC',
energy_method={"kind": "orbnet", "model": "fuji"}
)
result = sierra.run(inp, stream_output=True)
print(result.energies)
where kind
is an extra required field for dictionaries, and maps to the type of method specified.
As a further example, we will perform analysis of BDEs for all hydrogens in methanol using the B3LYP/6-311G* level of theory.
import sierra
from sierra.inputs import *
inp = BondDissociationEnergyInput(
molecule=Molecule(smiles='CO'),
energy_method=DFTMethod(xc="b3lyp", ao="6-311g*")
)
result = sierra.run(inp, stream_output=True)
Specifying energy methods on the command line
Energy methods can be specified on the command line by supplying a json string representing the dictionaries referred to above. For example to run the BDE for methanol through the CLI, we can type the following:
sierra bde "smiles:CO" --energy-method='{"kind": "dft", "xc": "b3lyp", "ao": "6-311g*"}'