Shift dihedral angles#

Shifting dihedral angles by incremental angular amounts.

The function molsysmt.structure.shift_dihedral_angles() rotates dihedral angles incrementally relative to their existing values, applying an angular displacement \(\Delta \theta\) while preserving connected covalent blocks.

Added in version 1.0.0.

Basic usage#

Let’s show how to shift a specific backbone \(\phi\) dihedral angle by \(+90.0^\circ\) in Met-enkephalin:

import molsysmt as msm
import pyunitwizard as puw
molsys = msm.convert(msm.systems['Met-enkephalin']['met_enkephalin.h5msm'])

We query the backbone \(\phi\) quartets and measure the current value of the second \(\phi\) angle:

phi_quartets = msm.topology.get_dihedral_quartets(molsys, phi=True)
initial_angle = msm.structure.get_dihedral_angles(molsys, dihedral_quartets=phi_quartets[1])
print('Initial phi angle:', puw.convert(initial_angle, to_unit='degrees'))
Initial phi angle: [[-179.9997685580422]] degree

We inspect the initial 3D conformation of the peptide:

msm.view(molsys)

We shift the dihedral angle by \(+90.0^\circ\) using molsysmt.structure.shift_dihedral_angles():

molsys_shifted = msm.structure.shift_dihedral_angles(molsys, dihedral_quartets=phi_quartets[1], shifts='90.0 degrees')

We verify that the new angle reflects exactly the \(+90.0^\circ\) angular increment:

new_angle = msm.structure.get_dihedral_angles(molsys_shifted, dihedral_quartets=phi_quartets[1])
print('Shifted phi angle:', puw.convert(new_angle, to_unit='degrees'))
Shifted phi angle: [[-89.99976855823314]] degree

Visualizing the shifted system in 3D confirms the updated peptide backbone geometry:

msm.view(molsys_shifted)

Shifting multiple dihedral angles simultaneously#

Multiple dihedral angles can be shifted concurrently by providing a list or array of angular shifts:

shifts = puw.quantity([30.0, 30.0, 30.0, 30.0], 'degrees')
molsys_multi_shift = msm.structure.shift_dihedral_angles(molsys, dihedral_quartets=phi_quartets, shifts=shifts)
all_shifted = msm.structure.get_dihedral_angles(molsys_multi_shift, dihedral_quartets=phi_quartets)
print('All phi angles after multi-shift:', puw.convert(all_shifted, to_unit='degrees'))
All phi angles after multi-shift: [[-149.9997705129718 -149.99976855823317 -149.99976916209638  -149.99977065270835]] degree