IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
charmm_topology.py
1## \example atom/charmm_topology.py
2# This example shows how to use IMP's CHARMM topology reader to
3# build an atomic structure (in this case, alanine dipeptide) from
4# primary sequence, and to apply topology patches.
5#
6
7import IMP.atom
8import sys
9
10IMP.setup_from_argv(sys.argv, "CHARMM topology")
11
12# Read CHARMM non-hydrogen parameters
14
15# Start building a single segment (chain) topology
17
18# Get the topology of an ideal alanine from the CHARMM topology
19ideal_ala = ff.get_residue_topology(IMP.atom.ALA)
20
21# Use ideal topology as a template to make the real alanine topology
22# ("real" topology can be modified, e.g. by patching)
23ala = IMP.atom.CHARMMResidueTopology(ideal_ala)
24
25# Apply ACE and CT3 patches to our topology. Normally a residue can only
26# be patched once, so reset the patched flag after the first patch.
27ace = ff.get_patch("ACE")
28ct3 = ff.get_patch("CT3")
29ace.apply(ala)
30ala.set_patched(False)
31ct3.apply(ala)
32
33# Add the residue and chain to the top-level topology
34st.add_residue(ala)
36t.add_segment(st)
37
38# Make a Hierarchy using this topology
39m = IMP.Model()
40h = t.create_hierarchy(m)
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
The topology of a single residue in a model.
The topology of a single CHARMM segment in a model.
The topology of a complete CHARMM model.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
Functionality for loading, creating, manipulating and scoring atomic structures.
CHARMMParameters * get_heavy_atom_CHARMM_parameters()
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.