| |
- builtins.object
-
- AnnealIVM
- FinalParams
- InitialParams
- NullClass
- RunAction
-
- IVMAction
- LinRamp
- MultRamp
- StaticRamp
- StructInfo
- StructureLoop
class AnnealIVM(builtins.object) |
|
AnnealIVM(initTemp, finalTemp, ivm=0, numSteps=None, tempStep=None, rampedParams={}, extraCommands=0, toleranceFactor=1000)
class to perform simulated annealing using molecular dynamics. |
|
Methods defined here:
- __init__(s, initTemp, finalTemp, ivm=0, numSteps=None, tempStep=None, rampedParams={}, extraCommands=0, toleranceFactor=1000)
- construct by specifying the intial and final annealing temperatures,
and an ivm.IVM object.
if tempStep is specified, it will be used to determine the number of
dynamics runs at different temperatures. If if is omitted, numSteps
will be used (and tempStep implicitly determined).
rampedParams is a list of MultRamp and LinRamp objects which specify
refinement parameters to adjust during the simulated annealing run.
extraCommands is a function or string which is run before dynamics at
each temperature. If it is a function, is is passed the current
AnnealIVM instance as the argument.
During each temperature step the following instance variables are set:
fractionDone - fraction (from 0 to 1) of annealing completed.
bathTemp - current temperature.
step - current step number.
toleranceFactor is used to adjust the ivm.IVM's energy tolerance
as the temperature changes. The energy tolerance is calculated as
eTolerance = temp / toleranceFactor
The ivm argument doesn't actually have to be an ivm.IVM, but it
must be an object which has the following methods defined:
setBathTemp
setETolerance
run
- finalParameters(s)
- sets parameters to final values
- initParameters(s)
- initialize ramped parameters
- printTemp(s)
- run(s)
- runExtraCommands(s)
- runIVM(s, temp)
- updateParameters(s)
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class FinalParams(builtins.object) |
|
FinalParams(pList, call=True)
constructor takes a list of ramped parameters. The constructor invokes
each parameter such that it set to its final value, unless the optional
call argument is specified as False.
Also, this object can be called as a function with zero arguments, to
set parameters to final values. |
|
Methods defined here:
- __call__(s)
- Call self as a function.
- __init__(s, pList, call=True)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class IVMAction(RunAction) |
|
IVMAction(action)
convenience class for static parameter setup.
update() - increments value. It will not change the value beyond
that specified by stopValue
value() - return the current value
setNumSteps(ns) - set number of steps
init(ns) - set number of steps and initialize val to startValue |
|
- Method resolution order:
- IVMAction
- RunAction
- builtins.object
Methods defined here:
- __init__(s, action)
- The action argument is used to set the action member.
Methods inherited from RunAction:
- finalize(s, caller=0)
- init(s, numSteps, caller=0)
- runAction(s, caller=0)
- Perform s.action, using the current value().
If action is a string, it is exec'd in the frame in which RunAction
is created, with the literal ``VALUE'' replaced by value().
Otherwise, action should be a function, taking a single argument,
value().
- setNumSteps(s, numSteps)
- update(s, caller=0)
- value(s)
Data descriptors inherited from RunAction:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class InitialParams(builtins.object) |
|
InitialParams(pList, call=True)
Constructor takes a list of ramped parameters. The constructor invokes
each parameter such that it set to its initial value, unless the optional
call argument is specified as False.
Also, this object can be called as a function with zero arguments, to
set parameters to initial values. |
|
Methods defined here:
- __call__(s)
- Call self as a function.
- __init__(s, pList, call=True)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class LinRamp(RunAction) |
|
LinRamp(startValue, stopValue, action=None)
convenience class for linearly
ramping a value from startValue to stopValue over numberSteps
constructor: MultRamp(startValue, stopValue, action)
methods:
update() - increments value. It will not change the value beyond
that specified by stopValue
value() - return the current value
setNumSteps(ns) - set number of steps
init(ns) - set number of steps and initialize val to startValue |
|
- Method resolution order:
- LinRamp
- RunAction
- builtins.object
Methods defined here:
- __init__(s, startValue, stopValue, action=None)
- The action argument is used to set the action member.
- setNumSteps(s, numSteps)
- update(s, caller=0)
Methods inherited from RunAction:
- finalize(s, caller=0)
- init(s, numSteps, caller=0)
- runAction(s, caller=0)
- Perform s.action, using the current value().
If action is a string, it is exec'd in the frame in which RunAction
is created, with the literal ``VALUE'' replaced by value().
Otherwise, action should be a function, taking a single argument,
value().
- value(s)
Data descriptors inherited from RunAction:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class MultRamp(RunAction) |
|
MultRamp(startValue, stopValue, action=None)
convenience class for multiplicatively (geometrically)
ramping a value from startValue to stopValue over numberSteps
constructor: MultRamp(startValue, stopValue, action)
methods:
update() - increments value. It will not change the value beyond
that specified by stopValue
value() - return the current value
setNumSteps(ns) - set number of steps
init(ns) - set number of steps and initialize val to startValue
finalize() - set value to the final value. |
|
- Method resolution order:
- MultRamp
- RunAction
- builtins.object
Methods defined here:
- __init__(s, startValue, stopValue, action=None)
- The action argument is used to set the action member.
- setNumSteps(s, numSteps)
- update(s, caller=0)
Methods inherited from RunAction:
- finalize(s, caller=0)
- init(s, numSteps, caller=0)
- runAction(s, caller=0)
- Perform s.action, using the current value().
If action is a string, it is exec'd in the frame in which RunAction
is created, with the literal ``VALUE'' replaced by value().
Otherwise, action should be a function, taking a single argument,
value().
- value(s)
Data descriptors inherited from RunAction:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class NullClass(builtins.object) |
|
dummy empty class |
|
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class RunAction(builtins.object) |
|
RunAction(action)
Base class for function or command string to be run in the defining
frame at a later time. There is a value associated with this object which
is always zero.
update() - increments value. It will not change the value beyond
that specified by stopValue
value() - return the current value
init(ns) - set number of steps and initialize val to startValue
finalize() - set value to the final value. |
|
Methods defined here:
- __init__(s, action)
- The action argument is used to set the action member.
- finalize(s, caller=0)
- init(s, numSteps, caller=0)
- runAction(s, caller=0)
- Perform s.action, using the current value().
If action is a string, it is exec'd in the frame in which RunAction
is created, with the literal ``VALUE'' replaced by value().
Otherwise, action should be a function, taking a single argument,
value().
- setNumSteps(s, numSteps)
- update(s, caller=0)
- value(s)
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class StaticRamp(RunAction) |
|
StaticRamp(action, stride=1)
convenience class for static parameter setup.
update() - increments value. It will not change the value beyond
that specified by stopValue
value() - return the current value
setNumSteps(ns) - set number of steps
init(ns) - set number of steps and initialize val to startValue |
|
- Method resolution order:
- StaticRamp
- RunAction
- builtins.object
Methods defined here:
- __init__(s, action, stride=1)
- action is a function or string to be executed.
stride specifies how often the function is called. A stride value of
1 specifies that the function is called every time update is called.
Larger values of stride specify that action is called by update()
if caller.step%stride=0.
- update(s, caller=0)
Methods inherited from RunAction:
- finalize(s, caller=0)
- init(s, numSteps, caller=0)
- runAction(s, caller=0)
- Perform s.action, using the current value().
If action is a string, it is exec'd in the frame in which RunAction
is created, with the literal ``VALUE'' replaced by value().
Otherwise, action should be a function, taking a single argument,
value().
- setNumSteps(s, numSteps)
- value(s)
Data descriptors inherited from RunAction:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class StructInfo(builtins.object) |
|
StructInfo(filename, energy, viols, accept, id, atomPosArr=None)
helper class for generating structure statistics in StructureLoop. |
|
Methods defined here:
- __init__(s, filename, energy, viols, accept, id, atomPosArr=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class StructureLoop(builtins.object) |
|
StructureLoop(numStructures=-1, startStructure=0, structureNums=[], pdbFilesIn=[], pdbFilesInErase=False, pdbFilesInCorrectSymmetricSidechains=True, inMemberModulo=None, structLoopAction='', pdbTemplate=None, doWriteStructures=False, calcMissingStructs=False, writeCrashStructures=True, writeSelection='all', potList=None, ivm=None, genViolationStats=False, storeCoordinates=False, averageFilename='', averagePotList=<potList.PotList; proxy of <Swig Object of type 'rc_DerivedPot< PotList > *' at 0x7f4947b256e0> >, averageRegularize=-1, averageFixedRegions=[], averageRigidRegions=[], averageSortPots=None, averageCrossTerms=[], averageContext=<function StructureLoop.<lambda> at 0x7f4947b17920>, writeViols=True, averageFitSel=-1, averageCompSel='not name H* and not PSEUDO', mleFitThreshold=2, averageTopFraction=0.5, averageTopNum=-1, averageAccept=<function StructureLoop.<lambda> at 0x7f4947b179c0>, averageRefineSteps=50, averageRestrain=False, averageRestrainSel='name CA or name C or name N or name O')
Class that performs loop over structure calculations.
Constructor: StructureLoop()
arguments:
numStructures - number of structures to calculate
startStructure - id of the first structure to calculate
structureNums - sequence of explicit structure numbers to
calculate.
pdbFilesIn - A list of existing coordinate files, or a
string including a glob wildcard. If
specified, structLoopAction will be called
after reading each specified file. In this
case, if the arguments numStructures or
structureNums are specified, the coordinates
will be initialized to the appropriate structure
number modulus the length of pdbFilesIn. If
numStructures and structureNums are not
specified, len(pdbFilesIn) structures will be
calculated. This argument can also be a template
string including the STRUCTURE literal which is
replaced by structure number. For ensemble
simulations, a MEMBER literal should also be
present, if separate coordinates for
are desired for each ensemble member. Coordinates
are initialized by calling protocol.initCoords,
the return value of which is stored in
the initCoordsRet member of the instance object
(passed as the argument to the structLoopAction
function).
pdbFilesInErase - the value to pass to the erase argument of
protocol.initCoords, when pdbFilesIn is
specified.
[default: False]
pdbFilesInCorrectSymmetricSidechains
- the value to pass to the
correctSymmetricSidechainserase argument of
protocol.initCoords, when pdbFilesIn is
specified.
[default: True]
inMemberModulo - is used in conjunction with pdbFilesIn in
the case that an ensemble calculation is
using input structures from a smaller ensemble.
This number specifies the size of the smaller
input ensemble.
structLoopAction - a user-defined function which takes
one argument: an instance of this class.
If this argument is omitted, new structures
are not calculated. Rather, existing structures
in files specified by pdbFilesIn are read-in,
and analyzed. There is a special null class
member named sharedData created during run()
which can be written to in structLoopAction
and read back out after run() is called,
but at that point, structData is a
dictionary whose keys are structure numbers. The
argument to the function is an instance of this
class, such that structure-specific info can be
accessed. Useful members include:
structNum - the current structure number .
filename() - returns the output filename
for the current structure.
extraRemarks - extra data to place in the
REMARKs section of the output
PDB, passed to the
writeStructure method.
pdbTemplate - template string used to create a filename
for the pdbFile method. The filename is
generated using the makeFilename method.
Note that the template string should always
include the STRUCTURE literal so that distinct
structure files are generated. For
ensembleSimulation calculations a MEMBER
literal should also be present *after* the
STRUCTURE literal. The name of the input file
(as specified in pdbFileIn), can be specified
using the INFILE literal.
[default: "SCRIPT_STRUCTURE.pdb" for
non-EnsembleSimulations and
"SCRIPT_STRUCTURE_MEMBER.pdb" for
EnsembleSimulations]
doWriteStructures - write the structures using writeStructure
after each call to structLoopAction. The
potList argument is used as the PotList for
analysis, the member altPotList (which
defaults to the value of averageCrossTerms)
is used as the second argument, and the
member extraRemarks is used as the third
argument.
[default: False]
writeCrashStructures - If structLoopAction (the structure calculation
function) throws an exception, a crash
coordinate file will be created if this is
True.
[default: True]
writeSelection - Atom selection specifying which atoms to write
to output files, whether those written from
the pdbTemplate, crash structures, or the
averaged coordinates.
[default: all]
potList - The potList argument to writeStructures if
doWriteStructures is True. If it is not set,
it defaults to averagePotList.
ivm - An ivm.IVM object, used for consistency
checking. If set, a check is made if fitting
of atomic coordinates is attempted while
(non-pseudo) atoms are fixed in the IVM. If so,
an exception is raised.
calcMissingStructs - If True, structures are only calculated if
their associated filename does not exist.
However, all structures specified by
numStructures or structureNums are read in
and used for analysis.
[default: False]
if numStructures<0, existing files matching pdbTemplate are processed,
starting at startStructure, and stopping when a file does not exist.
This mode of operation does not work with structure parallelism, but
it does work with ensemble parallelism.
There are additional arguments if you would like an average structure
to be calculated. If averaging is enabled, the output structure files
will be fit by averageFitSel to that which has the lowest averageSortPots
energy. Ensemble Structures from ensembleSimulation.EnsembleSimulation
calculations structures are fit to the respective ensemble member
of the ensemble which has the lowest averageSortPots energy. This
approach to ensemble fitting is often not appropriate.
averageFilename - name for output structure file. If not specified,
the average structure will not be calculated.
averagePotList - potential terms to use for average structure
calculation. These terms are reported on in the
.stats file.
averageRegularize - flag determining whether or not structure
regularization (gradient minimization) is
carried out on the average structure, by
minimizing against averagePotList.
[default: True, if averageFilename is set]
averageFixedRegions - sequence of regions held fixed in space during
structure regularization.
averageRigidRegions - sequence of regions held rigid during structure
regularization.
averageSortPots - potential terms used for sorting structures. The
top fraction or number of structures is reported
on in the .stats file.
[defaults to averagePotList]
averageCrossTerms - potential terms to report on, but not to use
in refinement of average structure.
averageContext - function to call to initialize force constants
and other parameters for the energy/observable
summary printed at the beginning of the output
structure files, .viols files, and statistical
restraint analysis. It is also used to setup the
average minimization run.
writeViols - if False, do not write .viols files.
averageFitSel - atom selection used to fit structures in
calculation of average structure and to fit
structures to the lowest energy
structure. A special selection keyword "ordered"
can be used to force a maximum likelihood
determination (using makeLikelyFit) of the
residues in ordered regions of the structure
after structure calculation. The literal
"ordered" is then replaced with a string
representing these regions. Setting averageFitSel
to None will disable fitting. If the energy
depends on the absolute position or orientation
of the coordinates, averageFitSel should be set
to None. The default value is None if the current
Simulation has the attribute noFit set to True,
and "name CA" otherwise.
mleFitThreshold - threshold RMSD for an atom to be considered in
an ordered region. Used if the "ordered" literal
is present in the averageFitSel selection
string [2].
averageCompSel - atom selection used for heavy atom rmsd
comparison metric [not name H* and not PSEUDO].
averageTopFraction - fraction of structures to use in calculation of
average structure. The structures are sorted
by energy, and the top fraction is retained.
[0.5 - half of calculated structures].
averageTopNum - number of structures to use in calculation of
average structure. Specify only one of
averageTopFraction or averageTopNum.
averageAccept - function to call to assess whether it is
acceptable, i.e. meets violation, rmsd
requirements. The function has a single argument:
averagePotList [defaults to accepting all
structures.]
averageRefineSteps - number of minimization steps to take during
regularization refinement of the average
structure [50]
genViolationStats - flag controlling whether statics are gathered
(over all structures) on which restraints are
violated most often. The results are collected
in a file named pdbTemplate.stats. Statistics
will be gathered for all terms in
averagePotList, so this attribute must be
specified for this facility to work.
storeCoordinates - if True, atomic coordinates are saved in memory
for final analysis, but this may use excessive
memory if many structures are calculated. By
default, storeCoordinates=False.
averageRestrain - flag the control the inclusion of probDist energy
potential in calculating the average structure
from the ensemble. averageRestrainSel helps in
selecting atoms from which the density map is
created. inconsistentAveStruct is a flag that
is set to True if the sortEnergy (and associated
violation count) of the calculated average
structure is greater than all of the structures
used to compute it.
method: run():
performs numStructures loop of action. In each pass, the coordinates
of the current Simulation are reset to their initial values and the
instance variable count is incremented. Also, the global random seed
is incremented. If the current simulation is an EnsembleSimulation,
the seed-setting takes this into account.
After run() has completed, average structure coordinates are left in
the current Simulation, if they have been calculated. If restraint
statistics are generated, the StructureLoop instance will have the
following members when run() returns:
restraintStats
restraintStatsCross
These are restraintStats.RestraintStats objects corresponding to
potential terms in averagePotList and AverageCrossTerms, respectively.
The precision of the calculated structures is stored in the members
fitRMSD
compRMSD
corresponding to averageFitSel and averageCompSel, respectively. The
member
structInfo
contains a list of StructInfo objects, one for each structure reported
on the the .stats file.
Also, the cpu time spent within the run() method will be contained
in the members
cpuTime
cpuTimes
cpuTimeTot
The first contains the local process's cpu time, the second is an array
of times from each process, and the third is the sum. |
|
Methods defined here:
- __init__(s, numStructures=-1, startStructure=0, structureNums=[], pdbFilesIn=[], pdbFilesInErase=False, pdbFilesInCorrectSymmetricSidechains=True, inMemberModulo=None, structLoopAction='', pdbTemplate=None, doWriteStructures=False, calcMissingStructs=False, writeCrashStructures=True, writeSelection='all', potList=None, ivm=None, genViolationStats=False, storeCoordinates=False, averageFilename='', averagePotList=<potList.PotList; proxy of <Swig Object of type 'rc_DerivedPot< PotList > *' at 0x7f4947b256e0> >, averageRegularize=-1, averageFixedRegions=[], averageRigidRegions=[], averageSortPots=None, averageCrossTerms=[], averageContext=<function StructureLoop.<lambda> at 0x7f4947b17920>, writeViols=True, averageFitSel=-1, averageCompSel='not name H* and not PSEUDO', mleFitThreshold=2, averageTopFraction=0.5, averageTopNum=-1, averageAccept=<function StructureLoop.<lambda> at 0x7f4947b179c0>, averageRefineSteps=50, averageRestrain=False, averageRestrainSel='name CA or name C or name N or name O')
- Initialize self. See help(type(self)) for accurate signature.
- directFit(s, comm, sim, structInfo)
- filename(s, structNum=None, memberNum=None, suffix='')
- Return filename generated by makeFilename() from the pdbTemplate
member which can be initialized using the thus-named argument in the
class constructor. If structNum is not specified, it
defaults to s.structNum.
- genAveStats(s, comm, sim)
- generate averages, statistics for calculated structures
- getExtraRemarks(s, pdbFile)
- Return those REMARKs records previously written by writeStructure
using the extraRemarks argument.
- makeFilename(s, template, structNum=None, memberNum=None)
- create a filename given a template. In the template:
the following substitutions are made:
SCRIPT -> name of input script (without .py suffix)
STRUCTURE -> structNum if specified, else s.structNum
MEMBER -> memberNum if specified, else ensemble member
index
INFILE -> the name of the input coordinate file name
(blank if none) without the extension.
- mleFit(s, comm, sim, structInfo, mleThreshold)
- Maximum likeihood fitting of structures - to determine ordered
regions used for fitting. Return a valid selection string
corresponding to this region.
Currently, the values of the fit coordinates are not returned.
This function cannot be used in a socketComm single-process
region.
- pdbFile(s, nameSuffix='')
- return a PDBTool object whose filename is generated by
makeFilename() from the pdbTemplate argument of the class
constructor. nameSuffix specifies an optional additional suffix
for the generated filename.
- pdbFileIn(s)
- return the input pdb filename corresponding to structNum. If
running in the context of an EnsembleSimulation, the MEMBER literal
in the filename is replaced with the appropriate ensemble member
identifier.
- run(s)
- structureNum(s)
- return the current structure number, or -1.
- writeStructure(s, potList=None, altPotList=None, extraRemarks='', nameSuffix='', makeBackup=True)
- perform analysis using analyze(), then write a structure with
the analysis information included as remarks.
The filename is generated from the pdbTemplate argument of the
StructureLoop constructor.
A summary is written out for each term in potList (and in altPotList,
if specified), and more detailed violation information is output
to a file named filename + '.viols' .
If potList is not specified, it defaults to s.averagePotList.
If altPotList is not specified, it defaults to s.averageCrossTerms.
extraRemarks, if specified, is extra (string or a list of
strings) information in the REMARKS section of the PDB file,
printed after the usual summary.
nameSuffix specifies an optional additional suffix for the
generated filename.
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
| |