Skip to content

Commit

Permalink
Use a working example for the aux reader (#52)
Browse files Browse the repository at this point in the history
This depends on MDAnalysis/mdanalysis#1290 being merged!
  • Loading branch information
jbarnoud authored and kain88-de committed Apr 8, 2017
1 parent 085053f commit 3343316
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions _posts/2017-11-11-release-0.16.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ auxiliary data corresponding to the current time step.

{% highlight python %}
import MDAnalysis as mda
from MDAnalysisTests.datafiles import PDB_sub_sol, XTC_sub_sol, XVG_BZ2

# Create your universe as usual
universe = mda.Universe(SIMULATION)
# Attach an auxiliary time serie with the name `pull_force`
universe.trajectory.add_auxiliaty('pull_force', 'md_f.xvg')
universe = mda.Universe(PDB_sub_sol, XTC_sub_sol)
# Attach an auxiliary time serie with the name `forces`
# In this example, the XVG file contains the force that applies to each atom.
universe.trajectory.add_auxiliary('forces', XVG_BZ2)
# Itarete through your trajectory, the time serie is kept in sync
for time_step in universe.trajectory:
print(time_step.aux.pull_force)
print(time_step.aux.forces)
# The first element of each array is the time in picoseconds.
# The next elements are the other columns of the XVG file.
{% endhighlight %}

@fiona-naugthon worked at offering several convenient way to iterate through your
Expand Down

0 comments on commit 3343316

Please sign in to comment.