Package schrodinger :: Package application :: Package desmond :: Package packages :: Package msys :: Package molfile
[hide private]
[frames] | no frames]

Package molfile

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 )
Submodules [hide private]

Classes [hide private]
  FrameIter
  Grid
  StkFile
Generalized stk file: handles any molfile format that provides times
  SeqFile
Read csv-like files with column names in the first row
  ls
Generalized stk file: handles any molfile format that provides times
  seq
Read csv-like files with column names in the first row
Functions [hide private]
 
register_plugin(plugin)
put plugin in the global namespace, and add to extensiondict
 
load_shared_library(path)
 
guess_filetype(filename, default=None)
return plugin name based on filename, or default if none found.
 
_grid_from_reader(reader, n)
 
_grid_to_writer(writer, grid)
Variables [hide private]
  extensiondict = {'atr': [<Plugin for DESRES Trajectory, clobbe...
  with_pandas = True
hash(x)
  __package__ = 'schrodinger.application.desmond.packages.msys.m...
  dcd = <Plugin for CHARMM,NAMD,XPLOR DCD Trajectory>
  dms = <Plugin for DESRES Structure>
  dtr = <Plugin for DESRES Trajectory, clobber>
  dtr_append = <Plugin for DESRES Trajectory, append>
  dtr_clobber = <Plugin for DESRES Trajectory, clobber>
  dtr_noclobber = <Plugin for DESRES Trajectory, no-clobber>
  dtr_serialized_version = '0008'
  dx = <Plugin for DX>
  force_dtr = <Plugin for DESRES Force Trajectory>
  g96 = <Plugin for Gromacs g96>
  gro = <Plugin for Gromacs GRO>
  mae = <Plugin for MAESTRO file>
  mol2 = <Plugin for MDL mol2>
  parm7 = <Plugin for AMBER7 Parm>
  pdb = <Plugin for PDB>
  psf = <Plugin for CHARMM,NAMD,XPLOR PSF>
  rst = <Plugin for Amber restart file>
  sdf = <Plugin for SDF>
  trj = <Plugin for Gromacs TRJ Trajectory>
  trr = <Plugin for Gromacs TRR Trajectory>
  webpdb = <Plugin for Web PDB Download>
  xtc = <Plugin for Gromacs XTC Compressed Trajectory>
  xyz = <Plugin for XYZ>
Variables Details [hide private]

extensiondict

Value:
{'atr': [<Plugin for DESRES Trajectory, clobber>],
 'atr/': [<Plugin for DESRES Trajectory, clobber>],
 'cms': [<Plugin for MAESTRO file>],
 'cms.gz': [<Plugin for MAESTRO file>],
 'dcd': [<Plugin for CHARMM,NAMD,XPLOR DCD Trajectory>],
 'dms': [<Plugin for DESRES Structure>],
 'dms.gz': [<Plugin for DESRES Structure>],
 'dtr': [<Plugin for DESRES Trajectory, clobber>],
...

__package__

Value:
'schrodinger.application.desmond.packages.msys.molfile'