I'm having a bit of trouble understanding how the ParmEd Python API handles
NetCDF trajectory files. For example:
>>> import parmed as pmd
>>> mol = pmd.load_file(<prmtop>, xyz=<mdcrd>)
Where mdcrd is a NetCDF trajectory from a simulation. The documentation
states "If the file is a trajectory file, the first frame is used for the
coordinates." This is more or less what I want - a single structure and, if
possible, to avoid the time-consuming process of reading a whole
trajectory. Indeed this is what the object contains (using results from a
real file now):
>>> mol.coordinates.shape
(201, 3)
>>> len(mol.atoms)
201
However I see that some of the I/O interfaces instead use the (hidden?)
method get_coordinates() instead of the coordinate attribute and *this*
returns the whole trajectory by default:
>>> mol.get_coordinates().shape
(250, 201, 3)
Thus something like:
>>> mol.save('foo.pqr')
Actually contains many structures (= not what I expected). This can be
circumvented by specifying the "coordinates" parameter to save(), but it'd
be nice if I could just delete all of the frames that I don't want from the
object -- is this possible? I would like to write several files and it is
tedious to keep reassigning coordinates plus they are just wasted RAM and
expensive to copy (e.g. if I want to strip some atoms and write a different
set of file).
Thanks,
Brian
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Nov 20 2019 - 08:00:01 PST