Re: colvars: How to implement a collective variable of vector type?

From: yjcoshc (yjcoshc_at_gmail.com)
Date: Mon Mar 12 2018 - 02:32:56 CDT

Thanks for your suggestion! The expression is rather complex so I may
consider C++ or tcl through scriptedFunction. I notice the
scriptedFunctionType can be set to vector. The documentation says it
should be passed as space-separated lists. Should the
calc_<scriptedFunction> return a list like "x1 x2 x3" or "{x1 x2 x3}"?

在 2018年03月12日 05:54, Jérôme Hénin 写道:
> Hi,
>
> You might be able to implement at least proof-of-concept versions of
> your custom variable using either scriptedFunction or even
> customFunction (depending on the complexity of the expressions
> involved). Of course that will not use your C++ code directly, for
> that Giacomo's message gives you the path to follow. I just wanted to
> state that both scriptedFunction and customFunction let you define
> vector variables.
>
> Best,
> Jerome
>
> On 11 March 2018 at 13:05, Giacomo Fiorin <giacomo.fiorin_at_gmail.com
> <mailto:giacomo.fiorin_at_gmail.com>> wrote:
>
> Hi Haochuan, you need to derive a new class from the colvar::cvc,
> whose structure is described here.
> http://colvars.github.io/doxygen/html/classcolvar_1_1cvc.html#details
> <http://colvars.github.io/doxygen/html/classcolvar_1_1cvc.html#details>
> The rest of the webpage shows you also the current inheritance
> structure (what classes are derived from what).
>
> Among the variables that have vector values, a good example to
> take a look at could be distance_pairs. Presumably you only need
> to wrap your C++ code in the correct functions, and add the calls
> that read coordinates or send forces.
>
> See also:
> http://colvars.github.io/doxygen/html/index.html
> <http://colvars.github.io/doxygen/html/index.html>
> for documentation on the other classes.
>
> Giacomo
>
> On Sat, Mar 10, 2018 at 4:27 AM, yjcoshc <yjcoshc_at_gmail.com
> <mailto:yjcoshc_at_gmail.com>> wrote:
>
> Hello,
>
> I want to implement a vector collective variable in NAMD
> through the colvars module. It can calculate the least square
> fitted plane among multiple atomgroups and return the normal
> vector of the plane. The example pathCV script in colvartools
> folder seems scalar type only. Any suggestion of implementing
> a vector type one? I have finished a sample C++ code to
> calculate this. How do I incorporate it in colvars?
>
> Thanks,
>
> Haochuan Chen
>
>
>
>
> --
> Giacomo Fiorin
> Associate Professor of Research, Temple University, Philadelphia, PA
> Contractor, National Institutes of Health, Bethesda, MD
> http://goo.gl/Q3TBQU
> https://github.com/giacomofiorin <https://github.com/giacomofiorin>
>
>

This archive was generated by hypermail 2.1.6 : Fri Dec 06 2019 - 23:19:38 CST