schrodinger.structutils.minimize module

Deprecated: structutils.minimize has been deprecated. Use schrodinger.forcefield.minimizer instead.

A deprecated module for force field energy evaluation and minimization. The minimize.Minimizer class in this module is stateful and can cause problematic interactions with existing instances of mmffld. schrodinger.forcefield.minimizer meets most needs, though is not a drop-in replacement. If you need a feature that it lacks, please file a SHARED ticket.

schrodinger.structutils.minimize.minimize_structure(struct: schrodinger.structure._structure.Structure, **kwargs)

Deprecated: structutils.minimize.minimize_structure has been deprecated. Use schrodinger.forcefield.minimizer.minimize_structure instead.

class schrodinger.structutils.minimize.Minimizer(ffld_version=None, struct=None, cleanup=True, honor_pbc=True, **kwargs)

Bases: object

deprecated: structutils.minimize.Minimizer has been deprecated. Use schrodinger.forcefield.minimizer instead.

A class to provide force field energy and minimization.

For simple cases the minimize_structure function can be used. Direct use of this class is mostly useful for cases where multiple conformers are to be minimized, as the updateCoordinates() method allows one to avoid running atom-typing for every conformer.

__init__(ffld_version=None, struct=None, cleanup=True, honor_pbc=True, **kwargs)

Initialize.

Additional keyword arguments will be used to set properties of the instance. See the __init__() method for supported property names.

Parameters
  • ffld_version (integer module constant) – Use one of the valid force fields. Default is to use the force field that is selected in Maestro preferences.

  • struct (schrodinger.structure.Structure) – The structure to be minimized.

  • cleanup (bool) – If True, attempts to automatically clean up the structure will be made. (This uses the C function mmlewis_apply().) Note that this can modify the atom types of the passed in structure.

  • min_method (enum) – The minimizer method. Valid values are MinBFGS, MinAUTO and MinCG. Default is MinAUTO, which uses BFGS if number of atoms is less than 500, CG otherwise.

  • max_steps (int) – The maximum number of steps to run the mimization for. Default is 1500.

  • energy_criterion (float) – The energy convergence criterion. Default is 5.0e-09.

  • gradient_criterion (float) – The gradient convergence criterion. Default is 0.05.

  • verbose (bool) – Printing verbosity. Default is False.

  • energy_no_electrostatics (bool) – Whether to turn off electrostatics. Default is False, i.e. to use electrostatics. NOTE: Can not be modified after the instance is created

  • energy_lj_repulsive_only (bool) – Whether to use only the repulsive portion of the Lennard-Jones term. Default is False. NOTE: Can not be modified after the instance is created

  • nonbonded_cutoff (float) – The cutoff for non-bonded interactions. It will be automatically scaled down for small BPC boxes. Default is 14.0.

  • maintain_planarity (bool) – Enable scaling of forces to artificially maintain planarity of certain sub-structures. This sets associated scale factors to their default values. Default is False. NOTE: Can not be modified after the instance is created

  • dielectric_constant (float) – The strength of the constant dielectric field used in the energy calculation. The default is 1.0 (vacuum).

  • no_zob_restrain (bool) – The default (False) is to restrain zero-order metal bonds to their input value. Setting this to True causes the forcefield parameters to be taken from lookup results if possible.

  • charges_from_ct (bool) – The default (False) is to use the charges from the force field. Setting this to True causes the charges from the ct to be used.

  • honor_pbc (bool) – Honor Periodic Boundary Conditions, if defined as properties in the structure. Default is True.

cleanup_resources()
getStructure()

Return the current structure.

updateCoordinates(struct)

Update the coordinates of the current structure with the values from the provided struct.

This allows an additional conformer to be minimized without re-running atomtyping. It is the caller’s responsibility to make sure the molecules are equivalent and have the same atomtypes (i.e. same charges, connectivity).

minimize()

Minimize the provided Structure.

Note that this method will require a valid product license. Currently, MacroModel, GLIDE, Impact, or PLOP will suffice.

Returns

minimization results

Return type

mm.MinimizeResults

Raises

RuntimeError – If minimization fails

getTotalEnergy()

get the total energy of the system

getStretchEnergy()

only used in testing

getBendingEnergy()

only used in testing

getTorsionEnergy()

only used in testing

getImpTorsionEnergy()

get the improper torsion energy of the system

only used in testing

get14LJEnergy()

only used in testing

getLJEnergy()

get the Lennard Jones energy of the system

get14EleEnergy()

only used in testing

getEleEnergy()

only used in testing

getBondedEnergyComponents(stretch_item_list, bending_item_list, torsion_item_list, imp_torsion_item_list)

Get energy components for bonded terms given in an list of stretches/bend/torsions/improper torsions (given as integer numbers) in _item_list. The _energy_list arguments are ignored.

Returns the corresponding energies as a tuple of double lists: (stretch_energy_list, bending_energy_list, torsion_energy_list, imp_torsion_energy_list).

Atoms are counted starting at zero.

NOTE: The API of this function may change in the next release.

getNBEnergyForTwoAtomLists(atom_list_i, atom_list_j)

Get the non-bonded energy components for two arbitrary list of atoms. The total Coulomb and LJ interaction energies are returned.

getTotalAtom()

get the total number of atoms

getTotalStretch()

get the total number of stretch

getStretch(istr)

get the stretch type information and parameters

getTotalBending()

get the total number of bending

getBending(ibnd)

get the bending type information and parameters

getTotalTorsion()

get the total number of torsion

getTorsion(itor)

get the torsion type information and parameters

getTotalImpTorsion()

get the total number of improper torsion

getImpTorsion(imp_tor)

get the improper torsion type information and parameters

getTotal14Pair()

get the total number of 1,4-pairs

getNB14Pairs(i14pair)

get the 1,4-pair information

getExcludedAtomList(iatom)

get the excluded atoms

setStructure(struct)

Change the structure to be minimized.

This method generally won’t need to be called by the end user. To minimize different molecules, it is preferable to create separate Minimizer instances.

If only the coordinates of the structure changed, it is much faster to call updateCoordinates() instead of setStructure().

getEnergy(recalc=None)

Run a zero-step minimization to calculate the energy, and return it. Units are kcal/mol.

Parameters

recalc (bool) – Deprecated, and will propably go away.

setOptions(**kwargs)

Set Minimizer options by keyword. To be used only internally by the constructor.

getOptions()

Return the values for all properties that control Minimizer behavior.

setLigandCleanupOptions()

Obsolete.

addTorsionRestraint(i, j, k, l, force_constant, target, flat_bottom=0.0)

Define a torsional restraint.

Parameters
  • l (i, j, k,) – atoms defining the restraint

  • force_constant (float) – force constant

  • target (float) – target value

  • flat_bottom (float) – flat-bottom half width (default 0.0)

addAngleRestraint(i, j, k, force_constant, target, flat_bottom=0.0)

Define an angle restraint.

Parameters
  • k (i, j,) – atoms defining the restraint

  • force_constant (float) – force constant

  • target (float) – target value

  • flat_bottom (float) – flat-bottom half width (default 0.0)

addDistanceRestraint(i, j, force_constant, target, flat_bottom=0.0)

Define a distance restraint.

Parameters
  • j (i,) – atoms defining the restraint

  • force_constant (float) – force constant

  • target (float) – target value

  • flat_bottom (float) – flat-bottom half width (default 0.0)

addPosRestraint(i, force_constant, flat_bottom=0.0)

Define a positional restraint.

Parameters
  • i (int) – atom defining the restraint

  • force_constant (float) – force constant

  • flat_bottom (float) – flat-bottom half width (default 0.0)

addPosFrozen(i)

Define a frozen atom.

Parameters

i (int) – atom to be frozen

deleteAllRestraints(rest_type=0)

Delete all the restraints for a given type (default all types).

Parameters

rest_type (mm Constant) – One of: - mm.MMFfldTorsionRest - mm.MMFfldPosRest - mm.MMFfldPosFrozen - mm.MMFfldAllRestType

printParameters()

Print all parameters for the entered molecules.

property min_method

See the constructor method for documentation.

property max_steps

See the constructor method for documentation.

property energy_criterion

See the constructor method for documentation.

property gradient_criterion

See the constructor method for documentation.

property verbose

See the constructor method for documentation.

property energy_no_electrostatics

See the constructor method for documentation.

property energy_lj_repulsive_only

See the constructor method for documentation.

property nonbonded_cutoff

See the constructor method for documentation.

property maintain_planarity

See the constructor method for documentation.

property no_zob_restrain

See the constructor method for documentation.

property charges_from_ct

See the constructor method for documentation.

property dielectric_constant

See the constructor method for documentation.

getBondedEnergies(atom_subset)

Return bonded energies for bonded interactions within the given atom subset.

Parameters

atom_subset (List of atom indices.) – Atoms to calculate bonded energies for.

Returns

(stretch-energy, bend-energy, torsion-energy, imp-tor-energy)

Return type

tuple

getNonBondedEnergies(atom_subset, verbose=False)

Given a list of atoms representing a substructure (e.g. a residue), return a tuple of:

  1. the sum of non-bonded energies WITHIN the set.

  2. the sum of non-bonded energies between the set atoms and everything else.

Parameters

atom_subset (list(int)) – Atoms indicies to calculate non-bonded energies for

Returns

(internal non-bonded energy in kcal/mol, non-bonded interaction energy in kcal/mol)

Return type

tuple

getSelfEnergy(atom_subset, include_intra_nb=True)

Return the internal energy of the the given atoms. This is the sum of all bonded interactions between the given atoms.

Parameters
  • atom_subset (List of atom indices.) – Atoms to calculate self-energy for.

  • include_intra_nb (bool) – If True, include non-bonded interaction energy within the given subset. If False, include only bonded interactions.

Returns

Total self-energy

Return type

float

getInteractionEnergy(subset_atoms, *, include_bonded=False, verbose=False)

Calculate the energy of interaction between the <subset_atoms> and the <consider_atoms>. If <consider_atoms> is not specified, then returns a sum of all interactions between the <subset_atoms> and the rest of the atoms.

Note that in the default case where <consider_atoms> is None, atoms outside of the cutoff are not considered.

Parameters
  • subset_atoms (List of atom indices.) – First atom set.

  • consider_atoms (List of atom indices.) – Second atom set (optional)

  • include_bonded (Boolean.) – Whether to also include bonded terms. By default, only non-bonded interactions are included, even if the atom sets are covalently bonded, and any bonded interactions are excluded.

Returns

Interaction energy betwen the given atom sets (or between the given atom sets and the rest of the structure).

Return type

float

schrodinger.structutils.minimize.minimizer_context(**kwargs)

Context manager to patch the Minimizer class.

with minimizer_context(**kwargs) as min:
    min.setStructure(st)
    min.minimize()
schrodinger.structutils.minimize.compute_energy(struct, **kwargs)

Compute the energy in kcal/mol, store it on the structure, and return it.

Parameters

struct (schrodinger.structure.Structure) – the structure for which to compute the energy

Return type

float

Returns

the energy in kcal/mol