Contents
This tutorial is for those who love running cpptraj in batch mode. Try it online:
Note
This tutorial is for advanced users and the syntax might be changed in future.
if you want to run cpptraj’s batch mode like below:
parm tz2.ortho.parm7
trajin tz2.ortho.nc
autoimage
rms first @CA
radgyr @H,C,N,O
molsurf
you can create a ‘CpptrajState’
TrajectoryIterator
class¶# load traj first
In [1]: import pytraj as pt
In [2]: traj = pt.iterload('./tz2.ortho.nc', 'tz2.ortho.parm7')
In [3]: traj
Out[3]:
pytraj.TrajectoryIterator, 10 frames:
Size: 0.001183 (GB)
<Topology: 5293 atoms, 1704 residues, 1692 mols, PBC with box type = ortho>
# create text (do not need to have ``parm`` and ``trajin`` info)
In [4]: text = '''
...: autoimage
...: rms first @CA
...: radgyr @H,C,N,O
...: molsurf @CA'''
...:
# load CpptrajState
In [5]: state = pt.load_batch(traj, text)
# performa calculation
In [6]: state.run()
Out[6]:
CpptrajState, include:
<datasetlist: 5 datasets>
In [7]: state