Extracts metadata from MD trajectories. This tool comes with an powerful interpreter of reverse polish notation to represent complex system properties in a condensed way.
A compact notation to express arbitrary mathematical operations while refraining from the extensive usage of braces is called the reverse polish notation. In general, it is a postfix syntax, that is, the operator is written after the operands. For example the first line becomes
(3 + 4) * (5 + 6) / 7
3 4 + 5 6 + * 7 /
The list of the operands waiting to be consumed by an operator is called stack. Objects can be placed on the stack arbitrarily. However, this implementation requires you to end with a single entry on the stack. Each of the objects can be both a scalar and a vector.
Suppose you have a molecule with three points of interest, which shall be called A, B, and C. You are interested in the angle of the vectors BA and CB with the zaxis and the angle between these two vectors. Then the following lines will give you three angles in radians per frame.
f_timeseries.py input.psf input.dcd periodic \
cmd 'selection A:com; selection B:com;diff;0,0,1;angle' \
cmd 'selection B:com; selection C:com;diff;0,0,1;angle' \
cmd 'selection A:com; selection B:com;diff;selection B:com; selection C:com;diff;angle'
Sometimes a command will be used frequently. Hence, there are shortcuts in this case. The following shortcuts are available. Each time, the two lines are identical.
# prints the side lengths (x, y, z) of the unit cell
box
boxdimen;1,1,1,0,0,0;mask;3;pile
All file formats of MDAnalysis are supported. Input files may be compressed using gzip or bzip2.
Note
File formats are recognized by file extension. Therefore, you have to stick to the standard file extensions.
Warning
Only rectangular simulation boxes are currently supported.
Todo
Guess input file format.
The topology file to work with.
The coordinate file to work with.
The zerobased frame selection that allows for slicing. The general syntax is ‘start:stop:step’ which would select all frames from start to stop (excluding stop) while skipping step frames inbetween. Selecting single frames by specifying a single number is possible. Negative indices count backwards from the end of the trajectory.
Whether to wrap atoms for spatial selection criteria back to the original cell.
Files that contain named groups of atoms based on their indices. Files have to be in GROMACS ndxFormat. Can be used multiple times.
String concatenating the operators using reverse polish notation together with atom selectors. This command can be issued multiple times on the command line. Every option will result in an additional entry printed in the resulting line per frame. The general notation is
selection:cmd;selection2:cmd2
There are some operators that do not support selections. They are meant to be used this way
:cmd;:cmd2
You can put elements on the stack by yourself. They have to be numeric, but can be either a commaseparated vector or a scalar. The selection syntax is decribed separately. Please refer to the section on atom selections. The available operators are
id 110:com
1,1,1; 2,2,2; dist
id 110:com; id 1120:com; dist
3;4;diff
id 110:com; id 1120:com; diff
stacklen
framenum
boxdimen
boxdimen;1,1,0,0,0,0;mask
0,60;100;0,0,1;not resname UNK:charge
type PL:fitplane
Note
The algorithm used is Singular Value Decomposition. Please make sure that you only have only atoms for one plane as multiple parallel planes in the underlying structure will lead to spurious errors.
boxdimen;1,1,1,0,0,0;mask;3;pile
id 2,5,7,8:dihedral
Lists the current stack elements.
Parameters:  stack : iterable
output : output_tracker instance


Reverse polish notation parser.
Parameters:  columns : iterable
command : String
framenum : Integer
universe : MDAnalysis.core.AtomGroup.Universe
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that calculates the angle between the last two stack elements.
The last two stack elements have to be a vector.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that filters amongst the last stack elements as long as their shape is compatible with the mask.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that puts the simulation box dimensions on the stack.
Parameters:  stack : iterable
universe : MDAnalysis.core.AtomGroup.Universe
framenum : Integer
output : output_tracker instance


Reverse polish notation operator that calculates the charge density profile.
Note
Only works correctly for charge density profiles along the z axis.
Todo
Implement vector choice.
Parameters:  stack : iterable
selection : String
universe : MDAnalysis.core.AtomGroup.Universe
framenum : Integer
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that calculates the center of mass.
Parameters:  selection : String
universe : MDAnalysis.core.AtomGroup.Universe
output : output_tracker instance


Returns:  numpy.array :

Reverse polish notation operator that calculates the difference between the last two stack elements.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that calculates the dihedral angle.
Parameters:  stack : iterable
selection : String
universe : MDAnalysis.core.AtomGroup.Universe
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that calculates the distance between the last two stack elements.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that fits a plane to coordinates.
Parameters:  stack : iterable
selection : String
universe : MDAnalysis.core.AtomGroup.Universe
framenum : Integer
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that puts every element of an vector on the stack separately.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  Iterable :

Reverse polish notation operator that calculates the quotient of the last two stack elements.
Note that the last stack element is treated as numerator.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that filters amongst the last stack elements.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that joins elements on the stack info one single vector.
Parameters:  stack : Iterable
output : output_tracker instance


Returns:  Iterable :

Reverse polish notation operator that calculates the product of the last two stack elements.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Reverse polish notation operator that calculates the sum of the last two stack elements.
Parameters:  stack : iterable
output : output_tracker instance


Returns:  iterable :

Takes the requested number of elements from the stack.
Parameters:  stack : iterable
length : int
output : output_tracker instance


Returns:  tuple :
