IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP.isd.shared_functions.sfo_common Class Reference

nonspecific methods used across all shared function objects. More...

Detailed Description

nonspecific methods used across all shared function objects.

Rules:

  • Their name starts with the name of the parent function (e.g. init_model_* )
  • they don't store anything in the class, but instead return all created objects. Exceptions: the model, which is self._m the statistics class, which is self.stat
  • they store what they have to store in the model (e.g. restraints)
  • they don't print out anything except for long routines (e.g. NOE parsing)
  • the prior RestraintSet is added to the model when it is created, so that when it is passed to another function, it is not added twice.
Note
This class is only available in Python.

Definition at line 124 of file shared_functions.py.

Public Member Functions

 do_md_protein_statistics (self, md_key, nsteps, md_instance, temperature=300.0, prot_coordinates=None)
 updates statistics for md simulation: target temp, kinetic energy, kinetic temperature, writes coordinates and increments counter.
 find_atom (self, atom, prot)
 scans the prot hierarchy and tries to find atom = (resno, name) assumes that resno follows the same numbering as the sequence.
 get_pdb (self, prot)
 returns a string corresponding to the pdb structure of hierarchy prot.
 init_model_ambiguous_NOE_restraint (self, prot, contributions, distance, sigma, gamma)
 Reads an ambiguous NOE restraint.
 init_model_base (self, wd)
 moves to wd and creates model
 init_model_charmm_protein_and_ff (self, initpdb, top, par, selector, pairscore, ff_temp=300.0, disulfides=None, representation='custom')
 creates a CHARMM protein representation.
 init_model_conjugate_kappa (self, scales, c, R, prior_rs=None)
 given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of vonMisesKappaConjugateRestraint on each scale.
 init_model_HBonds_marginal (self, prot, seqfile, tblfile, name='NOE', verbose=True)
 read TBL file and store lognormal restraints, using the marginal of the lognormal with one sigma and gamma=1, for the whole dataset.
 init_model_jeffreys (self, scales, prior_rs=None)
 given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of JeffreysRestraint on each scale.
 init_model_jeffreys_kappa (self, scales, prior_rs=None)
 given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of vonMisesKappaJeffreysRestraint on each scale.
 init_model_NOE_restraint (self, prot, atoms, distance, sigma, gamma)
 Sets up a lognormal distance restraint using the given sigma and gamma.
 init_model_NOEs (self, prot, seqfile, tblfile, name='NOE', prior_rs=None, bounds_sigma=(1.0, 0.1, 100), bounds_gamma=(1.0, 0.1, 100), verbose=True, sequence_match=(1, 1))
 read TBL file and store NOE restraints, using one sigma and one gamma for the whole dataset.
 init_model_NOEs_marginal (self, prot, seqfile, tblfile, name='NOE', verbose=True, sequence_match=(1, 1))
 read TBL file and store NOE restraints, using the marginal of the lognormal with one sigma and one gamma, for the whole dataset.
 init_model_setup_scale (self, default, lower=None, upper=None)
 sets up a Scale particle to the initial default value.
 init_model_standard_SAXS_restraint (self, prot, profilefile, name='SAXS', ff_type=IMP.saxs.HEAVY_ATOMS)
 read experimental SAXS profile and apply restraint the standard way (like foxs) Returns: a restraintset and the experimental profile
 init_model_TALOS (self, prot, seqfile, talos_data, fulldata=True, sequence_match=(1, 1), name='TALOS', prior_rs=None, bounds_kappa=(1.0, 0.1, 10), verbose=True, prior='jeffreys', keep_all=False)
 read TALOS dihedral angle data, and create restraints for phi/psi torsion angles, along with the prior for kappa, which is a scale for the whole dataset, compare to 1/sigma**2 in the NOE case.
 init_model_vonMises_restraint_full (self, atoms, data, kappa)
 Sets up a vonMises torsion angle restraint using the given kappa particle as concentration parameter.
 init_model_vonMises_restraint_mean (self, prot, atoms, data, kappa)
 Sets up a vonMises torsion angle restraint using the given kappa particle as concentration parameter.
 init_simulation_setup_nuisance_mc (self, nuis, temperature=300.0, mc_restraints=None, nm_stepsize=0.1)
 sets up monte carlo on nuisance, at a certain target temperature, optionally using a certain set of restraints only.
 init_simulation_setup_protein_hmc_hopper (self, prot, temperature=300.0, gamma=0.01, n_md_steps=10, md_restraints=None, mc_restraints=None, timestep=1.0, sd_threshold=0.0, sd_stepsize=0.01, sd_maxsteps=100)
 setup hybrid monte-carlo on protein.
 init_simulation_setup_protein_hmc_nve (self, prot, temperature=300.0, n_md_steps=100, md_restraints=None, mc_restraints=None, timestep=1.0)
 setup hybrid monte-carlo on protein.
 init_stats_add_hmc_category (self, stat, name='hmc', coord='protein')
 shortcut for a frequent series of operations on HMC simulations' statistics.
 init_stats_add_mc_category (self, stat, name='mc', coord='particle')
 shortcut for a frequent series of operations on MC simulations' statistics.
 init_stats_add_md_category (self, stat, name='md', coord='protein')
 shortcut for a frequent series of operations on MD simulations' statistics.
 m (self, name, *args, **kw)
 wrapper to call methods of m
 rescale_velocities (self, particles, factor)
 rescale the velocities of a bunch of particles having vx vy and vz floatkeys

Member Function Documentation

◆ do_md_protein_statistics()

IMP.isd.shared_functions.sfo_common.do_md_protein_statistics ( self,
md_key,
nsteps,
md_instance,
temperature = 300.0,
prot_coordinates = None )

updates statistics for md simulation: target temp, kinetic energy, kinetic temperature, writes coordinates and increments counter.

  • md_key: stats md key
  • nsteps: number of steps performed.
  • md_instance: instance of the MolecularDynamics class.
  • temperature: target temperature
  • prot_coordinates: protein coordinates to be passed to the stats class, (should be a string)

Definition at line 941 of file shared_functions.py.

◆ find_atom()

IMP.isd.shared_functions.sfo_common.find_atom ( self,
atom,
prot )

scans the prot hierarchy and tries to find atom = (resno, name) assumes that resno follows the same numbering as the sequence.

Stores already found atoms for increased speed.

Definition at line 370 of file shared_functions.py.

◆ get_pdb()

IMP.isd.shared_functions.sfo_common.get_pdb ( self,
prot )

returns a string corresponding to the pdb structure of hierarchy prot.

Definition at line 930 of file shared_functions.py.

◆ init_model_ambiguous_NOE_restraint()

IMP.isd.shared_functions.sfo_common.init_model_ambiguous_NOE_restraint ( self,
prot,
contributions,
distance,
sigma,
gamma )

Reads an ambiguous NOE restraint.

contributions is a list of (atom1, atom2) pairs, where atom1 is (resno, atomname). Sets up a lognormal distance restraint using the given sigma and gamma. Returns the restraint.

Definition at line 433 of file shared_functions.py.

◆ init_model_base()

IMP.isd.shared_functions.sfo_common.init_model_base ( self,
wd )

moves to wd and creates model

Definition at line 155 of file shared_functions.py.

◆ init_model_charmm_protein_and_ff()

IMP.isd.shared_functions.sfo_common.init_model_charmm_protein_and_ff ( self,
initpdb,
top,
par,
selector,
pairscore,
ff_temp = 300.0,
disulfides = None,
representation = 'custom' )

creates a CHARMM protein representation.

creates the charmm force field, bonded and nonbonded.

  • initpdb: initial structure in pdb format
  • top is a CHARMM top.lib, read if representation=='custom' (default)
  • par is a CHARMM par.lib
  • selector is an instance of one of the selectors of IMP.atom, for example IMP.atom.NonWaterNonHydrogenPDBSelector().
  • pairscore is an instance of a Pair Score to score the interaction between two atoms. usually, it's either LennardJonesDistancePairScore(0,1) or RepulsiveDistancePairScore(0,1)
  • ff_temp is the temperature at which the force field should be simulated.
  • disulfides: if not None, a list of tuples corresponding to residue numbers that should be cross-linked. Residues should be cysteines, and residue numbering should start at 0.
  • representation: 'full' : all-atom CHARMM force field 'heavy': heavy atom CHARMM forcefield with polar H 'calpha': only C alphas, ball and stick model with bondlength 3.78 angstrom, beads at VdW contact, and harmonic restraint between them. 'custom' (default) : read given CHARMM top and par files. Returns: prot, ff, rsb, rs
    • prot: the protein
    • ff: the force field
    • rsb: the RestraintSet on bonded interactions
    • rs: the RestraintSet on nonbonded interactions. Both are weighted using ff_temp.

Definition at line 188 of file shared_functions.py.

◆ init_model_conjugate_kappa()

IMP.isd.shared_functions.sfo_common.init_model_conjugate_kappa ( self,
scales,
c,
R,
prior_rs = None )

given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of vonMisesKappaConjugateRestraint on each scale.

If argument prior_rs is used, add them to that RestraintSet instead.

Definition at line 355 of file shared_functions.py.

◆ init_model_HBonds_marginal()

IMP.isd.shared_functions.sfo_common.init_model_HBonds_marginal ( self,
prot,
seqfile,
tblfile,
name = 'NOE',
verbose = True )

read TBL file and store lognormal restraints, using the marginal of the lognormal with one sigma and gamma=1, for the whole dataset.

  • prot: protein hierarchy
  • seqfile: a file with 3-letter sequence
  • tblfile: a TBL file with the restraints
  • name: an optional name for the restraintset
  • verbose: be verbose (default True) Returns: data_rs

Definition at line 543 of file shared_functions.py.

◆ init_model_jeffreys()

IMP.isd.shared_functions.sfo_common.init_model_jeffreys ( self,
scales,
prior_rs = None )

given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of JeffreysRestraint on each scale.

If argument prior_rs is used, add them to that RestraintSet instead.

Definition at line 343 of file shared_functions.py.

◆ init_model_jeffreys_kappa()

IMP.isd.shared_functions.sfo_common.init_model_jeffreys_kappa ( self,
scales,
prior_rs = None )

given a list of scales, returns a RestraintSet('prior') with weight 1.0 that contains a list of vonMisesKappaJeffreysRestraint on each scale.

If argument prior_rs is used, add them to that RestraintSet instead.

Definition at line 330 of file shared_functions.py.

◆ init_model_NOE_restraint()

IMP.isd.shared_functions.sfo_common.init_model_NOE_restraint ( self,
prot,
atoms,
distance,
sigma,
gamma )

Sets up a lognormal distance restraint using the given sigma and gamma.

Returns the restraint. assumes atoms = (atom1, atom2) where atom1 is (resno, atomname) and resno is the residue sequence number.

Definition at line 412 of file shared_functions.py.

◆ init_model_NOEs()

IMP.isd.shared_functions.sfo_common.init_model_NOEs ( self,
prot,
seqfile,
tblfile,
name = 'NOE',
prior_rs = None,
bounds_sigma = (1.0, 0.1, 100),
bounds_gamma = (1.0, 0.1, 100),
verbose = True,
sequence_match = (1, 1) )

read TBL file and store NOE restraints, using one sigma and one gamma for the whole dataset.

Creates the necessary uninformative priors.

  • prot: protein hierarchy
  • seqfile: a file with 3-letter sequence
  • tblfile: a TBL file with the restraints
  • name: an optional name for the restraintset
  • prior_rs: when not None, add new sigma and gamma to this RestraintSet instance.
  • bounds_sigma or gamma: tuple of (initial value, lower, upper bound) bounds can be -1 to set to default range [0,+inf]
  • verbose: be verbose (default True)
  • sequence_match : (noe_start, sequence_start) Returns: data_rs, prior_rs, sigma, gamma

Definition at line 450 of file shared_functions.py.

◆ init_model_NOEs_marginal()

IMP.isd.shared_functions.sfo_common.init_model_NOEs_marginal ( self,
prot,
seqfile,
tblfile,
name = 'NOE',
verbose = True,
sequence_match = (1, 1) )

read TBL file and store NOE restraints, using the marginal of the lognormal with one sigma and one gamma, for the whole dataset.

  • prot: protein hierarchy
  • seqfile: a file with 3-letter sequence
  • tblfile: a TBL file with the restraints
  • name: an optional name for the restraintset
  • verbose: be verbose (default True)
  • sequence_match : (noe_start, sequence_start) Returns: data_rs

Definition at line 504 of file shared_functions.py.

◆ init_model_setup_scale()

IMP.isd.shared_functions.sfo_common.init_model_setup_scale ( self,
default,
lower = None,
upper = None )

sets up a Scale particle to the initial default value.

It can optionally be constrained between two positive bounds, or else its range is 0 to infinity.

Definition at line 317 of file shared_functions.py.

◆ init_model_standard_SAXS_restraint()

IMP.isd.shared_functions.sfo_common.init_model_standard_SAXS_restraint ( self,
prot,
profilefile,
name = 'SAXS',
ff_type = IMP.saxs.HEAVY_ATOMS )

read experimental SAXS profile and apply restraint the standard way (like foxs) Returns: a restraintset and the experimental profile

Definition at line 682 of file shared_functions.py.

◆ init_model_TALOS()

IMP.isd.shared_functions.sfo_common.init_model_TALOS ( self,
prot,
seqfile,
talos_data,
fulldata = True,
sequence_match = (1, 1),
name = 'TALOS',
prior_rs = None,
bounds_kappa = (1.0, 0.1, 10),
verbose = True,
prior = 'jeffreys',
keep_all = False )

read TALOS dihedral angle data, and create restraints for phi/psi torsion angles, along with the prior for kappa, which is a scale for the whole dataset, compare to 1/sigma**2 in the NOE case.

  • prot: protein hierarchy
  • seqfile: a file with 3-letter sequence
  • talos_data: either a file (pred.tab), or a folder (pred/) in which all files in the form res???.tab can be found. If possible, try to provide the folder, as statistics are more accurate in that case.
  • fulldata : either True or False, whether the data is the full TALOS output (predAll.tab or pred/ folder), or just the averages (pred.tab)
  • sequence_match : (talos_no, sequence_no) to adjust for different residue numberings
  • name: an optional name for the restraintset
  • prior_rs: when not None, add new kappa(s) to this RestraintSet instance.
  • bounds_kappa: tuple of (initial value, lower, upper bound) bounds can be -1 to set to default range [0,+inf]
  • verbose: be verbose (default True)
  • prior: either 'jeffreys' or a tuple (R,c), which signifies to use the conjugate prior of the von Mises restraint, with parameters R and c. Good values are R=0 and c=10. Default: jeffreys prior.
  • keep_all: in case of a folder for 'talos_data', whether to keep candidates marked as 'outliers' by TALOS, or to include them. Returns: data_rs, prior_rs, kappa

Definition at line 579 of file shared_functions.py.

◆ init_model_vonMises_restraint_full()

IMP.isd.shared_functions.sfo_common.init_model_vonMises_restraint_full ( self,
atoms,
data,
kappa )

Sets up a vonMises torsion angle restraint using the given kappa particle as concentration parameter.

Returns the restraint. data is a list of observations.

Definition at line 396 of file shared_functions.py.

◆ init_model_vonMises_restraint_mean()

IMP.isd.shared_functions.sfo_common.init_model_vonMises_restraint_mean ( self,
prot,
atoms,
data,
kappa )

Sets up a vonMises torsion angle restraint using the given kappa particle as concentration parameter.

Returns the restraint. data is (mean, standard deviation).

Definition at line 404 of file shared_functions.py.

◆ init_simulation_setup_nuisance_mc()

IMP.isd.shared_functions.sfo_common.init_simulation_setup_nuisance_mc ( self,
nuis,
temperature = 300.0,
mc_restraints = None,
nm_stepsize = 0.1 )

sets up monte carlo on nuisance, at a certain target temperature, optionally using a certain set of restraints only.

  • nuis: nuisance particle
  • temperature: target temperature
  • mc_restraints: optional set of restraints from which the energy should be drawn instead of the energy of the complete system.
  • floatkey: the floatkey to move.
  • nm_stepsize: the stepsize of the normal mover Returns: mc instance, nm instance.

Definition at line 863 of file shared_functions.py.

◆ init_simulation_setup_protein_hmc_hopper()

IMP.isd.shared_functions.sfo_common.init_simulation_setup_protein_hmc_hopper ( self,
prot,
temperature = 300.0,
gamma = 0.01,
n_md_steps = 10,
md_restraints = None,
mc_restraints = None,
timestep = 1.0,
sd_threshold = 0.0,
sd_stepsize = 0.01,
sd_maxsteps = 100 )

setup hybrid monte-carlo on protein.

Uses basin hopping with steepest descent minimization.

  • prot: protein hierarchy.
  • temperature: target temperature.
  • gamma: coupling constant for langevin (/fs)
  • n_md_steps: number of md steps per mc step
  • md_restraints: if not None, specify the terms of the energy to be used during the md steps.
  • mc_restraints: if not None, use these energy terms for the metropolis criterion.
  • timestep: time step for md, in femtoseconds.
  • sd_threshold: stop steepest descent after energy difference drops below that threshold
  • sd_stepsize: stepsize to use for the steepest descent, in angstrom.
  • sd_maxsteps: maximum number of steps for steepest descent Returns: hmc, mdmover, md and OptimizerState (thermostat)

Definition at line 787 of file shared_functions.py.

◆ init_simulation_setup_protein_hmc_nve()

IMP.isd.shared_functions.sfo_common.init_simulation_setup_protein_hmc_nve ( self,
prot,
temperature = 300.0,
n_md_steps = 100,
md_restraints = None,
mc_restraints = None,
timestep = 1.0 )

setup hybrid monte-carlo on protein.

Uses NVE MD and tries the full

  • prot: protein hierarchy.
  • temperature: target temperature.
  • coupling: coupling constant (tau (fs) for berendsen, gamma (/fs) for langevin)
  • n_md_steps: number of md steps per mc step
  • md_restraints: if not None, specify the terms of the energy to be used during the md steps.
  • mc_restraints: if not None, use these energy terms for the metropolis criterion.
  • timestep: time step for md, in femtoseconds.
  • sd_threshold: stop steepest descent after energy difference drops below that threshold
  • sd_stepsize: stepsize to use for the steepest descent, in angstrom.
  • sd_maxsteps: maximum number of steps for steepest descent Returns: hmc, mdmover and md

Definition at line 823 of file shared_functions.py.

◆ init_stats_add_hmc_category()

IMP.isd.shared_functions.sfo_common.init_stats_add_hmc_category ( self,
stat,
name = 'hmc',
coord = 'protein' )

shortcut for a frequent series of operations on HMC simulations' statistics.

Adds acceptance, number of MD steps and a trajectory for a protein.

Definition at line 995 of file shared_functions.py.

◆ init_stats_add_mc_category()

IMP.isd.shared_functions.sfo_common.init_stats_add_mc_category ( self,
stat,
name = 'mc',
coord = 'particle' )

shortcut for a frequent series of operations on MC simulations' statistics.

Creates an entry for acceptance, stepsize and one coordinate set printed in the statistics file.

Definition at line 960 of file shared_functions.py.

◆ init_stats_add_md_category()

IMP.isd.shared_functions.sfo_common.init_stats_add_md_category ( self,
stat,
name = 'md',
coord = 'protein' )

shortcut for a frequent series of operations on MD simulations' statistics.

Creates an entry for target temp, instantaneous temp, kinetic energy, and one set of coordinates called 'protein' by default.

Definition at line 977 of file shared_functions.py.

◆ m()

IMP.isd.shared_functions.sfo_common.m ( self,
name,
* args,
** kw )

wrapper to call methods of m

Definition at line 150 of file shared_functions.py.

◆ rescale_velocities()

IMP.isd.shared_functions.sfo_common.rescale_velocities ( self,
particles,
factor )

rescale the velocities of a bunch of particles having vx vy and vz floatkeys

Definition at line 1013 of file shared_functions.py.


The documentation for this class was generated from the following file: