%load_ext autoreload
%autoreload 2
import molsysmt as msm

Set dihedral angles#

The geometry of a peptide or protein can be changed setting new values to a given dihedral angle (or a set of them). Lets see in the following lines how this can be done with the help of the method molsysmt.set_dihedral_angles. First of all a demo molecular system is loaded to play with it:

molecular_system = msm.systems['Met-enkephalin']['met_enkephalin.h5msm']
molecular_system = msm.convert(molecular_system)
msm.info(molecular_system)
form n_atoms n_groups n_components n_chains n_molecules n_entities n_peptides n_structures
molsysmt.MolSys 72 5 1 1 1 1 1 1

Lets get, before changing its value, the second \(\phi\) angle in the current conformation of the system:

phi_chains = msm.topology.get_dihedral_quartets(molecular_system, phi=True)
msm.structure.get_dihedral_angles(molecular_system, quartets=phi_chains[2])
Magnitude
[[-179.99976916196186]]
Unitsdegree
view = msm.view(molecular_system, viewer='NGLView')
view.clear()
selection_quartet = msm.select(molecular_system, selection=phi_chains[2], to_syntax='NGLView')
view.add_ball_and_stick('all', color='white')
view.add_ball_and_stick(selection_quartet, color='orange')
view

Now we can rotate this angle in order to have the desired value:

molecular_system = msm.structure.set_dihedral_angles(molecular_system, quartets=phi_chains[2],
                                                     angles='0.0 degrees', pbc=False)
msm.structure.get_dihedral_angles(molecular_system, quartets=phi_chains[2])
Magnitude
[[0.0]]
Unitsdegree
view = msm.view(molecular_system, viewer='NGLView')
view.clear()
selection_quartet = msm.select(molecular_system, selection=phi_chains[2], to_syntax='NGLView')
view.add_ball_and_stick('all', color='white')
view.add_ball_and_stick(selection_quartet, color='orange')
view