Skip to content
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 'splitcoords' command and 'for VAR in <list>' for loop #636

Merged
merged 8 commits into from
Sep 7, 2018

Conversation

drroe
Copy link
Contributor

@drroe drroe commented Sep 7, 2018

This PR adds a new command and new for loop type (and tests for both).

New splitcoords command

splitcoords <crd set> name <output set name>

Will split the trajectory <crd set> by molecule and output to a new COORDS set. I added this since I've been doing a lot of work with the REPLICA functionality in CHARMM lately and it's useful to be able to split the replicated system back into molecules. Very basic right now but gets the job done.

New for loop type

for <var> in <list>

Here <list> is a comma-separated list of strings or file names; file names can include wild card characters (* or ?). So for example, you could do something like:

for TRAJ in mytraj.?.nc,mytraj.??.nc
  trajin $TRAJ
done

Here is a script that I've used combining both of these new features to split multiple CHARMM REPLICA PDBs up and calculate dihedral angles:

# First create all COORDS
parm diala_nrep*.psf

for IN in gmin.pdb,before.pdb OUT in Gmin,Before
  loadcrd $IN
  splitcoords $IN name $OUT
  crdout $OUT $OUT.mol2
  set CLIST += $OUT,
done

for t=1;t<12;t++
  loadcrd init_path_$t.pdb
  splitcoords init_path_$t.pdb name Init$t
  crdout Init$t Init.$t.mol2
  set CLIST += Init$t,
done

# Calculate phi/psi for all
for VAR in $CLIST
  crdaction $VAR multidihedral d$VAR phi psi
  dataset makexy d$VAR[phi] d$VAR[psi] name phipsi$VAR
done

writedata phipsi.agr phipsiBefore phipsiInit* phipsiGmin

@drroe drroe self-assigned this Sep 7, 2018
@drroe drroe merged commit f7721cc into Amber-MD:master Sep 7, 2018
@drroe drroe deleted the split branch September 7, 2018 16:14
@hainm
Copy link
Contributor

hainm commented Mar 17, 2019

May be adding new command label rather enhancement. This would make it easier for me to search (vs going all the issues) to add support to pytraj.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants