(page was renamed from Make_alpha_helix)
(Add to Examples category)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:




<pre><nowiki>#!python
<syntaxhighlight lang="python">
# Example for model.build_sequence(), secondary_structure.alpha()
# Example for Model.build_sequence(), secondary_structure.Alpha()


from modeller import *
from modeller import *
from modeller.optimizers import conjugate_gradients
from modeller.optimizers import ConjugateGradients


# Set up environment
# Set up environment
e = environ()
e = Environ()
e.libs.topology.read('${LIB}/top_heav.lib')
e.libs.topology.read('${LIB}/top_heav.lib')
e.libs.parameters.read('${LIB}/par.lib')
e.libs.parameters.read('${LIB}/par.lib')


# Build an extended chain model from primary sequence, and write it out
# Build an extended chain model from primary sequence, and write it out
m = model(e)
m = Model(e)
m.build_sequence('GSCASVCGV')
m.build_sequence('GSCASVCGV')
m.write(file='extended-chain.pdb')
m.write(file='extended-chain.pdb')


# Make stereochemical restraints on all atoms
# Make stereochemical restraints on all atoms
allatoms = selection(m)
allatoms = Selection(m)
m.restraints.make(allatoms, restraint_type='STEREO', spline_on_site=False)
m.restraints.make(allatoms, restraint_type='STEREO', spline_on_site=False)


# Constrain all residues to be alpha-helical
# Constrain all residues to be alpha-helical
# (Could also use m.residue_range() rather than m.residues here.)
# (Could also use m.residue_range() rather than m.residues here.)
m.restraints.add(secondary_structure.alpha(m.residues))
m.restraints.add(secondary_structure.Alpha(m.residues))


# Get an optimized structure with CG, and write it out
# Get an optimized structure with CG, and write it out
cg = conjugate_gradients()
cg = ConjugateGradients()
cg.optimize(allatoms, max_iterations=100)
cg.optimize(allatoms, max_iterations=100)
m.write(file='alpha-helix.pdb')
m.write(file='alpha-helix.pdb')
</nowiki></pre>
</syntaxhighlight>
 


[[Category: Examples]]

Latest revision as of 21:16, 16 August 2022

The example below builds a small model from primary sequence alone, and makes it alpha-helical.


# Example for Model.build_sequence(), secondary_structure.Alpha()

from modeller import *
from modeller.optimizers import ConjugateGradients

# Set up environment
e = Environ()
e.libs.topology.read('${LIB}/top_heav.lib')
e.libs.parameters.read('${LIB}/par.lib')

# Build an extended chain model from primary sequence, and write it out
m = Model(e)
m.build_sequence('GSCASVCGV')
m.write(file='extended-chain.pdb')

# Make stereochemical restraints on all atoms
allatoms = Selection(m)
m.restraints.make(allatoms, restraint_type='STEREO', spline_on_site=False)

# Constrain all residues to be alpha-helical
# (Could also use m.residue_range() rather than m.residues here.)
m.restraints.add(secondary_structure.Alpha(m.residues))

# Get an optimized structure with CG, and write it out
cg = ConjugateGradients()
cg.optimize(allatoms, max_iterations=100)
m.write(file='alpha-helix.pdb')