Get degrees of freedom#
Calculating mechanical degrees of freedom for parameterized molecular systems.
The function molsysmt.molecular_mechanics.get_degrees_of_freedom() computes the effective number of mechanical degrees of freedom (\(3 N_{\text{particles}} - N_{\text{constraints}}\)) accounting for force field constraints.
Added in version 1.0.0.
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.molecular_mechanics.get_degrees_of_freedom().
Note
Molecular Mechanics Backend Engine
Molecular mechanics and force evaluations in MolSysMT are executed using backend simulation engines (currently OpenMM by default). MolSysMT intentionally unifies the Pythonic interface and data structures while delegating energy evaluations, parameterizations, and gradient calculations to high-performance, battle-tested molecular simulation engines.
Basic usage#
Let’s determine the mechanical degrees of freedom for a parameterized molecular system:
import molsysmt as msm
prmtop_sys = msm.convert(msm.systems['pentalanine']['pentalanine.prmtop'])
omm_sys = msm.convert(prmtop_sys, to_form='openmm.System')
Note
Demo Systems Catalog
This tutorial uses demonstration datasets provided by MolSysMT. To explore the full catalog of bundled systems, forms, and file paths, visit the Demo Systems guide.
We calculate the degrees of freedom directly from the openmm.System object:
dof = msm.molecular_mechanics.get_degrees_of_freedom(omm_sys)
print('Total mechanical degrees of freedom:', dof)
Total mechanical degrees of freedom: 10444
Direct calculation from molecular topologies#
When providing molecular topologies or native MolSysMT objects, the system is automatically converted and parameterized using the specified force field to determine the number of constraints:
molsys = msm.build.build_peptide('AceAlaCysAspGluPheNme')
dof_peptide = msm.molecular_mechanics.get_degrees_of_freedom(molsys, forcefield='AMBER14')
print('Peptide degrees of freedom (AMBER14):', dof_peptide)
Peptide degrees of freedom (AMBER14): 204
See also
Related Tools & References
Build peptide: Construct peptide models with
molsysmt.build.build_peptide().Convert: Convert molecular systems with
molsysmt.basic.convert().Get potential energy: Calculate potential energy with
molsysmt.molecular_mechanics.get_potential_energy().