schrodinger.application.matsci.mlip.constraint module¶
Constraint terms for the MLIP nanoreactor MD engine.
Provides soft harmonic constraints for fixing atom positions or preserving relative distances between atoms.
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.matsci.mlip.constraint.PairwiseHarmonicConstraint(indices_to_constrain, init_r=None, k_constraint=1.0, return_zero_energy=True)¶
Bases:
objectSoft constraint preserving relative distances between selected atoms.
Applies harmonic potentials between each pair of constrained atoms, following the approach from xTB: https://xtb-docs.readthedocs.io/en/latest/xcontrol.html#fixing-constraining-and-confining
- atom_behavior = 'relative'¶
- __init__(indices_to_constrain, init_r=None, k_constraint=1.0, return_zero_energy=True)¶
- Parameters:
indices_to_constrain (list) – Zero-based atom indices to constrain
init_r (torch.Tensor or None) – Initial positions of shape (M, N, 3) in Angstrom. If None, reference distances are set on first call.
k_constraint (float) – Force constant in eV/Angstrom^2
return_zero_energy (bool) – If True, return zero energy and only apply forces
- buildReferenceDistances(r_tensor)¶
Build reference pairwise distances from the given positions.
- Parameters:
r_tensor (torch.Tensor) – Positions of shape (M, N, 3) in Angstrom
- class schrodinger.application.matsci.mlip.constraint.FixPositionConstraint(indices_to_constrain, init_r=None, k_constraint=1.0, return_zero_energy=True)¶
Bases:
objectFix the position of selected atoms at their initial positions using a harmonic restraint potential.
If the initial position is not given, it is captured on the first call.
- atom_behavior = 'absolute'¶
- __init__(indices_to_constrain, init_r=None, k_constraint=1.0, return_zero_energy=True)¶
- Parameters:
indices_to_constrain (list) – Zero-based atom indices to constrain
init_r (torch.Tensor or None) – Initial positions of shape (M, N, 3) in Angstrom. If None, reference positions are set on first call.
k_constraint (float) – Force constant in eV/Angstrom^2
return_zero_energy (bool) – If True, return zero energy and only apply forces