one simple question about collective variable

Dear lammps deveolpers and users:

I only have one simple question to ask, that is ,could i define the average value of the result from “compute hexorder/atom” command as collective variable? I also have read the manual about the colvar package, but i did not find q6/q4 in the collective variable. Does it mean that i can not put q6/q4 as collective variable to run the enhanced simulation with lammps? Is there any other way to realize my purpose?

Any suggestiones for me will be appreciated, many thanks!

Xiaodong

Dear lammps deveolpers and users:

I only have one simple question to ask, that is ,could i define the average value of the result from “compute hexorder/atom” command as collective variable?

no.

I also have read the manual about the colvar package, but i did not find q6/q4 in the collective variable. Does it mean that i can not put q6/q4 as collective variable to run the enhanced simulation with lammps? Is there any other way to realize my purpose?

the colvars package is an independent feature (in fact, it can be used with multiple MD engines, not just LAMMPS), so it knows very little about LAMMPS internals. there have been some ideas bounced around to change this, but nobody know if and when this will be implemented. thus currently, if you want to have a custom collective variable in colvars that does not yet exist, you have to program it into colvars.
colvars development is hosted on github at https://github.com/colvars/colvars

axel.

Hi Xiaodong, that’s a good question. As Axel mentioned, we discussed already using some of the LAMMPS computes as collective variables. Unfortunately, those computes typically provide the order parameter itself, but not its atomic gradients. This means that you cannot apply forces to achieve enhanced sampling, nor measure free-energy differences by projecting the total atomic forces onto the order parameter for thermodynamic integration (TI).

For this reason, the integration that Axel mentioned between Colvars and LAMMPS computes would not be tremendously useful. What would be helpful is a fix hexorder/atom, which can also apply forces to the atoms, and making it communicate with Colvars: the latter is not too hard to implement, but the former would take some work.

A good alternative for this specific use case would be to use Plumed, which nowadays has a fairly good LAMMPS interface and I believe provides Steinhardt order parameters as collective variables:
https://www.plumed.org/doc-v2.5/user-doc/html/_q6.html
This is listed as “still being developed”, so you may want to shoot an email to the Plumed mailing list to check the status.

In general, defining custom functions as variables can be done in Colvars to some level:
https://colvars.github.io/colvars-refman-lammps/colvars-refman-lammps.html#sec:colvar_custom_function
It would be very difficult to implement Steinhardt order parameters this way, but for simpler functions this is definitely the way to go, especially for functions of variables already implemented in Colvars.

Giacomo