Set dihedral angles#
Setting dihedral angles to target values by rotating covalent blocks.
The function molsysmt.structure.set_dihedral_angles() alters the 3D conformation of a molecular system by setting specific dihedral angles to target angular values, rotating the covalently connected atomic block on the movable side of the central bond.
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.structure.set_dihedral_angles().
Basic usage#
Let’s show how to set a specific backbone \(\phi\) dihedral angle to a new target value in Met-enkephalin:
import molsysmt as msm
import pyunitwizard as puw
molsys = msm.convert(msm.systems['Met-enkephalin']['met_enkephalin.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 identify the atom quartets defining backbone \(\phi\) angles using molsysmt.topology.get_dihedral_quartets() and check the initial 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('Selected quartet:', phi_quartets[1])
print('Initial phi angle:', puw.convert(initial_angle, to_unit='degrees'))
Selected quartet: [26, 28, 30, 33]
Initial phi angle: [[-179.9997685580422]] degree
We inspect the initial 3D conformation of the peptide:
msm.view(molsys)
We set the dihedral angle to \(+60.0^\circ\) using molsysmt.structure.set_dihedral_angles():
molsys_mod = msm.structure.set_dihedral_angles(molsys, dihedral_quartets=phi_quartets[1], angles='60.0 degrees')
We verify that the angle has been updated exactly to the requested value:
updated_angle = msm.structure.get_dihedral_angles(molsys_mod, dihedral_quartets=phi_quartets[1])
print('Updated phi angle:', puw.convert(updated_angle, to_unit='degrees'))
Updated phi angle: [[59.99999999980902]] degree
Visualizing the modified conformation in 3D illustrates the conformational rotation of the covalent block:
msm.view(molsys_mod)
Setting multiple dihedral angles simultaneously#
Multiple dihedral angles can be set concurrently by passing an array of quartets and target angles:
target_angles = puw.quantity([-60.0, -60.0, -60.0, -60.0], 'degrees')
molsys_multi = msm.structure.set_dihedral_angles(molsys, dihedral_quartets=phi_quartets, angles=target_angles)
all_phi = msm.structure.get_dihedral_angles(molsys_multi, dihedral_quartets=phi_quartets)
print('All phi angles after multi-set:', puw.convert(all_phi, to_unit='degrees'))
All phi angles after multi-set: [[-60.00000000345287 -60.00000000019093 -59.999999995397786 -60.00000000180088]] degree
See also
Related Tools & References
Convert: Convert molecular systems between different forms with
molsysmt.basic.convert().Get dihedral quartets: Identify atom quartets for dihedral angles with
molsysmt.topology.get_dihedral_quartets().Get dihedral angles: Measure dihedral angle values with
molsysmt.structure.get_dihedral_angles().View: Render molecular systems interactively with
molsysmt.basic.view().Shift dihedral angles: Increment or decrement dihedral angles with
molsysmt.structure.shift_dihedral_angles().