diff --git a/doc/comm_modify.html b/doc/comm_modify.html index d8819a8c3d..db169c35f1 100644 --- a/doc/comm_modify.html +++ b/doc/comm_modify.html @@ -28,10 +28,10 @@

Examples:

-
communicate mode multi
-communicate mode multi group solvent
-communicate vel yes
-communicate cutoff 5.0 vel yes 
+
comm_modify mode multi
+comm_modify mode multi group solvent
+comm_modify vel yes
+comm_modify cutoff 5.0 vel yes 
 

Description:

diff --git a/doc/comm_modify.txt b/doc/comm_modify.txt index 7a8c2236b8..22e4dec40f 100644 --- a/doc/comm_modify.txt +++ b/doc/comm_modify.txt @@ -22,10 +22,10 @@ keyword = {mode} or {cutoff} or {group} or {vel} :l [Examples:] -communicate mode multi -communicate mode multi group solvent -communicate vel yes -communicate cutoff 5.0 vel yes :pre +comm_modify mode multi +comm_modify mode multi group solvent +comm_modify vel yes +comm_modify cutoff 5.0 vel yes :pre [Description:] diff --git a/doc/set.html b/doc/set.html index 74e91d16a8..224ab3a53c 100644 --- a/doc/set.html +++ b/doc/set.html @@ -96,6 +96,7 @@ set group edge bond 4 set region half charge 0.5 set type 3 charge 0.5 set type 1*3 charge 0.5 +set atom * charge v_atomfile set atom 100*200 x 0.5 y 1.0 set atom 1492 type 3
@@ -149,11 +150,16 @@ for details of how to specify a group or region. change, for the selected atoms.

Note that except where explicitly prohibited below, all of the -keywords allow an atom-style variable to be used as -the specified value(s). If the value is a variable, it should be -specified as v_name, where name is the variable name. In this case, -the variable will be evaluated, and its resulting per-atom value used -to determine the value assigned to each selected atom. +keywords allow an atom-style or atomfile-style +variable to be used as the specified value(s). If the +value is a variable, it should be specified as v_name, where name is +the variable name. In this case, the variable will be evaluated, and +its resulting per-atom value used to determine the value assigned to +each selected atom. Note that the per-atom value from the variable +will be ignored for atoms that are not selected via the style and +ID settings explained above. A simple way to use per-atom values +from the variable to reset a property for all atoms is to use style +atom with ID = "*"; this selects all atom IDs.

Atom-style variables can specify formulas with various mathematical functions, and include thermo_style command diff --git a/doc/set.txt b/doc/set.txt index d901880fb6..94c5ac0f31 100644 --- a/doc/set.txt +++ b/doc/set.txt @@ -92,6 +92,7 @@ set group edge bond 4 set region half charge 0.5 set type 3 charge 0.5 set type 1*3 charge 0.5 +set atom * charge v_atomfile set atom 100*200 x 0.5 y 1.0 set atom 1492 type 3 :pre @@ -145,11 +146,16 @@ This section describes the keyword options for which properties to change, for the selected atoms. Note that except where explicitly prohibited below, all of the -keywords allow an "atom-style variable"_variable.html to be used as -the specified value(s). If the value is a variable, it should be -specified as v_name, where name is the variable name. In this case, -the variable will be evaluated, and its resulting per-atom value used -to determine the value assigned to each selected atom. +keywords allow an "atom-style or atomfile-style +variable"_variable.html to be used as the specified value(s). If the +value is a variable, it should be specified as v_name, where name is +the variable name. In this case, the variable will be evaluated, and +its resulting per-atom value used to determine the value assigned to +each selected atom. Note that the per-atom value from the variable +will be ignored for atoms that are not selected via the {style} and +{ID} settings explained above. A simple way to use per-atom values +from the variable to reset a property for all atoms is to use style +{atom} with {ID} = "*"; this selects all atom IDs. Atom-style variables can specify formulas with various mathematical functions, and include "thermo_style"_thermo_style.html command diff --git a/doc/variable.html b/doc/variable.html index e848d8ab0a..51daea0bf2 100644 --- a/doc/variable.html +++ b/doc/variable.html @@ -66,8 +66,8 @@ angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) - atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i] - atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz + atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] + atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q compute references = c_ID, c_ID[i], c_ID[i][j] fix references = f_ID, f_ID[i], f_ID[i][j] variable references = v_name, v_name[i] @@ -373,8 +373,8 @@ references to other variables. Group functions count(ID), mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), fcm(ID,dim), bound(ID,dir), gyration(ID), ke(ID), angmom(ID,dim), torque(ID,dim), inertia(ID,dimdim), omega(ID,dim) Region functions count(ID,IDR), mass(ID,IDR), charge(ID,IDR), xcm(ID,dim,IDR), vcm(ID,dim,IDR), fcm(ID,dim,IDR), bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR), angmom(ID,dim,IDR), torque(ID,dim,IDR), inertia(ID,dimdim,IDR), omega(ID,dim,IDR) Special functions sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) -Atom values id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i] -Atom vectors id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz +Atom values id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] +Atom vectors id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q Compute references c_ID, c_ID[i], c_ID[i][j] Fix references f_ID, f_ID[i], f_ID[i][j] Other variables v_name, v_name[i] diff --git a/doc/variable.txt b/doc/variable.txt index e461d08e59..e9362de392 100644 --- a/doc/variable.txt +++ b/doc/variable.txt @@ -61,8 +61,8 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) - atom value = id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\] - atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz + atom value = id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\], q\[i\] + atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q compute references = c_ID, c_ID\[i\], c_ID\[i\]\[j\] fix references = f_ID, f_ID\[i\], f_ID\[i\]\[j\] variable references = v_name, v_name\[i\] :pre @@ -374,8 +374,8 @@ Region functions: count(ID,IDR), mass(ID,IDR), charge(ID,IDR), \ inertia(ID,dimdim,IDR), omega(ID,dim,IDR) Special functions: sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) Atom values: id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], \ - vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\] -Atom vectors: id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz + vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\], q\[i\] +Atom vectors: id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q Compute references: c_ID, c_ID\[i\], c_ID\[i\]\[j\] Fix references: f_ID, f_ID\[i\], f_ID\[i\]\[j\] Other variables: v_name, v_name\[i\] :tb(s=:) diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index 421d67b08c..11b5b8e14c 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -343,6 +343,10 @@ void cvm::atom_group::parse (std::string const &conf, } cvm::log ("Within atom group \""+std::string (key)+"\":\n"); ref_pos_group = new atom_group (group_conf, "refPositionsGroup"); + + // regardless of the configuration, fit gradients must be calculated by refPositionsGroup + ref_pos_group->b_fit_gradients = this->b_fit_gradients; + this->b_fit_gradients = false; } atom_group *group_for_fit = ref_pos_group ? ref_pos_group : this; diff --git a/src/group.cpp b/src/group.cpp index 0c14b911f0..bcee4afcac 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -186,7 +186,8 @@ void Group::assign(int narg, char **arg) if (narg > 3 && (strcmp(arg[2],"<") == 0 || strcmp(arg[2],">") == 0 || strcmp(arg[2],"<=") == 0 || strcmp(arg[2],">=") == 0 || - strcmp(arg[2],"<>") == 0 || strcmp(arg[2],"==") == 0)) { + strcmp(arg[2],"==") == 0 || strcmp(arg[2],"!=") == 0 || + strcmp(arg[2],"<>") == 0)) { int condition = -1; if (strcmp(arg[2],"<") == 0) condition = LT; diff --git a/src/variable.cpp b/src/variable.cpp index 0b321fe374..89e091e834 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -3494,7 +3494,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, id = positive global ID of atom, converted to local index push result onto tree or arg stack customize by adding an atom vector: - id,mass,type,mol,x,y,z,vx,vy,vz,fx,fy,fz + id,mass,type,mol,x,y,z,vx,vy,vz,fx,fy,fz,q ------------------------------------------------------------------------- */ void Variable::peratom2global(int flag, char *word, @@ -3532,7 +3532,11 @@ void Variable::peratom2global(int flag, char *word, else if (strcmp(word,"fx") == 0) mine = atom->f[index][0]; else if (strcmp(word,"fy") == 0) mine = atom->f[index][1]; else if (strcmp(word,"fz") == 0) mine = atom->f[index][2]; - + else if (strcmp(word,"q") == 0) { + if (!atom->q_flag) + error->one(FLERR,"Variable uses atom property that isn't allocated"); + mine = atom->q[index]; + } else error->one(FLERR,"Invalid atom vector in variable formula"); } else mine = vector[index*nstride]; @@ -3555,7 +3559,7 @@ void Variable::peratom2global(int flag, char *word, check if word matches an atom vector return 1 if yes, else 0 customize by adding an atom vector: - id,mass,type,mol,x,y,z,vx,vy,vz,fx,fy,fz + id,mass,type,mol,x,y,z,vx,vy,vz,fx,fy,fz,q ------------------------------------------------------------------------- */ int Variable::is_atom_vector(char *word) @@ -3573,6 +3577,7 @@ int Variable::is_atom_vector(char *word) if (strcmp(word,"fx") == 0) return 1; if (strcmp(word,"fy") == 0) return 1; if (strcmp(word,"fz") == 0) return 1; + if (strcmp(word,"q") == 0) return 1; return 0; } @@ -3581,7 +3586,7 @@ int Variable::is_atom_vector(char *word) push result onto tree word = atom vector customize by adding an atom vector: - id,mass,type,mol,x,y,z,vx,vy,vz,fx,fy,fz + id,mass,type,mol,x,y,z,vx,vy,vz,fx,fy,fz,q ------------------------------------------------------------------------- */ void Variable::atom_vector(char *word, Tree **tree, @@ -3643,6 +3648,11 @@ void Variable::atom_vector(char *word, Tree **tree, else if (strcmp(word,"fx") == 0) newtree->array = &atom->f[0][0]; else if (strcmp(word,"fy") == 0) newtree->array = &atom->f[0][1]; else if (strcmp(word,"fz") == 0) newtree->array = &atom->f[0][2]; + + else if (strcmp(word,"q") == 0) { + newtree->nstride = 1; + newtree->array = atom->q; + } } /* ----------------------------------------------------------------------