-
class
MacroModelEnergy
(macromodel_path, output_dir=None, force_field=16, use_cache=False)¶ Bases:
stk.calculators.base_calculators._MoleculeCalculator
,stk.calculators.energy.energy_calculators.EnergyCalculator
Calculates the energy using MacroModel.
Methods
add_to_cache
(self, mol[, value])Add a molecule to the cache.
get_cached_value
(self, mol)Return the value stored in the cache for mol.
get_energy
(self, mol)Calculate the energy of mol.
is_caching
(self)True
if the calculator has caching turned on.is_in_cache
(self, mol)Return
True
if mol is cached.set_cache_use
(self, use_cache)Set cache use on or off.
-
__init__
(self, macromodel_path, output_dir=None, force_field=16, use_cache=False)¶ Initialize a
MacroModelEnergy
instance.- Parameters
macromodel_path (
str
) – The full path of the Schrodinger suite within the user’s machine. For example, on a Linux machine this may be something like'/opt/schrodinger2017-2'
.output_dir (
str
, optional) – The name of the directory into which files generated during the optimization are written, ifNone
thenuuid.uuid4()
is used.force_field (
int
, optional) – The number of the force field to be used.use_cache (
bool
, optional) – IfTrue
get_energy()
will not run twice on the same molecule, but will instead return the previously calculated value.
-
add_to_cache
(self, mol, value=None)¶ Add a molecule to the cache.
- Parameters
mol (
Molecule
) – The molecule to be added to the cache.value (class:object, optional) – The cached value associated with the molecule.
- Returns
The calculator.
- Return type
-
get_cached_value
(self, mol)¶ Return the value stored in the cache for mol.
- Parameters
mol (
Molecule
) – The molecule whose cached value is to be returned.- Returns
The cached value.
- Return type
object
-
get_energy
(self, mol)¶ Calculate the energy of mol.
- Parameters
mol (
Molecule
) – TheMolecule
whose energy is to be calculated.- Returns
The energy.
- Return type
float
- Raises
EnergyError – This exception is raised if no energy value is found in the MacroModel calculation’s
.log
file. Likely due to a forcefield error.
-
is_caching
(self)¶ True
if the calculator has caching turned on.- Returns
True
if the calculator has caching turned on.- Return type
bool
-
is_in_cache
(self, mol)¶ Return
True
if mol is cached.- Parameters
mol (
Molecule
) – The molecule being checked.- Returns
True
if mol is cached.- Return type
bool
-
set_cache_use
(self, use_cache)¶ Set cache use on or off.
- Parameters
use_cache (
bool
) –True
if the cache is to be used.- Returns
The calculator.
- Return type
-