Then a second copy of the protein is loaded and they are both added to the same hierarchy to define a hypothetical assembly.
import IMP import IMP.core import IMP.atom m = IMP.Model() mp0= IMP.atom.read_pdb(IMP.atom.get_example_path('example_protein.pdb'), m) # get the 16th residue of the first chain hchain= IMP.atom.get_by_type(mp0, IMP.atom.CHAIN_TYPE)[0] # decorate the chain particle with an IMP.atom.Chain decorator. # unfortunately, our python wrapper does not handle converseions properly # as a result you have to manually get the particle for that chain chain=IMP.atom.Chain(hchain.get_particle()) r16 = IMP.atom.get_residue(chain, 16) r16.show() # get all the atoms atoms= IMP.atom.get_by_type(mp0, IMP.atom.ATOM_TYPE) # I didn't really have anything interesting to do with them... # create a new version of the protein that is coarsened (one particle per residue) smp0= IMP.atom.create_simplified_along_backbone(chain, 1) # we don't need mp0 any more IMP.atom.destroy(mp0) # load another copy mp1= IMP.atom.read_pdb(IMP.atom.get_example_path('example_protein.pdb'), m) # make this one rigid IMP.atom.setup_as_rigid_body(mp1) # create a hierarchy which contains the two proteins p = IMP.Particle(m) rmp= IMP.atom.Hierarchy.setup_particle(p) rmp.add_child(smp0) rmp.add_child(mp1)
import IMP.atom m= IMP.Model() prot= IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m) bds= IMP.atom.get_internal_bonds(prot) bl= IMP.container.ListSingletonContainer(bds.get_particles()) h= IMP.core.Harmonic(0,1) bs= IMP.atom.BondSingletonScore(h) br= IMP.container.SingletonsRestraint(bs, bl) m.add_restraint(br) print m.evaluate(False)
import IMP.atom import IMP.container # Create an IMP model and add a heavy atom-only protein from a PDB file m = IMP.Model() prot = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m, IMP.atom.NonWaterNonHydrogenPDBSelector()) # Read in the CHARMM heavy atom topology and parameter files ff = IMP.atom.CHARMMParameters(IMP.atom.get_data_path("top_heav.lib"), IMP.atom.get_data_path("par.lib")) # Using the CHARMM libraries, determine the ideal topology (atoms and their # connectivity) for the PDB file's primary sequence topology = ff.create_topology(prot) # Typically this modifies the C and N termini of each chain in the protein by # applying the CHARMM CTER and NTER patches. Patches can also be manually # applied at this point, e.g. to add disulfide bridges. topology.apply_default_patches(ff) # Each atom is mapped to its CHARMM type. These are needed to look up bond # lengths, Lennard-Jones radii etc. in the CHARMM parameter file. Atom types # can also be manually assigned at this point using the CHARMMAtom decorator. topology.add_atom_types(prot) # Generate and return lists of bonds, angles, dihedrals and impropers for # the protein. Each is a Particle in the model which defines the 2, 3 or 4 # atoms that are bonded, and adds parameters such as ideal bond length # and force constant. Note that bonds and impropers are explicitly listed # in the CHARMM topology file, while angles and dihedrals are generated # automatically from an existing set of bonds. These particles only define the # bonds, but do not score them or exclude them from the nonbonded list. bonds = topology.add_bonds(prot, ff) angles = ff.generate_angles(bonds) dihedrals = ff.generate_dihedrals(bonds) impropers = topology.add_impropers(prot, ff) # Maintain stereochemistry by scoring bonds, angles, dihedrals and impropers # Score all of the bonds. This is done by combining IMP 'building blocks': # - A ListSingletonContainer simply manages a list of the bond particles. # - A BondSingletonScore, when given a bond particle, scores the bond by # calculating the distance between the two atoms it bonds, subtracting the # ideal value, and weighting the result by the bond's "stiffness", such that # an "ideal" bond scores zero, and bonds away from equilibrium score non-zero. # It then hands off to a UnaryFunction to actually penalize the value. In # this case, a Harmonic UnaryFunction is used with a mean of zero, so that # bond lengths are harmonically restrained. # - A SingletonsRestraint simply goes through each of the bonds in the # container and scores each one in turn. cont = IMP.container.ListSingletonContainer("bonds") cont.add_particles(bonds) bss = IMP.atom.BondSingletonScore(IMP.core.Harmonic(0, 1)) m.add_restraint(IMP.container.SingletonsRestraint(bss, cont)) # Score angles, dihedrals, and impropers. In the CHARMM forcefield, angles and # impropers are harmonically restrained, so this is the same as for bonds. # Dihedrals are scored internally by a periodic (cosine) function. cont = IMP.container.ListSingletonContainer("angles") cont.add_particles(angles) bss = IMP.atom.AngleSingletonScore(IMP.core.Harmonic(0,1)) m.add_restraint(IMP.container.SingletonsRestraint(bss, cont)) cont = IMP.container.ListSingletonContainer("dihedrals") cont.add_particles(dihedrals) bss = IMP.atom.DihedralSingletonScore() m.add_restraint(IMP.container.SingletonsRestraint(bss, cont)) cont = IMP.container.ListSingletonContainer("impropers") cont.add_particles(impropers) bss = IMP.atom.ImproperSingletonScore(IMP.core.Harmonic(0,1)) m.add_restraint(IMP.container.SingletonsRestraint(bss, cont)) # Add non-bonded interaction (in this case, Lennard-Jones). This needs to # know the radii and well depths for each atom, so add them from the forcefield # (they can also be assigned manually using the XYZR or LennardJones # decorators): ff.add_radii(prot) ff.add_well_depths(prot) # Get a list of all atoms in the protein, and put it in a container atoms = IMP.atom.get_by_type(prot, IMP.atom.ATOM_TYPE) cont = IMP.container.ListSingletonContainer(atoms) # Add a restraint for the Lennard-Jones interaction. Again, this is built from # a collection of building blocks. First, a ClosePairContainer maintains a list # of all pairs of Particles that are close. A StereochemistryPairFilter is used # to exclude atoms from this list that are bonded to each other or are involved # in an angle or dihedral (1-3 or 1-4 interaction). Then, a # LennardJonesPairScore scores a pair of atoms with the Lennard-Jones potential. # Finally, a PairsRestraint is used which simply applies the # LennardJonesPairScore to each pair in the ClosePairContainer. nbl = IMP.container.ClosePairContainer(cont, 4.0) pair_filter = IMP.atom.StereochemistryPairFilter() pair_filter.set_bonds(bonds) pair_filter.set_angles(angles) pair_filter.set_dihedrals(dihedrals) nbl.add_pair_filter(pair_filter) sf = IMP.atom.ForceSwitch(6.0, 7.0) ps = IMP.atom.LennardJonesPairScore(sf) m.add_restraint(IMP.container.PairsRestraint(ps, nbl)) # Finally, evaluate the score of the whole system (without derivatives) print m.evaluate(False)