How to cut the trajectory of an universe at given times and use it in a radial distribution function analysis and similar?

353 views
Skip to first unread message

Elías C

unread,
Sep 13, 2021, 10:53:08 PM9/13/21
to mdnalysis-...@googlegroups.com
Dear researchers,

I am working with an xtc file obtained from gromacs. It has 3000 frames, in total 30 ns, I would like to use the data from the first 10 ns to perform a RDF analysis. I have read about how to cut a trajectory with MDAnalysis but I don't understand how to integrate the method in a type of analysis for which, a for loop is not commonly used.

Thank you for reading.

Ropon-Palacios G.

unread,
Sep 13, 2021, 11:01:40 PM9/13/21
to mdnalysis-...@googlegroups.com

a common way would be for you to select the number of frames you want to use

 

u.traj [0: 1000]

 

this could select the first 1000 frames.

in your case it would be [0: 10000], the first 10,000.

 

To un loop can use:

for i in u.traj[0:10000]:

do anything

 

 

Best,

 

Geo.

 

From: <mdnalysis-...@googlegroups.com> on behalf of Elías C <ecoba...@gmail.com>
Reply-To: <mdnalysis-...@googlegroups.com>
Date: Monday, September 13, 2021 at 9:53 PM
To: <mdnalysis-...@googlegroups.com>
Subject: [mdnalysis-discussion] How to cut the trajectory of an universe at given times and use it in a radial distribution function analysis and similar?

 

Thank you for reading.



Hugo Macdermott-Opeskin

unread,
Sep 13, 2021, 11:04:04 PM9/13/21
to MDnalysis discussion
Hi,

You can use the `start, stop step` keywords to slice the trajectory for analysis.

For example 

`
import MDAnalysis as mda
u = mda.Universe(my_topology, my_trajectory)
ag1 = u.select("group1")
ag2 = u.select("group2")

rdf = mda.analysis.rdf.InterRDF(ag1, ag2, start=0, stop=1000, step=1)
rdf.run()
`

Elías C

unread,
Sep 13, 2021, 11:27:40 PM9/13/21
to mdnalysis-...@googlegroups.com
Thank you. It was very simple. I am very grateful.

--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/80a6809f-e535-4900-9a4e-9136faa00ed4n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages