Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
bed427e7
"wrappers/python/vscode:/vscode.git/clone" did not exist on "fee9a5b8b1cb9debee467558510b45ce863eafa5"
Commit
bed427e7
authored
Nov 03, 2015
by
Robert McGibbon
Browse files
Fix more python docstrings, especially __init__ functions
parent
d3150755
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
167 additions
and
88 deletions
+167
-88
wrappers/python/simtk/openmm/app/charmmpsffile.py
wrappers/python/simtk/openmm/app/charmmpsffile.py
+15
-6
wrappers/python/simtk/openmm/app/dcdreporter.py
wrappers/python/simtk/openmm/app/dcdreporter.py
+6
-3
wrappers/python/simtk/openmm/app/desmonddmsfile.py
wrappers/python/simtk/openmm/app/desmonddmsfile.py
+4
-3
wrappers/python/simtk/openmm/app/element.py
wrappers/python/simtk/openmm/app/element.py
+10
-5
wrappers/python/simtk/openmm/app/gromacsgrofile.py
wrappers/python/simtk/openmm/app/gromacsgrofile.py
+4
-3
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+16
-10
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
+17
-11
wrappers/python/simtk/openmm/app/modeller.py
wrappers/python/simtk/openmm/app/modeller.py
+8
-3
wrappers/python/simtk/openmm/app/pdbfile.py
wrappers/python/simtk/openmm/app/pdbfile.py
+4
-2
wrappers/python/simtk/openmm/app/pdbreporter.py
wrappers/python/simtk/openmm/app/pdbreporter.py
+6
-3
wrappers/python/simtk/openmm/app/pdbxfile.py
wrappers/python/simtk/openmm/app/pdbxfile.py
+7
-3
wrappers/python/simtk/openmm/app/simulation.py
wrappers/python/simtk/openmm/app/simulation.py
+13
-7
wrappers/python/simtk/openmm/app/statedatareporter.py
wrappers/python/simtk/openmm/app/statedatareporter.py
+57
-29
No files found.
wrappers/python/simtk/openmm/app/charmmpsffile.py
View file @
bed427e7
...
...
@@ -591,13 +591,22 @@ class CharmmPsfFile(object):
def
setBox
(
self
,
a
,
b
,
c
,
alpha
=
90.0
*
u
.
degrees
,
beta
=
90.0
*
u
.
degrees
,
gamma
=
90.0
*
u
.
degrees
):
"""
Sets the periodic box boundary conditions.
"""Sets the periodic box boundary conditions.
Parameters:
- a, b, c (floats) : Lengths of the periodic cell
- alpha, beta, gamma (floats, optional) : Angles between the
periodic cell vectors.
Parameters
----------
a : length
Lengths of the periodic cell
b : length
Lengths of the periodic cell
c : length
Lengths of the periodic cell
alpha : floats, optional
Angles between the periodic cell vectors.
beta : floats, optional
Angles between the periodic cell vectors.
gamma : floats, optional
Angles between the periodic cell vectors.
"""
try
:
# Since we are setting the box, delete the cached box lengths if we
...
...
wrappers/python/simtk/openmm/app/dcdreporter.py
View file @
bed427e7
...
...
@@ -45,9 +45,12 @@ class DCDReporter(object):
def
__init__
(
self
,
file
,
reportInterval
):
"""Create a DCDReporter.
Parameters:
- file (string) The file to write to
- reportInterval (int) The interval (in time steps) at which to write frames
Parameters
----------
file : string
The file to write to
reportInterval : int
The interval (in time steps) at which to write frames
"""
self
.
_reportInterval
=
reportInterval
self
.
_out
=
open
(
file
,
'wb'
)
...
...
wrappers/python/simtk/openmm/app/desmonddmsfile.py
View file @
bed427e7
...
...
@@ -46,10 +46,11 @@ class DesmondDMSFile(object):
def
__init__
(
self
,
file
):
"""Load a DMS file
Parameters:
- file (string) the name of the file to load
Parameters
----------
file : string
the name of the file to load
"""
# sqlite3 is included in the standard lib, but at python
# compile time, you can disable support (I think), so it's
# not *guarenteed* to be available. Doing the import here
...
...
wrappers/python/simtk/openmm/app/element.py
View file @
bed427e7
...
...
@@ -58,11 +58,16 @@ class Element(object):
def
__init__
(
self
,
number
,
name
,
symbol
,
mass
):
"""Create a new element
Parameters:
number (int) The atomic number of the element
name (string) The name of the element
symbol (string) The chemical symbol of the element
mass (float) The atomic mass of the element
Parameters
----------
number : int
The atomic number of the element
name : string
The name of the element
symbol : string
The chemical symbol of the element
mass : float
The atomic mass of the element
"""
## The atomic number of the element
self
.
_atomic_number
=
number
...
...
wrappers/python/simtk/openmm/app/gromacsgrofile.py
View file @
bed427e7
...
...
@@ -114,10 +114,11 @@ class GromacsGroFile(object):
The atom positions can be retrieved by calling getPositions().
Parameters:
- file (string) the name of the file to load
Parameters
----------
file : string
the name of the file to load
"""
xyzs
=
[]
elements
=
[]
# The element, most useful for quantum chemistry calculations
atomname
=
[]
# The atom name, for instance 'HW1'
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
bed427e7
...
...
@@ -433,16 +433,22 @@ class GromacsTopFile(object):
def
__init__
(
self
,
file
,
periodicBoxVectors
=
None
,
unitCellDimensions
=
None
,
includeDir
=
None
,
defines
=
None
):
"""Load a top file.
Parameters:
- file (string) the name of the file to load
- periodicBoxVectors (tuple of Vec3=None) the vectors defining the periodic box
- unitCellDimensions (Vec3=None) the dimensions of the crystallographic unit cell. For
non-rectangular unit cells, specify periodicBoxVectors instead.
- includeDir (string=None) A directory in which to look for other files
included from the top file. If not specified, we will attempt to locate a gromacs
installation on your system. When gromacs is installed in /usr/local, this will resolve
to /usr/local/gromacs/share/gromacs/top
- defines (dict={}) preprocessor definitions that should be predefined when parsing the file
Parameters
----------
file : str
the name of the file to load
periodicBoxVectors : tuple of Vec3=None
the vectors defining the periodic box
unitCellDimensions : Vec3=None
the dimensions of the crystallographic unit cell. For
non-rectangular unit cells, specify periodicBoxVectors instead.
includeDir : string=None
A directory in which to look for other files included from the
top file. If not specified, we will attempt to locate a gromacs
installation on your system. When gromacs is installed in
/usr/local, this will resolve to /usr/local/gromacs/share/gromacs/top
defines : dict={}
preprocessor definitions that should be predefined when parsing the file
"""
if
includeDir
is
None
:
includeDir
=
_defaultGromacsIncludeDir
()
...
...
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
View file @
bed427e7
...
...
@@ -123,15 +123,18 @@ class PdbStructure(object):
"""
def
__init__
(
self
,
input_stream
,
load_all_models
=
False
):
def
__init__
(
self
,
input_stream
,
load_all_models
=
False
):
"""Create a PDB model from a PDB file stream.
Parameters:
- self (PdbStructure) The new object that is created.
- input_stream (stream) An input file stream, probably created with
open().
- load_all_models (bool) Whether to load every model of an NMR
structure or trajectory, or just load the first model, to save memory.
Parameters
----------
self : PdbStructure
The new object that is created.
input_stream : stream
An input file stream, probably created with open().
load_all_models : bool
Whether to load every model of an NMR structure or trajectory, or
just load the first model, to save memory.
"""
# initialize models
self
.
load_all_models
=
load_all_models
...
...
@@ -201,7 +204,7 @@ class PdbStructure(object):
def
_reset_atom_numbers
(
self
):
self
.
_atom_numbers_are_hex
=
False
self
.
_next_atom_number
=
1
def
_reset_residue_numbers
(
self
):
self
.
_residue_numbers_are_hex
=
False
self
.
_next_residue_number
=
1
...
...
@@ -269,8 +272,11 @@ class PdbStructure(object):
Iterate over atomic positions.
Parameters
- use_all_models (bool=False) Get positions from all models or just the first one.
- include_alt_loc (bool=False) Get all positions for each atom, or just the first one.
----------
use_all_models : bool=False
Get positions from all models or just the first one.
include_alt_loc : bool=False
Get all positions for each atom, or just the first one.
"""
for
model
in
self
.
iter_models
(
use_all_models
):
for
loc
in
model
.
iter_positions
(
include_alt_loc
):
...
...
@@ -711,7 +717,7 @@ class Atom(object):
self
.
is_first_atom_in_chain
=
False
self
.
is_final_atom_in_chain
=
False
self
.
is_first_residue_in_chain
=
False
self
.
is_final_residue_in_chain
=
False
self
.
is_final_residue_in_chain
=
False
# Start parsing fields from pdb line
self
.
record_name
=
pdb_line
[
0
:
6
].
strip
()
if
pdbstructure
is
not
None
and
pdbstructure
.
_atom_numbers_are_hex
:
...
...
wrappers/python/simtk/openmm/app/modeller.py
View file @
bed427e7
...
...
@@ -186,10 +186,15 @@ class Modeller(object):
def
convertWater
(
self
,
model
=
'tip3p'
):
"""Convert all water molecules to a different water model.
Parameters:
- model (string='tip3p') the water model to convert to. Supported values are 'tip3p', 'spce', 'tip4pew', and 'tip5p'.
Parameters
----------
model : string='tip3p'
the water model to convert to. Supported values are 'tip3p',
'spce', 'tip4pew', and 'tip5p'.
@deprecated Use addExtraParticles() instead. It performs the same function but in a more general way.
@deprecated Use addExtraParticles() instead. It performs the same
function but in a more general way.
"""
if
model
in
(
'tip3p'
,
'spce'
):
sites
=
3
...
...
wrappers/python/simtk/openmm/app/pdbfile.py
View file @
bed427e7
...
...
@@ -64,8 +64,10 @@ class PDBFile(object):
The atom positions and Topology can be retrieved by calling getPositions() and getTopology().
Parameters:
- file (string) the name of the file to load
Parameters
----------
file : string
the name of the file to load
"""
top
=
Topology
()
## The Topology read from the PDB file
...
...
wrappers/python/simtk/openmm/app/pdbreporter.py
View file @
bed427e7
...
...
@@ -44,9 +44,12 @@ class PDBReporter(object):
def
__init__
(
self
,
file
,
reportInterval
):
"""Create a PDBReporter.
Parameters:
- file (string) The file to write to
- reportInterval (int) The interval (in time steps) at which to write frames
Parameters
----------
file : string
The file to write to
reportInterval : int
The interval (in time steps) at which to write frames
"""
self
.
_reportInterval
=
reportInterval
self
.
_out
=
open
(
file
,
'w'
)
...
...
wrappers/python/simtk/openmm/app/pdbxfile.py
View file @
bed427e7
...
...
@@ -53,10 +53,14 @@ class PDBxFile(object):
def
__init__
(
self
,
file
):
"""Load a PDBx/mmCIF file.
The atom positions and Topology can be retrieved by calling getPositions() and getTopology().
The atom positions and Topology can be retrieved by calling
getPositions() and getTopology().
Parameters:
- file (string) the name of the file to load. Alternatively you can pass an open file object.
Parameters
----------
file : string
the name of the file to load. Alternatively you can pass an open
file object.
"""
top
=
Topology
()
## The Topology read from the PDBx/mmCIF file
...
...
wrappers/python/simtk/openmm/app/simulation.py
View file @
bed427e7
...
...
@@ -55,13 +55,19 @@ class Simulation(object):
def
__init__
(
self
,
topology
,
system
,
integrator
,
platform
=
None
,
platformProperties
=
None
):
"""Create a Simulation.
Parameters:
- topology (Topology) A Topology describing the the system to simulate
- system (System) The OpenMM System object to simulate
- integrator (Integrator) The OpenMM Integrator to use for simulating the System
- platform (Platform=None) If not None, the OpenMM Platform to use
- platformProperties (map=None) If not None, a set of platform-specific properties to pass
to the Context's constructor
Parameters
----------
topology : Topology
A Topology describing the the system to simulate
system : System
The OpenMM System object to simulate
integrator : Integrator
The OpenMM Integrator to use for simulating the System
platform : Platform=None
If not None, the OpenMM Platform to use
platformProperties : map=None
If not None, a set of platform-specific properties to pass to the
Context's constructor
"""
## The Topology describing the system being simulated
self
.
topology
=
topology
...
...
wrappers/python/simtk/openmm/app/statedatareporter.py
View file @
bed427e7
...
...
@@ -60,31 +60,54 @@ class StateDataReporter(object):
progress
=
False
,
remainingTime
=
False
,
speed
=
False
,
elapsedTime
=
False
,
separator
=
','
,
systemMass
=
None
,
totalSteps
=
None
):
"""Create a StateDataReporter.
Parameters:
- file (string or file) The file to write to, specified as a file name or file object
- reportInterval (int) The interval (in time steps) at which to write frames
- step (boolean=False) Whether to write the current step index to the file
- time (boolean=False) Whether to write the current time to the file
- potentialEnergy (boolean=False) Whether to write the potential energy to the file
- kineticEnergy (boolean=False) Whether to write the kinetic energy to the file
- totalEnergy (boolean=False) Whether to write the total energy to the file
- temperature (boolean=False) Whether to write the instantaneous temperature to the file
- volume (boolean=False) Whether to write the periodic box volume to the file
- density (boolean=False) Whether to write the system density to the file
- progress (boolean=False) Whether to write current progress (percent completion) to the file.
If this is True, you must also specify totalSteps.
- remainingTime (boolean=False) Whether to write an estimate of the remaining clock time until
completion to the file. If this is True, you must also specify totalSteps.
- speed (bool=False) Whether to write an estimate of the simulation speed in ns/day to the file
- elapsedTime (bool=False) Whether to write the elapsed time of the simulation in seconds to the file.
- separator (string=',') The separator to use between columns in the file
- systemMass (mass=None) The total mass to use for the system when reporting density. If this is
None (the default), the system mass is computed by summing the masses of all particles. This
parameter is useful when the particle masses do not reflect their actual physical mass, such as
when some particles have had their masses set to 0 to immobilize them.
- totalSteps (int=None) The total number of steps that will be included in the simulation. This
is required if either progress or remainingTime is set to True, and defines how many steps will
indicate 100% completion.
Parameters
----------
file : string or file
The file to write to, specified as a file name or file object
reportInterval : int
The interval (in time steps) at which to write frames
step : bool=False
Whether to write the current step index to the file
time : bool=False
Whether to write the current time to the file
potentialEnergy : bool=False
Whether to write the potential energy to the file
kineticEnergy : bool=False
Whether to write the kinetic energy to the file
totalEnergy : bool=False
Whether to write the total energy to the file
temperature : bool=False
Whether to write the instantaneous temperature to the file
volume : bool=False
Whether to write the periodic box volume to the file
density : bool=False
Whether to write the system density to the file
progress : bool=False
Whether to write current progress (percent completion) to the file.
If this is True, you must also specify totalSteps.
remainingTime : bool=False
Whether to write an estimate of the remaining clock time until
completion to the file. If this is True, you must also specify
totalSteps.
speed : bool=False
Whether to write an estimate of the simulation speed in ns/day to
the file
elapsedTime : bool=False
Whether to write the elapsed time of the simulation in seconds to
the file.
separator : string=','
The separator to use between columns in the file
systemMass : mass=None
The total mass to use for the system when reporting density. If
this is None (the default), the system mass is computed by summing
the masses of all particles. This parameter is useful when the
particle masses do not reflect their actual physical mass, such as
when some particles have had their masses set to 0 to immobilize
them.
totalSteps : int=None
The total number of steps that will be included in the simulation.
This is required if either progress or remainingTime is set to True,
and defines how many steps will indicate 100% completion.
"""
self
.
_reportInterval
=
reportInterval
self
.
_openedFile
=
isinstance
(
file
,
str
)
...
...
@@ -189,11 +212,16 @@ class StateDataReporter(object):
def
_constructReportValues
(
self
,
simulation
,
state
):
"""Query the simulation for the current state of our observables of interest.
Parameters:
- simulation (Simulation) The Simulation to generate a report for
- state (State) The current state of the simulation
Parameters
----------
simulation : Simulation
The Simulation to generate a report for
state : State
The current state of the simulation
Returns: A list of values summarizing the current state of
Returns
-------
A list of values summarizing the current state of
the simulation, to be printed or saved. Each element in the list
corresponds to one of the columns in the resulting CSV file.
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment