git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14270 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -85,7 +85,7 @@ it gives quick access to documentation for all LAMMPS commands.
|
|||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
:numbered:
|
:numbered: // comment
|
||||||
|
|
||||||
Section_intro
|
Section_intro
|
||||||
Section_start
|
Section_start
|
||||||
@ -105,8 +105,8 @@ it gives quick access to documentation for all LAMMPS commands.
|
|||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
==================
|
||||||
|
|
||||||
* :ref:`genindex`
|
* :ref:`genindex` // comment
|
||||||
* :ref:`search`
|
* :ref:`search` // comment
|
||||||
|
|
||||||
END_RST -->
|
END_RST -->
|
||||||
|
|
||||||
|
|||||||
@ -121,22 +121,23 @@ class lammps:
|
|||||||
# double was allocated by library interface function
|
# double was allocated by library interface function
|
||||||
|
|
||||||
def extract_fix(self,id,style,type,i=0,j=0):
|
def extract_fix(self,id,style,type,i=0,j=0):
|
||||||
if type == 0:
|
if style == 0:
|
||||||
if style > 0: return None
|
|
||||||
self.lib.lammps_extract_fix.restype = POINTER(c_double)
|
self.lib.lammps_extract_fix.restype = POINTER(c_double)
|
||||||
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
||||||
result = ptr[0]
|
result = ptr[0]
|
||||||
self.lib.lammps_free(ptr)
|
self.lib.lammps_free(ptr)
|
||||||
return result
|
return result
|
||||||
if type == 1:
|
elif (style == 1) or (style == 2):
|
||||||
self.lib.lammps_extract_fix.restype = POINTER(c_double)
|
if type == 1:
|
||||||
|
self.lib.lammps_extract_fix.restype = POINTER(c_double)
|
||||||
|
elif type == 2:
|
||||||
|
self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double))
|
||||||
|
else:
|
||||||
|
return None
|
||||||
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
||||||
return ptr
|
return ptr
|
||||||
if type == 2:
|
else:
|
||||||
self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double))
|
return None
|
||||||
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
|
||||||
return ptr
|
|
||||||
return None
|
|
||||||
|
|
||||||
# free memory for 1 double or 1 vector of doubles via lammps_free()
|
# free memory for 1 double or 1 vector of doubles via lammps_free()
|
||||||
# for vector, must copy nlocal returned values to local c_double vector
|
# for vector, must copy nlocal returned values to local c_double vector
|
||||||
|
|||||||
@ -73,10 +73,22 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp)
|
|||||||
|
|
||||||
nextra = 1;
|
nextra = 1;
|
||||||
segment = NULL;
|
segment = NULL;
|
||||||
|
|
||||||
|
// generate unique fix-id for this pair style instance
|
||||||
fix_id = strdup("XX_FIX_SRP");
|
fix_id = strdup("XX_FIX_SRP");
|
||||||
fix_id[0] = '0' + srp_instance / 10;
|
fix_id[0] = '0' + srp_instance / 10;
|
||||||
fix_id[1] = '0' + srp_instance % 10;
|
fix_id[1] = '0' + srp_instance % 10;
|
||||||
++srp_instance;
|
++srp_instance;
|
||||||
|
|
||||||
|
// create fix SRP instance here, as it has to
|
||||||
|
// be executed before all other fixes
|
||||||
|
char **fixarg = new char*[3];
|
||||||
|
fixarg[0] = fix_id;
|
||||||
|
fixarg[1] = (char *) "all";
|
||||||
|
fixarg[2] = (char *) "SRP";
|
||||||
|
modify->add_fix(3,fixarg);
|
||||||
|
f_srp = (FixSRP *) modify->fix[modify->nfix-1];
|
||||||
|
delete [] fixarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -436,16 +448,10 @@ void PairSRP::init_style()
|
|||||||
if (!force->newton_pair)
|
if (!force->newton_pair)
|
||||||
error->all(FLERR,"PairSRP: Pair srp requires newton pair on");
|
error->all(FLERR,"PairSRP: Pair srp requires newton pair on");
|
||||||
|
|
||||||
// need fix srp
|
// verify that fix SRP is still defined and has not been changed.
|
||||||
// invoke here instead of constructor
|
int ifix = modify->find_fix(fix_id);
|
||||||
// to make restart possible
|
if (f_srp != (FixSRP *)modify->fix[ifix])
|
||||||
char **fixarg = new char*[3];
|
error->all(FLERR,"Fix SRP has been changed unexpectedly");
|
||||||
fixarg[0] = fix_id;
|
|
||||||
fixarg[1] = (char *) "all";
|
|
||||||
fixarg[2] = (char *) "SRP";
|
|
||||||
modify->add_fix(3,fixarg);
|
|
||||||
f_srp = (FixSRP *) modify->fix[modify->nfix-1];
|
|
||||||
delete [] fixarg;
|
|
||||||
|
|
||||||
// set bond type in fix srp
|
// set bond type in fix srp
|
||||||
// bonds of this type will be represented by bond particles
|
// bonds of this type will be represented by bond particles
|
||||||
|
|||||||
@ -435,8 +435,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
|||||||
if (count == 1) vector = (int *) vptr;
|
if (count == 1) vector = (int *) vptr;
|
||||||
else array = (int **) vptr;
|
else array = (int **) vptr;
|
||||||
|
|
||||||
int *copy;
|
int *copy = (int*) data;
|
||||||
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
|
||||||
for (i = 0; i < count*natoms; i++) copy[i] = 0;
|
for (i = 0; i < count*natoms; i++) copy[i] = 0;
|
||||||
|
|
||||||
tagint *tag = lmp->atom->tag;
|
tagint *tag = lmp->atom->tag;
|
||||||
@ -452,8 +451,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
|||||||
copy[offset++] = array[i][0];
|
copy[offset++] = array[i][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
MPI_Allreduce(copy,data,count*natoms,MPI_INT,MPI_SUM,lmp->world);
|
MPI_Allreduce(MPI_IN_PLACE,data,count*natoms,MPI_INT,MPI_SUM,lmp->world);
|
||||||
lmp->memory->destroy(copy);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
double *vector = NULL;
|
double *vector = NULL;
|
||||||
@ -461,8 +459,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
|||||||
if (count == 1) vector = (double *) vptr;
|
if (count == 1) vector = (double *) vptr;
|
||||||
else array = (double **) vptr;
|
else array = (double **) vptr;
|
||||||
|
|
||||||
double *copy;
|
double *copy = (double*) data;
|
||||||
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
|
||||||
for (i = 0; i < count*natoms; i++) copy[i] = 0.0;
|
for (i = 0; i < count*natoms; i++) copy[i] = 0.0;
|
||||||
|
|
||||||
tagint *tag = lmp->atom->tag;
|
tagint *tag = lmp->atom->tag;
|
||||||
@ -479,8 +476,7 @@ void lammps_gather_atoms(void *ptr, char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPI_Allreduce(copy,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
MPI_Allreduce(MPI_IN_PLACE,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
||||||
lmp->memory->destroy(copy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user