git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9511 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2013-02-15 17:36:41 +00:00
parent 9befcb50b3
commit f57f4ec774
5 changed files with 48 additions and 44 deletions

View File

@ -32,7 +32,7 @@ using namespace FixConst;
enum{NOBIAS,BIAS}; enum{NOBIAS,BIAS};
typedef struct { double x,y,z; } vec3_t; typedef struct { double x,y,z; } dbl3_t;
#if defined(__GNUC__) #if defined(__GNUC__)
#define _noalias __restrict #define _noalias __restrict
#else #else
@ -75,10 +75,10 @@ void FixNHAsphereOMP::init()
void FixNHAsphereOMP::nve_v() void FixNHAsphereOMP::nve_v()
{ {
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
vec3_t * _noalias const angmom = (vec3_t *) atom->angmom[0]; dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0];
const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
const vec3_t * _noalias const torque = (vec3_t *) atom->torque[0]; const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0];
const double * _noalias const rmass = atom->rmass; const double * _noalias const rmass = atom->rmass;
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
@ -109,9 +109,9 @@ void FixNHAsphereOMP::nve_v()
void FixNHAsphereOMP::nve_x() void FixNHAsphereOMP::nve_x()
{ {
vec3_t * _noalias const x = (vec3_t *) atom->x[0]; dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
const vec3_t * _noalias const v = (vec3_t *) atom->v[0]; const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
vec3_t * _noalias const angmom = (vec3_t *) atom->angmom[0]; dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0];
const double * _noalias const rmass = atom->rmass; const double * _noalias const rmass = atom->rmass;
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
AtomVecEllipsoid::Bonus * _noalias const bonus = avec->bonus; AtomVecEllipsoid::Bonus * _noalias const bonus = avec->bonus;
@ -163,8 +163,8 @@ void FixNHAsphereOMP::nve_x()
void FixNHAsphereOMP::nh_v_temp() void FixNHAsphereOMP::nh_v_temp()
{ {
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
vec3_t * _noalias const angmom = (vec3_t *) atom->angmom[0]; dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -188,6 +188,7 @@ void FixNHAsphereOMP::nh_v_temp()
#pragma omp parallel for default(none) private(i) schedule(static) #pragma omp parallel for default(none) private(i) schedule(static)
#endif #endif
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
double buf[3];
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
temperature->remove_bias(i,&v[i].x); temperature->remove_bias(i,&v[i].x);
v[i].x *= factor_eta; v[i].x *= factor_eta;

View File

@ -33,7 +33,7 @@ enum{ISO,ANISO,TRICLINIC};
#define TILTMAX 1.5 #define TILTMAX 1.5
typedef struct { double x,y,z; } vec3_t; typedef struct { double x,y,z; } dbl3_t;
#if defined(__GNUC__) #if defined(__GNUC__)
#define _noalias __restrict #define _noalias __restrict
#else #else
@ -48,14 +48,12 @@ typedef struct { double x,y,z; } vec3_t;
void FixNHOMP::remap() void FixNHOMP::remap()
{ {
int i; double oldlo,oldhi,expfac;
double oldlo,oldhi;
double expfac;
double * const * const x = atom->x; double * const * _noalias const x = atom->x;
const int * const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = atom->nlocal; const int nlocal = atom->nlocal;
double * const h = domain->h; double * _noalias const h = domain->h;
// omega is not used, except for book-keeping // omega is not used, except for book-keeping
@ -65,6 +63,7 @@ void FixNHOMP::remap()
if (allremap) domain->x2lamda(nlocal); if (allremap) domain->x2lamda(nlocal);
else { else {
int i;
#if defined (_OPENMP) #if defined (_OPENMP)
#pragma omp parallel for private(i) default(none) schedule(static) #pragma omp parallel for private(i) default(none) schedule(static)
#endif #endif
@ -74,7 +73,7 @@ void FixNHOMP::remap()
} }
if (nrigid) if (nrigid)
for (i = 0; i < nrigid; i++) for (int i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->deform(0); modify->fix[rfix[i]]->deform(0);
// reset global and local box to new size/shape // reset global and local box to new size/shape
@ -92,9 +91,9 @@ void FixNHOMP::remap()
// //
// Ordering of operations preserves time symmetry. // Ordering of operations preserves time symmetry.
double dto2 = dto/2.0; const double dto2 = dto/2.0;
double dto4 = dto/4.0; const double dto4 = dto/4.0;
double dto8 = dto/8.0; const double dto8 = dto/8.0;
// off-diagonal components, first half // off-diagonal components, first half
@ -215,6 +214,7 @@ void FixNHOMP::remap()
if (allremap) domain->lamda2x(nlocal); if (allremap) domain->lamda2x(nlocal);
else { else {
int i;
#if defined (_OPENMP) #if defined (_OPENMP)
#pragma omp parallel for private(i) default(none) schedule(static) #pragma omp parallel for private(i) default(none) schedule(static)
#endif #endif
@ -224,7 +224,7 @@ void FixNHOMP::remap()
} }
if (nrigid) if (nrigid)
for (i = 0; i < nrigid; i++) for (int i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->deform(1); modify->fix[rfix[i]]->deform(1);
} }
@ -238,7 +238,7 @@ void FixNHOMP::nh_v_press()
const double factor0 = exp(-dt4*(omega_dot[0]+mtk_term2)); const double factor0 = exp(-dt4*(omega_dot[0]+mtk_term2));
const double factor1 = exp(-dt4*(omega_dot[1]+mtk_term2)); const double factor1 = exp(-dt4*(omega_dot[1]+mtk_term2));
const double factor2 = exp(-dt4*(omega_dot[2]+mtk_term2)); const double factor2 = exp(-dt4*(omega_dot[2]+mtk_term2));
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -266,6 +266,7 @@ void FixNHOMP::nh_v_press()
#pragma omp parallel for default(none) private(i) schedule(static) #pragma omp parallel for default(none) private(i) schedule(static)
#endif #endif
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
double buf[3];
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
temperature->remove_bias(i,&v[i].x); temperature->remove_bias(i,&v[i].x);
v[i].x *= factor0; v[i].x *= factor0;
@ -290,8 +291,8 @@ void FixNHOMP::nh_v_press()
void FixNHOMP::nve_v() void FixNHOMP::nve_v()
{ {
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -332,8 +333,8 @@ void FixNHOMP::nve_v()
void FixNHOMP::nve_x() void FixNHOMP::nve_x()
{ {
vec3_t * _noalias const x = (vec3_t *) atom->x[0]; dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
const vec3_t * _noalias const v = (vec3_t *) atom->v[0]; const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -357,7 +358,7 @@ void FixNHOMP::nve_x()
void FixNHOMP::nh_v_temp() void FixNHOMP::nh_v_temp()
{ {
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -378,6 +379,7 @@ void FixNHOMP::nh_v_temp()
#pragma omp parallel for default(none) private(i) schedule(static) #pragma omp parallel for default(none) private(i) schedule(static)
#endif #endif
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
double buf[3];
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
temperature->remove_bias(i,&v[i].x); temperature->remove_bias(i,&v[i].x);
v[i].x *= factor_eta; v[i].x *= factor_eta;

View File

@ -30,7 +30,7 @@ enum{NOBIAS,BIAS};
#define INERTIA 0.4 // moment of inertia prefactor for sphere #define INERTIA 0.4 // moment of inertia prefactor for sphere
typedef struct { double x,y,z; } vec3_t; typedef struct { double x,y,z; } dbl3_t;
#if defined(__GNUC__) #if defined(__GNUC__)
#define _noalias __restrict #define _noalias __restrict
#else #else
@ -71,10 +71,10 @@ void FixNHSphereOMP::init()
void FixNHSphereOMP::nve_v() void FixNHSphereOMP::nve_v()
{ {
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
vec3_t * _noalias const omega = (vec3_t *) atom->omega[0]; dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0];
const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
const vec3_t * _noalias const torque = (vec3_t *) atom->torque[0]; const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0];
const double * _noalias const radius = atom->radius; const double * _noalias const radius = atom->radius;
const double * _noalias const rmass = atom->rmass; const double * _noalias const rmass = atom->rmass;
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
@ -116,8 +116,8 @@ void FixNHSphereOMP::nve_v()
void FixNHSphereOMP::nh_v_temp() void FixNHSphereOMP::nh_v_temp()
{ {
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
vec3_t * _noalias const omega = (vec3_t *) atom->omega[0]; dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -141,6 +141,7 @@ void FixNHSphereOMP::nh_v_temp()
#pragma omp parallel for default(none) private(i) schedule(static) #pragma omp parallel for default(none) private(i) schedule(static)
#endif #endif
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
double buf[3];
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
temperature->remove_bias(i,&v[i].x); temperature->remove_bias(i,&v[i].x);
v[i].x *= factor_eta; v[i].x *= factor_eta;

View File

@ -18,7 +18,7 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
typedef struct { double x,y,z; } vec3_t; typedef struct { double x,y,z; } dbl3_t;
#if defined(__GNUC__) #if defined(__GNUC__)
#define _noalias __restrict #define _noalias __restrict
#else #else
@ -38,9 +38,9 @@ void FixNVEOMP::initial_integrate(int vflag)
{ {
// update v and x of atoms in group // update v and x of atoms in group
vec3_t * _noalias const x = (vec3_t *) atom->x[0]; dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
const int * const mask = atom->mask; const int * const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -86,8 +86,8 @@ void FixNVEOMP::final_integrate()
{ {
// update v of atoms in group // update v of atoms in group
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
const int * const mask = atom->mask; const int * const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;

View File

@ -33,7 +33,7 @@ using namespace FixConst;
enum{NO_REMAP,X_REMAP,V_REMAP}; // same as fix_deform.cpp enum{NO_REMAP,X_REMAP,V_REMAP}; // same as fix_deform.cpp
typedef struct { double x,y,z; } vec3_t; typedef struct { double x,y,z; } dbl3_t;
#if defined(__GNUC__) #if defined(__GNUC__)
#define _noalias __restrict #define _noalias __restrict
#else #else
@ -112,7 +112,7 @@ void FixNVTSllodOMP::nh_v_temp()
// calculate temperature since some computes require temp // calculate temperature since some computes require temp
// computed on current nlocal atoms to remove bias // computed on current nlocal atoms to remove bias
vec3_t * _noalias const v = (vec3_t *) atom->v[0]; dbl3_t * _noalias const v = (dbl3_t *) atom->v[0];
const int * _noalias const mask = atom->mask; const int * _noalias const mask = atom->mask;
const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal;
int i; int i;
@ -126,7 +126,7 @@ void FixNVTSllodOMP::nh_v_temp()
#pragma omp parallel for default(none) private(i) shared(h_two) schedule(static) #pragma omp parallel for default(none) private(i) shared(h_two) schedule(static)
#endif #endif
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
double vdelu0,vdelu1,vdelu2; double vdelu0,vdelu1,vdelu2,buf[3];
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
vdelu0 = h_two[0]*v[i].x + h_two[5]*v[i].y + h_two[4]*v[i].z; vdelu0 = h_two[0]*v[i].x + h_two[5]*v[i].y + h_two[4]*v[i].z;
vdelu1 = h_two[1]*v[i].y + h_two[3]*v[i].z; vdelu1 = h_two[1]*v[i].y + h_two[3]*v[i].z;