-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add control structures to cpptraj scripts #556
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…detailed output and error messages.
…ration for adding generic variables to for loop.
…pporting different for loop types
…stinguished by its destination. This way it shows up in the CONTROL category for help.
…/residues/molecules in a given mask.
…re in data set name
…arge integers in pointers section.
The jenkins failure is a cuda driver problem I think, not code. Updated syntax for
Scalar data sets can now be used as script variables as well, although only the first value from a data set will be used. This can be expanded later if necessary. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a control structure framework to cpptraj scripts; specifically
for
loops. Since it represents a significant feature addition I'm keeping it a work in progress for the time being.The
for
loop can currently be over atom masks or integers. Help entry:Any number of loop types can be combined into a single
for
statement. For example:Would loop over atoms in mask
:1-27&!@H=
while setting variablei
to 1 and incrementing by 1 each iteration of the loop. If multiple end conditions exist within a singlefor
loop the loop will execute until the first end condition is reached. For loops can also be nested.Variables created by
for
loops are called "script" variables and are prefaced by$
. This was chosen because it doesn't clash with existing cpptraj syntax and is familiar to almost all programmers. It also won't conflict with existing shell scripts since the$
would need to be protected in order to make it to cpptraj (rendering it a non-variable to the shell script).NOTE: the
for
loop could potentially render the commandsmulticurve
andmultihist
obsolete. Themultidihedral
andmultivector
commands have some additional functionality which justifies keeping them around.This also adds two commands that pertain to "script" variables.
This means that "script" variables can be used as placeholders in cpptraj scripts, e.g.:
Note that "script" variables in
for
loops themselves are currently only allowed in the outermost loop; script variables in nested loops are not currently supported.