Re: [AMBER] Difference in velocity values between parmed and pytraj

From: Jason Swails <jason.swails.gmail.com>
Date: Mon, 9 Sep 2019 11:56:34 -0400

I'm a little late to the party here, but I'll add a comment from the ParmEd
perspective.

ParmEd is not intended to be an analysis engine -- it's supposed to provide
the base of file format interconversion and system manipulation. To this
end, it's easier to work with "natural" units that are easy to think about.

For pytraj and cpptraj, where the primary use-case is analysis, Dan
(correctly) pointed out that for these use cases, it's more convenient to
work with scaled velocities. Neither is "wrong" -- they're optimized for
different purposes.

HTH,
Jason

On Thu, Aug 8, 2019 at 3:23 PM Daniel Roe <daniel.r.roe.gmail.com> wrote:

> Hi,
>
> On Thu, Aug 8, 2019 at 3:06 PM Irfan Alibay
> <irfan.alibay.lists.gmail.com> wrote:
> >
> > So from the looks of it, pytraj/cpptraj ignores the 'scale_factor'
> variable
>
> It's not that they ignore the scale factor - it's just that 1) keeping
> the velocities in those units is consistent with what the MD engines
> in Amber do and 2) using those units make things like the kinetic
> energy calculation easier (since they are the actual AKMA units for
> velocity).
>
> That said, it may be a good idea to have an option for converting the
> velocities to different units. I'll open an issue on GitHub...
>
> -Dan
>
> > attribute, or at least doesn't scale the values when displaying the
> > trajectory object. I guess the follow up question is; in order for users
> to
> > have consistent units for all NetCDF variables in pytraj, is the only
> > approach to implement one's own scale_factor reader and multiplying
> through?
> >
> > Many thanks,
> >
> > Irfan Alibay
> > Postdoctoral Research Associate
> > Department of Biochemistry
> > The University of Oxford
> >
> > On Wed, Aug 7, 2019 at 4:48 PM Hai Nguyen <nhai.qn.gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I think pytraj (which is cpptraj under the hood) reads whatever
> velocity
> > > stored in the trajectory file as it is.
> > > It seems like parmed does the auto-conversion if traj is in amber
> format.
> > >
> > > In [31]: import pytraj as pt
> > >
> > >
> > >
> > > In [32]: from scipy.io import netcdf
> > >
> > >
> > >
> > > In [33]: traj = pt.iterload('trunc.nc', 'system.prmtop')
> > >
> > >
> > >
> > > In [34]: fh = netcdf.netcdf_file('./trunc.nc')
> > >
> > >
> > >
> > > In [35]: # pytraj
> > >
> > >
> > >
> > > In [36]: traj[0].velocity
> > >
> > >
> > > Out[36]:
> > > array([[-0.06234377, -0.212735 , -0.07553997],
> > > [-0.33413538, -0.97585237, 0.41033223],
> > > [ 0.28189024, 0.3869082 , 0.55642217],
> > > ...,
> > > [-0.06586777, -0.31600413, 0.39305016],
> > > [-0.53357279, 0.21872835, -0.2971119 ],
> > > [-0.28074518, -0.06457534, 0.27767515]])
> > >
> > > In [37]: # raw data (via scipy)
> > >
> > >
> > >
> > > In [38]: fh.variables['velocities'].data[0]
> > >
> > >
> > > Out[38]:
> > > array([[-0.06234377, -0.212735 , -0.07553997],
> > > [-0.33413538, -0.9758524 , 0.41033223],
> > > [ 0.28189024, 0.3869082 , 0.5564222 ],
> > > ...,
> > > [-0.06586777, -0.31600413, 0.39305016],
> > > [-0.5335728 , 0.21872835, -0.2971119 ],
> > > [-0.28074518, -0.06457534, 0.27767515]], dtype=float32)
> > >
> > > Hai
> > >
> > > On Wed, Aug 7, 2019 at 11:13 AM Irfan Alibay <
> irfan.alibay.lists.gmail.com
> > > >
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I have noticed that on reading a NetCDF restart file, parmed and
> pytraj
> > > > will report different velocity values which are off by a factor of
> > > 20.455.
> > > >
> > > > I unfortunately couldn't find a definite answer as to what velocity
> units
> > > > are used in parmed and pytraj respectively. So, as a sanity check, I
> was
> > > > wondering if anyone on-list could confirm that:
> > > >
> > > > parmed reports velocities in Angstroms per ps
> > > > pytraj reports velocities in Angstroms per 1/20.455 ps (as per
> > > > http://ambermd.org/formats.html)
> > > >
> > > > Many thanks,
> > > >
> > > > Irfan Alibay
> > > > Postdoctoral Research Associate
> > > > Department of Biochemistry
> > > > The University of Oxford
> > > > _______________________________________________
> > > > AMBER mailing list
> > > > AMBER.ambermd.org
> > > > http://lists.ambermd.org/mailman/listinfo/amber
> > > >
> > > _______________________________________________
> > > AMBER mailing list
> > > AMBER.ambermd.org
> > > http://lists.ambermd.org/mailman/listinfo/amber
> > >
> > _______________________________________________
> > AMBER mailing list
> > AMBER.ambermd.org
> > http://lists.ambermd.org/mailman/listinfo/amber
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>


-- 
Jason M. Swails
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Sep 09 2019 - 09:00:02 PDT
Custom Search