Re: [AMBER] Using Pytraj to read and write velocity files

From: Korey M Reid <koreyr.unr.edu>
Date: Wed, 6 Jun 2018 07:50:32 +0000

thank you so very much this is exactly what I was looking for! It is an excellent solution!

Have an awesome week!


With gratitude,

Korey

________________________________
From: Hai Nguyen <nhai.qn.gmail.com>
Sent: Tuesday, June 5, 2018 9:21:08 PM
To: AMBER Mailing List
Cc: Daniel Roe
Subject: Re: [AMBER] Using Pytraj to read and write velocity files

uhm, clearly pytraj does not know how to read your velocity trajectory. I
will let Dan Roe to comment about the cpptraj's option.

Meanwhile, you can try to use parmed to read your netcdf file (hope that
works) and pass

In [17]: import parmed as pmd


In [18]: f = parmed.utils.netcdf.netcdf_file('files/tz2.nc')


In [19]: f.variables

Out[19]:

{'cell_angular': <parmed.utils.netcdf.netcdf_variable at 0x1131ea668>,

 'cell_spatial': <parmed.utils.netcdf.netcdf_variable at 0x1131ea710>,

 'coordinates': <parmed.utils.netcdf.netcdf_variable at 0x1131ea748>,

 'spatial': <parmed.utils.netcdf.netcdf_variable at 0x1131ea588>,

 'time': <parmed.utils.netcdf.netcdf_variable at 0x1131ea6a0>}


In [20]: f.variables['coordinates'].data # check f.variables to find your
keywords and replace "coordinates"


# Then reconstruct a pytraj's Trajectory

In [21]: import pytraj as pt

In [22]: traj = pt.Trajectory(xyz=f.variables['coordinates'].data,
top=your.top)

# Then do anything you want wit this.


# Above example shows way to get the data (e.g: coordinates, velocity) and
then you can update the traj

traj.xyz = your_xyz

traj.velocity = your_velocity

Hai

On Wed, Jun 6, 2018 at 12:03 AM, Korey M Reid <koreyr.unr.edu> wrote:

> Hello Hai,
>
> I have produced separate coordinate and velocity netcdf trajectory files
> with input options ntwx=5 and ntwv=2.5. This is so I can accurately
> calculate the midpoint of the velocity trajectory timepoints so that they
> match the coordinate timepoints. I would like to perform this with pytraj.
> However when I attempt to load the velocity trajectory files like so:
>
> >traj_vel = pt.load('vel.netcdf',top='top.parm7')
>
> the velocities fail to load. When I check the trajectory:
>
> >traj_vel
>
> the output reads:
>
> pytraj.Trajectory, 0 frames:
> Size: 0.000000 (GB)
> <Topology: 30220 atoms, 8815 residues, 8525 mols, PBC with box type =
> truncoct>
>
>
> and if I attempt to follow your example (thank you for this example I used
> it as a reference some time ago to extract the t0-dt/2 frame some time ago)
> running the following command in python:
>
> >traj_vel.velocities
>
> there is no output, which supports the 0GB trajectory file which from my
> simulations should read 4GB or so. This is why I am curious if like cpptraj
> there is an option to read velocities as coordinates since I am having such
> difficulty finding a solution to my needs.
>
>
> Thank you for your help!
>
>
> With best,
>
> Korey
>
>
> ________________________________
> From: Hai Nguyen <nhai.qn.gmail.com>
> Sent: Saturday, June 2, 2018 3:44:59 PM
> To: AMBER Mailing List
> Subject: Re: [AMBER] Using Pytraj to read and write velocity files
>
> Hi Korey,
>
> Can you elaborate about "unsuccessful at reading in velocity netcdf files
> produced from simulation"? (e.g: what's command you used?)
> PS: I've posted an example a while ago and I hope that helps:
> https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Farchive.ambermd.org%2F201805%2F0078.html&data=
> 01%7C01%7Ckoreyr%40unr.edu%7C51ed053e33494edb2c9f08d5c8da82de%
> 7C523b4bfc0ebd4c03b2b96f6a17fd31d8%7C1&sdata=%2FxFdna%
> 2Bz5vU1n1eF5sI0jnssVAVJFKIIXpzms1bIZfg%3D&reserved=0
>
> Hai
>
>
> On Sat, Jun 2, 2018 at 12:08 AM, Korey M Reid <koreyr.unr.edu> wrote:
>
> > Dear all,
> >
> > I have been able to extract velocity coordinates from a restart file up
> to
> > know for calculations down the line. However, I have been unsuccessful at
> > reading in velocity netcdf files produced from simulation. Is there a
> flag
> > that I have been unable to identify such as in cpptraj's usevelascoords?
> > The reason I ask is that I would like to code my analysis in python and I
> > need to slice things in an unexpected way and would like to avoid
> rerunning
> > some long simulations. As always thank you for your input and time!
> >
> >
> > With best,
> >
> > Korey Reid
> >
> > University of Nevada, Reno
> >
> > Chemistry Dept.
> >
> > Emphasis: Energy flow, Barrier conductance accross proteins, entropy
> meters
> > _______________________________________________
> > AMBER mailing list
> > AMBER.ambermd.org
> > https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Flists.ambermd.org%2Fmailman%2Flistinfo%
> 2Famber&data=01%7C01%7Ckoreyr%40unr.edu%7C51ed053e33494edb2c9f08d5c8da
> 82de%7C523b4bfc0ebd4c03b2b96f6a17fd31d8%7C1&sdata=1%
> 2BHtFB0MaHN7eTwd4PvS97mzTJZXex9ilKNgWvc2Igs%3D&reserved=0
> >
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Flists.ambermd.org%2Fmailman%2Flistinfo%
> 2Famber&data=01%7C01%7Ckoreyr%40unr.edu%7C51ed053e33494edb2c9f08d5c8da
> 82de%7C523b4bfc0ebd4c03b2b96f6a17fd31d8%7C1&sdata=1%
> 2BHtFB0MaHN7eTwd4PvS97mzTJZXex9ilKNgWvc2Igs%3D&reserved=0
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.ambermd.org%2Fmailman%2Flistinfo%2Famber&data=01%7C01%7Ckoreyr%40unr.edu%7C478936f14e94496ee0b408d5cb64ffb2%7C523b4bfc0ebd4c03b2b96f6a17fd31d8%7C1&sdata=0ZTGfbhxcWAf3Pg%2FA%2BvE0trsJgcq6%2FsCgSt7Pl6Rn7o%3D&reserved=0
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.ambermd.org%2Fmailman%2Flistinfo%2Famber&data=01%7C01%7Ckoreyr%40unr.edu%7C478936f14e94496ee0b408d5cb64ffb2%7C523b4bfc0ebd4c03b2b96f6a17fd31d8%7C1&sdata=0ZTGfbhxcWAf3Pg%2FA%2BvE0trsJgcq6%2FsCgSt7Pl6Rn7o%3D&reserved=0
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Jun 06 2018 - 01:00:03 PDT
Custom Search