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

This commit is contained in:
sjplimp
2014-01-30 18:30:18 +00:00
parent d22a9eab28
commit 1ba04dabf6
33 changed files with 102 additions and 193 deletions

View File

@ -57,7 +57,7 @@ void PairTersoffMOD::read_file(char *file)
FILE *fp; FILE *fp;
if (comm->me == 0) { if (comm->me == 0) {
fp = fopen(file,"r"); fp = open_potential(file);
if (fp == NULL) { if (fp == NULL) {
char str[128]; char str[128];
sprintf(str,"Cannot open Tersoff potential file %s",file); sprintf(str,"Cannot open Tersoff potential file %s",file);

View File

@ -460,7 +460,7 @@ void PairMEAM::read_files(char *globalfile, char *userfile)
FILE *fp; FILE *fp;
if (comm->me == 0) { if (comm->me == 0) {
fp = fopen(globalfile,"r"); fp = open_potential(globalfile);
if (fp == NULL) { if (fp == NULL) {
char str[128]; char str[128];
sprintf(str,"Cannot open MEAM potential file %s",globalfile); sprintf(str,"Cannot open MEAM potential file %s",globalfile);
@ -641,7 +641,7 @@ void PairMEAM::read_files(char *globalfile, char *userfile)
// open user param file on proc 0 // open user param file on proc 0
if (comm->me == 0) { if (comm->me == 0) {
fp = fopen(userfile,"r"); fp = open_potential(userfile);
if (fp == NULL) { if (fp == NULL) {
char str[128]; char str[128];
sprintf(str,"Cannot open MEAM potential file %s",userfile); sprintf(str,"Cannot open MEAM potential file %s",userfile);

View File

@ -105,10 +105,10 @@ void PairLJCharmmCoulCharmm::compute(int eflag, int vflag)
for (jj = 0; jj < jnum; jj++) { for (jj = 0; jj < jnum; jj++) {
j = jlist[jj]; j = jlist[jj];
jtype = type[j];
factor_lj = special_lj[sbmask(j)]; factor_lj = special_lj[sbmask(j)];
factor_coul = special_coul[sbmask(j)]; factor_coul = special_coul[sbmask(j)];
j &= NEIGHMASK; j &= NEIGHMASK;
jtype = type[j];
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];

View File

@ -546,7 +546,7 @@ int DumpAtomMPIIO::convert_string_omp(int n, double *mybuf)
int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf) int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
{ {
MPI_Status mpiStatus; double *localbuf = mybuf;
char **mpifh_buffer_line_per_thread; char **mpifh_buffer_line_per_thread;
int mpifhStringCount; int mpifhStringCount;
int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength;
@ -581,7 +581,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char));
mpifh_buffer_line_per_thread[i][0] = '\0'; mpifh_buffer_line_per_thread[i][0] = '\0';
#pragma omp parallel default(none) #pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread)
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
int m=0; int m=0;
@ -593,7 +593,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char);
} }
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (mybuf[bufOffset[tid]+m]),static_cast<int> (mybuf[bufOffset[tid]+m+1]),mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4],static_cast<int> (mybuf[bufOffset[tid]+m+5]),static_cast<int> (mybuf[bufOffset[tid]+m+6]),static_cast<int> (mybuf[bufOffset[tid]+m+7])); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (localbuf[bufOffset[tid]+m]),static_cast<int> (localbuf[bufOffset[tid]+m+1]),localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4],static_cast<int> (localbuf[bufOffset[tid]+m+5]),static_cast<int> (localbuf[bufOffset[tid]+m+6]),static_cast<int> (localbuf[bufOffset[tid]+m+7]));
m += size_one; m += size_one;
} }
} }
@ -637,7 +637,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf) int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf)
{ {
MPI_Status mpiStatus; double *localbuf = mybuf;
char **mpifh_buffer_line_per_thread; char **mpifh_buffer_line_per_thread;
int mpifhStringCount; int mpifhStringCount;
int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength;
@ -672,7 +672,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf)
mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char));
mpifh_buffer_line_per_thread[i][0] = '\0'; mpifh_buffer_line_per_thread[i][0] = '\0';
#pragma omp parallel default(none) #pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread)
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
int m=0; int m=0;
@ -684,7 +684,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf)
bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char);
} }
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (mybuf[bufOffset[tid]+m]),static_cast<int> (mybuf[bufOffset[tid]+m+1]),mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4]); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (localbuf[bufOffset[tid]+m]),static_cast<int> (localbuf[bufOffset[tid]+m+1]),localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4]);
m += size_one; m += size_one;
} }
} }

View File

@ -566,7 +566,7 @@ void DumpCustomMPIIO::write_string(int n, double *mybuf)
int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf) int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf)
{ {
MPI_Status mpiStatus; double *localbuf = mybuf;
char **mpifh_buffer_line_per_thread; char **mpifh_buffer_line_per_thread;
int mpifhStringCount; int mpifhStringCount;
int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength;
@ -601,7 +601,7 @@ int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf)
mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char));
mpifh_buffer_line_per_thread[i][0] = '\0'; mpifh_buffer_line_per_thread[i][0] = '\0';
#pragma omp parallel default(none) #pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread)
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
int m=0; int m=0;
@ -615,11 +615,11 @@ int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf)
for (int j = 0; j < size_one; j++) { for (int j = 0; j < size_one; j++) {
if (vtype[j] == INT) if (vtype[j] == INT)
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast<int> (mybuf[bufOffset[tid]+m])); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast<int> (localbuf[bufOffset[tid]+m]));
else if (vtype[j] == DOUBLE) else if (vtype[j] == DOUBLE)
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],mybuf[bufOffset[tid]+m]); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],localbuf[bufOffset[tid]+m]);
else if (vtype[j] == STRING) else if (vtype[j] == STRING)
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],typenames[(int) mybuf[bufOffset[tid]+m]]); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],typenames[(int) localbuf[bufOffset[tid]+m]]);
m ++; m ++;
} }
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n"); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n");

View File

@ -308,7 +308,7 @@ void DumpXYZMPIIO::write_string(int n, double *mybuf)
int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf) int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf)
{ {
MPI_Status mpiStatus; double *localbuf = mybuf;
char **mpifh_buffer_line_per_thread; char **mpifh_buffer_line_per_thread;
int mpifhStringCount; int mpifhStringCount;
int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength; int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength;
@ -343,7 +343,7 @@ int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf)
mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char)); mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char));
mpifh_buffer_line_per_thread[i][0] = '\0'; mpifh_buffer_line_per_thread[i][0] = '\0';
#pragma omp parallel default(none) #pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread)
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
int m=0; int m=0;
@ -355,7 +355,7 @@ int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf)
bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char);
} }
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,typenames[static_cast<int> (mybuf[bufOffset[tid]+m+1])],mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4]); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,typenames[static_cast<int> (localbuf[bufOffset[tid]+m+1])],localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4]);
m += size_one; m += size_one;
} }

View File

@ -78,9 +78,9 @@ elif (test $2 = "diff") then
echo " src/$file does not exist" echo " src/$file does not exist"
elif (! cmp -s $file ../$file) then elif (! cmp -s $file ../$file) then
echo "************************************************" echo "************************************************"
echo "diff $1/$file src/$file " echo "diff -u $1/$file src/$file "
echo "************************************************" echo "************************************************"
diff $file ../$file diff -u $file ../$file
fi fi
done done
fi fi

View File

@ -24,6 +24,8 @@ pair_dipole_sf.h
pair_dipole_sf.cpp pair_dipole_sf.cpp
pair_dipole_sf_omp.h pair_dipole_sf_omp.h
pair_dipole_sf_omp.cpp pair_dipole_sf_omp.cpp
pair_dipole_sf_gpu.h
pair_dipole_sf_gpu.cpp
# deleted on Wed May 8 15:24:36 2013 +0000 # deleted on Wed May 8 15:24:36 2013 +0000
compute_spec_atom.cpp compute_spec_atom.cpp
compute_spec_atom.h compute_spec_atom.h

View File

@ -649,8 +649,6 @@ void FixShake::find_clusters()
tagint tagprev; tagint tagprev;
double massone; double massone;
tagint *buf; tagint *buf;
MPI_Request request;
MPI_Status status;
if (me == 0 && screen) fprintf(screen,"Finding SHAKE clusters ...\n"); if (me == 0 && screen) fprintf(screen,"Finding SHAKE clusters ...\n");

View File

@ -315,7 +315,8 @@ int FixAppendAtoms::get_spatial()
if (domain->boxhi[2] - shockfront_loc < spatlead) advance = 1; if (domain->boxhi[2] - shockfront_loc < spatlead) advance = 1;
delete [] pos,val; delete [] pos;
delete [] val;
} }
advance_sum = 0; advance_sum = 0;
@ -453,7 +454,6 @@ void FixAppendAtoms::pre_exchange()
double x[3]; double x[3];
double *sublo = domain->sublo; double *sublo = domain->sublo;
double *subhi = domain->subhi; double *subhi = domain->subhi;
double *mass = atom->mass;
int i,j,k,m; int i,j,k,m;
for (k = klo; k <= khi; k++) { for (k = klo; k <= khi; k++) {

View File

@ -38,6 +38,7 @@
#include "stdio.h" #include "stdio.h"
#include "string.h" #include "string.h"
#include <sstream> #include <sstream>
#include <string>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -288,7 +289,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
int me = ATC::LammpsInterface::instance()->comm_rank(); int me = ATC::LammpsInterface::instance()->comm_rank();
string groupName(arg[1]); std::string groupName(arg[1]);
int igroup = group->find(groupName.c_str()); int igroup = group->find(groupName.c_str());
int atomCount = group->count(igroup); int atomCount = group->count(igroup);

View File

@ -1332,7 +1332,7 @@ void FixLbRigidPCSphere::set_xv()
void FixLbRigidPCSphere::pre_neighbor() void FixLbRigidPCSphere::pre_neighbor()
{ {
int original,oldimage,newimage; imageint original,oldimage,newimage;
for (int ibody = 0; ibody < nbody; ibody++) { for (int ibody = 0; ibody < nbody; ibody++) {
original = imagebody[ibody]; original = imagebody[ibody];
@ -1355,10 +1355,11 @@ void FixLbRigidPCSphere::pre_neighbor()
// adjust image flags of any atom in a rigid body whose xcm was remapped // adjust image flags of any atom in a rigid body whose xcm was remapped
int *atomimage = atom->image; imageint *atomimage = atom->image;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
int ibody,idim,otherdims; int ibody;
imageint idim,otherdims;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (body[i] == -1) continue; if (body[i] == -1) continue;

View File

@ -78,7 +78,7 @@ class FixLbRigidPCSphere : public Fix {
double **torque_fluid; double **torque_fluid;
double **torque_fluid_old; double **torque_fluid_old;
double **rotate; double **rotate;
int *imagebody; // image flags of xcm of each rigid body imageint *imagebody; // image flags of xcm of each rigid body
double **fflag; // flag for on/off of center-of-mass force double **fflag; // flag for on/off of center-of-mass force
double **tflag; // flag for on/off of center-of-mass torque double **tflag; // flag for on/off of center-of-mass torque

View File

@ -303,7 +303,6 @@ double AngleCosineShiftExp::single(int type, int i1, int i2, int i3)
double s=sqrt(1.0-c*c); double s=sqrt(1.0-c*c);
double cccpsss=c*cost[type]+s*sint[type]; double cccpsss=c*cost[type]+s*sint[type];
double cssmscc=c*sint[type]-s*cost[type];
if (doExpansion[type]) if (doExpansion[type])
{ {

View File

@ -52,7 +52,7 @@ char Read_Force_Field( char *ffield_file, reax_interaction *reax,
/* open force field file */ /* open force field file */
if ( (fp = fopen( ffield_file, "r" ) ) == NULL ) { if ( (fp = fopen( ffield_file, "r" ) ) == NULL ) {
fprintf( stderr, "error opening the force filed file! terminating...\n" ); fprintf( stderr, "error opening the force field file! terminating...\n" );
MPI_Abort( comm, FILE_NOT_FOUND ); MPI_Abort( comm, FILE_NOT_FOUND );
} }

View File

@ -388,7 +388,7 @@ int Allocate_Tokenizer_Space( char **line, char **backup, char ***tokens )
int Tokenize( char* s, char*** tok ) int Tokenize( char* s, char*** tok )
{ {
char test[MAX_LINE]; char test[MAX_LINE];
char *sep = "\t \n!="; const char *sep = (const char *)"\t \n!=";
char *word; char *word;
int count=0; int count=0;
@ -405,7 +405,7 @@ int Tokenize( char* s, char*** tok )
/***************** taken from lammps ************************/ /***************** taken from lammps ************************/
/* safe malloc */ /* safe malloc */
void *smalloc( long n, char *name, MPI_Comm comm ) void *smalloc( long n, const char *name, MPI_Comm comm )
{ {
void *ptr; void *ptr;
@ -428,7 +428,7 @@ void *smalloc( long n, char *name, MPI_Comm comm )
/* safe calloc */ /* safe calloc */
void *scalloc( int n, int size, char *name, MPI_Comm comm ) void *scalloc( int n, int size, const char *name, MPI_Comm comm )
{ {
void *ptr; void *ptr;
@ -458,7 +458,7 @@ void *scalloc( int n, int size, char *name, MPI_Comm comm )
/* safe free */ /* safe free */
void sfree( void *ptr, char *name ) void sfree( void *ptr, const char *name )
{ {
if( ptr == NULL ) { if( ptr == NULL ) {
fprintf( stderr, "WARNING: trying to free the already NULL pointer %s!\n", fprintf( stderr, "WARNING: trying to free the already NULL pointer %s!\n",

View File

@ -67,8 +67,8 @@ int Allocate_Tokenizer_Space( char**, char**, char*** );
int Tokenize( char*, char*** ); int Tokenize( char*, char*** );
/* from lammps */ /* from lammps */
void *smalloc( long, char*, MPI_Comm ); void *smalloc( long, const char*, MPI_Comm );
void *scalloc( int, int, char*, MPI_Comm ); void *scalloc( int, int, const char*, MPI_Comm );
void sfree( void*, char* ); void sfree( void*, const char* );
#endif #endif

View File

@ -721,116 +721,6 @@ int Balance::adjust(int n, double *split)
return change; return change;
} }
/* ----------------------------------------------------------------------
OLD code: for local diffusion method that didn't work as well as RCB
adjust cuts between N slices in a dim via diffusive method
count = atoms per slice
split = current N+1 cuts, with 0.0 and 1.0 at end points
overwrite split with new cuts
diffusion means slices with more atoms than their neighbors "send" atoms,
by moving cut closer to sender, further from receiver
------------------------------------------------------------------------- */
void Balance::old_adjust(int iter, int n, bigint *count, double *split)
{
// need to allocate this if start using it again
double *cuts;
// damping factor
double damp = 0.5;
// loop over slices
// cut I is between 2 slices (I-1 and I) with counts
// cut I+1 is between 2 slices (I and I+1) with counts
// for a cut between 2 slices, only slice with larger count adjusts it
// special treatment of end slices with only 1 neighbor
bigint leftcount,mycount,rightcount;
double rho,target,targetleft,targetright;
for (int i = 0; i < n; i++) {
if (i == 0) leftcount = MAXBIGINT;
else leftcount = count[i-1];
mycount = count[i];
if (i == n-1) rightcount = MAXBIGINT;
else rightcount = count[i+1];
// middle slice is <= both left and right, so do nothing
// special case if 2 slices both have count = 0 -> no change in cut
if (mycount <= leftcount && mycount <= rightcount) {
if (leftcount == 0) cuts[i] = split[i];
if (rightcount == 0) cuts[i+1] = split[i+1];
continue;
}
// rho = density of atoms in the slice
rho = mycount / (split[i+1] - split[i]);
// middle slice has more atoms than left or right slice
// send atoms in that dir
if (mycount > leftcount) {
target = damp * 0.5*(mycount-leftcount);
cuts[i] = split[i] + target/rho;
}
if (mycount > rightcount) {
target = damp * 0.5*(mycount-rightcount);
cuts[i+1] = split[i+1] - target/rho;
}
/*
// middle slice has more atoms then left or right slice
// if delta from middle to top slice > delta between top and bottom slice
// then send atoms both dirs to bring all 3 slices to same count
// else bottom slice is very low, so send atoms only in that dir
if (mycount > leftcount && mycount > rightcount) {
if (mycount-MAX(leftcount,rightcount) >= fabs(leftcount-rightcount)) {
if (leftcount <= rightcount) {
targetleft = damp *
(rightcount-leftcount + (mycount-rightcount)/3.0);
targetright = damp * (mycount-rightcount)/3.0;
cuts[i] = split[i] + targetleft/rho;
cuts[i+1] = split[i+1] - targetright/rho;
} else {
targetleft = damp * (mycount-leftcount)/3.0;
targetright = damp *
(leftcount-rightcount + (mycount-leftcount)/3.0);
cuts[i] = split[i] + targetleft/rho;
cuts[i+1] = split[i+1] - targetright/rho;
}
} else if (leftcount < rightcount) {
target = damp * 0.5*(mycount-leftcount);
cuts[i] = split[i] + target/rho;
cuts[i+1] = split[i+1];
} else if (rightcount < leftcount) {
target = damp * 0.5*(mycount-rightcount);
cuts[i+1] = split[i+1] - target/rho;
cuts[i] = split[i];
}
// middle slice has more atoms than only left or right slice
// send atoms only in that dir
} else if (mycount > leftcount) {
target = damp * 0.5*(mycount-leftcount);
cuts[i] = split[i] + target/rho;
} else if (mycount > rightcount) {
target = damp * 0.5*(mycount-rightcount);
cuts[i+1] = split[i+1] - target/rho;
}
*/
}
// overwrite adjustable splits with new cuts
for (int i = 1; i < n; i++) split[i] = cuts[i];
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binary search for where value falls in N-length vec binary search for where value falls in N-length vec
note that vec actually has N+1 values, but ignore last one note that vec actually has N+1 values, but ignore last one

View File

@ -68,7 +68,6 @@ class Balance : protected Pointers {
double imbalance_splits(int &); double imbalance_splits(int &);
void tally(int, int, double *); void tally(int, int, double *);
int adjust(int, double *); int adjust(int, double *);
void old_adjust(int, int, bigint *, double *);
int binary(double, int, double *); int binary(double, int, double *);
void debug_output(int, int, int, double *); void debug_output(int, int, int, double *);
}; };

View File

@ -35,10 +35,10 @@ class Body : protected Pointers {
// methods implemented by child classes // methods implemented by child classes
virtual int pack_comm_body(class AtomVecBody::Bonus *, double *) {return 0;} virtual int pack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;}
virtual int unpack_comm_body(class AtomVecBody::Bonus *, double *) {return 0;} virtual int unpack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;}
virtual int pack_border_body(class AtomVecBody::Bonus *, double *) {return 0;} virtual int pack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;}
virtual int unpack_border_body(class AtomVecBody::Bonus *, virtual int unpack_border_body(struct AtomVecBody::Bonus *,
double *) {return 0;} double *) {return 0;}
virtual void data_body(int, int, int, char **, char **) = 0; virtual void data_body(int, int, int, char **, char **) = 0;

View File

@ -273,9 +273,9 @@ void DumpCFG::write_lines(int n, double *mybuf)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (j = 0; j < size_one; j++) { for (j = 0; j < size_one; j++) {
if (j == 0) { if (j == 0) {
fprintf(fp,"%f \n",mybuf[m]); fprintf(fp,"%f \n",mybuf[m]);
} else if (j == 1) { } else if (j == 1) {
fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); fprintf(fp,"%s \n",typenames[(int) mybuf[m]]);
} else if (j >= 2) { } else if (j >= 2) {
if (vtype[j] == INT) if (vtype[j] == INT)
fprintf(fp,vformat[j],static_cast<int> (mybuf[m])); fprintf(fp,vformat[j],static_cast<int> (mybuf[m]));
@ -296,9 +296,9 @@ void DumpCFG::write_lines(int n, double *mybuf)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (j = 0; j < size_one; j++) { for (j = 0; j < size_one; j++) {
if (j == 0) { if (j == 0) {
fprintf(fp,"%f \n",mybuf[m]); fprintf(fp,"%f \n",mybuf[m]);
} else if (j == 1) { } else if (j == 1) {
fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); fprintf(fp,"%s \n",typenames[(int) mybuf[m]]);
} else if (j >= 2 && j <= 4) { } else if (j >= 2 && j <= 4) {
unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5;
fprintf(fp,vformat[j],unwrap_coord); fprintf(fp,vformat[j],unwrap_coord);

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class DumpDCD : public Dump { class DumpDCD : public Dump {
public: public:
DumpDCD(LAMMPS *, int, char**); DumpDCD(LAMMPS *, int, char**);
~DumpDCD(); virtual ~DumpDCD();
private: private:
int natoms,ntotal; int natoms,ntotal;

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class DumpLocal : public Dump { class DumpLocal : public Dump {
public: public:
DumpLocal(LAMMPS *, int, char **); DumpLocal(LAMMPS *, int, char **);
~DumpLocal(); virtual ~DumpLocal();
private: private:
int nevery; // dump frequency to check Fix against int nevery; // dump frequency to check Fix against

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class DumpXYZ : public Dump { class DumpXYZ : public Dump {
public: public:
DumpXYZ(class LAMMPS *, int, char**); DumpXYZ(class LAMMPS *, int, char**);
~DumpXYZ(); virtual ~DumpXYZ();
protected: protected:
int ntypes; int ntypes;

View File

@ -200,8 +200,16 @@ void FixAdapt::init()
if (ad->which == PAIR) { if (ad->which == PAIR) {
anypair = 1; anypair = 1;
Pair *pair = NULL;
Pair *pair = force->pair_match(ad->pstyle,1); if (lmp->suffix_enable) {
char psuffix[128];
strcpy(psuffix,ad->pstyle);
strcat(psuffix,"/");
strcat(psuffix,lmp->suffix);
pair = force->pair_match(psuffix,1);
}
if (pair == NULL) pair = force->pair_match(ad->pstyle,1);
if (pair == NULL) error->all(FLERR,"Fix adapt pair style does not exist"); if (pair == NULL) error->all(FLERR,"Fix adapt pair style does not exist");
void *ptr = pair->extract(ad->pparam,ad->pdim); void *ptr = pair->extract(ad->pparam,ad->pdim);
if (ptr == NULL) if (ptr == NULL)

View File

@ -1,4 +1,4 @@
/* ---------------------------------------------------------------------- /* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov Steve Plimpton, sjplimp@sandia.gov
@ -29,9 +29,6 @@ class FixWallHarmonic : public FixWall {
FixWallHarmonic(class LAMMPS *, int, char **); FixWallHarmonic(class LAMMPS *, int, char **);
void precompute(int) {} void precompute(int) {}
void wall_particle(int, int, double); void wall_particle(int, int, double);
private:
double offset[6];
}; };
} }

View File

@ -37,9 +37,16 @@ inline double trunc(double x) {
} }
// Windows version of mkdir function does not have permission flags // Windows version of mkdir function does not have permission flags
#ifndef S_IRWXU
# define S_IRWXU 0 # define S_IRWXU 0
#endif
#ifndef S_IRGRP
# define S_IRGRP 0 # define S_IRGRP 0
#endif
#ifndef S_IXGRP
# define S_IXGRP 0 # define S_IXGRP 0
#endif
inline int mkdir(const char *path, int){ inline int mkdir(const char *path, int){
return _mkdir(path); return _mkdir(path);
} }

View File

@ -27,8 +27,10 @@ int main(int argc, char **argv)
MPI_Init(&argc,&argv); MPI_Init(&argc,&argv);
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD); LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
lammps->input->file(); lammps->input->file();
delete lammps; delete lammps;
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize(); MPI_Finalize();
} }

View File

@ -320,7 +320,9 @@ void Neighbor::init()
special_flag[3] = 1; special_flag[3] = 1;
else special_flag[3] = 2; else special_flag[3] = 2;
if (force->kspace) special_flag[1] = special_flag[2] = special_flag[3] = 2; if (force->kspace || force->pair_match("coul/wolf",0)
|| force->pair_match("coul/dsf",0))
special_flag[1] = special_flag[2] = special_flag[3] = 2;
// maxwt = max multiplicative factor on atom indices stored in neigh list // maxwt = max multiplicative factor on atom indices stored in neigh list

View File

@ -37,6 +37,7 @@ using namespace MathConst;
PairBornCoulWolf::PairBornCoulWolf(LAMMPS *lmp) : Pair(lmp) PairBornCoulWolf::PairBornCoulWolf(LAMMPS *lmp) : Pair(lmp)
{ {
writedata = 1; writedata = 1;
single_enable = 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -43,7 +43,10 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairCoulDSF::PairCoulDSF(LAMMPS *lmp) : Pair(lmp) {} PairCoulDSF::PairCoulDSF(LAMMPS *lmp) : Pair(lmp)
{
single_enable = 0;
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -59,7 +62,7 @@ PairCoulDSF::~PairCoulDSF()
void PairCoulDSF::compute(int eflag, int vflag) void PairCoulDSF::compute(int eflag, int vflag)
{ {
int i,j,ii,jj,inum,jnum,itype,jtype; int i,j,ii,jj,inum,jnum;
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair;
double r,rsq,r2inv,forcecoul,factor_coul; double r,rsq,r2inv,forcecoul,factor_coul;
double prefactor,erfcc,erfcd,e_self,t; double prefactor,erfcc,erfcd,e_self,t;
@ -72,7 +75,6 @@ void PairCoulDSF::compute(int eflag, int vflag)
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;
double *q = atom->q; double *q = atom->q;
int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
double *special_coul = force->special_coul; double *special_coul = force->special_coul;
int newton_pair = force->newton_pair; int newton_pair = force->newton_pair;
@ -91,11 +93,10 @@ void PairCoulDSF::compute(int eflag, int vflag)
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
itype = type[i];
jlist = firstneigh[i]; jlist = firstneigh[i];
jnum = numneigh[i]; jnum = numneigh[i];
if (evflag) { if (eflag) {
e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e;
ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0);
} }
@ -109,20 +110,17 @@ void PairCoulDSF::compute(int eflag, int vflag)
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j];
if (rsq < cutsq[itype][jtype]) { if (rsq < cut_coulsq) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
if (rsq < cut_coulsq) { r = sqrt(rsq);
r = sqrt(rsq); prefactor = factor_coul * qqrd2e*qtmp*q[j]/r;
prefactor = factor_coul * qqrd2e*qtmp*q[j]/r; erfcd = exp(-alpha*alpha*rsq);
erfcd = exp(-alpha*alpha*rsq); t = 1.0 / (1.0 + EWALD_P*alpha*r);
t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd;
erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd +
forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r;
r*f_shift) * r;
}
fpair = forcecoul * r2inv; fpair = forcecoul * r2inv;
f[i][0] += delx*fpair; f[i][0] += delx*fpair;
@ -135,10 +133,8 @@ void PairCoulDSF::compute(int eflag, int vflag)
} }
if (eflag) { if (eflag) {
if (rsq < cut_coulsq) { ecoul = prefactor * (erfcc - r*e_shift - rsq*f_shift);
ecoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); } else ecoul = 0.0;
} else ecoul = 0.0;
}
if (evflag) ev_tally(i,j,nlocal,newton_pair, if (evflag) ev_tally(i,j,nlocal,newton_pair,
0.0,ecoul,fpair,delx,dely,delz); 0.0,ecoul,fpair,delx,dely,delz);

View File

@ -34,7 +34,10 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairCoulWolf::PairCoulWolf(LAMMPS *lmp) : Pair(lmp) {} PairCoulWolf::PairCoulWolf(LAMMPS *lmp) : Pair(lmp)
{
single_enable = 0;
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -43,7 +43,10 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp) {} PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp)
{
single_enable = 0;
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -72,7 +75,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag)
int i,j,ii,jj,inum,jnum,itype,jtype; int i,j,ii,jj,inum,jnum,itype,jtype;
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
double r,rsq,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj; double r,rsq,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj;
double prefactor,erfcc,erfcd,e_self,t; double prefactor,erfcc,erfcd,t;
int *ilist,*jlist,*numneigh,**firstneigh; int *ilist,*jlist,*numneigh,**firstneigh;
evdwl = ecoul = 0.0; evdwl = ecoul = 0.0;
@ -84,8 +87,8 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag)
double *q = atom->q; double *q = atom->q;
int *type = atom->type; int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
double *special_coul = force->special_coul;
double *special_lj = force->special_lj; double *special_lj = force->special_lj;
double *special_coul = force->special_coul;
int newton_pair = force->newton_pair; int newton_pair = force->newton_pair;
double qqrd2e = force->qqrd2e; double qqrd2e = force->qqrd2e;
@ -106,8 +109,8 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag)
jlist = firstneigh[i]; jlist = firstneigh[i];
jnum = numneigh[i]; jnum = numneigh[i];
if (evflag) { if (eflag) {
e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; double e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e;
ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0);
} }
@ -139,7 +142,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag)
erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd;
forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd +
r*f_shift) * r; r*f_shift) * r;
} } else forcecoul = 0.0;
fpair = (forcecoul + factor_lj*forcelj) * r2inv; fpair = (forcecoul + factor_lj*forcelj) * r2inv;
f[i][0] += delx*fpair; f[i][0] += delx*fpair;