MMFFBatchElement#

class nvmolkit.batchedForcefield.MMFFBatchElement(parent, idx: int)#

Per-molecule view for configuring one molecule in an MMFF batch.

Retrieve an element with ff[i] and use it to inspect the number of atoms or to add constraints for that molecule. Constraints apply to all conformers of the molecule.

Example:

ff = MMFFBatchedForcefield([mol_a, mol_b])
ff[0].add_position_constraint(0, 0.1, 50.0)
ff[1].add_distance_constraint(1, 4, False, 2.0, 2.2, 25.0)
energies, converged = ff.minimize()
add_angle_constraint(
idx1: int,
idx2: int,
idx3: int,
relative: bool,
min_angle_deg: float,
max_angle_deg: float,
force_constant: float,
) None#

Add an angle constraint to this molecule.

Parameters:
  • idx1 – Index of the first atom in the angle.

  • idx2 – Index of the central atom.

  • idx3 – Index of the third atom in the angle.

  • relative – If True, interpret angle bounds relative to the current angle. If False, interpret them as absolute angles in degrees.

  • min_angle_deg – Lower bound of the allowed angle range in degrees.

  • max_angle_deg – Upper bound of the allowed angle range in degrees.

  • force_constant – Constraint force constant.

add_distance_constraint(
idx1: int,
idx2: int,
relative: bool,
min_len: float,
max_len: float,
force_constant: float,
) None#

Add a distance constraint to this molecule.

Parameters:
  • idx1 – Index of the first constrained atom.

  • idx2 – Index of the second constrained atom.

  • relative – If True, interpret min_len and max_len as offsets from the current distance. If False, interpret them as absolute distances in Angstroms.

  • min_len – Lower bound of the allowed distance range.

  • max_len – Upper bound of the allowed distance range.

  • force_constant – Constraint force constant.

add_position_constraint(
idx: int,
max_displ: float,
force_constant: float,
) None#

Add a position constraint to one atom in this molecule.

Parameters:
  • idx – Index of the constrained atom.

  • max_displ – Maximum displacement allowed from the current atom position before the restraint contributes energy.

  • force_constant – Constraint force constant.

add_torsion_constraint(
idx1: int,
idx2: int,
idx3: int,
idx4: int,
relative: bool,
min_dihedral_deg: float,
max_dihedral_deg: float,
force_constant: float,
) None#

Add a torsion constraint to this molecule.

Parameters:
  • idx1 – Index of the first atom in the torsion.

  • idx2 – Index of the second atom in the torsion.

  • idx3 – Index of the third atom in the torsion.

  • idx4 – Index of the fourth atom in the torsion.

  • relative – If True, interpret dihedral bounds relative to the current dihedral angle. If False, interpret them as absolute dihedral bounds in degrees.

  • min_dihedral_deg – Lower bound of the allowed dihedral range in degrees.

  • max_dihedral_deg – Upper bound of the allowed dihedral range in degrees.

  • force_constant – Constraint force constant.

property num_atoms: int#

Return the number of atoms in this molecule.