Defines MacroModel optimizers.

exception MacroModelConversionError

Bases: Exception

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class MacroModelForceField(macromodel_path, output_dir=None, restricted=False, timeout=None, force_field=16, maximum_iterations=2500, minimum_gradient=0.05, use_cache=False)

Bases: stk.calculators.optimization.macromodel._MacroModel

Uses MacroModel force fields to optimize molecules.

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.

is_caching(self)

True if the calculator has caching turned on.

is_in_cache(self, mol)

Return True if mol is cached.

optimize(self, mol)

Optimize a molecule.

set_cache_use(self, use_cache)

Set cache use on or off.

__init__(self, macromodel_path, output_dir=None, restricted=False, timeout=None, force_field=16, maximum_iterations=2500, minimum_gradient=0.05, use_cache=False)

Initialize a MacroModelForceField object.

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, if None then uuid.uuid4() is used.

  • restricted (bool, optional) – If True then an optimization is performed only on the bonds added by construct(). If False then all bonds are optimized.

  • timeout (float, optional) – The amount in seconds the optimization is allowed to run before being terminated. None means there is no timeout.

  • force_field (int, optional) – The number of the force field to be used.

  • maximum_iterations (int, optional) – The maximum number of iterations done during the optimization. Cannot be more than 999999.

  • minimum_gradient (float, optional) – The gradient at which optimization is stopped. Cannot be less than 0.0001.

  • use_cache (bool, optional) – If True optimize() will not run twice on the same molecule.

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

MoleculeCalculator

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

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

optimize(self, mol)

Optimize a molecule.

Parameters

mol (Molecule) – The molecule to be optimized.

Returns

None

Return type

NoneType

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

MoleculeCalculator

exception MacroModelForceFieldError

Bases: Exception

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MacroModelInputError

Bases: Exception

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MacroModelLewisStructureError

Bases: Exception

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class MacroModelMD(macromodel_path, output_dir=None, timeout=None, force_field=16, temperature=750, conformers=50, time_step=1, eq_time=10, simulation_time=200, maximum_iterations=2500, minimum_gradient=0.05, restricted_bonds=None, restricted_bond_angles=None, restricted_torsional_angles=None, use_cache=False)

Bases: stk.calculators.optimization.macromodel._MacroModel

Runs a molecular dynamics conformer search 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.

is_caching(self)

True if the calculator has caching turned on.

is_in_cache(self, mol)

Return True if mol is cached.

optimize(self, mol)

Optimize a molecule.

set_cache_use(self, use_cache)

Set cache use on or off.

__init__(self, macromodel_path, output_dir=None, timeout=None, force_field=16, temperature=750, conformers=50, time_step=1, eq_time=10, simulation_time=200, maximum_iterations=2500, minimum_gradient=0.05, restricted_bonds=None, restricted_bond_angles=None, restricted_torsional_angles=None, use_cache=False)

Initialize a MacroModelMD 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, if None then uuid.uuid4() is used.

  • timeout (float, optional) – The amount in seconds the MD is allowed to run before being terminated. None means there is no timeout.

  • force_field (int, optional) – The number of the force field to be used.

  • temperature (float, optional) – The temperature in Kelvin at which the MD is run. Cannot be more than 99999.99.

  • conformers' (int, optional) – The number of conformers sampled and optimized from the MD. Cannot be more than 9999.

  • simulation_time (float, optional) – The simulation time in ps of the MD. Cannot be more than 999999.99.

  • time_step (float, optional) – The time step in fs for the MD. Cannot be more than 99999.99.

  • eq_time (float, optional) – The equilibriation time in ps before the MD is run. Cannot be more than 999999.99.

  • maximum_iterations (int, optional) – The maximum number of iterations done during the optimization. Cannot be more than 999999.

  • minimum_gradient (float, optional) – The gradient at which optimization is stopped. Cannot be less than 0.0001.

  • restricted_bonds (set, optional) –

    A set of the form

    restricted_bonds = {
        frozenset((0, 10)),
        frozenset((3, 14)),
        frozenset((5, 6))
    }
    

    Where each frozenset defines which bonds should have a fixed length via the atom ids of atoms in the bond.

  • restricted_bond_angles (set, optional) –

    A set of the form

    restricted_bonds = {
        frozenset((0, 10, 12)),
        frozenset((3, 14, 7)),
        frozenset((5, 8, 2))
    }
    

    Where each frozenset defines which bond angles should have a fixed size via the atom ids of atoms in the bond angle.

  • restricted_torsional_angles (set, optional) –

    A set of the form

    restricted_bonds = {
        frozenset((0, 10, 12, 3)),
        frozenset((3, 14, 7, 4)),
        frozenset((5, 8, 2, 9))
    }
    

    Where each frozenset defines which torsional angles should have a fixed size via the atom ids of atoms in the torsional angle.

  • use_cache (bool, optional) – If True optimize() will not run twice on the same molecule.

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

MoleculeCalculator

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

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

optimize(self, mol)

Optimize a molecule.

Parameters

mol (Molecule) – The molecule to be optimized.

Returns

None

Return type

NoneType

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

MoleculeCalculator

exception MacroModelOptimizationError

Bases: Exception

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MacroModelPathError

Bases: Exception

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.