MDAnalysis
Atoms, residules, and segments
The data structure in MDAnalysis
Source: https://userguide.mdanalysis.org/stable/groups_of_atoms.html
Selecting atoms
Numerical ranges can be written as first-last or first:last where the range is inclusive. Note that in slicing, the last index is not included.
1
2
3
4
print(u.select_atoms('resid 50-100').n_residues)
print(u.residues[50:100].n_residues)
> 51
> 50
Constructing, modifying, and adding to a Universe
https://userguide.mdanalysis.org/stable/examples/constructing_universe.html
Angles, Dihedral angles
1
2
3
4
nhh = u.atoms[:3]
print(nhh.names)
angle_nhh = nhh.angle
print(f"N-H-H angle: {angle_nhh.value():.2f}")
Rotating around a dihedral with MDAnalysis