16 from math
import sqrt,exp
17 from StringIO
import StringIO
19 from random
import random
21 kB= (1.381 * 6.02214) / 4184.0
24 def __init__(self, cont, md, n_md_steps):
27 self.n_md_steps = n_md_steps
34 for i
in xrange(self.cont.get_number_of_particles()):
35 p=self.cont.get_particle(i)
38 self.oldcoords.append(d.get_coordinates())
40 def propose_move(self, prob):
41 self.md.optimize(self.n_md_steps)
44 for i
in xrange(self.cont.get_number_of_particles()):
45 p=self.cont.get_particle(i)
49 d.set_coordinates(self.oldcoords[i])
51 def get_number_of_steps(self):
52 return self.n_md_steps
54 def set_number_of_steps(self, nsteps):
55 self.n_md_steps = nsteps
60 def __init__(self,model):
63 def add_mover(self,mv):
69 def set_return_best(self,thing):
71 def set_move_probability(self,thing):
75 pot=self.m.evaluate(
False)
77 kin=self.mv.md.get_kinetic_energy()
80 def metropolis(self, old, new):
83 print ": old %f new %f deltaE %f new_epot: %f" % (old,new,deltaE,
84 self.m.evaluate(
False)),
89 return exp(-deltaE/kT) > random()
91 def optimize(self,nsteps):
93 print "=== new MC call"
96 for i
in xrange(nsteps):
97 print "MC step %d " % i,
99 self.mv.md.assign_velocities(self.kT / kB)
101 old=self.get_energy()
103 self.mv.propose_move(1)
105 new=self.get_energy()
106 if self.metropolis(old,new):
116 def get_number_of_forward_steps(self):
120 """nonspecific methods used across all shared function objects.
122 - Their name starts with the name of the parent function (e.g.
124 - they don't store anything in the class, but instead
125 return all created objects.
126 Exceptions: the model, which is self._m
127 the statistics class, which is self.stat
128 - they store what they have to store in the model (e.g. restraints)
129 - they don't print out anything except for long routines (e.g. NOE
131 - the prior RestraintSet is added to the model when it is created, so
132 that when it is passed to another function, it is not added twice.
138 def set_checklevel(self,value):
141 def set_loglevel(self,value):
144 def m(self,name,*args,**kw):
145 "wrapper to call methods of m"
146 func=getattr(self._m,name)
147 return func(*args, **kw)
150 "moves to wd and creates model"
156 ff_temp=300.0, disulfides=
None, representation=
'custom'):
157 """creates a CHARMM protein representation.
158 creates the charmm force field, bonded and nonbonded.
159 - initpdb: initial structure in pdb format
160 - top is a CHARMM top.lib, read if representation=='custom' (default)
161 - par is a CHARMM par.lib
162 - selector is an instance of
163 one of the selectors of IMP.atom, for example
164 IMP.atom.NonWaterNonHydrogenPDBSelector().
165 - pairscore is an instance of a Pair Score to score the interaction
166 between two atoms. usually, it's either
167 LennardJonesDistancePairScore(0,1) or
168 RepulsiveDistancePairScore(0,1)
169 - ff_temp is the temperature at which the force field should be
171 - disulfides: if not None, a list of tuples corresponding to residue
172 numbers that should be cross-linked. Residues should be
173 cysteines, and residue numbering should start at 0.
174 - representation: 'full' : all-atom CHARMM force field
175 'heavy': heavy atom CHARMM forcefield with polar H
176 'calpha': only C alphas, ball and stick model with
177 bondlength 3.78 angstrom, beads at VdW
178 contact, and harmonic restraint between
180 'custom' (default) : read given CHARMM top and par
182 Returns: prot, ff, rsb, rs
184 - ff: the force field
185 - rsb: the RestraintSet on bonded interactions
186 - rs: the RestraintSet on nonbonded interactions. Both are weighted
191 if not prot.get_is_valid(
True):
192 raise ValueError,
"invalid hierarchy!"
193 if representation ==
'custom':
196 elif representation ==
'heavy':
198 elif representation ==
'full':
200 elif representation ==
'calpha':
203 raise NotImplementedError, representation
204 if representation ==
'calpha':
205 print "setting up simplified C alpha force field"
212 for chain
in prot.get_children():
213 residues=[(chain.get_child(i),chain.get_child(i+1))
214 for i
in xrange(chain.get_number_of_children()-1)]
215 residues=[(i.get_child(0).get_particle(),
216 j.get_child(0).get_particle())
217 for (i,j)
in residues]
218 pairs.extend(residues)
237 rsb.add_restraint(br)
238 rsb.set_weight(1.0/(kB*ff_temp))
241 nonbonded_pair_filter.set_bonds(bonds)
244 print "setting up CHARMM forcefield"
248 topology = ff.create_topology(prot)
252 topology.apply_default_patches()
255 s=topology.get_segment(0)
256 dis=ff.get_patch(
'DISU')
257 for (i,j)
in disulfides:
263 r0.set_patched(
False)
265 r1.set_patched(
False)
267 print "added disulfide bridge between cysteines %d and %d" % (i,j)
273 topology.setup_hierarchy(prot)
286 ff.add_well_depths(prot)
287 nonbonded_pair_filter = r.get_pair_filter()
299 nbl.add_pair_filter(nonbonded_pair_filter)
305 return prot, ff, rsb, rs
308 """sets up a Scale particle to the initial default value. It can
309 optionnally be constrained between two positive bounds, or else its
310 range is 0 to infinity.
315 scale.set_lower(lower)
317 scale.set_upper(upper)
321 """given a list of scales, returns a RestraintSet('prior') with weight
322 1.0 that contains a list of vonMisesKappaJeffreysRestraint on each scale.
323 If argument prior_rs is used, add them to that RestraintSet instead.
327 self._m.add_restraint(prior_rs)
328 prior_rs.set_weight(1.0)
334 """given a list of scales, returns a RestraintSet('prior') with weight
335 1.0 that contains a list of JeffreysRestraint on each scale.
336 If argument prior_rs is used, add them to that RestraintSet instead.
340 self._m.add_restraint(prior_rs)
343 prior_rs.add_restraint(jr)
347 """given a list of scales, returns a RestraintSet('prior') with weight
348 1.0 that contains a list of vonMisesKappaConjugateRestraint on each
349 scale. If argument prior_rs is used, add them to that RestraintSet
352 if not (0 <= R <= c):
353 raise ValueError,
"parameters R and c should satisfy 0 <= R <= c"
356 self._m.add_restraint(prior_rs)
362 """scans the prot hierarchy and tries to find atom = (resno, name)
363 assumes that resno follows the same numbering as the sequence.
364 Stores already found atoms for increased speed.
366 if not hasattr(self,
'__memoized'):
367 self.__memoized={prot:{}}
369 return self.__memoized[prot][atom]
374 residue_index=atom[0],
376 ).get_selected_particles()
378 print "found multiple atoms for atom %d %s!" % atom
382 print "atom %d %s not found" % atom
384 self.__memoized[prot][atom] = p0
389 Sets up a vonMises torsion angle restraint using the given kappa
390 particle as concentration parameter. Returns the restraint.
391 data is a list of observations.
397 Sets up a vonMises torsion angle restraint using the given kappa
398 particle as concentration parameter. Returns the restraint.
399 data is (mean, standard deviation).
401 raise NotImplementedError
405 Sets up a lognormal distance restraint using the given sigma and gamma.
406 Returns the restraint.
407 assumes atoms = (atom1, atom2)
408 where atom1 is (resno, atomname) and resno is the residue sequence
420 """Reads an ambiguous NOE restraint. contributions is a list of
421 (atom1, atom2) pairs, where atom1 is (resno, atomname). Sets up a
422 lognormal distance restraint using the given sigma and gamma.
423 Returns the restraint.
426 pairs=[(self.
find_atom(i, prot).get_particle(),
427 self.
find_atom(j, prot).get_particle())
for (i,j)
in
435 bounds_sigma=(1.0,0.1,100), bounds_gamma=(1.0,0.1,100),
436 verbose=
True, sequence_match=(1,1)):
437 """read TBL file and store NOE restraints, using one sigma and one gamma
438 for the whole dataset. Creates the necessary uninformative priors.
439 - prot: protein hierarchy
440 - seqfile: a file with 3-letter sequence
441 - tblfile: a TBL file with the restraints
442 - name: an optional name for the restraintset
443 - prior_rs: when not None, add new sigma and gamma to this
444 RestraintSet instance.
445 - bounds_sigma or gamma: tuple of (initial value, lower, upper bound)
446 bounds can be -1 to set to default range [0,+inf]
447 - verbose: be verbose (default True)
448 - sequence_match : (noe_start, sequence_start)
449 Returns: data_rs, prior_rs, sigma, gamma
453 print "Prior for the NOE Scales"
461 first_residue_number=sequence_match[1])
462 tblr = IMP.isd.TBLReader.TBLReader(sequence,
463 sequence_match=sequence_match)
464 restraints = tblr.read_distances(tblfile,
'NOE')[
'NOE']
465 for i,restraint
in enumerate(restraints):
466 if verbose
and i % 100 == 0:
472 if len(restraint[0]) > 1:
474 restraint[1], sigma, gamma)
477 restraint[1], sigma, gamma)
480 print "\r%d NOE restraints read" % i
483 self._m.add_restraint(rs)
484 return rs, prior_rs, sigma, gamma
487 verbose=
True, sequence_match=(1,1)):
488 """read TBL file and store NOE restraints, using the marginal of the
489 lognormal with one sigma and one gamma, for the whole dataset.
490 - prot: protein hierarchy
491 - seqfile: a file with 3-letter sequence
492 - tblfile: a TBL file with the restraints
493 - name: an optional name for the restraintset
494 - verbose: be verbose (default True)
495 - sequence_match : (noe_start, sequence_start)
502 first_residue_number=sequence_match[1])
503 tblr = IMP.isd.TBLReader.TBLReader(sequence,
504 sequence_match=sequence_match)
505 restraints = tblr.read_distances(tblfile,
'NOE')[
'NOE']
507 for i,restraint
in enumerate(restraints):
508 if verbose
and i % 100 == 0:
515 pairs=[(self.
find_atom(i, prot).get_particle(),
516 self.
find_atom(j, prot).get_particle())
for (i,j)
in
519 ln.add_contribution(pairs, restraint[4])
522 print "\r%d NOE contributions added" % (len(restraints))
523 self._m.add_restraint(rs)
528 """read TBL file and store lognormal restraints, using the marginal of the
529 lognormal with one sigma and gamma=1, for the whole dataset.
530 - prot: protein hierarchy
531 - seqfile: a file with 3-letter sequence
532 - tblfile: a TBL file with the restraints
533 - name: an optional name for the restraintset
534 - verbose: be verbose (default True)
541 tblr = IMP.isd.TBLReader.TBLReader(sequence)
542 restraints = tblr.read_distances(tblfile,
'HBond')[
'HBond']
544 for i,restraint
in enumerate(restraints):
545 if verbose
and i % 100 == 0:
552 pairs=[(self.
find_atom(i, prot).get_particle(),
553 self.
find_atom(j, prot).get_particle())
for (i,j)
in
556 ln.add_contribution(pairs, restraint[4])
559 print "\r%d Hbond contributions added" % (len(restraints))
560 self._m.add_restraint(rs)
564 sequence_match=(1,1),name=
'TALOS', prior_rs=
None,
565 bounds_kappa=(1.0, 0.1,10), verbose=
True, prior=
'jeffreys',
567 """read TALOS dihedral angle data, and create restraints for phi/psi
568 torsion angles, along with the prior for kappa, which is a scale for the
569 whole dataset, compare to 1/sigma**2 in the NOE case.
570 - prot: protein hierarchy
571 - seqfile: a file with 3-letter sequence
572 - talos_data: either a file (pred.tab), or a folder (pred/) in which all
573 files in the form res???.tab can be found. If possible,
574 try to provide the folder, as statistics are more
575 accurate in that case.
576 - fulldata : either True or False, whether the data is the full TALOS
577 output (predAll.tab or pred/ folder), or just the averages
579 - sequence_match : (talos_no, sequence_no) to adjust for different
581 - name: an optional name for the restraintset
582 - prior_rs: when not None, add new kappa(s) to this RestraintSet instance.
583 - bounds_kappa: tuple of (initial value, lower, upper bound)
584 bounds can be -1 to set to default range [0,+inf]
585 - verbose: be verbose (default True)
586 - prior: either 'jeffreys' or a tuple (R,c), which signifies to use the
587 conjugate prior of the von Mises restraint, with parameters R
588 and c. Good values are R=0 and c=10. Default: jeffreys prior.
589 - keep_all: in case of a folder for 'talos_data', whether to keep
590 candidates marked as 'outliers' by TALOS, or to include them.
591 Returns: data_rs, prior_rs, kappa
596 print "Prior for von Mises Kappa"
604 first_residue_no=sequence_match[1])
607 sequence_match=sequence_match)
608 if os.path.isdir(talos_data):
610 for i,res
in enumerate(glob(os.path.join(talos_data,
'res???.tab'))):
611 if verbose
and i % 100:
617 talosr.read(talos_data)
621 sequence_match=sequence_match)
622 talosr.read(talos_data)
624 data = talosr.get_data()
626 print "\rread dihedral data for %d residues" % len(data)
627 print "creating restraints"
629 for resno,datum
in data.iteritems():
640 avgR.append(r.get_R0())
644 avgR.append(r.get_R0())
649 avgR.append(r.get_R0())
653 avgR.append(r.get_R0())
655 print "%s Restraints created. Average R0: %f" % \
656 (len(avgR), sum(avgR)/float(len(avgR)))
657 self._m.add_restraint(rs)
658 return rs, prior_rs, kappa
661 ff_type=IMP.saxs.HEAVY_ATOMS):
662 """read experimental SAXS profile and apply restraint the standard
664 Returns: a restraintset and the experimental profile
670 rs.add_restraint(saxs_restraint)
671 self._m.add_restraint(rs)
672 return rs, saxs_profile
674 def _setup_md(self,prot, temperature=300.0, thermostat='berendsen',
675 coupling=500, md_restraints=
None, timestep=1.0, recenter=1000,
677 """setup molecular dynamics
678 - temperature: target temperature
679 - thermostat: one of 'NVE', rescale_velocities',
680 'berendsen', 'langevin'
681 - coupling: coupling constant (tau (fs) for berendsen,
682 gamma (/fs) for langevin)
683 - md_restraints: if not None, specify the terms of the energy to be used
684 during the md steps via a list of restraints.
685 - timestep: in femtoseconds.
686 - recenter: recenter the molecule every so many steps (Langevin only)
687 - momentum: remove angular momentum every so many steps (Berendsen only)
688 Returns: an instance of md and an instance of an OptimizerState (the
689 thermostat), or None if NVE.
693 md.set_model(self._m)
694 md.assign_velocities(temperature)
695 md.set_time_step(timestep)
696 if thermostat ==
'NVE':
698 elif thermostat ==
'rescale_velocities':
701 md.add_optimizer_state(os)
702 elif thermostat ==
'berendsen':
705 md.add_optimizer_state(os)
708 md.add_optimizer_state(mom)
709 elif thermostat ==
'langevin':
712 md.add_optimizer_state(os)
717 raise NotImplementedError, thermostat
720 md.set_restraints(md_restraints)
724 def _setup_normal_mover(self, particle, floatkey, stepsize):
725 """setup NormalMover to move particle's floatkey attribute
726 by a gaussian with standard deviation 'stepsize'
727 Returns: mover instance.
733 def _setup_md_mover(self, md, particles, temperature, n_md_steps=10):
734 """setup MDMover using md and particles.
736 - particles: particles to move, usually the leaves of the protein
738 - n_md_steps: number of md steps to perform on each move
739 Returns: mover instance.
742 cont.add_particles(particles)
743 return IMP.atom.MDMover(cont, md, temperature, n_md_steps)
745 def _setup_mc(self, mover, temperature=300.0, mc_restraints=None):
746 """setup monte carlo using a certain mover.
747 - mover: mover to use, NormalMover or MDMover usually.
748 - temperature: target temperature.
749 - mc_restraints: if not None, list of restraints for the metropolis
751 Returns: mc instance.
757 mc.set_kt(kB*temperature)
759 mc.set_return_best(
False)
762 mc.set_restraints(mc_restraints)
766 gamma=0.01, n_md_steps=10,
767 md_restraints=
None, mc_restraints=
None, timestep=1.0,
768 sd_threshold=0.0, sd_stepsize=0.01, sd_maxsteps=100):
769 """setup hybrid monte-carlo on protein. Uses basin hopping with steepest
770 descent minimization.
771 - prot: protein hierarchy.
772 - temperature: target temperature.
773 - gamma: coupling constant for langevin (/fs)
774 - n_md_steps: number of md steps per mc step
775 - md_restraints: if not None, specify the terms of the energy to be used
777 - mc_restraints: if not None, use these energy terms for the metropolis
779 - timestep: time step for md, in femtoseconds.
780 - sd_threshold: stop steepest descent after energy difference drops
782 - sd_stepsize: stepsize to use for the steepest descent, in angstrom.
783 - sd_maxsteps: maximum number of steps for steepest descent
784 Returns: hmc, mdmover, md and OptimizerState (thermostat)
786 raise NotImplementedError
787 md, os = self._setup_md(prot, temperature=temperature,
788 thermostat=
'langevin', coupling=gamma,
789 md_restraints=md_restraints, timestep=timestep)
791 mdmover = self._setup_md_mover(md, particles, temperature, n_md_steps)
792 hmc = self._setup_mc(mdmover, temperature, mc_restraints)
794 sd.set_threshold(sd_threshold)
795 sd.set_step_size(sd_stepsize)
796 hmc.set_local_optimizer(sd)
797 hmc.set_local_steps(sd_maxsteps)
798 hmc.set_use_basin_hopping(
True)
799 return hmc, mdmover, md, os
802 n_md_steps=100, md_restraints=
None, mc_restraints=
None,
804 """setup hybrid monte-carlo on protein. Uses NVE MD and tries the full
805 - prot: protein hierarchy.
806 - temperature: target temperature.
807 - coupling: coupling constant (tau (fs) for berendsen,
808 gamma (/fs) for langevin)
809 - n_md_steps: number of md steps per mc step
810 - md_restraints: if not None, specify the terms of the energy to be used
812 - mc_restraints: if not None, use these energy terms for the metropolis
814 - timestep: time step for md, in femtoseconds.
815 - sd_threshold: stop steepest descent after energy difference drops
817 - sd_stepsize: stepsize to use for the steepest descent, in angstrom.
818 - sd_maxsteps: maximum number of steps for steepest descent
819 Returns: hmc, mdmover and md
821 prot = self._p[
'prot']
822 md, os = self._setup_md(prot, temperature=temperature,
823 thermostat=
'NVE', coupling=
None, timestep=1.0,
824 md_restraints=md_restraints)
827 cont.add_particles(particles)
828 mdmover = PyMDMover(cont, md, n_md_steps)
834 mc.add_mover(mdmover)
836 mc.set_kt(kB*temperature)
838 mc.set_return_best(
False)
840 mc.set_move_probability(1.0)
841 return mc, mdmover, md
844 mc_restraints=
None, nm_stepsize=0.1):
845 """sets up monte carlo on nuisance, at a certain target temperature,
846 optionnally using a certain set of restraints only.
847 - nuis: nuisance particle
848 - temperature: target temperature
849 - mc_restraints: optional set of restraints from which the energy should
850 be drawn instead of the energy of the complete system.
851 - floatkey: the floatkey to move.
852 - nm_stepsize: the stepsize of the normal mover
853 Returns: mc instance, nm instance.
855 nm = self._setup_normal_mover(nuis, nuis.get_nuisance_key(),
857 mc = self._setup_mc(nm, temperature, mc_restraints)
860 def _mc_and_update_nm(self, nsteps, mc, nm, stats_key,
861 adjust_stepsize=
True):
862 """run mc using a normal mover on a single particle,
863 update stepsize and store nsteps, acceptance and stepsize in the
864 statistics instance self.stat by using the key stats_key.
868 naccept = mc.get_number_of_forward_steps()
870 self.stat.increment_counter(stats_key, nsteps)
872 accept = float(naccept)/nsteps
873 self.stat.update(stats_key,
'acceptance', accept)
874 stepsize = nm.get_sigma()
875 self.stat.update(stats_key,
'stepsize', stepsize)
878 if 0.4 < accept < 0.6:
884 nm.set_sigma(stepsize*2*accept)
886 def _hmc_and_update_md(self, nsteps, hmc, mv, stats_key,
887 adjust_stepsize=
True):
888 """run hmc, update stepsize and print statistics. Updates number of MD
889 steps to reach a target acceptance between 0.4 and 0.6, sends
890 statistics to self.stat. MD steps are always at least 10 and at most 500.
893 naccept = hmc.get_number_of_forward_steps()
894 self.stat.increment_counter(stats_key, nsteps)
895 accept = float(naccept)/nsteps
896 self.stat.update(stats_key,
'acceptance', accept)
897 mdsteps = mv.get_number_of_steps()
898 self.stat.update(stats_key,
'n_md_steps', mdsteps)
900 if 0.4 < accept < 0.6:
902 mdsteps = int(mdsteps *2**(accept-0.5))
907 mv.set_nsteps(mdsteps)
910 """returns a string corresponding to the pdb structure of hierarchy
915 return output.getvalue()
917 def get_netcdf(self, prot):
918 raise NotImplementedError
921 temperature=300.0, prot_coordinates=
None):
922 """updates statistics for md simulation: target temp, kinetic energy,
923 kinetic temperature, writes coordinates and increments counter.
924 - md_key: stats md key
925 - nsteps: number of steps performed.
926 - md_instance: instance of the MolecularDynamics class.
927 - temperature: target temperature
928 - prot_coordinates: protein coordinates to be passed to the stats class,
931 self.stat.update(md_key,
'target_temp', temperature)
932 kinetic = md_instance.get_kinetic_energy()
933 self.stat.update(md_key,
'E_kinetic', kinetic)
934 self.stat.update(md_key,
'instant_temp',
935 md_instance.get_kinetic_temperature(kinetic))
936 self.stat.update_coordinates(md_key,
'protein', prot_coordinates)
937 self.stat.increment_counter(md_key, nsteps)
940 """shortcut for a frequent series of operations on MC simulations'
941 statistics. Creates an entry for acceptance, stepsize and one
942 coordinate set printed in the statistics file.
945 mc_key = stat.add_category(name=name)
947 stat.add_entry(mc_key, entry=Entry(
'temperature',
'%10G',
None))
948 stat.add_entry(mc_key, entry=Entry(
'acceptance',
'%10G',
None))
949 stat.add_entry(mc_key, entry=Entry(
'stepsize',
'%10G',
None))
951 stat.add_entry(mc_key, entry=Entry(coord,
'%10G',
None))
953 stat.add_entry(mc_key, name=
'counter')
957 """shortcut for a frequent series of operations on MD simulations'
958 statistics. Creates an entry for target temp, instantaneous temp,
959 kinetic energy, and one set of coordinates called 'protein' by
963 md_key = stat.add_category(name=name)
965 stat.add_entry(md_key, entry=Entry(
'target_temp',
'%10G',
None))
966 stat.add_entry(md_key, entry=Entry(
'instant_temp',
'%10G',
None))
967 stat.add_entry(md_key, entry=Entry(
'E_kinetic',
'%10G',
None))
969 stat.add_coordinates(md_key, coord)
971 stat.add_entry(md_key, name=
'counter')
975 """shortcut for a frequent series of operations on HMC simulations'
976 statistics. Adds acceptance, number of MD steps and a trajectory for
980 hmc_key = stat.add_category(name=name)
982 stat.add_entry(hmc_key, entry=Entry(
'temperature',
'%10G',
None))
983 stat.add_entry(hmc_key, entry=Entry(
'acceptance',
'%10G',
None))
984 stat.add_entry(hmc_key, entry=Entry(
'n_md_steps',
'%10G',
None))
985 stat.add_entry(hmc_key, entry=Entry(
'E_kinetic',
'%10G',
None))
987 stat.add_coordinates(hmc_key, coord)
989 stat.add_entry(hmc_key, name=
'counter')
993 """rescale the velocities of a bunch of particles having vx vy and vz
999 p.set_value(k, p.get_value(k)*factor)
Applies a SingletonScore to each Singleton in a list.
def rescale_velocities
rescale the velocities of a bunch of particles having vx vy and vz floatkeys
CHARMMParameters * get_heavy_atom_CHARMM_parameters()
def init_model_ambiguous_NOE_restraint
Reads an ambiguous NOE restraint.
Maintains temperature during molecular dynamics.
Enforce CHARMM stereochemistry on the given Hierarchy.
Atoms get_phi_dihedral_atoms(Residue rd)
void write_pdb(const Selection &mhd, base::TextOutput out, unsigned int model=1)
def do_md_protein_statistics
updates statistics for md simulation: target temp, kinetic energy, kinetic temperature, writes coordinates and increments counter.
def init_model_charmm_protein_and_ff
creates a CHARMM protein representation.
def find_atom
scans the prot hierarchy and tries to find atom = (resno, name) assumes that resno follows the same n...
def init_model_NOEs
read TBL file and store NOE restraints, using one sigma and one gamma for the whole dataset...
See IMP.container for more information.
def init_simulation_setup_nuisance_mc
sets up monte carlo on nuisance, at a certain target temperature, optionnally using a certain set of ...
A decorator for a particle which has bonds.
void set_log_level(LogLevel l)
Set the current global log level.
def init_simulation_setup_protein_hmc_nve
setup hybrid monte-carlo on protein.
Calculate score based on fit to SAXS profile.
void set_check_level(CheckLevel tf)
Control runtime checks in the code.
Object used to hold a set of restraints.
A simple steepest descent optimizer.
def init_model_TALOS
read TALOS dihedral angle data, and create restraints for phi/psi torsion angles, along with the prio...
static Scale setup_particle(kernel::Model *m, ParticleIndex pi)
Ambiguous NOE distance restraint between a number of pairs of particles.
def get_pdb
returns a string corresponding to the pdb structure of hierarchy prot.
Hierarchy get_residue(Hierarchy mhd, unsigned int index)
Get the residue with the specified index.
def init_model_base
moves to wd and creates model
def init_model_NOEs_marginal
read TBL file and store NOE restraints, using the marginal of the lognormal with one sigma and one ga...
Return all close unordered pairs of particles taken from the SingletonContainer.
Classes to handle ISD statistics files.
def init_model_NOE_restraint
Sets up a lognormal distance restraint using the given sigma and gamma.
CHARMM force field parameters.
Bond create_custom_bond(Bonded a, Bonded b, Float length, Float stiffness=-1)
Connect the two wrapped particles by a custom bond.
Removes rigid translation and rotation from the particles.
def init_model_vonMises_restraint_full
Sets up a vonMises torsion angle restraint using the given kappa particle as concentration parameter...
Store a ParticleIndexPairs.
Conjugate prior for the concentration parameter of a von Mises distribution.
Maintains temperature during molecular dynamics by velocity scaling.
static Bonded setup_particle(kernel::Model *m, ParticleIndex pi)
def init_model_jeffreys_kappa
given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of vonMi...
Simple molecular dynamics optimizer.
Atoms get_psi_dihedral_atoms(Residue rd)
def init_stats_add_md_category
shortcut for a frequent series of operations on MD simulations' statistics.
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
def init_model_HBonds_marginal
read TBL file and store lognormal restraints, using the marginal of the lognormal with one sigma and ...
Apply an NOE distance restraint between two particles.
def init_stats_add_mc_category
shortcut for a frequent series of operations on MC simulations' statistics.
def init_simulation_setup_protein_hmc_hopper
setup hybrid monte-carlo on protein.
A decorator for a particle with x,y,z coordinates.
Class to handle individual model particles.
phi/psi dihedral restraint between four particles, using data from TALOS.
Score the bond based on a UnaryFunction,.
def read_sequence_file
read sequence of ONE chain, 1-letter or 3-letter, returns dict of no:3-letter code.
Base class for all optimizers.
reads a TALOS file, or a TALOS folder, and stores the data
Modify a set of continuous variables using a normal distribution.
nonspecific methods used across all shared function objects.
A decorator for a residue.
Apply a lognormal distance restraint between two particles.
See IMP.core for more information.
def init_model_standard_SAXS_restraint
read experimental SAXS profile and apply restraint the standard way (like foxs) Returns: a restraints...
def init_model_setup_scale
sets up a Scale particle to the initial default value.
def init_model_jeffreys
given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of Jeffr...
A filter that excludes bonds, angles and dihedrals.
def init_model_vonMises_restraint_mean
Sets up a vonMises torsion angle restraint using the given kappa particle as concentration parameter...
def init_stats_add_hmc_category
shortcut for a frequent series of operations on HMC simulations' statistics.
def m
wrapper to call methods of m
Apply an NOE distance restraint between two particles.
static bool particle_is_instance(::IMP::kernel::Particle *p)
See IMP.atom for more information.
void read_pdb(base::TextInput input, int model, Hierarchy h)
CHARMMParameters * get_all_atom_CHARMM_parameters()
Hierarchies get_leaves(const Selection &h)
Classes to handle TALOS files or folders.
Applies a PairScore to each Pair in a list.
See IMP.saxs for more information.
def init_model_conjugate_kappa
given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of vonMi...
Class for storing model, its restraints, constraints, and particles.
See IMP.isd for more information.
Classes to handle TBL files.
Harmonic function (symmetric about the mean)
Maintains temperature during molecular dynamics.
A decorator for a particle with x,y,z coordinates and a radius.