Re: angle between 2 vectors as collective variable

From: Giacomo Fiorin (giacomo.fiorin_at_gmail.com)
Date: Thu Mar 26 2015 - 10:16:25 CDT

So, obviously "angle" function is what you're looking for if you have three
groups (A, B, and C) and you want to calculate the angle between the B-->A
vector and the B-->C vector.

Because you're asking about this you probably have a less simple case than
that, where the "B" group isn't shared, but you have four independent
groups, and the vectors are B-->A and C-->D.

So you can do something like this:
- translate A so that B is centered on the origin
- translate D so that C is centered on the origin
- calculate the angle between the origin-->A vector and the origin-->D
vector

You can do that with centerReference, which allows you to translate the
positions of a group (e.g. the A group), and refPositionsGroup, which
allows you to use an additional group for the fitting (e.g. the B group).

colvar {
    angle {
        group1 {
            # define here the "A" group
            centerReference yes
            rotateReference no
            refPositionsGroup {
                # define here the "B" group
            }
            refPositionsFile file.pdb # a set of positions for "B" that is
centered on the origin
        }
        group2 { dummyAtom (0, 0, 0) }
        group3 {
            # define here the "D" group
            centerReference yes
            rotateReference no
            refPositionsGroup {
                # define here the "C" group
            }
            refPositionsFile file.pdb # a set of positions for "C" that is
centered on the origin
        }
    }
}

Note that you need to disable rotateReference, otherwise the rotational fit
of groups B or C will change the orientation of the vectors.

Giacomo

On Thu, Mar 26, 2015 at 11:03 AM, Vlad Cojocaru <
vlad.cojocaru_at_mpi-muenster.mpg.de> wrote:

> As distance vectors from positions ...
>
> Vlad
>
> On March 26, 2015 3:58:26 PM CET, Giacomo Fiorin <giacomo.fiorin_at_gmail.com>
> wrote:
>>
>> Hello Vlad, it depends on how the two vectors are being calculated from,
>> e.g. as distance vectors between two positions or axes of rotation.
>>
>> Giacomo
>>
>> On Thu, Mar 26, 2015 at 10:17 AM, Vlad Cojocaru <
>> vlad.cojocaru_at_mpi-muenster.mpg.de> wrote:
>>
>>> Dear all,
>>>
>>> This might be a trivial question but somehow I am not able to find an
>>> answer to it. Is it possible to define the angle between 2 vectors as
>>> collective variable within the COLVAR module ?
>>>
>>> Thanks for any tips
>>>
>>> Best wishes
>>> Vlad
>>>
>>> --
>>> Dr. Vlad Cojocaru
>>> Computational Structural Biology Laboratory
>>> Department of Cell and Developmental Biology
>>> Max Planck Institute for Molecular Biomedicine
>>> Röntgenstrasse 20, 48149 Münster, Germany
>>> Tel: +49-251-70365-324; Fax: +49-251-70365-399
>>> Email: vlad.cojocaru[at]mpi-muenster.mpg.de
>>> http://www.mpi-muenster.mpg.de/43241/cojocaru
>>>
>>>
>>
>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>

-- 
Giacomo Fiorin
Assistant Professor of Research
Institute for Computational Molecular Science (ICMS)
College of Science and Technology, Temple University
1925 North 12th Street (035-07), Room 704D
Philadelphia, PA 19122-1801
Phone: +1-215-204-4213
https://icms.cst.temple.edu/members.html
http://giacomofiorin.github.io/

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