Get potential energy#
Evaluating total potential energy and force field energy components for molecular systems.
The function molsysmt.molecular_mechanics.get_potential_energy() computes total potential energies and individual bonded and non-bonded force group contributions.
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_potential_energy().
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 compute the total potential energy of the Barnase–Barstar complex:
import molsysmt as msm
import pyunitwizard as puw
molsys = msm.convert(msm.systems['Barnase-Barstar']['barnase_barstar.h5msm'])
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 total potential energy of the system:
u_total = msm.molecular_mechanics.get_potential_energy(molsys)
print('Total potential energy:', u_total)
Total potential energy: -24923.70144628682 kilojoule / mole
Energy decomposition into force terms#
Setting decomposition=True breaks down the total energy into individual force contributions (such as bonds, angles, torsions, and non-bonded interactions):
u_decomp = msm.molecular_mechanics.get_potential_energy(molsys, decomposition=True)
for force_name, energy_val in u_decomp.items():
print(f'{force_name}: {energy_val}')
HarmonicBondForce: 409.62411894172345 kilojoule / mole
NonbondedForce: -36569.760746567394 kilojoule / mole
PeriodicTorsionForce: 9523.330057869382 kilojoule / mole
CMMotionRemover: 0.0 kilojoule / mole
HarmonicAngleForce: 1713.1051234694648 kilojoule / mole
Selection-specific potential energy#
We can compute the isolated internal potential energy of specific molecules or chains:
u_barnase = msm.molecular_mechanics.get_potential_energy(molsys, selection='molecule_name=="BARNASE"')
u_barstar = msm.molecular_mechanics.get_potential_energy(molsys, selection='molecule_name=="BARSTAR"')
print('Barnase internal energy:', u_barnase)
print('Barstar internal energy:', u_barstar)
Barnase internal energy: -12982.372195725475 kilojoule / mole
Barstar internal energy: -8779.041597591939 kilojoule / mole
See also
Related Tools & References
Convert: Convert molecular systems with
molsysmt.basic.convert().Potential energy minimization: Minimize potential energy with
molsysmt.molecular_mechanics.potential_energy_minimization().Get non-bonded potential energy: Calculate non-bonded interaction energy with
molsysmt.molecular_mechanics.get_non_bonded_potential_energy().