Single Point
Single-point calculations include evaluation of the energy, nuclear gradients, Hessian, and properties at a single molecular geometry.
The input for performing a single-point calculation is created via the EnergyInput
, GradientInput
and HessianInput
objects, which specify the molecular structure, the energy method, and the type of the calculation.
The energy, and possibly its derivatives w.r.t. nuclear coordinates, is computed and stored in the corresponding result object. The results of a higher-order energy derivative calculation automatically contain the lower-order derivatives.
Examples
The following examples demonstrate how to perform a range of single-point calculations:
import sierra
from sierra.inputs import *
from sierra import constants
import numpy as np
water = Molecule(pubchem="water")
# Perform a single-point energy calculation at DFT B3LYP/Def2-SVP level of
# theory
dft_input = EnergyInput(
molecule=water,
method=DFTMethod(xc="B3LYP", ao="def2-svp"),
)
dft_result = sierra.run(dft_input)
print(f"DFT B3LYP/Def2-SVP energy: {dft_result.energy:.6f} Hartree")
#> DFT B3LYP/Def2-SVP energy: -76.321152 Hartree
# Perform a single-point hessian calculation at GFN1-xTB level of theory
# Note that the energy and gradient are automatically computed.
xtb_input = HessianInput(molecule=water, method=XTBMethod(model="GFN1"))
xtb_result = sierra.run(xtb_input)
xtb_energy = xtb_result.energy
print(f"XTB Energy: {xtb_energy:.6f} Hartree")
#> XTB Energy: -5.768441 Hartree
xtb_gradient = xtb_result.gradient
xtb_max_abs_gradient = np.abs(xtb_gradient).max()
print(f"XTB Max Absolute Gradient: {xtb_max_abs_gradient:.6f} Hartree/Bohr")
#> XTB Max Absolute Gradient: 0.011685 Hartree/Bohr
# Get the vibrational frequencies
freqs = xtb_result.frequencies * constants.cf("hartree", "wavenumber")
print(f"XTB Largest Vib. Frequency: {freqs.max():.3f} cm^(-1)")
#> XTB Largest Vib. Frequency: 3641.967 cm^(-1)
In the details field, further details like conversion criteria and output control can be configured:
import sierra
from sierra.inputs import *
water = Molecule(pubchem="water")
inp = EnergyInput(
molecule=water,
method=XTBMethod(),
details={
"energy_threshold": 1e-8,
"store_extras": ["n_iter", "fermi_level"],
},
)
result = sierra.run(inp)
print(result.extras)
#> {'n_iter': 4, 'fermi_level': -0.3300772290495668}
EnergyInput
Fields
method
-
The computational method for this call
- Type: One of: [MethodBase, CustomMethod, XTBMethod, HFMethod, DFTMethod, EMFTMethod, OrbNetMethod]
molecule
-
The molecule the result is computed with
- Type: Molecule
details
-
Additional detail parameters to supply to the computation
Detail Fields
energy_threshold
-
threshold for energy convergence
- Type: Optional[float]
result_contract
-
- Type: SingleResultContract
store_extras
-
This field determines the amount of output that is kept in the 'extras' field in addition to the requirements of the contract. 'True' will lead to storing all available information and 'False' will lead to storing no information beyond the requirements of the contract. Alternatively, a list of field names can be provided that shall be stored.
- Type: One of: [bool, List[str]]
- Default: False
EnergyResult
Fields
All the fields in EnergyInput and the following:
energy
-
The energy of the given method
- Type: float
extras
-
Additional key/value pairs generated during the computation.
- Type: Mapping[str, Any]
- Default: {}
wavefunction
-
Wavefunction quantities for the given computation.
- Type: Optional[Wavefunction]
GradientInput
Fields
All the fields in EnergyInput.
GradientResult
Fields
All the fields in GradientInput, EnergyResult and the following:
gradient
-
The nuclear gradient of the given method
- Type: Array
- Additional Details: shape: (-1, 3)
HessianInput
Fields
All the fields in GradientInput.
HessianResult
Fields
All the fields in HessianInput, GradientResult and the following:
frequencies
-
The frequencies of the normal modes
- Type: Array
hessian
-
The nuclear Hessian of the given method
- Type: Array
infrared_intensities
-
- Type: Optional[Array]
normal_modes
-
The normal modes of the molecule
- Type: Array
Functions
HessianResult.visualize
visualize((str) units) -> None
:
The frequencies and IR intensities (if they have been computed) can be straightforwardly visualized using this function. CAVEAT: This function can only be used inside a jupyter notebook.
Arguments
spec
-
This argument must be set to "frequencies" or "ir intensities" to visualize the corresponding data.
- Type:
str
- Type:
Returns
None
SingleResultContract
In any single-point calculation, information about the wavefunction can be optionally requested. The result_contract
field in a single point calculation may be set to {"wavefunction": "none"}
or {"wavefunction": "all"}
.
Fields
wavefunction
-
- Type: WavefunctionContract
- Default: WavefunctionContract.none