Better compute_pressure hybrid and doc
This commit is contained in:
@ -16,12 +16,13 @@ ID, group-ID are documented in "compute"_compute.html command
|
|||||||
pressure = style name of this compute command
|
pressure = style name of this compute command
|
||||||
temp-ID = ID of compute that calculates temperature, can be NULL if not needed
|
temp-ID = ID of compute that calculates temperature, can be NULL if not needed
|
||||||
zero or more keywords may be appended
|
zero or more keywords may be appended
|
||||||
keyword = {ke} or {pair} or {bond} or {angle} or {dihedral} or {improper} or {kspace} or {fix} or {virial} :ul
|
keyword = {ke} or {pair} or {bond} or {angle} or {dihedral} or {improper} or {kspace} or {fix} or {virial} or {hybridpair} :ul
|
||||||
|
|
||||||
[Examples:]
|
[Examples:]
|
||||||
|
|
||||||
compute 1 all pressure thermo_temp
|
compute 1 all pressure thermo_temp
|
||||||
compute 1 all pressure NULL pair bond :pre
|
compute 1 all pressure NULL pair bond
|
||||||
|
compute 1 all pressure NULL hybridpair lj/cut :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
@ -67,6 +68,9 @@ extra keywords are listed, then only those components are summed to
|
|||||||
compute temperature or ke and/or the virial. The {virial} keyword
|
compute temperature or ke and/or the virial. The {virial} keyword
|
||||||
means include all terms except the kinetic energy {ke}.
|
means include all terms except the kinetic energy {ke}.
|
||||||
|
|
||||||
|
The {hybridpair} keyword means to only include contribution
|
||||||
|
from a subpair in a {hybrid} or {hybrid/overlay} pair style.
|
||||||
|
|
||||||
Details of how LAMMPS computes the virial efficiently for the entire
|
Details of how LAMMPS computes the virial efficiently for the entire
|
||||||
system, including for many-body potentials and accounting for the
|
system, including for many-body potentials and accounting for the
|
||||||
effects of periodic boundary conditions are discussed in
|
effects of periodic boundary conditions are discussed in
|
||||||
|
|||||||
@ -81,8 +81,37 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
int iarg = 4;
|
int iarg = 4;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"ke") == 0) keflag = 1;
|
if (strcmp(arg[iarg],"ke") == 0) keflag = 1;
|
||||||
else if (strcmp(arg[iarg],"hybridpair") == 0)
|
else if (strcmp(arg[iarg],"hybridpair") == 0) {
|
||||||
hybridpairflag = force->inumeric(FLERR, arg[++iarg]);
|
int n = strlen(arg[++iarg]) + 1;
|
||||||
|
if (lmp->suffix) n += strlen(lmp->suffix) + 1;
|
||||||
|
pstyle = new char[n];
|
||||||
|
strcpy(pstyle,arg[iarg++]);
|
||||||
|
|
||||||
|
nsub = 0;
|
||||||
|
|
||||||
|
if (narg > iarg) {
|
||||||
|
if (isdigit(arg[iarg][0])) {
|
||||||
|
nsub = force->inumeric(FLERR,arg[iarg]);
|
||||||
|
++iarg;
|
||||||
|
if (nsub <= 0)
|
||||||
|
error->all(FLERR,"Illegal compute pressure command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if pair style with and without suffix exists
|
||||||
|
|
||||||
|
hybridpair = (Pair *) force->pair_match(pstyle,1,nsub);
|
||||||
|
if (!hybridpair && lmp->suffix) {
|
||||||
|
strcat(pstyle,"/");
|
||||||
|
strcat(pstyle,lmp->suffix);
|
||||||
|
hybridpair = (Pair *) force->pair_match(pstyle,1,nsub);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hybridpair)
|
||||||
|
error->all(FLERR,"Unrecognized pair style in compute pressure command");
|
||||||
|
|
||||||
|
hybridpairflag = 1;
|
||||||
|
}
|
||||||
else if (strcmp(arg[iarg],"pair") == 0) pairflag = 1;
|
else if (strcmp(arg[iarg],"pair") == 0) pairflag = 1;
|
||||||
else if (strcmp(arg[iarg],"bond") == 0) bondflag = 1;
|
else if (strcmp(arg[iarg],"bond") == 0) bondflag = 1;
|
||||||
else if (strcmp(arg[iarg],"angle") == 0) angleflag = 1;
|
else if (strcmp(arg[iarg],"angle") == 0) angleflag = 1;
|
||||||
@ -144,12 +173,7 @@ void ComputePressure::init()
|
|||||||
nvirial = 0;
|
nvirial = 0;
|
||||||
vptr = NULL;
|
vptr = NULL;
|
||||||
|
|
||||||
if (hybridpairflag > 0 && force->pair) {
|
if (hybridpairflag && force->pair) nvirial++;
|
||||||
if (strstr(force->pair_style, "hybrid")) {
|
|
||||||
PairHybrid *ph = (PairHybrid *) force->pair;
|
|
||||||
if (hybridpairflag <= ph->nstyles) nvirial++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pairflag && force->pair) nvirial++;
|
if (pairflag && force->pair) nvirial++;
|
||||||
if (bondflag && atom->molecular && force->bond) nvirial++;
|
if (bondflag && atom->molecular && force->bond) nvirial++;
|
||||||
if (angleflag && atom->molecular && force->angle) nvirial++;
|
if (angleflag && atom->molecular && force->angle) nvirial++;
|
||||||
@ -162,12 +186,10 @@ void ComputePressure::init()
|
|||||||
if (nvirial) {
|
if (nvirial) {
|
||||||
vptr = new double*[nvirial];
|
vptr = new double*[nvirial];
|
||||||
nvirial = 0;
|
nvirial = 0;
|
||||||
if (hybridpairflag > 0 && force->pair) {
|
if (hybridpairflag && force->pair) {
|
||||||
if (strstr(force->pair_style, "hybrid")) {
|
PairHybrid *ph = (PairHybrid *) force->pair;
|
||||||
PairHybrid *ph = (PairHybrid *) force->pair;
|
ph->no_virial_fdotr_compute = 1;
|
||||||
if (hybridpairflag <= ph->nstyles)
|
vptr[nvirial++] = hybridpair->virial;
|
||||||
vptr[nvirial++] = ph->styles[hybridpairflag-1]->virial;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (pairflag && force->pair) vptr[nvirial++] = force->pair->virial;
|
if (pairflag && force->pair) vptr[nvirial++] = force->pair->virial;
|
||||||
if (bondflag && force->bond) vptr[nvirial++] = force->bond->virial;
|
if (bondflag && force->bond) vptr[nvirial++] = force->bond->virial;
|
||||||
|
|||||||
Reference in New Issue
Block a user