forked from lijiext/lammps
Merge pull request #1896 from pmla/user-ptm-group-fix
Apply compute group correctly for compute ptm/atom
This commit is contained in:
commit
e766518062
|
@ -9,12 +9,13 @@ Syntax
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
compute ID group-ID ptm/atom structures threshold
|
compute ID group-ID ptm/atom structures threshold group2-ID
|
||||||
|
|
||||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||||
* ptm/atom = style name of this compute command
|
* ptm/atom = style name of this compute command
|
||||||
* structures = structure types to search for
|
* structures = structure types to search for
|
||||||
* threshold = lattice distortion threshold (RMSD)
|
* threshold = lattice distortion threshold (RMSD)
|
||||||
|
* group2-ID determines which group is used for neighbor selection (optional, default "all")
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
""""""""
|
""""""""
|
||||||
|
@ -22,8 +23,8 @@ Examples
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
compute 1 all ptm/atom default 0.1
|
compute 1 all ptm/atom default 0.1 all
|
||||||
compute 1 all ptm/atom fcc-hcp-dcub-dhex 0.15
|
compute 1 all ptm/atom fcc-hcp-dcub-dhex 0.15 all
|
||||||
compute 1 all ptm/atom all 0
|
compute 1 all ptm/atom all 0
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
@ -82,7 +83,9 @@ The neighbor list needed to compute this quantity is constructed each
|
||||||
time the calculation is performed (e.g. each time a snapshot of atoms
|
time the calculation is performed (e.g. each time a snapshot of atoms
|
||||||
is dumped). Thus it can be inefficient to compute/dump this quantity
|
is dumped). Thus it can be inefficient to compute/dump this quantity
|
||||||
too frequently or to have multiple compute/dump commands, each with a
|
too frequently or to have multiple compute/dump commands, each with a
|
||||||
*ptm/atom* style.
|
*ptm/atom* style. By default the compute processes **all** neighbors
|
||||||
|
unless the optional *group2-ID* argument is given, then only members
|
||||||
|
of that group are considered as neighbors.
|
||||||
|
|
||||||
**Output info:**
|
**Output info:**
|
||||||
|
|
||||||
|
@ -106,6 +109,7 @@ The interatomic distance is computed from the scale factor in the RMSD equation.
|
||||||
The (qw,qx,qy,qz) parameters represent the orientation of the local structure
|
The (qw,qx,qy,qz) parameters represent the orientation of the local structure
|
||||||
in quaternion form. The reference coordinates for each template (from which the
|
in quaternion form. The reference coordinates for each template (from which the
|
||||||
orientation is determined) can be found in the *ptm\_constants.h* file in the PTM source directory.
|
orientation is determined) can be found in the *ptm\_constants.h* file in the PTM source directory.
|
||||||
|
For atoms that are not within the compute group-ID, all values are set to zero.
|
||||||
|
|
||||||
Restrictions
|
Restrictions
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|
|
@ -33,6 +33,7 @@ under
|
||||||
#include "neigh_request.h"
|
#include "neigh_request.h"
|
||||||
#include "neighbor.h"
|
#include "neighbor.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "group.h"
|
||||||
|
|
||||||
#include "ptm_functions.h"
|
#include "ptm_functions.h"
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ static const char cite_user_ptm_package[] =
|
||||||
|
|
||||||
ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg)
|
ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg)
|
||||||
: Compute(lmp, narg, arg), list(NULL), output(NULL) {
|
: Compute(lmp, narg, arg), list(NULL), output(NULL) {
|
||||||
if (narg != 5)
|
if (narg < 5 || narg > 6)
|
||||||
error->all(FLERR, "Illegal compute ptm/atom command");
|
error->all(FLERR, "Illegal compute ptm/atom command");
|
||||||
|
|
||||||
char *structures = arg[3];
|
char *structures = arg[3];
|
||||||
|
@ -122,6 +123,14 @@ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg)
|
||||||
if (rmsd_threshold == 0)
|
if (rmsd_threshold == 0)
|
||||||
rmsd_threshold = INFINITY;
|
rmsd_threshold = INFINITY;
|
||||||
|
|
||||||
|
char* group_name = (char *)"all";
|
||||||
|
if (narg > 5) {
|
||||||
|
group_name = arg[5];
|
||||||
|
}
|
||||||
|
int igroup = group->find(group_name);
|
||||||
|
if (igroup == -1) error->all(FLERR,"Could not find fix group ID");
|
||||||
|
group2bit = group->bitmask[igroup];
|
||||||
|
|
||||||
peratom_flag = 1;
|
peratom_flag = 1;
|
||||||
size_peratom_cols = NUM_COLUMNS;
|
size_peratom_cols = NUM_COLUMNS;
|
||||||
create_attribute = 1;
|
create_attribute = 1;
|
||||||
|
@ -168,6 +177,8 @@ typedef struct
|
||||||
int **firstneigh;
|
int **firstneigh;
|
||||||
int *ilist;
|
int *ilist;
|
||||||
int nlocal;
|
int nlocal;
|
||||||
|
int *mask;
|
||||||
|
int group2bit;
|
||||||
|
|
||||||
} ptmnbrdata_t;
|
} ptmnbrdata_t;
|
||||||
|
|
||||||
|
@ -184,6 +195,8 @@ static bool sorthelper_compare(ptmnbr_t const &a, ptmnbr_t const &b) {
|
||||||
static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, int num, size_t* nbr_indices, int32_t* numbers, double (*nbr_pos)[3])
|
static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, int num, size_t* nbr_indices, int32_t* numbers, double (*nbr_pos)[3])
|
||||||
{
|
{
|
||||||
ptmnbrdata_t* data = (ptmnbrdata_t*)vdata;
|
ptmnbrdata_t* data = (ptmnbrdata_t*)vdata;
|
||||||
|
int *mask = data->mask;
|
||||||
|
int group2bit = data->group2bit;
|
||||||
|
|
||||||
double **x = data->x;
|
double **x = data->x;
|
||||||
double *pos = x[atom_index];
|
double *pos = x[atom_index];
|
||||||
|
@ -203,6 +216,9 @@ static int get_neighbours(void* vdata, size_t central_index, size_t atom_index,
|
||||||
|
|
||||||
for (int jj = 0; jj < jnum; jj++) {
|
for (int jj = 0; jj < jnum; jj++) {
|
||||||
int j = jlist[jj];
|
int j = jlist[jj];
|
||||||
|
if (!(mask[j] & group2bit))
|
||||||
|
continue;
|
||||||
|
|
||||||
j &= NEIGHMASK;
|
j &= NEIGHMASK;
|
||||||
if (j == atom_index)
|
if (j == atom_index)
|
||||||
continue;
|
continue;
|
||||||
|
@ -265,7 +281,11 @@ void ComputePTMAtom::compute_peratom() {
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
ptmnbrdata_t nbrlist = {x, numneigh, firstneigh, ilist, atom->nlocal};
|
ptmnbrdata_t nbrlist = {x, numneigh, firstneigh, ilist, atom->nlocal, mask, group2bit};
|
||||||
|
|
||||||
|
// zero output
|
||||||
|
|
||||||
|
memset(output,0,nmax*NUM_COLUMNS*sizeof(double));
|
||||||
|
|
||||||
for (int ii = 0; ii < inum; ii++) {
|
for (int ii = 0; ii < inum; ii++) {
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ class ComputePTMAtom : public Compute {
|
||||||
double rmsd_threshold;
|
double rmsd_threshold;
|
||||||
class NeighList *list;
|
class NeighList *list;
|
||||||
double **output;
|
double **output;
|
||||||
|
int group2bit;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue