schrodinger.application.desmond.packages.msys.molfile package¶
Structure and coordinate file manipulation library.
Reading a structure file:
reader = molfile.mae.read('/path/to/foo.mae')
Iterating through the frames in a file:
for frame in molfile.dtr.read('/path/to/foo.dtr').frames():
function( frame.pos, frame.vel, frame.time, frame.box )
Random access to frames (only dtr files support this currently):
f27 = molfile.dtr.read('/path/to/foo.dtr').frame(27) # 0-based index
Convert an mae file to a pdb file:
input=molfile.mae.read('foo.mae')
output=molfile.pdb.write('foo.pdb', atoms=input.atoms)
output.frame(input.frames().next())
output.close()
Write every 10th frame in a dtr to a trr:
input=molfile.dtr.read('big.dtr')
output=molfile.trr.write('out.trr, natoms=input.natoms)
for i in range(0,input.nframes, 10):
output.frame( input.frame(i) )
output.close()
Write a frame with a specified set of gids:
f = molfile.Frame(natoms, with_gids=True
f.gid[:] = my_gids
f.pos[:] = my_positions
w.frame(f)
Read the raw fields from a frameset (dtr):
dtr = molfile.DtrReader('input.dtr') # also works for stk
for i in range(dtr.nframes):
f = dtr.frame(i)
keyvals = dict()
frame = dtr.frame(i, keyvals=keyvals)
## use data in keyvals
Write raw fields to a frameset (dtr):
dtr = molfile.DtrWriter('output.dtr', natoms=natoms)
keyvals = dict( s = "a string",
f = positions.flatten(), # must be 1d arrays
i = numpy.array([1,2,3]),
)
dtr.append( time = my_time, keyvals = keyvals )
-
schrodinger.application.desmond.packages.msys.molfile.
register_plugin
(plugin)¶ put plugin in the global namespace, and add to extensiondict
-
schrodinger.application.desmond.packages.msys.molfile.
guess_filetype
(filename, default=None)¶ return plugin name based on filename, or default if none found.
-
class
schrodinger.application.desmond.packages.msys.molfile.
FrameIter
(reader)¶ Bases:
object
-
__init__
(reader)¶ Initialize self. See help(type(self)) for accurate signature.
-
skip
(count=1)¶
-
-
class
schrodinger.application.desmond.packages.msys.molfile.
Grid
(data, name='', axis=None, origin=None)¶ Bases:
object
-
__init__
(data, name='', axis=None, origin=None)¶ construct a new Grid object. data - 3d array of data; a copy is made. name - name for the grid. default empty string. axis - 3x3 array with grid axes in the rows. Default diag(1,1,1) origin - 0,0,0 corner of grid. Defaults to [0,0,0]
-
name
¶
-
data
¶
-
axis
¶
-
origin
¶
-
-
class
schrodinger.application.desmond.packages.msys.molfile.
StkFile
¶ Bases:
object
Generalized stk file: handles any molfile format that provides times
-
name
= 'ls'¶
-
filename_extensions
= 'ls'¶
-
classmethod
read
(path, filetype=None)¶
-
class
Reader
(path, filetype)¶ Bases:
object
-
__init__
(path, filetype)¶ Initialize self. See help(type(self)) for accurate signature.
-
natoms
¶
-
nframes
¶
-
frames
()¶
-
frame
(n)¶
-
get_prop
(prop)¶ Use the same technique as used for times to generate a properly ordered set of properties across all readers
-
at_time_near
(time)¶
-
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.application.desmond.packages.msys.molfile.
SeqFile
¶ Bases:
object
Read csv-like files with column names in the first row
-
filename_extensions
= 'seq'¶
-
name
= 'seq'¶
-
classmethod
read
(path)¶ Open an eneseq file for reading
-
class
Reader
(path)¶ Bases:
object
-
__init__
(path)¶ Only use a direct read to determine the header for the file Otherwise, use numpy.loadtxt
-
natoms
¶
-
nframes
¶
-
get_prop
(prop)¶
-
frame
(n)¶
-
frames
()¶
-
at_time_near
(time)¶
-
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
schrodinger.application.desmond.packages.msys.molfile.
ls
¶ alias of
schrodinger.application.desmond.packages.msys.molfile.StkFile
-
schrodinger.application.desmond.packages.msys.molfile.
seq
¶ alias of
schrodinger.application.desmond.packages.msys.molfile.SeqFile