Make 'makestructure' a Command Instead of an Action
@swails and @hainm, I'd like your feedback on this in particular since we've discussed things like this in the past (e.g. #179).
Since they are really designed to operate on a single input structure (dihedralscan will rotate selected dihedrals by intervals to generate a trajectory or randomly, makestructure will rotate selected dihedrals to target values) it makes sense to me to have these be commands (Exec classes in the new cpptraj command framework) instead of Actions. I originally wrote these when the command structure was not so refined. atommap could also be a candidate but it actually can act like an Action for remapping so I wouldn't consider so it's not quite in the same boat.
I'd also change the dihedralscan name to something like permutedihedrals to better reflect what it does.
@drroe
Can remind me again about the real difference between action and command?
An input example would be great.
Is command only used for interactive mode?
Can remind me again about the real difference between action and command?
In the new framework, the core of any command given in cpptraj is the class DispatchObject. There are currently 4 classes that inherit DispatchObject (i.e. 4 basic kinds of commands):
- Action: Placed into the Action queue to be executed during a Run.
- Analysis: Placed into the Analysis queue to be executed after a Run (or via
runanalysis). - Deprecated: Deprecated command; no execution, just print helpful messages about alternatives etc.
- Exec: Command to be executed immediately.
So for example, rms is an Action that gets sent to the Action queue. But trajin is a command that gets executed immediately and places an input trajectory in TrajinList. Does that make sense?
Is command only used for interactive mode?
All commands execute the same way in batch and interactive mode (otherwise behavior would not be consistent). The only difference between batch and interactive mode is that in interactive mode errors don't exit the program by default.
It seems I need to improve documentation on cpptraj behavior. I tried to address this in section 29.1.4 of the manual but I need to improve it so that users aren't similarly confused.
I don't use either of those commands, so my opinion would probably be a bit arbitrary here.
Is anybody actually using these commands in a non-command way (i.e., a deferred action dropped into the stack)? If people that use these commands now do something like
trajin restart
makestructure <whatever>
run # to get it to run quickly
# do other stuff
then yea, move it to a command. But I don't have a good feel for how people are actually using it in the wild.
But I don't have a good feel for how people are actually using it in the wild.
I don't either. A brief search of my email (which includes Amber list emails) shows that 2 people tried to use makestructure, both on single frames, and all suggestions that I (and in one case @hainm) made for makestructure were 1 frame only.
I could only find one user that tried to use dihedralscan and they thought it would look for dihedrals (which is what prompted the discussion in #179). So I'm pretty sure I'm going to do this.
@swails and @hainm, what do you think of deprecating dihedralscan and naming it permutedihedrals?
So for example, rms is an Action that gets sent to the Action queue. But trajin is a command that gets executed immediately and places an input trajectory in TrajinList. Does that make sense?
yeap. I see.
don't either. A brief search of my email (which includes Amber list emails) shows that 2 people tried to use makestructure, both on single frames, and all suggestions that I (and in one case @hainm) made for makestructure were 1 frame only.
if so, I would prefer to keep "makestructure" as Action since I already implemented in pytraj (Action class). Currently pytraj does not see the need to use cpptraj excel class.
Motivation with makestructure: I can create a new Trajectory with rotated dihedral for given residue and then can view Trajectory with nglview (in Jupyter notebook).
so how's about keeping makestructure in Action and leave dihedralscan in command.
what do you think of deprecating dihedralscan and naming it permutedihedrals?
:+1:
if so, I would prefer to keep "makestructure" as Action since I already implemented in pytraj
OK, in the interests of not messing with pytraj too much right before the release, I'll keep makestructure an Action for now.
Changed the title to reflect #238
I know how to call Exec class now (via creating cpptraj state) and am ready for your change.