**From:** Jeff Comer (*jeffcomer_at_gmail.com*)

**Date:** Mon Mar 23 2015 - 18:17:18 CDT

**Next message:**Subbarao Kanchi: "Re: NAMD"**Previous message:**Jérôme Hénin: "Re: Restraining angle between bond vector and coordinate vector"**In reply to:**Seth Axen: "Restraining angle between bond vector and coordinate vector"**Next in thread:**Seth Axen: "Re: Restraining angle between bond vector and coordinate vector"**Reply:**Seth Axen: "Re: Restraining angle between bond vector and coordinate vector"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]

Hi,

Another solution, which is also due to Jérôme, is to use the

"centerReference" keyword to shift the positions so that the second

atom or group is at (0,0,0). Then you can calculate the angle

group1–group2–arbitrary_fixed_axis.

In the example below, I have two groups (atoms 1–10 and atoms 11–20)

and want to keep the vector from the center of mass of atoms 11–20 to

the center of mass of atoms 1–10 along the z-axis (defined by

dummyAtom (0,0,1)). I think this solution may also have problems in

NAMD 2.10, so you'll need the nightly build of NAMD or compile NAMD

with the current version of Colvars as indicated by Jérôme.

colvar {

name colatitude

outputValue

outputAppliedForce

angle {

group1 {

atomNumbersRange 1-10

centerReference on

refPositionsGroup { atomNumbersRange 11-20 }

refPositions (0,0,0)

}

group2 {

atomNumbersRange 11-20

centerReference on

refPositions (0,0,0)

}

group3 {

dummyAtom (0,0,1)

}

}

}

harmonic {

colvars colatitude

centers 0

forceConstant 10

}

–––––––––––––––––––––––––––––––––––———————

Jeffrey Comer, PhD

Assistant Professor

Institute of Computational Comparative Medicine

Nanotechnology Innovation Center of Kansas State

Kansas State University

Office: P-213 Mosier Hall

Phone: 785-532-6311

On Mon, Mar 23, 2015 at 3:26 PM, Seth Axen <seth.axen_at_gmail.com> wrote:

*> I would like to add a harmonic restraint for an angle between a specific
*

*> bond vector and a target vector in 3D space, defined by 3 coordinates. The
*

*> resulting force should be updated at every step of the simulation. I'm
*

*> having trouble figuring out the best way to go about this from the
*

*> documentation and user-defined forces examples, and I'd appreciate any
*

*> suggestions.
*

*>
*

*> Thanks!
*

**Next message:**Subbarao Kanchi: "Re: NAMD"**Previous message:**Jérôme Hénin: "Re: Restraining angle between bond vector and coordinate vector"**In reply to:**Seth Axen: "Restraining angle between bond vector and coordinate vector"**Next in thread:**Seth Axen: "Re: Restraining angle between bond vector and coordinate vector"**Reply:**Seth Axen: "Re: Restraining angle between bond vector and coordinate vector"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]

*
This archive was generated by hypermail 2.1.6
: Thu Dec 31 2015 - 23:21:45 CST
*