PLUMED colvar directly applying force on atoms, instead of using setAtomsDerivatives

320 views
Skip to first unread message

Po-chia Chen

unread,
Nov 16, 2015, 8:45:41 AM11/16/15
to PLUMED users
 Hi PLUMED devs,

 I'm in the process of writing an quaternion colvar and restraint, and have hit a snag. Most colvars I have seen use atomsDerivatives to determine the resulting force on an atom, which makes sense for scalar quantities. I cannot write the atomic gradients of Quaternions q= w0, w1, w2, w3, but only the force on an atom due to U(q) from its quaternion products.

  - can I call the U(q) potential into the colvar? Iit seems to me that biases and colvars are designed to be separate, for example, Restraint.cpp sets the required value and forces on a colvar but does not calculate them. 
 - can I call some sort of applyForce() in the colvar.cpp and have the force be correctly evaluated without worrying about setAtomsDerivatives? Should I set it to zero unequivocally/would this impact something on the MD engine?

  So in order to implement quaternion-based restraints, I would need to make changes across multiple files in the Plumed source?

 Cheers,
 Poker.

Giovanni Bussi

unread,
Nov 16, 2015, 8:50:09 AM11/16/15
to plumed...@googlegroups.com
Hi,

I didn't understand your problem.

If you know how to compute q=w0,w1,w2,w3 from atom coordinates, you should also be able to compute dw0/dr, dw1/dr, etc

Notice that you would have to define a colvar with multiple components (e.g. 4 components). Many colvars already do it (e.g. POSITION).

Isn't that ok?

If you are not able to do the analytical derivatives, or are lazy, you can try to use the option NUMERICAL_DERIVATIVES, but it is quite slow and there mostly for debugging.

Giovanni


--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
To post to this group, send email to plumed...@googlegroups.com.
Visit this group at http://groups.google.com/group/plumed-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/1383e0d8-fa3e-4aa0-b8b6-d2abbc228411%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Po-chia Chen

unread,
Nov 16, 2015, 11:39:55 AM11/16/15
to PLUMED users
 Ah. Sorry, I didn't fully wrap my head around the code before. Thanks for the reminder that I should split q into the equivalent of four colvars.

 I've written what I *think* will work, so I'll go test it later.

 - Poker.

Po-chia Chen

unread,
Nov 18, 2015, 12:16:23 PM11/18/15
to PLUMED users
 Okay, preliminary tests using PRINT (validated with my own VMD/TcL quaternionclculations) and RESTRAINTS (a small test set of quaternions) are successful.
 I'm going to see how it behaves after FIT_TO_TEMPLATE = OPTIMAL  in a multimeric system, and also extend the colvar to have an orientational restraint between any two arbitrary non-disordered biomolecules without needing pesky system-frame restraints.
 
 What's normally done with external PLUMED contributions? Should I first host my own github fork?
 Anyway, before that I'll email Giacomo Fiorin (NAMD) since I used his orientational implementation as a reference to confirm the maths (specifically, confirming dq/dSij, S being the matrix being diagonalised.)

 Cheers,
 Poker.

On Monday, 16 November 2015 14:50:09 UTC+1, Giovanni Bussi wrote:

Giovanni Bussi

unread,
Nov 18, 2015, 1:27:14 PM11/18/15
to plumed...@googlegroups.com
Hi,

GitHub is the best way to share. Thanks!

Giovanni

Inviato da iPhone

Giovanni Bussi

unread,
Nov 18, 2015, 1:50:18 PM11/18/15
to plumed...@googlegroups.com
Also notice that FIT_TO_TEMPLATE with TYPE=OPTIMAL requires you to properly set the virial in all the variables computed after that line (with setBoxDerivatives).

I guess this could be different by the implementation in the colvars module.

Giovanni

Po-chia Chen

unread,
Dec 3, 2015, 7:29:53 AM12/3/15
to PLUMED users
Thanks Giovanni, so what  I've done is to host a forked plumed2 repo on my github with a branch called "orient-q" at

https://github.com/zharmad/plumed2/tree/orient-q

 It's self-contained in the sense that I'm basing this of the master branch instead of the fit-to-template branches.
 Hopefully I'll be able to get the relative orientation constraints implemented and tested over the next couple of months.

 Cheers,
 Poker.
Reply all
Reply to author
Forward
0 new messages