forked from lijiext/lammps
Merge pull request #875 from akohlmey/collected-small-fixes
Collected small changes and bug fixes for the next patch release
This commit is contained in:
commit
749f1ff407
|
@ -15,7 +15,7 @@ compute ID group-ID displace/atom :pre
|
|||
ID, group-ID are documented in "compute"_compute.html command :ulb,l
|
||||
displace/atom = style name of this compute command :l
|
||||
zero or more keyword/arg pairs may be appended :l
|
||||
keyword = {refresh} :
|
||||
keyword = {refresh} :l
|
||||
{replace} arg = name of per-atom variable :pre
|
||||
|
||||
:ule
|
||||
|
|
|
@ -34,6 +34,8 @@ written to {filename} on timesteps that are multiples of {Nevery},
|
|||
including timestep 0. For time-averaged chemical species analysis,
|
||||
please see the "fix reaxc/c/species"_fix_reaxc_species.html command.
|
||||
|
||||
The specified group-ID is ignored by this fix.
|
||||
|
||||
The format of the output file should be reasonably self-explanatory.
|
||||
The meaning of the column header abbreviations is as follows:
|
||||
|
||||
|
|
|
@ -384,6 +384,11 @@ class lammps(object):
|
|||
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
|
||||
return ptr
|
||||
if type == 2:
|
||||
if style == 0:
|
||||
self.lib.lammps_extract_compute.restype = POINTER(c_int)
|
||||
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
|
||||
return ptr[0]
|
||||
else:
|
||||
self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double))
|
||||
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
|
||||
return ptr
|
||||
|
|
|
@ -34,7 +34,11 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleCosineSquared::AngleCosineSquared(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleCosineSquared::AngleCosineSquared(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
k = NULL;
|
||||
theta0 = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -30,7 +30,11 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
k = NULL;
|
||||
theta0 = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -332,3 +332,13 @@ void DihedralHelix::read_restart(FILE *fp)
|
|||
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralHelix::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||
fprintf(fp,"%d %g %g %g\n",i,aphi[i],bphi[i],cphi[i]);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class DihedralHelix : public Dihedral {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
double *aphi,*bphi,*cphi;
|
||||
|
|
|
@ -331,3 +331,13 @@ void DihedralMultiHarmonic::read_restart(FILE *fp)
|
|||
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralMultiHarmonic::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||
fprintf(fp,"%d %g %g %g %g %g\n",i,a1[i],a2[i],a3[i],a4[i],a5[i]);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class DihedralMultiHarmonic : public Dihedral {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
double *a1,*a2,*a3,*a4,*a5;
|
||||
|
|
|
@ -34,7 +34,10 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleCosineShift::AngleCosineShift(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleCosineShift::AngleCosineShift(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
kcost = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -34,7 +34,16 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleCosineShiftExp::AngleCosineShiftExp(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleCosineShiftExp::AngleCosineShiftExp(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
doExpansion = NULL;
|
||||
umin = NULL;
|
||||
a = NULL;
|
||||
opt1 = NULL;
|
||||
theta0 = NULL;
|
||||
sint = NULL;
|
||||
cost = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -32,7 +32,11 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
k = NULL;
|
||||
gamma0 = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -35,7 +35,13 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleFourier::AngleFourier(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleFourier::AngleFourier(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
k = NULL;
|
||||
C0 = NULL;
|
||||
C1 = NULL;
|
||||
C2 = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -35,7 +35,12 @@ using namespace MathConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AngleFourierSimple::AngleFourierSimple(LAMMPS *lmp) : Angle(lmp) {}
|
||||
AngleFourierSimple::AngleFourierSimple(LAMMPS *lmp) : Angle(lmp)
|
||||
{
|
||||
k = NULL;
|
||||
C = NULL;
|
||||
N = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "force.h"
|
||||
#include "update.h"
|
||||
#include "memory.h"
|
||||
#include "math_const.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
@ -285,9 +286,9 @@ void DihedralCosineShiftExp::coeff(int narg, char **arg)
|
|||
doExpansion[i]=(fabs(a_)<0.001);
|
||||
umin[i] = umin_;
|
||||
a[i] = a_;
|
||||
cost[i] = cos(theta0_*3.14159265/180);
|
||||
sint[i] = sin(theta0_*3.14159265/180);
|
||||
theta[i] = theta0_*3.14159265/180;
|
||||
cost[i] = cos(theta0_*MathConst::MY_PI/180.0);
|
||||
sint[i] = sin(theta0_*MathConst::MY_PI/180.0);
|
||||
theta[i] = theta0_*MathConst::MY_PI/180.0;
|
||||
|
||||
if (!doExpansion[i]) opt1[i]=umin_/(exp(a_)-1);
|
||||
|
||||
|
@ -338,3 +339,14 @@ void DihedralCosineShiftExp::read_restart(FILE *fp)
|
|||
if (!doExpansion[i]) opt1[i]=umin[i]/(exp(a[i])-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralCosineShiftExp::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||
fprintf(fp,"%d %g %g %g\n",i,umin[i],
|
||||
theta[i]*180.0/MathConst::MY_PI,a[i]);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class DihedralCosineShiftExp : public Dihedral {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
bool *doExpansion;
|
||||
|
|
|
@ -333,3 +333,12 @@ void DihedralQuadratic::read_restart(FILE *fp)
|
|||
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void DihedralQuadratic::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->ndihedraltypes; i++)
|
||||
fprintf(fp,"%d %g %g \n",i,k[i],phi0[i]*180.0/MY_PI);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class DihedralQuadratic : public Dihedral {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
double *k,*phi0;
|
||||
|
|
|
@ -312,3 +312,13 @@ void ImproperCossq::read_restart(FILE *fp)
|
|||
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperCossq::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||
fprintf(fp,"%d %g %g\n",i,k[i],chi[i]/MY_PI*180.0);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class ImproperCossq : public Improper {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
double *k, *chi;
|
||||
|
|
|
@ -223,7 +223,6 @@ void ImproperDistance::coeff(int narg, char **arg)
|
|||
int count = 0;
|
||||
for (int i = ilo; i <= ihi; i++) {
|
||||
k[i] = k_one;
|
||||
//chi[i] = chi_one/180.0 * PI;
|
||||
chi[i] = chi_one;
|
||||
setflag[i] = 1;
|
||||
count++;
|
||||
|
@ -259,3 +258,13 @@ void ImproperDistance::read_restart(FILE *fp)
|
|||
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperDistance::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||
fprintf(fp,"%d %g %g\n",i,k[i],chi[i]);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class ImproperDistance : public Improper {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
private:
|
||||
double *k,*chi;
|
||||
|
|
|
@ -343,3 +343,13 @@ void ImproperFourier::read_restart(FILE *fp)
|
|||
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperFourier::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||
fprintf(fp,"%d %g %g %g %g %d\n",i,k[i],C0[i],C1[i],C2[i],all[i]);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class ImproperFourier : public Improper {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
double *k, *C0, *C1, *C2;
|
||||
|
|
|
@ -337,3 +337,13 @@ void ImproperRing::read_restart(FILE *fp)
|
|||
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
proc 0 writes to data file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ImproperRing::write_data(FILE *fp)
|
||||
{
|
||||
for (int i = 1; i <= atom->nimpropertypes; i++)
|
||||
fprintf(fp,"%d %g %g\n",i,k[i],acos(chi[i])/MY_PI*180.0);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ class ImproperRing : public Improper {
|
|||
void coeff(int, char **);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
void write_data(FILE *);
|
||||
|
||||
protected:
|
||||
double *k,*chi;
|
||||
|
|
|
@ -231,6 +231,8 @@ void PairCoulShield::init_style()
|
|||
{
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Pair style coul/shield requires atom attribute q");
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Pair style coul/shield requires atom attribute molecule");
|
||||
|
||||
neighbor->request(this,instance_me);
|
||||
}
|
||||
|
|
|
@ -636,7 +636,9 @@ void PairILPGrapheneHBN::calc_normal()
|
|||
void PairILPGrapheneHBN::init_style()
|
||||
{
|
||||
if (force->newton_pair == 0)
|
||||
error->all(FLERR,"Pair style ILP requires newton pair on");
|
||||
error->all(FLERR,"Pair style ilp/graphene/hbn requires newton pair on");
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Pair style ilp/graphene/hbn requires atom attribute molecule");
|
||||
|
||||
// need a full neighbor list, including neighbors of ghosts
|
||||
|
||||
|
|
|
@ -640,7 +640,9 @@ void PairKolmogorovCrespiFull::calc_normal()
|
|||
void PairKolmogorovCrespiFull::init_style()
|
||||
{
|
||||
if (force->newton_pair == 0)
|
||||
error->all(FLERR,"Pair style KC requires newton pair on");
|
||||
error->all(FLERR,"Pair style kolmolgorov/crespi/full requires newton pair on");
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Pair style kolmolgorov/crespi/full requires atom attribute molecule");
|
||||
|
||||
// need a full neighbor list, including neighbors of ghosts
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ void FixRestrain::restrain_bond(int m)
|
|||
if (r > 0.0) fbond = -2.0*rk/r;
|
||||
else fbond = 0.0;
|
||||
|
||||
energy = rk*dr;
|
||||
energy += rk*dr;
|
||||
|
||||
// apply force to each of 2 atoms
|
||||
|
||||
|
@ -368,7 +368,7 @@ void FixRestrain::restrain_angle(int m)
|
|||
dtheta = acos(c) - target[m];
|
||||
tk = k * dtheta;
|
||||
|
||||
energy = tk*dtheta;
|
||||
energy += tk*dtheta;
|
||||
|
||||
a = -2.0 * tk * s;
|
||||
a11 = a*c / rsq1;
|
||||
|
@ -549,7 +549,7 @@ void FixRestrain::restrain_dihedral(int m)
|
|||
df1 *= -mult;
|
||||
p += 1.0;
|
||||
|
||||
energy = k * p;
|
||||
energy += k * p;
|
||||
|
||||
fg = vb1x*vb2xm + vb1y*vb2ym + vb1z*vb2zm;
|
||||
hg = vb3x*vb2xm + vb3y*vb2ym + vb3z*vb2zm;
|
||||
|
|
|
@ -480,10 +480,13 @@ void *lammps_extract_atom(void *ptr, char *name)
|
|||
compute's internal data structure for the entity
|
||||
caller should cast it to (double *) for a scalar or vector
|
||||
caller should cast it to (double **) for an array
|
||||
for per-atom or local data, returns a pointer to the
|
||||
for per-atom or local vector/array data, returns a pointer to the
|
||||
compute's internal data structure for the entity
|
||||
caller should cast it to (double *) for a vector
|
||||
caller should cast it to (double **) for an array
|
||||
for local data, accessing scalar data for the compute (type = 0),
|
||||
returns a pointer that should be cast to (int *) which points to
|
||||
an int with the number of local rows, i.e. the length of the local array.
|
||||
returns a void pointer to the compute's internal data structure
|
||||
for the entity which the caller can cast to the proper data type
|
||||
returns a NULL if id is not recognized or style/type not supported
|
||||
|
@ -541,6 +544,11 @@ void *lammps_extract_compute(void *ptr, char *id, int style, int type)
|
|||
|
||||
if (style == 2) {
|
||||
if (!compute->local_flag) return NULL;
|
||||
if (type == 0) {
|
||||
if (compute->invoked_local != lmp->update->ntimestep)
|
||||
compute->compute_local();
|
||||
return (void *) &compute->size_local_rows;
|
||||
}
|
||||
if (type == 1) {
|
||||
if (compute->invoked_local != lmp->update->ntimestep)
|
||||
compute->compute_local();
|
||||
|
|
Loading…
Reference in New Issue