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 ability to move and rotate (via RMS fitting on coordinates) grids #913

Merged
merged 82 commits into from
Aug 25, 2021

Conversation

drroe
Copy link
Contributor

@drroe drroe commented Aug 25, 2021

Version 5.4.1.

This represents a significant enhancement in grid functionality in cpptraj. Grids are no longer locked in as being orthogonal or non-orthgonal. The GridBin class has been reworked to be general - when the grid is X-aligned, the orthogonal routines are used, otherwise the non-orthogonal routines are used. Which routines are used are set via internal function pointers which are updated if the grid is ever rotated.

There are now 3 new modes for grid (and dipole and gfe, which use the GridAction class under the hood).

  • boxcenter : Ensure grid remains centered in the middle of the unit cell.
  • maskcenter <mask> : Ensure grid remains centered on atoms selected by <mask>.
  • rmsfit <mask> : Center and rotate grid to match selected coordinates from the first frame.

The rmsfit more is functionally equivalent to RMS-fitting the coordinates prior to grid, but allows this without having to modify the coordinates. The speed of gridding has also been increased by almost 50% in my limited tests.

For example, the following will auto-image the trajectory, then create a grid of water density (selected by :WAT@O) that follows and rotates with the atoms selected by :TCS :

autoimage
grid name TCSgrid out grid.tcs.fit.dx :WAT@O 20 .5 20 .5 20 .5 rmsfit :TCS

Also added a keyword to the vector command called gridset, which allows calculation of "box" vectors from grid data sets instead of the Frame box. This allows one to visualize the grid as it's being moved/rotated.

For example:

grid out tz2.ortho.grid.maskcenter.dx :WAT@O 20 .5 20 .5 20 .5 maskcenter :6 name Tz2oMaskc
vector VTOMx gridset Tz2oMaskc ucellx
vector VTOMy gridset Tz2oMaskc ucelly
vector VTOMz gridset Tz2oMaskc ucellz
run
writedata VTOM.mol2 vectraj trajfmt mol2 VTOMx VTOMy VTOMz

drroe added 30 commits June 23, 2021 11:10
implementation; which calc routine gets used will depend on if the grid
is X-aligned and orthogonal or not.
drroe added 26 commits July 2, 2021 10:54
first frame to current frame. Since rms fit to a single reference is
usually what is done before grid, this gives results more in line to
what is expected.
inheriting class implement summation of the grid.
@drroe drroe self-assigned this Aug 25, 2021
@drroe drroe merged commit 64c9023 into Amber-MD:master Aug 25, 2021
@drroe drroe deleted the rotategrid branch August 25, 2021 19:48
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.

1 participant