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.

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'])

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