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)[source]¶
put plugin in the global namespace, and add to extensiondict
- schrodinger.application.desmond.packages.msys.molfile.guess_filetype(filename, default=None)[source]¶
return plugin name based on filename, or default if none found.
- class schrodinger.application.desmond.packages.msys.molfile.FrameIter(reader)[source]¶
Bases:
object
- class schrodinger.application.desmond.packages.msys.molfile.Grid(data, name='', axis=None, origin=None)[source]¶
Bases:
object
- __init__(data, name='', axis=None, origin=None)[source]¶
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]
- property name¶
- property data¶
- property axis¶
- property origin¶
- class schrodinger.application.desmond.packages.msys.molfile.StkFile[source]¶
Bases:
object
Generalized stk file: handles any molfile format that provides times
- name = 'ls'¶
- filename_extensions = 'ls'¶
- class schrodinger.application.desmond.packages.msys.molfile.SeqFile[source]¶
Bases:
object
Read csv-like files with column names in the first row
- filename_extensions = 'seq'¶
- name = 'seq'¶
- 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