Closed joeyelk closed 5 years ago
Hi @joeyelk,
that's something we've had in mind for a while. There are two problems with that - one is that the fitting group as implemented now stores gradients that are specific of a colvar component. That could be changed, however there is a second, more complex issue: having one group use a previously defined fitting group introduces a dependency between two atom groups. That dependency breaks the logic we currently have for parallel processing of different variables and components in SMP architectures.
By the way, the bias you are describing sounds like it can be achieved already. You can either restrain the tilt of one group with respect to the other, or restrain the difference between two tilt components.
Hi @joeyelk does @jhenin's suggestion work for you? Since the feature suggested is useful in other contexts, I'll change the title and keep it open.
Hi @jhenin and @giacomofiorin,
Thank you for your response and suggestions. The system I am considering is two identical groups A and B. I would like to have collective variables that are the equivalent of the spinAngle and tilt of B referenced to A.
Currently, I use the same reference structure for both spinAngle and tilt calculations and omit the axis keyword to use the default z axis.
I calculate cos (tilt angle) of A and B and restrain both to 1.0. This allows for rotation only about the z axis, which is measured by spinAngle. If I instead constrain the difference in cos (tilt angle) of the two groups to be zero, this would permit, for example, one molecule to rotate 90 degrees about the x axis, and the other to rotate 90 degrees about the y axis.
The spinAngles of A and B are then subtracted and then remapped between -180 and 180 using a custom function. I ultimately want to do metadynamics and umbrella sampling calculations with the relative spinAngle. Does this require flagging this custom function as periodic, and if so is there a way to do this?
As an alternative to spinAngle, I could divide A and B into subgroups and measure a dihedral.
Best,
Joe
Hi @joeyelk, apologies if I'm missing something. Is it possible for you to use A as fittingGroup
for B, and apply both the restraint on tilt
and the metadynamics or harmonic bias in the rotated frame. Any forces applied on B in the rotated frame are also projected onto A, for as long as enableFitGradients
is on (default).
Hi @giacomofiorin,
Unfortunately, using tilt
or spinAngle
with fittingGroup
gives the error message:
Feature "implicit atom gradient" is incompatible with "fit gradients" in atom group atoms. ...required by "implicit gradient" in Error: Failed dependency in .
Applying enableFitGradients off
removes the error message.
This example seems to mention the issue:
orientation-fitgroup.in
Hi @joeyelk the example mentions a related issue: fit gradients are not available for orientation
because orientation
is a vector-valued component, which does not store the gradients in the atom group but evaluates them on the fly when applying forces ("implicit atom gradient") and the fit gradients cannot be computed.
But tilt
and spinAngle
do have functional fit gradients: I presume they are not available in your case because you added a custom function in the middle to compute the difference between spinAngle
s of A and B. But in the rotated frame, the spinAngle
of one molecule is always zero, and you don't need to use the custom function. Also, the range is automatically -180° to 180°, but should you want another interval you can try the wrapAround
keyword rather than a custom function.
@joeyelk Were you able to achieve what you needed by ditching the custom function and using spinAngle
directly instead?
Hi @giacomofiorin ,
Thanks for checking in. I’ve been able to continue my project by using a dihedral colvar instead of spinAngle, but I’m still interested in getting this to work correctly.
I tested this issue using the namd/tests/library/000_orientation-fitgroup_harmonic-ori-fixed/test.in file. I replaced theorientation {...}
block with spinAngle {...}
and I replaced the harmonic constraint centers (1.0, 0.0, 0.0, 0.0)
with centers 0.0
and commented out rotateReference yes
. In this case NAMD finishes with no errors. However, if I also comment out the enableFitGradients no
line, I get an error message:
Feature "implicit atom gradient" is incompatible with "fit gradients" in atom group atoms.
colvars: ...required by "implicit gradient" in
colvars: Error: Failed dependency in .
FATAL ERROR: Error in the collective variables module: exiting.
The same behavior occurs with tilt{}
In each case I run the simulations from the test.in directory with namd2 --source ../Common/test.namd
I’m using NAMD_2.13b1_Linux-x86_64-multicore
Hi @joeyelk this behavior is actually a bug. Thanks for catching it! The incompatibility flag was set incorrectly, because the "implicit gradient" restriction only applies to orientation
, but its derivatives are capable of handling explicit gradients.
Take a look at the code in pull request #199, which should fix this problem: regression test inputs and outputs for your specific case are included. If it works for you, just comment on either thread.
No errors appear to remain, closing.
If fittingGroup could be used without refPositionsFile to reference another group of atoms in the simulation, this would allow, for example, constraining the relative tilt of two groups.