17 from math
import sqrt, exp
18 from StringIO
import StringIO
20 from random
import random
22 kB = (1.381 * 6.02214) / 4184.0
27 def __init__(self, cont, md, n_md_steps):
30 self.n_md_steps = n_md_steps
37 for i
in xrange(self.cont.get_number_of_particles()):
38 p = self.cont.get_particle(i)
41 self.oldcoords.append(d.get_coordinates())
43 def propose_move(self, prob):
44 self.md.optimize(self.n_md_steps)
47 for i
in xrange(self.cont.get_number_of_particles()):
48 p = self.cont.get_particle(i)
52 d.set_coordinates(self.oldcoords[i])
54 def get_number_of_steps(self):
55 return self.n_md_steps
57 def set_number_of_steps(self, nsteps):
58 self.n_md_steps = nsteps
64 def __init__(self, model):
67 def add_mover(self, mv):
73 def set_return_best(self, thing):
76 def set_move_probability(self, thing):
80 pot = self.m.evaluate(
False)
82 kin = self.mv.md.get_kinetic_energy()
85 def metropolis(self, old, new):
88 print ": old %f new %f deltaE %f new_epot: %f" % (old, new, deltaE,
95 return exp(-deltaE / kT) > random()
97 def optimize(self, nsteps):
99 print "=== new MC call"
102 for i
in xrange(nsteps):
103 print "MC step %d " % i,
105 self.mv.md.assign_velocities(self.kT / kB)
107 old = self.get_energy()
109 self.mv.propose_move(1)
111 new = self.get_energy()
112 if self.metropolis(old, new):
122 def get_number_of_forward_steps(self):
128 """nonspecific methods used across all shared function objects.
130 - Their name starts with the name of the parent function (e.g.
132 - they don't store anything in the class, but instead
133 return all created objects.
134 Exceptions: the model, which is self._m
135 the statistics class, which is self.stat
136 - they store what they have to store in the model (e.g. restraints)
137 - they don't print out anything except for long routines (e.g. NOE
139 - the prior RestraintSet is added to the model when it is created, so
140 that when it is passed to another function, it is not added twice.
146 def set_checklevel(self, value):
149 def set_loglevel(self, value):
152 def m(self, name, *args, **kw):
153 "wrapper to call methods of m"
154 func = getattr(self._m, name)
155 return func(*args, **kw)
158 "moves to wd and creates model"
164 self, initpdb, top, par, selector, pairscore,
165 ff_temp=300.0, disulfides=
None, representation=
'custom'):
166 """creates a CHARMM protein representation.
167 creates the charmm force field, bonded and nonbonded.
168 - initpdb: initial structure in pdb format
169 - top is a CHARMM top.lib, read if representation=='custom' (default)
170 - par is a CHARMM par.lib
171 - selector is an instance of
172 one of the selectors of IMP.atom, for example
173 IMP.atom.NonWaterNonHydrogenPDBSelector().
174 - pairscore is an instance of a Pair Score to score the interaction
175 between two atoms. usually, it's either
176 LennardJonesDistancePairScore(0,1) or
177 RepulsiveDistancePairScore(0,1)
178 - ff_temp is the temperature at which the force field should be
180 - disulfides: if not None, a list of tuples corresponding to residue
181 numbers that should be cross-linked. Residues should be
182 cysteines, and residue numbering should start at 0.
183 - representation: 'full' : all-atom CHARMM force field
184 'heavy': heavy atom CHARMM forcefield with polar H
185 'calpha': only C alphas, ball and stick model with
186 bondlength 3.78 angstrom, beads at VdW
187 contact, and harmonic restraint between
189 'custom' (default) : read given CHARMM top and par
191 Returns: prot, ff, rsb, rs
193 - ff: the force field
194 - rsb: the RestraintSet on bonded interactions
195 - rs: the RestraintSet on nonbonded interactions. Both are weighted
200 if not prot.get_is_valid(
True):
201 raise ValueError(
"invalid hierarchy!")
202 if representation ==
'custom':
205 elif representation ==
'heavy':
207 elif representation ==
'full':
209 elif representation ==
'calpha':
212 raise NotImplementedError(representation)
213 if representation ==
'calpha':
214 print "setting up simplified C alpha force field"
221 for chain
in prot.get_children():
222 residues = [(chain.get_child(i), chain.get_child(i + 1))
223 for i
in xrange(chain.get_number_of_children() - 1)]
224 residues = [(i.get_child(0).get_particle(),
225 j.get_child(0).get_particle())
226 for (i, j)
in residues]
227 pairs.extend(residues)
246 rsb.add_restraint(br)
247 rsb.set_weight(1.0 / (kB * ff_temp))
250 nonbonded_pair_filter.set_bonds(bonds)
253 print "setting up CHARMM forcefield"
257 topology = ff.create_topology(prot)
261 topology.apply_default_patches()
264 s = topology.get_segment(0)
265 dis = ff.get_patch(
'DISU')
266 for (i, j)
in disulfides:
269 r0 = s.get_residue(i)
270 r1 = s.get_residue(j)
272 r0.set_patched(
False)
274 r1.set_patched(
False)
276 print "added disulfide bridge between cysteines %d and %d" % (i, j)
282 topology.setup_hierarchy(prot)
295 ff.add_well_depths(prot)
296 nonbonded_pair_filter = r.get_pair_filter()
308 nbl.add_pair_filter(nonbonded_pair_filter)
314 return prot, ff, rsb, rs
317 """sets up a Scale particle to the initial default value. It can
318 optionnally be constrained between two positive bounds, or else its
319 range is 0 to infinity.
324 scale.set_lower(lower)
326 scale.set_upper(upper)
330 """given a list of scales, returns a RestraintSet('prior') with weight
331 1.0 that contains a list of vonMisesKappaJeffreysRestraint on each scale.
332 If argument prior_rs is used, add them to that RestraintSet instead.
336 self._m.add_restraint(prior_rs)
337 prior_rs.set_weight(1.0)
343 """given a list of scales, returns a RestraintSet('prior') with weight
344 1.0 that contains a list of JeffreysRestraint on each scale.
345 If argument prior_rs is used, add them to that RestraintSet instead.
349 self._m.add_restraint(prior_rs)
352 prior_rs.add_restraint(jr)
356 """given a list of scales, returns a RestraintSet('prior') with weight
357 1.0 that contains a list of vonMisesKappaConjugateRestraint on each
358 scale. If argument prior_rs is used, add them to that RestraintSet
361 if not (0 <= R <= c):
362 raise ValueError(
"parameters R and c should satisfy 0 <= R <= c")
365 self._m.add_restraint(prior_rs)
367 prior_rs.add_restraint(
372 """scans the prot hierarchy and tries to find atom = (resno, name)
373 assumes that resno follows the same numbering as the sequence.
374 Stores already found atoms for increased speed.
376 if not hasattr(self,
'__memoized'):
377 self.__memoized = {prot: {}}
379 return self.__memoized[prot][atom]
384 residue_index=atom[0],
386 ).get_selected_particles()
388 print "found multiple atoms for atom %d %s!" % atom
392 print "atom %d %s not found" % atom
394 self.__memoized[prot][atom] = p0
399 Sets up a vonMises torsion angle restraint using the given kappa
400 particle as concentration parameter. Returns the restraint.
401 data is a list of observations.
407 Sets up a vonMises torsion angle restraint using the given kappa
408 particle as concentration parameter. Returns the restraint.
409 data is (mean, standard deviation).
411 raise NotImplementedError
415 Sets up a lognormal distance restraint using the given sigma and gamma.
416 Returns the restraint.
417 assumes atoms = (atom1, atom2)
418 where atom1 is (resno, atomname) and resno is the residue sequence
436 """Reads an ambiguous NOE restraint. contributions is a list of
437 (atom1, atom2) pairs, where atom1 is (resno, atomname). Sets up a
438 lognormal distance restraint using the given sigma and gamma.
439 Returns the restraint.
442 pairs = [(self.
find_atom(i, prot).get_particle(),
443 self.
find_atom(j, prot).get_particle())
for (i, j)
in
448 pairs, sigma, gamma, distance ** (-6))
452 self, prot, seqfile, tblfile, name=
'NOE', prior_rs=
None,
453 bounds_sigma=(1.0, 0.1, 100), bounds_gamma=(1.0, 0.1, 100),
454 verbose=
True, sequence_match=(1, 1)):
455 """read TBL file and store NOE restraints, using one sigma and one gamma
456 for the whole dataset. Creates the necessary uninformative priors.
457 - prot: protein hierarchy
458 - seqfile: a file with 3-letter sequence
459 - tblfile: a TBL file with the restraints
460 - name: an optional name for the restraintset
461 - prior_rs: when not None, add new sigma and gamma to this
462 RestraintSet instance.
463 - bounds_sigma or gamma: tuple of (initial value, lower, upper bound)
464 bounds can be -1 to set to default range [0,+inf]
465 - verbose: be verbose (default True)
466 - sequence_match : (noe_start, sequence_start)
467 Returns: data_rs, prior_rs, sigma, gamma
471 print "Prior for the NOE Scales"
479 first_residue_number=sequence_match[1])
480 tblr = IMP.isd.TBLReader.TBLReader(sequence,
481 sequence_match=sequence_match)
482 restraints = tblr.read_distances(tblfile,
'NOE')[
'NOE']
483 for i, restraint
in enumerate(restraints):
484 if verbose
and i % 100 == 0:
490 if len(restraint[0]) > 1:
493 restraint[1], sigma, gamma)
496 restraint[1], sigma, gamma)
499 print "\r%d NOE restraints read" % i
502 self._m.add_restraint(rs)
503 return rs, prior_rs, sigma, gamma
506 verbose=
True, sequence_match=(1, 1)):
507 """read TBL file and store NOE restraints, using the marginal of the
508 lognormal with one sigma and one gamma, for the whole dataset.
509 - prot: protein hierarchy
510 - seqfile: a file with 3-letter sequence
511 - tblfile: a TBL file with the restraints
512 - name: an optional name for the restraintset
513 - verbose: be verbose (default True)
514 - sequence_match : (noe_start, sequence_start)
521 first_residue_number=sequence_match[1])
522 tblr = IMP.isd.TBLReader.TBLReader(sequence,
523 sequence_match=sequence_match)
524 restraints = tblr.read_distances(tblfile,
'NOE')[
'NOE']
526 for i, restraint
in enumerate(restraints):
527 if verbose
and i % 100 == 0:
534 pairs = [(self.
find_atom(i, prot).get_particle(),
535 self.
find_atom(j, prot).get_particle())
for (i, j)
in
538 ln.add_contribution(pairs, restraint[4])
541 print "\r%d NOE contributions added" % (len(restraints))
542 self._m.add_restraint(rs)
547 """read TBL file and store lognormal restraints, using the marginal of the
548 lognormal with one sigma and gamma=1, for the whole dataset.
549 - prot: protein hierarchy
550 - seqfile: a file with 3-letter sequence
551 - tblfile: a TBL file with the restraints
552 - name: an optional name for the restraintset
553 - verbose: be verbose (default True)
560 tblr = IMP.isd.TBLReader.TBLReader(sequence)
561 restraints = tblr.read_distances(tblfile,
'HBond')[
'HBond']
563 for i, restraint
in enumerate(restraints):
564 if verbose
and i % 100 == 0:
571 pairs = [(self.
find_atom(i, prot).get_particle(),
572 self.
find_atom(j, prot).get_particle())
for (i, j)
in
575 ln.add_contribution(pairs, restraint[4])
578 print "\r%d Hbond contributions added" % (len(restraints))
579 self._m.add_restraint(rs)
583 sequence_match=(1, 1), name=
'TALOS', prior_rs=
None,
584 bounds_kappa=(1.0, 0.1, 10), verbose=
True, prior=
'jeffreys',
586 """read TALOS dihedral angle data, and create restraints for phi/psi
587 torsion angles, along with the prior for kappa, which is a scale for the
588 whole dataset, compare to 1/sigma**2 in the NOE case.
589 - prot: protein hierarchy
590 - seqfile: a file with 3-letter sequence
591 - talos_data: either a file (pred.tab), or a folder (pred/) in which all
592 files in the form res???.tab can be found. If possible,
593 try to provide the folder, as statistics are more
594 accurate in that case.
595 - fulldata : either True or False, whether the data is the full TALOS
596 output (predAll.tab or pred/ folder), or just the averages
598 - sequence_match : (talos_no, sequence_no) to adjust for different
600 - name: an optional name for the restraintset
601 - prior_rs: when not None, add new kappa(s) to this RestraintSet instance.
602 - bounds_kappa: tuple of (initial value, lower, upper bound)
603 bounds can be -1 to set to default range [0,+inf]
604 - verbose: be verbose (default True)
605 - prior: either 'jeffreys' or a tuple (R,c), which signifies to use the
606 conjugate prior of the von Mises restraint, with parameters R
607 and c. Good values are R=0 and c=10. Default: jeffreys prior.
608 - keep_all: in case of a folder for 'talos_data', whether to keep
609 candidates marked as 'outliers' by TALOS, or to include them.
610 Returns: data_rs, prior_rs, kappa
615 print "Prior for von Mises Kappa"
623 first_residue_no=sequence_match[1])
626 sequence_match=sequence_match)
627 if os.path.isdir(talos_data):
629 for i, res
in enumerate(glob(os.path.join(talos_data,
'res???.tab'))):
630 if verbose
and i % 100:
636 talosr.read(talos_data)
640 sequence_match=sequence_match)
641 talosr.read(talos_data)
643 data = talosr.get_data()
645 print "\rread dihedral data for %d residues" % len(data)
646 print "creating restraints"
648 for resno, datum
in data.iteritems():
649 phidata = datum[
'phi']
650 psidata = datum[
'psi']
660 avgR.append(r.get_R0())
665 avgR.append(r.get_R0())
671 avgR.append(r.get_R0())
676 avgR.append(r.get_R0())
678 print "%s Restraints created. Average R0: %f" % \
679 (len(avgR), sum(avgR) / float(len(avgR)))
680 self._m.add_restraint(rs)
681 return rs, prior_rs, kappa
684 self, prot, profilefile, name=
'SAXS',
685 ff_type=IMP.saxs.HEAVY_ATOMS):
686 """read experimental SAXS profile and apply restraint the standard
688 Returns: a restraintset and the experimental profile
694 rs.add_restraint(saxs_restraint)
695 self._m.add_restraint(rs)
696 return rs, saxs_profile
698 def _setup_md(self, prot, temperature=300.0, thermostat='berendsen',
699 coupling=500, md_restraints=
None, timestep=1.0, recenter=1000,
701 """setup molecular dynamics
702 - temperature: target temperature
703 - thermostat: one of 'NVE', rescale_velocities',
704 'berendsen', 'langevin'
705 - coupling: coupling constant (tau (fs) for berendsen,
706 gamma (/fs) for langevin)
707 - md_restraints: if not None, specify the terms of the energy to be used
708 during the md steps via a list of restraints.
709 - timestep: in femtoseconds.
710 - recenter: recenter the molecule every so many steps (Langevin only)
711 - momentum: remove angular momentum every so many steps (Berendsen only)
712 Returns: an instance of md and an instance of an OptimizerState (the
713 thermostat), or None if NVE.
717 md.assign_velocities(temperature)
718 md.set_time_step(timestep)
719 if thermostat ==
'NVE':
721 elif thermostat ==
'rescale_velocities':
724 md.add_optimizer_state(os)
725 elif thermostat ==
'berendsen':
728 md.add_optimizer_state(os)
731 md.add_optimizer_state(mom)
732 elif thermostat ==
'langevin':
735 md.add_optimizer_state(os)
740 raise NotImplementedError(thermostat)
743 md.set_restraints(md_restraints)
747 def _setup_normal_mover(self, particle, floatkey, stepsize):
748 """setup NormalMover to move particle's floatkey attribute
749 by a gaussian with standard deviation 'stepsize'
750 Returns: mover instance.
756 def _setup_md_mover(self, md, particles, temperature, n_md_steps=10):
757 """setup MDMover using md and particles.
759 - particles: particles to move, usually the leaves of the protein
761 - n_md_steps: number of md steps to perform on each move
762 Returns: mover instance.
765 cont.add_particles(particles)
766 return IMP.atom.MDMover(cont, md, temperature, n_md_steps)
768 def _setup_mc(self, mover, temperature=300.0, mc_restraints=None):
769 """setup monte carlo using a certain mover.
770 - mover: mover to use, NormalMover or MDMover usually.
771 - temperature: target temperature.
772 - mc_restraints: if not None, list of restraints for the metropolis
774 Returns: mc instance.
780 mc.set_kt(kB * temperature)
782 mc.set_return_best(
False)
785 mc.set_restraints(mc_restraints)
789 gamma=0.01, n_md_steps=10,
790 md_restraints=
None, mc_restraints=
None, timestep=1.0,
791 sd_threshold=0.0, sd_stepsize=0.01, sd_maxsteps=100):
792 """setup hybrid monte-carlo on protein. Uses basin hopping with steepest
793 descent minimization.
794 - prot: protein hierarchy.
795 - temperature: target temperature.
796 - gamma: coupling constant for langevin (/fs)
797 - n_md_steps: number of md steps per mc step
798 - md_restraints: if not None, specify the terms of the energy to be used
800 - mc_restraints: if not None, use these energy terms for the metropolis
802 - timestep: time step for md, in femtoseconds.
803 - sd_threshold: stop steepest descent after energy difference drops
805 - sd_stepsize: stepsize to use for the steepest descent, in angstrom.
806 - sd_maxsteps: maximum number of steps for steepest descent
807 Returns: hmc, mdmover, md and OptimizerState (thermostat)
809 raise NotImplementedError
810 md, os = self._setup_md(prot, temperature=temperature,
811 thermostat=
'langevin', coupling=gamma,
812 md_restraints=md_restraints, timestep=timestep)
814 mdmover = self._setup_md_mover(md, particles, temperature, n_md_steps)
815 hmc = self._setup_mc(mdmover, temperature, mc_restraints)
817 sd.set_threshold(sd_threshold)
818 sd.set_step_size(sd_stepsize)
819 hmc.set_local_optimizer(sd)
820 hmc.set_local_steps(sd_maxsteps)
821 hmc.set_use_basin_hopping(
True)
822 return hmc, mdmover, md, os
825 n_md_steps=100, md_restraints=
None, mc_restraints=
None,
827 """setup hybrid monte-carlo on protein. Uses NVE MD and tries the full
828 - prot: protein hierarchy.
829 - temperature: target temperature.
830 - coupling: coupling constant (tau (fs) for berendsen,
831 gamma (/fs) for langevin)
832 - n_md_steps: number of md steps per mc step
833 - md_restraints: if not None, specify the terms of the energy to be used
835 - mc_restraints: if not None, use these energy terms for the metropolis
837 - timestep: time step for md, in femtoseconds.
838 - sd_threshold: stop steepest descent after energy difference drops
840 - sd_stepsize: stepsize to use for the steepest descent, in angstrom.
841 - sd_maxsteps: maximum number of steps for steepest descent
842 Returns: hmc, mdmover and md
844 prot = self._p[
'prot']
845 md, os = self._setup_md(prot, temperature=temperature,
846 thermostat=
'NVE', coupling=
None, timestep=1.0,
847 md_restraints=md_restraints)
850 cont.add_particles(particles)
851 mdmover = PyMDMover(cont, md, n_md_steps)
857 mc.add_mover(mdmover)
859 mc.set_kt(kB * temperature)
861 mc.set_return_best(
False)
863 mc.set_move_probability(1.0)
864 return mc, mdmover, md
867 mc_restraints=
None, nm_stepsize=0.1):
868 """sets up monte carlo on nuisance, at a certain target temperature,
869 optionnally using a certain set of restraints only.
870 - nuis: nuisance particle
871 - temperature: target temperature
872 - mc_restraints: optional set of restraints from which the energy should
873 be drawn instead of the energy of the complete system.
874 - floatkey: the floatkey to move.
875 - nm_stepsize: the stepsize of the normal mover
876 Returns: mc instance, nm instance.
878 nm = self._setup_normal_mover(nuis, nuis.get_nuisance_key(),
880 mc = self._setup_mc(nm, temperature, mc_restraints)
883 def _mc_and_update_nm(self, nsteps, mc, nm, stats_key,
884 adjust_stepsize=
True):
885 """run mc using a normal mover on a single particle,
886 update stepsize and store nsteps, acceptance and stepsize in the
887 statistics instance self.stat by using the key stats_key.
891 naccept = mc.get_number_of_forward_steps()
893 self.stat.increment_counter(stats_key, nsteps)
895 accept = float(naccept) / nsteps
896 self.stat.update(stats_key,
'acceptance', accept)
897 stepsize = nm.get_sigma()
898 self.stat.update(stats_key,
'stepsize', stepsize)
901 if 0.4 < accept < 0.6:
907 nm.set_sigma(stepsize * 2 * accept)
909 def _hmc_and_update_md(self, nsteps, hmc, mv, stats_key,
910 adjust_stepsize=
True):
911 """run hmc, update stepsize and print statistics. Updates number of MD
912 steps to reach a target acceptance between 0.4 and 0.6, sends
913 statistics to self.stat. MD steps are always at least 10 and at most 500.
916 naccept = hmc.get_number_of_forward_steps()
917 self.stat.increment_counter(stats_key, nsteps)
918 accept = float(naccept) / nsteps
919 self.stat.update(stats_key,
'acceptance', accept)
920 mdsteps = mv.get_number_of_steps()
921 self.stat.update(stats_key,
'n_md_steps', mdsteps)
923 if 0.4 < accept < 0.6:
925 mdsteps = int(mdsteps * 2 ** (accept - 0.5))
930 mv.set_nsteps(mdsteps)
933 """returns a string corresponding to the pdb structure of hierarchy
938 return output.getvalue()
940 def get_netcdf(self, prot):
941 raise NotImplementedError
944 temperature=300.0, prot_coordinates=
None):
945 """updates statistics for md simulation: target temp, kinetic energy,
946 kinetic temperature, writes coordinates and increments counter.
947 - md_key: stats md key
948 - nsteps: number of steps performed.
949 - md_instance: instance of the MolecularDynamics class.
950 - temperature: target temperature
951 - prot_coordinates: protein coordinates to be passed to the stats class,
954 self.stat.update(md_key,
'target_temp', temperature)
955 kinetic = md_instance.get_kinetic_energy()
956 self.stat.update(md_key,
'E_kinetic', kinetic)
957 self.stat.update(md_key,
'instant_temp',
958 md_instance.get_kinetic_temperature(kinetic))
959 self.stat.update_coordinates(md_key,
'protein', prot_coordinates)
960 self.stat.increment_counter(md_key, nsteps)
963 """shortcut for a frequent series of operations on MC simulations'
964 statistics. Creates an entry for acceptance, stepsize and one
965 coordinate set printed in the statistics file.
968 mc_key = stat.add_category(name=name)
970 stat.add_entry(mc_key, entry=Entry(
'temperature',
'%10G',
None))
971 stat.add_entry(mc_key, entry=Entry(
'acceptance',
'%10G',
None))
972 stat.add_entry(mc_key, entry=Entry(
'stepsize',
'%10G',
None))
974 stat.add_entry(mc_key, entry=Entry(coord,
'%10G',
None))
976 stat.add_entry(mc_key, name=
'counter')
980 """shortcut for a frequent series of operations on MD simulations'
981 statistics. Creates an entry for target temp, instantaneous temp,
982 kinetic energy, and one set of coordinates called 'protein' by
986 md_key = stat.add_category(name=name)
988 stat.add_entry(md_key, entry=Entry(
'target_temp',
'%10G',
None))
989 stat.add_entry(md_key, entry=Entry(
'instant_temp',
'%10G',
None))
990 stat.add_entry(md_key, entry=Entry(
'E_kinetic',
'%10G',
None))
992 stat.add_coordinates(md_key, coord)
994 stat.add_entry(md_key, name=
'counter')
998 """shortcut for a frequent series of operations on HMC simulations'
999 statistics. Adds acceptance, number of MD steps and a trajectory for
1003 hmc_key = stat.add_category(name=name)
1005 stat.add_entry(hmc_key, entry=Entry(
'temperature',
'%10G',
None))
1006 stat.add_entry(hmc_key, entry=Entry(
'acceptance',
'%10G',
None))
1007 stat.add_entry(hmc_key, entry=Entry(
'n_md_steps',
'%10G',
None))
1008 stat.add_entry(hmc_key, entry=Entry(
'E_kinetic',
'%10G',
None))
1010 stat.add_coordinates(hmc_key, coord)
1012 stat.add_entry(hmc_key, name=
'counter')
1016 """rescale the velocities of a bunch of particles having vx vy and vz
1022 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)
Return the atoms comprising the phi dihedral.
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...
Various classes to hold sets of particles.
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.
static bool get_is_setup(const IMP::kernel::ParticleAdaptor &p)
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 kernel::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.
Store a kernel::ParticleIndexes.
Atoms get_psi_dihedral_atoms(Residue rd)
Return the atoms comprising the psi dihedral.
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.
Basic functionality that is expected to be used by a wide variety of IMP users.
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.
Functionality for loading, creating, manipulating and scoring atomic structures.
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.
Select hierarchy particles identified by the biological name.
Applies a PairScore to each Pair in a list.
Support for small angle X-ray scattering (SAXS) data.
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.
Inferential scoring building on methods developed as part of the Inferential Structure Determination ...
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.