git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12075 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -1109,6 +1109,59 @@ int AtomVecWavepacket::write_vel_hybrid(FILE *fp, double *buf)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
assign an index to named atom property and return index
|
||||||
|
return -1 if name is unknown to this atom style
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int AtomVecWavepacket::property_atom(char *name)
|
||||||
|
{
|
||||||
|
if (strcmp(name,"spin") == 0) return 0;
|
||||||
|
if (strcmp(name,"eradius") == 0) return 1;
|
||||||
|
if (strcmp(name,"ervel") == 0) return 2;
|
||||||
|
if (strcmp(name,"erforce") == 0) return 3;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
pack per-atom data into buf for ComputePropertyAtom
|
||||||
|
index maps to data specific to this atom style
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AtomVecWavepacket::pack_property_atom(int index, double *buf,
|
||||||
|
int nvalues, int groupbit)
|
||||||
|
{
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
if (index == 0) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = spin[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
} else if (index == 1) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = eradius[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
} else if (index == 2) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = ervel[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
} else if (index == 3) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = erforce[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return # of bytes of allocated memory
|
return # of bytes of allocated memory
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -71,6 +71,8 @@ public:
|
|||||||
int pack_vel_hybrid(int, double *);
|
int pack_vel_hybrid(int, double *);
|
||||||
void write_vel(FILE *, int, double **);
|
void write_vel(FILE *, int, double **);
|
||||||
int write_vel_hybrid(FILE *, double *);
|
int write_vel_hybrid(FILE *, double *);
|
||||||
|
int property_atom(char *);
|
||||||
|
void pack_property_atom(int, double *, int, int);
|
||||||
bigint memory_usage();
|
bigint memory_usage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -973,6 +973,59 @@ int AtomVecElectron::write_vel_hybrid(FILE *fp, double *buf)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
assign an index to named atom property and return index
|
||||||
|
return -1 if name is unknown to this atom style
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int AtomVecElectron::property_atom(char *name)
|
||||||
|
{
|
||||||
|
if (strcmp(name,"spin") == 0) return 0;
|
||||||
|
if (strcmp(name,"eradius") == 0) return 1;
|
||||||
|
if (strcmp(name,"ervel") == 0) return 2;
|
||||||
|
if (strcmp(name,"erforce") == 0) return 3;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
pack per-atom data into buf for ComputePropertyAtom
|
||||||
|
index maps to data specific to this atom style
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void AtomVecElectron::pack_property_atom(int index, double *buf,
|
||||||
|
int nvalues, int groupbit)
|
||||||
|
{
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
if (index == 0) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = spin[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
} else if (index == 1) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = eradius[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
} else if (index == 2) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = ervel[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
} else if (index == 3) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) buf[n] = erforce[i];
|
||||||
|
else buf[n] = 0.0;
|
||||||
|
n += nvalues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return # of bytes of allocated memory
|
return # of bytes of allocated memory
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -66,6 +66,8 @@ class AtomVecElectron : public AtomVec {
|
|||||||
int pack_vel_hybrid(int, double *);
|
int pack_vel_hybrid(int, double *);
|
||||||
void write_vel(FILE *, int, double **);
|
void write_vel(FILE *, int, double **);
|
||||||
int write_vel_hybrid(FILE *, double *);
|
int write_vel_hybrid(FILE *, double *);
|
||||||
|
int property_atom(char *);
|
||||||
|
void pack_property_atom(int, double *, int, int);
|
||||||
bigint memory_usage();
|
bigint memory_usage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -338,6 +338,8 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
"vector does not exist");
|
"vector does not exist");
|
||||||
pack_choice[i] = &ComputePropertyAtom::pack_dname;
|
pack_choice[i] = &ComputePropertyAtom::pack_dname;
|
||||||
|
|
||||||
|
// check if atom style recognizes keyword
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
index[i] = atom->avec->property_atom(arg[iarg]);
|
index[i] = atom->avec->property_atom(arg[iarg]);
|
||||||
if (index[i] < 0)
|
if (index[i] < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user