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
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):
...
@@ -591,13 +591,22 @@ class CharmmPsfFile(object):
def
setBox
(
self
,
a
,
b
,
c
,
alpha
=
90.0
*
u
.
degrees
,
beta
=
90.0
*
u
.
degrees
,
def
setBox
(
self
,
a
,
b
,
c
,
alpha
=
90.0
*
u
.
degrees
,
beta
=
90.0
*
u
.
degrees
,
gamma
=
90.0
*
u
.
degrees
):
gamma
=
90.0
*
u
.
degrees
):
"""
"""Sets the periodic box boundary conditions.
Sets the periodic box boundary conditions.
Parameters:
Parameters
- a, b, c (floats) : Lengths of the periodic cell
----------
- alpha, beta, gamma (floats, optional) : Angles between the
a : length
periodic cell vectors.
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
:
try
:
# Since we are setting the box, delete the cached box lengths if we
# 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):
...
@@ -45,9 +45,12 @@ class DCDReporter(object):
def
__init__
(
self
,
file
,
reportInterval
):
def
__init__
(
self
,
file
,
reportInterval
):
"""Create a DCDReporter.
"""Create a DCDReporter.
Parameters:
Parameters
- file (string) The file to write to
----------
- reportInterval (int) The interval (in time steps) at which to write frames
file : string
The file to write to
reportInterval : int
The interval (in time steps) at which to write frames
"""
"""
self
.
_reportInterval
=
reportInterval
self
.
_reportInterval
=
reportInterval
self
.
_out
=
open
(
file
,
'wb'
)
self
.
_out
=
open
(
file
,
'wb'
)
...
...
wrappers/python/simtk/openmm/app/desmonddmsfile.py
View file @
bed427e7
...
@@ -46,10 +46,11 @@ class DesmondDMSFile(object):
...
@@ -46,10 +46,11 @@ class DesmondDMSFile(object):
def
__init__
(
self
,
file
):
def
__init__
(
self
,
file
):
"""Load a DMS file
"""Load a DMS file
Parameters:
Parameters
- file (string) the name of the file to load
----------
file : string
the name of the file to load
"""
"""
# sqlite3 is included in the standard lib, but at python
# sqlite3 is included in the standard lib, but at python
# compile time, you can disable support (I think), so it's
# compile time, you can disable support (I think), so it's
# not *guarenteed* to be available. Doing the import here
# 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):
...
@@ -58,11 +58,16 @@ class Element(object):
def
__init__
(
self
,
number
,
name
,
symbol
,
mass
):
def
__init__
(
self
,
number
,
name
,
symbol
,
mass
):
"""Create a new element
"""Create a new element
Parameters:
Parameters
number (int) The atomic number of the element
----------
name (string) The name of the element
number : int
symbol (string) The chemical symbol of the element
The atomic number of the element
mass (float) The atomic mass 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
## The atomic number of the element
self
.
_atomic_number
=
number
self
.
_atomic_number
=
number
...
...
wrappers/python/simtk/openmm/app/gromacsgrofile.py
View file @
bed427e7
...
@@ -114,10 +114,11 @@ class GromacsGroFile(object):
...
@@ -114,10 +114,11 @@ class GromacsGroFile(object):
The atom positions can be retrieved by calling getPositions().
The atom positions can be retrieved by calling getPositions().
Parameters:
Parameters
- file (string) the name of the file to load
----------
file : string
the name of the file to load
"""
"""
xyzs
=
[]
xyzs
=
[]
elements
=
[]
# The element, most useful for quantum chemistry calculations
elements
=
[]
# The element, most useful for quantum chemistry calculations
atomname
=
[]
# The atom name, for instance 'HW1'
atomname
=
[]
# The atom name, for instance 'HW1'
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
bed427e7
...
@@ -433,16 +433,22 @@ class GromacsTopFile(object):
...
@@ -433,16 +433,22 @@ class GromacsTopFile(object):
def
__init__
(
self
,
file
,
periodicBoxVectors
=
None
,
unitCellDimensions
=
None
,
includeDir
=
None
,
defines
=
None
):
def
__init__
(
self
,
file
,
periodicBoxVectors
=
None
,
unitCellDimensions
=
None
,
includeDir
=
None
,
defines
=
None
):
"""Load a top file.
"""Load a top file.
Parameters:
Parameters
- file (string) the name of the file to load
----------
- periodicBoxVectors (tuple of Vec3=None) the vectors defining the periodic box
file : str
- unitCellDimensions (Vec3=None) the dimensions of the crystallographic unit cell. For
the name of the file to load
non-rectangular unit cells, specify periodicBoxVectors instead.
periodicBoxVectors : tuple of Vec3=None
- includeDir (string=None) A directory in which to look for other files
the vectors defining the periodic box
included from the top file. If not specified, we will attempt to locate a gromacs
unitCellDimensions : Vec3=None
installation on your system. When gromacs is installed in /usr/local, this will resolve
the dimensions of the crystallographic unit cell. For
to /usr/local/gromacs/share/gromacs/top
non-rectangular unit cells, specify periodicBoxVectors instead.
- defines (dict={}) preprocessor definitions that should be predefined when parsing the file
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
:
if
includeDir
is
None
:
includeDir
=
_defaultGromacsIncludeDir
()
includeDir
=
_defaultGromacsIncludeDir
()
...
...
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
View file @
bed427e7
...
@@ -123,15 +123,18 @@ class PdbStructure(object):
...
@@ -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.
"""Create a PDB model from a PDB file stream.
Parameters:
Parameters
- self (PdbStructure) The new object that is created.
----------
- input_stream (stream) An input file stream, probably created with
self : PdbStructure
open().
The new object that is created.
- load_all_models (bool) Whether to load every model of an NMR
input_stream : stream
structure or trajectory, or just load the first model, to save memory.
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
# initialize models
self
.
load_all_models
=
load_all_models
self
.
load_all_models
=
load_all_models
...
@@ -201,7 +204,7 @@ class PdbStructure(object):
...
@@ -201,7 +204,7 @@ class PdbStructure(object):
def
_reset_atom_numbers
(
self
):
def
_reset_atom_numbers
(
self
):
self
.
_atom_numbers_are_hex
=
False
self
.
_atom_numbers_are_hex
=
False
self
.
_next_atom_number
=
1
self
.
_next_atom_number
=
1
def
_reset_residue_numbers
(
self
):
def
_reset_residue_numbers
(
self
):
self
.
_residue_numbers_are_hex
=
False
self
.
_residue_numbers_are_hex
=
False
self
.
_next_residue_number
=
1
self
.
_next_residue_number
=
1
...
@@ -269,8 +272,11 @@ class PdbStructure(object):
...
@@ -269,8 +272,11 @@ class PdbStructure(object):
Iterate over atomic positions.
Iterate over atomic positions.
Parameters
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
model
in
self
.
iter_models
(
use_all_models
):
for
loc
in
model
.
iter_positions
(
include_alt_loc
):
for
loc
in
model
.
iter_positions
(
include_alt_loc
):
...
@@ -711,7 +717,7 @@ class Atom(object):
...
@@ -711,7 +717,7 @@ class Atom(object):
self
.
is_first_atom_in_chain
=
False
self
.
is_first_atom_in_chain
=
False
self
.
is_final_atom_in_chain
=
False
self
.
is_final_atom_in_chain
=
False
self
.
is_first_residue_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
# Start parsing fields from pdb line
self
.
record_name
=
pdb_line
[
0
:
6
].
strip
()
self
.
record_name
=
pdb_line
[
0
:
6
].
strip
()
if
pdbstructure
is
not
None
and
pdbstructure
.
_atom_numbers_are_hex
:
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):
...
@@ -186,10 +186,15 @@ class Modeller(object):
def
convertWater
(
self
,
model
=
'tip3p'
):
def
convertWater
(
self
,
model
=
'tip3p'
):
"""Convert all water molecules to a different water model.
"""Convert all water molecules to a different water model.
Parameters:
Parameters
- model (string='tip3p') the water model to convert to. Supported values are 'tip3p', 'spce', 'tip4pew', and 'tip5p'.
----------
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'
):
if
model
in
(
'tip3p'
,
'spce'
):
sites
=
3
sites
=
3
...
...
wrappers/python/simtk/openmm/app/pdbfile.py
View file @
bed427e7
...
@@ -64,8 +64,10 @@ class PDBFile(object):
...
@@ -64,8 +64,10 @@ class PDBFile(object):
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:
Parameters
- file (string) the name of the file to load
----------
file : string
the name of the file to load
"""
"""
top
=
Topology
()
top
=
Topology
()
## The Topology read from the PDB file
## The Topology read from the PDB file
...
...
wrappers/python/simtk/openmm/app/pdbreporter.py
View file @
bed427e7
...
@@ -44,9 +44,12 @@ class PDBReporter(object):
...
@@ -44,9 +44,12 @@ class PDBReporter(object):
def
__init__
(
self
,
file
,
reportInterval
):
def
__init__
(
self
,
file
,
reportInterval
):
"""Create a PDBReporter.
"""Create a PDBReporter.
Parameters:
Parameters
- file (string) The file to write to
----------
- reportInterval (int) The interval (in time steps) at which to write frames
file : string
The file to write to
reportInterval : int
The interval (in time steps) at which to write frames
"""
"""
self
.
_reportInterval
=
reportInterval
self
.
_reportInterval
=
reportInterval
self
.
_out
=
open
(
file
,
'w'
)
self
.
_out
=
open
(
file
,
'w'
)
...
...
wrappers/python/simtk/openmm/app/pdbxfile.py
View file @
bed427e7
...
@@ -53,10 +53,14 @@ class PDBxFile(object):
...
@@ -53,10 +53,14 @@ class PDBxFile(object):
def
__init__
(
self
,
file
):
def
__init__
(
self
,
file
):
"""Load a PDBx/mmCIF 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:
Parameters
- file (string) the name of the file to load. Alternatively you can pass an open file object.
----------
file : string
the name of the file to load. Alternatively you can pass an open
file object.
"""
"""
top
=
Topology
()
top
=
Topology
()
## The Topology read from the PDBx/mmCIF file
## 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):
...
@@ -55,13 +55,19 @@ class Simulation(object):
def
__init__
(
self
,
topology
,
system
,
integrator
,
platform
=
None
,
platformProperties
=
None
):
def
__init__
(
self
,
topology
,
system
,
integrator
,
platform
=
None
,
platformProperties
=
None
):
"""Create a Simulation.
"""Create a Simulation.
Parameters:
Parameters
- topology (Topology) A Topology describing the the system to simulate
----------
- system (System) The OpenMM System object to simulate
topology : Topology
- integrator (Integrator) The OpenMM Integrator to use for simulating the System
A Topology describing the the system to simulate
- platform (Platform=None) If not None, the OpenMM Platform to use
system : System
- platformProperties (map=None) If not None, a set of platform-specific properties to pass
The OpenMM System object to simulate
to the Context's constructor
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
## The Topology describing the system being simulated
self
.
topology
=
topology
self
.
topology
=
topology
...
...
wrappers/python/simtk/openmm/app/statedatareporter.py
View file @
bed427e7
...
@@ -60,31 +60,54 @@ class StateDataReporter(object):
...
@@ -60,31 +60,54 @@ class StateDataReporter(object):
progress
=
False
,
remainingTime
=
False
,
speed
=
False
,
elapsedTime
=
False
,
separator
=
','
,
systemMass
=
None
,
totalSteps
=
None
):
progress
=
False
,
remainingTime
=
False
,
speed
=
False
,
elapsedTime
=
False
,
separator
=
','
,
systemMass
=
None
,
totalSteps
=
None
):
"""Create a StateDataReporter.
"""Create a StateDataReporter.
Parameters:
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
file : string or file
- step (boolean=False) Whether to write the current step index to the file
The file to write to, specified as a file name or file object
- time (boolean=False) Whether to write the current time to the file
reportInterval : int
- potentialEnergy (boolean=False) Whether to write the potential energy to the file
The interval (in time steps) at which to write frames
- kineticEnergy (boolean=False) Whether to write the kinetic energy to the file
step : bool=False
- totalEnergy (boolean=False) Whether to write the total energy to the file
Whether to write the current step index to the file
- temperature (boolean=False) Whether to write the instantaneous temperature to the file
time : bool=False
- volume (boolean=False) Whether to write the periodic box volume to the file
Whether to write the current time to the file
- density (boolean=False) Whether to write the system density to the file
potentialEnergy : bool=False
- progress (boolean=False) Whether to write current progress (percent completion) to the file.
Whether to write the potential energy to the file
If this is True, you must also specify totalSteps.
kineticEnergy : bool=False
- remainingTime (boolean=False) Whether to write an estimate of the remaining clock time until
Whether to write the kinetic energy to the file
completion to the file. If this is True, you must also specify totalSteps.
totalEnergy : bool=False
- speed (bool=False) Whether to write an estimate of the simulation speed in ns/day to the file
Whether to write the total energy to the file
- elapsedTime (bool=False) Whether to write the elapsed time of the simulation in seconds to the file.
temperature : bool=False
- separator (string=',') The separator to use between columns in the file
Whether to write the instantaneous temperature to the file
- systemMass (mass=None) The total mass to use for the system when reporting density. If this is
volume : bool=False
None (the default), the system mass is computed by summing the masses of all particles. This
Whether to write the periodic box volume to the file
parameter is useful when the particle masses do not reflect their actual physical mass, such as
density : bool=False
when some particles have had their masses set to 0 to immobilize them.
Whether to write the system density to the file
- totalSteps (int=None) The total number of steps that will be included in the simulation. This
progress : bool=False
is required if either progress or remainingTime is set to True, and defines how many steps will
Whether to write current progress (percent completion) to the file.
indicate 100% completion.
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
.
_reportInterval
=
reportInterval
self
.
_openedFile
=
isinstance
(
file
,
str
)
self
.
_openedFile
=
isinstance
(
file
,
str
)
...
@@ -189,11 +212,16 @@ class StateDataReporter(object):
...
@@ -189,11 +212,16 @@ class StateDataReporter(object):
def
_constructReportValues
(
self
,
simulation
,
state
):
def
_constructReportValues
(
self
,
simulation
,
state
):
"""Query the simulation for the current state of our observables of interest.
"""Query the simulation for the current state of our observables of interest.
Parameters:
Parameters
- simulation (Simulation) The Simulation to generate a report for
----------
- state (State) The current state of the simulation
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
the simulation, to be printed or saved. Each element in the list
corresponds to one of the columns in the resulting CSV file.
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