IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
structure_from_sequence.py
1## \example atom/structure_from_sequence.py
2# An atomic protein structure is created from primary (amino-acid) sequence.
3#
4
5import IMP.atom
6import sys
7
8IMP.setup_from_argv(sys.argv, "structure from sequence")
9
10# Use the CHARMM all-atom (i.e. including hydrogens) topology and parameters
12
13# Create a single chain of amino acids and apply the standard C- and N-
14# termini patches
15topology.add_sequence('IACGACKPECPVNIIQGS')
16topology.apply_default_patches()
17
18# Make an IMP Hierarchy (atoms, residues, chains) that corresponds to
19# this topology
20m = IMP.Model()
21h = topology.create_hierarchy(m)
22
23# Generate coordinates for all atoms in the Hierarchy, using CHARMM internal
24# coordinate information (an extended chain conformation will be produced).
25# Since in some cases this information can be incomplete, better results will
26# be obtained if the atom types are assigned first and the CHARMM parameters
27# file is loaded, as we do here, so missing information can be filled in.
28# It will still work without that information, but will approximate the
29# coordinates.
30topology.add_atom_types(h)
31topology.add_coordinates(h)
32
33# Hierarchies in IMP must have radii
35
36# Write out the final structure to a PDB file
37IMP.atom.write_pdb(h, 'structure.pdb')
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
The topology of a complete CHARMM model.
Functionality for loading, creating, manipulating and scoring atomic structures.
void write_pdb(const Selection &mhd, TextOutput out, unsigned int model=1)
void add_radii(Hierarchy d, const ForceFieldParameters *ffp=get_all_atom_CHARMM_parameters(), FloatKey radius_key=FloatKey("radius"))
Add vdW radius from given force field.
CHARMMParameters * get_all_atom_CHARMM_parameters()
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.