In this example we make a tri-glycine peptide and scan over the phi/psi torsion angles between -180 and 180 degrees with 60 degrees spacing.
For each conformation, the MMFF94 force field energy is printed and the structure is saved as an XYZ file.
===
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fragbuilder import Peptide | |
# Create a peptide object with the sequence | |
# glycine-glycine-glycine. | |
sequence = "GGG" | |
pep = Peptide(sequence) | |
# Define a list of angles. | |
angles = range(-180, 180, 60) | |
# Double loop over phi/psi angles in the desired range. | |
for psi in angles: | |
for phi in angles: | |
# Set the second (leucine) residue to (phi, psi). | |
pep.set_bb_angles(2, [phi, psi]) | |
# Print the energy of the peptide in this state. | |
# This is of course just an example. | |
print pep.get_energy() | |
# Save each conformation. | |
pep.write_xyz("pep_%04i_%04i.xyz" % (phi, psi)) | |