The example below builds a small model from primary sequence alone, and makes it alpha-helical.
1 # Example for model.build_sequence(), secondary_structure.alpha()
2
3 from modeller import *
4 from modeller.optimizers import conjugate_gradients
5
6 # Set up environment
7 e = environ()
8 e.libs.topology.read('${LIB}/top_heav.lib')
9 e.libs.parameters.read('${LIB}/par.lib')
10
11 # Build an extended chain model from primary sequence, and write it out
12 m = model(e)
13 m.build_sequence('GSCASVCGV')
14 m.write(file='extended-chain.pdb')
15
16 # Make stereochemical restraints on all atoms
17 allatoms = selection(m)
18 m.restraints.make(allatoms, restraint_type='STEREO', spline_on_site=False)
19
20 # Constrain all residues to be alpha-helical
21 # (Could also use m.residue_range() rather than m.residues here.)
22 m.restraints.add(secondary_structure.alpha(m.residues))
23
24 # Get an optimized structure with CG, and write it out
25 cg = conjugate_gradients()
26 cg.optimize(allatoms, max_iterations=100)
27 m.write(file='alpha-helix.pdb')
