Amber-MD / pytraj

Python interface of cpptraj

Home Page:https://amber-md.github.io/pytraj

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add multipucker action

hainm opened this issue · comments

Please see the pucker function here:

pytraj/pytraj/all_actions.py

Lines 2244 to 2294 in 6d62181

@register_pmap
def pucker(traj=None,
pucker_mask=("C1'", "C2'", "C3'", "C4'", "O4'"),
resrange=None,
top=None,
dtype='dataset',
range360=False,
method='altona',
use_com=True,
amplitude=False,
offset=None):
"""compute pucker
Parameters
----------
traj : Trajectory-like
pucker_mask : str
resrange : None or array of int
top : Topology, optional
dtype : str, return type
range360: bool, use 360 or 180 scale
method : {'altona', 'cremer'}, default 'altona'
use_com : bool
amplitude : bool, default False
offset : None or float
Returns
-------
Dataset
"""
top_ = get_topology(traj, top)
if resrange is None:
resrange = range(top_.n_residues)
_range360 = "range360" if range360 else ""
geom = "geom" if not use_com else ""
amp = "amplitude" if amplitude else ""
offset_ = "offset " + str(offset) if offset else ""
c_dslist = CpptrajDatasetList()
for res in resrange:
command = " ".join((":" + str(res + 1) + '@' + x for x in pucker_mask))
name = "pucker_res" + str(res + 1)
command = " ".join((name, command, _range360, method, geom, amp,
offset_))
act = c_action.Action_Pucker()
act(command, traj, top=top_, dslist=c_dslist)
return get_data_from_dtype(c_dslist, dtype)

You could do similar to multipucker