Merge pull request #2293 from akohlmey/collected-small-changes

Collected small changes and fixes
This commit is contained in:
Axel Kohlmeyer 2020-08-19 11:11:43 -04:00 committed by GitHub
commit e9de1c1a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 54 additions and 69 deletions

View File

@ -9,8 +9,8 @@ if(DOWNLOAD_EIGEN3)
message(STATUS "Eigen3 download requested - we will build our own")
include(ExternalProject)
ExternalProject_Add(Eigen3_build
URL https://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz
URL_MD5 f2a417d083fe8ca4b8ed2bc613d20f07
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
URL_MD5 9e30f67e8531477de4117506fe44669b
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
)
ExternalProject_get_property(Eigen3_build SOURCE_DIR)

View File

@ -22,12 +22,10 @@ tarball = "eigen.tar.gz"
# known checksums for different Eigen versions. used to validate the download.
checksums = { \
'3.3.4' : '1a47e78efe365a97de0c022d127607c3', \
'3.3.5' : 'ee48cafede2f51fe33984ff5c9f48026', \
'3.3.6' : 'd1be14064b50310b0eb2b49e402c64d7', \
'3.3.7' : 'f2a417d083fe8ca4b8ed2bc613d20f07' \
'3.3.7' : '9e30f67e8531477de4117506fe44669b' \
}
# help message
HELP = """
@ -36,7 +34,7 @@ Syntax from src dir: make lib-smd args="-b"
Syntax from lib dir: python Install.py -b
or: python Install.py -p /usr/include/eigen3"
or: python Install.py -v 3.3.4 -b
or: python Install.py -v 3.3.7 -b
Example:
@ -78,7 +76,7 @@ if pathflag:
if buildflag:
print("Downloading Eigen ...")
eigentar = os.path.join(homepath, tarball)
url = "https://bitbucket.org/eigen/eigen/get/%s.tar.gz" % version
url = "https://gitlab.com/libeigen/eigen/-/archive/%s/eigen-%s.tar.gz" % (version,version)
geturl(url, eigentar)
# verify downloaded archive integrity via md5 checksum, if known.
@ -89,7 +87,7 @@ if buildflag:
print("Cleaning up old folders ...")
edir = glob.glob(os.path.join(homepath, "eigen-eigen-*"))
edir = glob.glob(os.path.join(homepath, "eigen-*"))
edir.append(eigenpath)
for one in edir:
if os.path.isdir(one):
@ -102,8 +100,8 @@ if buildflag:
os.remove(eigentar)
else:
sys.exit("File %s is not a supported archive" % eigentar)
edir = glob.glob(os.path.join(homepath, "eigen-eigen-*"))
os.rename(edir[0], eigenpath)
edir = os.path.join(homepath, "eigen-%s" % version)
os.rename(edir, eigenpath)
# create link in lib/smd to Eigen src dir

View File

@ -1460,7 +1460,7 @@ double PairGranular::single(int i, int j, int itype, int jtype,
damp_normal = a*meff;
} else if (damping_model[itype][jtype] == TSUJI) {
damp_normal = sqrt(meff*knfac);
}
} else damp_normal = 0.0;
damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal;
Fdamp = -damp_normal_prefactor*vnnr;

View File

@ -256,7 +256,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con
std::string key = words[1];
std::string filename = words[2];
std::vector<std::string> species(words.begin()+3,words.end());
if (species.size() != atom->ntypes)
if ((int)species.size() != atom->ntypes)
error->one(FLERR,"Incorrect args for KIM_SET_TYPE_PARAMETERS command");
FILE *fp;

View File

@ -1016,10 +1016,8 @@ double get_torque_conversion_factor(units from_unit_enum, units to_unit_enum)
double get_temperature_conversion_factor(units from_unit_enum, units to_unit_enum)
{
map<units, map<units, double> > conv;
double to_si;
conv[kelvin][kelvin] = 1.0;
return conv[from_unit_enum][to_unit_enum];
}

View File

@ -555,7 +555,7 @@ static int sizeofint(const int size)
unsigned int num = 1;
int num_of_bits = 0;
while (size >= num && num_of_bits < 32) {
while (size >= (int) num && num_of_bits < 32) {
num_of_bits++;
num <<= 1;
}
@ -596,7 +596,7 @@ static int sizeofints( const int num_of_ints, unsigned int sizes[])
}
num = 1;
num_of_bytes--;
while (bytes[num_of_bytes] >= num) {
while ((int)bytes[num_of_bytes] >= num) {
num_of_bits++;
num *= 2;
}
@ -650,13 +650,13 @@ static void sendints(int buf[], const int num_of_ints, const int num_of_bits,
}
num_of_bytes = bytecnt;
}
if (num_of_bits >= num_of_bytes * 8) {
for (i = 0; i < num_of_bytes; i++) {
if (num_of_bits >= (int)num_of_bytes * 8) {
for (i = 0; i < (int)num_of_bytes; i++) {
sendbits(buf, 8, bytes[i]);
}
sendbits(buf, num_of_bits - num_of_bytes * 8, 0);
} else {
for (i = 0; i < num_of_bytes-1; i++) {
for (i = 0; i < (int)num_of_bytes-1; i++) {
sendbits(buf, 8, bytes[i]);
}
sendbits(buf, num_of_bits- (num_of_bytes -1) * 8, bytes[i]);
@ -691,7 +691,7 @@ static int receivebits(int buf[], int num_of_bits)
num_of_bits -=8;
}
if (num_of_bits > 0) {
if (lastbits < num_of_bits) {
if ((int)lastbits < num_of_bits) {
lastbits += 8;
lastbyte = (lastbyte << 8) | cbuf[cnt++];
}
@ -931,11 +931,11 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision)
lip = ip;
luip = (unsigned int *) ip;
smallidx = FIRSTIDX;
while (smallidx < LASTIDX && magicints[smallidx] < mindiff) {
while (smallidx < (int)LASTIDX && magicints[smallidx] < mindiff) {
smallidx++;
}
xdr_int(xdrs, &smallidx);
maxidx = MYMIN(LASTIDX, smallidx + 8) ;
maxidx = MYMIN((int)LASTIDX, smallidx + 8) ;
minidx = maxidx - 8; /* often this equal smallidx */
smaller = magicints[MYMAX(FIRSTIDX, smallidx-1)] / 2;
small = magicints[smallidx] / 2;
@ -1111,7 +1111,7 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision)
}
xdr_int(xdrs, &smallidx);
maxidx = MYMIN(LASTIDX, smallidx + 8) ;
maxidx = MYMIN((int)LASTIDX, smallidx + 8) ;
minidx = maxidx - 8; /* often this equal smallidx */
smaller = magicints[MYMAX(FIRSTIDX, smallidx-1)] / 2;
small = magicints[smallidx] / 2;

View File

@ -318,7 +318,7 @@ void FixRX::post_constructor()
error->all(FLERR,"Exceeded the maximum number of species permitted in fix rx.");
tmpspecies[nUniqueSpecies] = new char[strlen(word)+1];
strcpy(tmpspecies[nUniqueSpecies],word);
tmpmaxstrlen = MAX(tmpmaxstrlen,strlen(word));
tmpmaxstrlen = MAX(tmpmaxstrlen,(int)strlen(word));
nUniqueSpecies++;
}
word = strtok(NULL, " \t\n\r\f");
@ -543,7 +543,7 @@ void FixRX::initSparse()
if (SparseKinetics_enableIntegralReactions){
sparseKinetics_inu[i][idx] = (int)sparseKinetics_nu[i][idx];
if (isIntegral_i){
if (sparseKinetics_inu[i][idx] >= nu_bin.size())
if (sparseKinetics_inu[i][idx] >= (int)nu_bin.size())
nu_bin.resize( sparseKinetics_inu[i][idx] );
nu_bin[ sparseKinetics_inu[i][idx] ] ++;
@ -561,7 +561,7 @@ void FixRX::initSparse()
if (SparseKinetics_enableIntegralReactions){
sparseKinetics_inu[i][idx] = (int) sparseKinetics_nu[i][idx];
if (isIntegral_i){
if (sparseKinetics_inu[i][idx] >= nu_bin.size())
if (sparseKinetics_inu[i][idx] >= (int)nu_bin.size())
nu_bin.resize( sparseKinetics_inu[i][idx] );
nu_bin[ sparseKinetics_inu[i][idx] ] ++;

View File

@ -25,7 +25,7 @@ manifold_thylakoid::manifold_thylakoid( LAMMPS *lmp, int /*narg*/, char ** /*arg
manifold_thylakoid::~manifold_thylakoid()
{
for( std::size_t i = 0; i < parts.size(); ++i ){
for(std::size_t i = 0; i < parts.size(); ++i) {
delete parts[i];
}
}
@ -60,7 +60,7 @@ void manifold_thylakoid::checkup()
if (comm->me == 0 ) {
fprintf(screen,"This is checkup of thylakoid %p\n", this);
fprintf(screen,"I have %ld parts. They are:\n", parts.size());
for( int i = 0; i < parts.size(); ++i ){
for( int i = 0; i < (int)parts.size(); ++i ){
fprintf(screen, "[%f, %f] x [%f, %f] x [%f, %f]\n",
parts[i]->xlo, parts[i]->xhi,
parts[i]->ylo, parts[i]->yhi,

View File

@ -163,7 +163,7 @@ void BondSpecial::coeff(int narg, char **arg)
return an equilbrium bond length
------------------------------------------------------------------------- */
double BondSpecial::equilibrium_distance(int i)
double BondSpecial::equilibrium_distance(int /*i*/)
{
return 0.;
}

View File

@ -37,7 +37,7 @@ void Tridiagonal_Solve( const double *a, const double *b,
c[0] /= b[0]; /* Division by zero risk. */
d[0] /= b[0]; /* Division by zero would imply a singular matrix. */
for(i = 1; i < n; i++){
for(i = 1; i < (int)n; i++){
id = (b[i] - c[i-1] * a[i]); /* Division by zero risk. */
c[i] /= id; /* Last value calculated is redundant. */
d[i] = (d[i] - d[i-1] * a[i])/id;
@ -64,26 +64,26 @@ void Natural_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const d
/* build the linear system */
a[0] = a[1] = a[n-1] = 0;
for( i = 2; i < n-1; ++i )
for( i = 2; i < (int)n-1; ++i )
a[i] = h[i-1];
b[0] = b[n-1] = 0;
for( i = 1; i < n-1; ++i )
for( i = 1; i < (int)n-1; ++i )
b[i] = 2 * (h[i-1] + h[i]);
c[0] = c[n-2] = c[n-1] = 0;
for( i = 1; i < n-2; ++i )
for( i = 1; i < (int)n-2; ++i )
c[i] = h[i];
d[0] = d[n-1] = 0;
for( i = 1; i < n-1; ++i )
for( i = 1; i < (int)n-1; ++i )
d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]);
v[0] = 0;
v[n-1] = 0;
Tridiagonal_Solve( &(a[1]), &(b[1]), &(c[1]), &(d[1]), &(v[1]), n-2 );
for( i = 1; i < n; ++i ){
for( i = 1; i < (int)n; ++i ){
coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]);
coef[i-1].c = v[i]/2;
coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6;
@ -114,25 +114,25 @@ void Complete_Cubic_Spline( LAMMPS_NS::Error* error_ptr, const double *h, const
/* build the linear system */
a[0] = 0;
for( i = 1; i < n; ++i )
for( i = 1; i < (int)n; ++i )
a[i] = h[i-1];
b[0] = 2*h[0];
for( i = 1; i < n; ++i )
for( i = 1; i < (int)n; ++i )
b[i] = 2 * (h[i-1] + h[i]);
c[n-1] = 0;
for( i = 0; i < n-1; ++i )
for( i = 0; i < (int)n-1; ++i )
c[i] = h[i];
d[0] = 6 * (f[1]-f[0])/h[0] - 6 * v0;
d[n-1] = 6 * vlast - 6 * (f[n-1]-f[n-2]/h[n-2]);
for( i = 1; i < n-1; ++i )
for( i = 1; i < (int)n-1; ++i )
d[i] = 6 * ((f[i+1]-f[i])/h[i] - (f[i]-f[i-1])/h[i-1]);
Tridiagonal_Solve( &(a[0]), &(b[0]), &(c[0]), &(d[0]), &(v[0]), n );
for( i = 1; i < n; ++i ){
for( i = 1; i < (int)n; ++i ){
coef[i-1].d = (v[i] - v[i-1]) / (6*h[i-1]);
coef[i-1].c = v[i]/2;
coef[i-1].b = (f[i]-f[i-1])/h[i-1] + h[i-1]*(2*v[i] + v[i-1])/6;

View File

@ -22,6 +22,5 @@ at Temple University with a little help and inspiration from
Loris Ercole (SISSA/ISAS Trieste), who contributed compute heat/flux/tally.
Additional contributed compute styles for this package are welcome.
Please contact Axel, if you have questions about the implementation.

View File

@ -543,10 +543,10 @@ void ComputeVoronoi::processCell(voronoicell_neighbor &c, int i)
c.vertices(vcell);
c.face_vertices(vlist); // for each face: vertex count followed list of vertex indices (n_1,v1_1,v2_1,v3_1,..,vn_1,n_2,v2_1,...)
double dx, dy, dz, r2, t2 = ethresh*ethresh;
for( j=0; j<vlist.size(); j+=vlist[j]+1 ) {
for( j=0; j < (int)vlist.size(); j+=vlist[j]+1 ) {
int a, b, nedge = 0;
// vlist[j] contains number of vertex indices for the current face
for( k=0; k<vlist[j]; ++k ) {
for( k=0; k < vlist[j]; ++k ) {
a = vlist[j+1+k]; // first vertex in edge
b = vlist[j+1+(k+1)%vlist[j]]; // second vertex in edge (possible wrap around to first vertex in list)
dx = vcell[a*3] - vcell[b*3];

View File

@ -306,10 +306,12 @@ double FixTempCSLD::compute_scalar()
void FixTempCSLD::write_restart(FILE *fp)
{
int nsize = (98+2+3)*comm->nprocs+2; // pRNG state per proc + nprocs + energy
double *list;
if (comm->me == 0) list = new double[nsize];
list[0] = energy;
list[1] = comm->nprocs;
double *list = nullptr;
if (comm->me == 0) {
list = new double[nsize];
list[0] = energy;
list[1] = comm->nprocs;
}
double state[103];
random->get_state(state);
MPI_Gather(state,103,MPI_DOUBLE,list+2,103*comm->nprocs,MPI_DOUBLE,0,world);
@ -318,8 +320,8 @@ void FixTempCSLD::write_restart(FILE *fp)
int size = nsize * sizeof(double);
fwrite(&size,sizeof(int),1,fp);
fwrite(list,sizeof(double),nsize,fp);
delete[] list;
}
if (comm->me == 0) delete[] list;
}
/* ----------------------------------------------------------------------

View File

@ -339,10 +339,12 @@ double FixTempCSVR::compute_scalar()
void FixTempCSVR::write_restart(FILE *fp)
{
int nsize = (98+2+3)*comm->nprocs+2; // pRNG state per proc + nprocs + energy
double *list;
if (comm->me == 0) list = new double[nsize];
list[0] = energy;
list[1] = comm->nprocs;
double *list = nullptr;
if (comm->me == 0) {
list = new double[nsize];
list[0] = energy;
list[1] = comm->nprocs;
}
double state[103];
random->get_state(state);
MPI_Gather(state,103,MPI_DOUBLE,list+2,103*comm->nprocs,MPI_DOUBLE,0,world);
@ -351,8 +353,8 @@ void FixTempCSVR::write_restart(FILE *fp)
int size = nsize * sizeof(double);
fwrite(&size,sizeof(int),1,fp);
fwrite(list,sizeof(double),nsize,fp);
delete[] list;
}
if (comm->me == 0) delete[] list;
}
/* ----------------------------------------------------------------------

View File

@ -577,8 +577,6 @@ TEST_F(LatticeRegionTest, region_cone)
lmp->input->one("write_dump all atom init.lammpstrj");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 42);
}
@ -591,8 +589,6 @@ TEST_F(LatticeRegionTest, region_cylinder)
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 114);
}
@ -605,8 +601,6 @@ TEST_F(LatticeRegionTest, region_prism)
lmp->input->one("create_atoms 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 1);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 16);
}
@ -619,8 +613,6 @@ TEST_F(LatticeRegionTest, region_sphere)
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 14);
}
@ -635,8 +627,6 @@ TEST_F(LatticeRegionTest, region_union)
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 67);
}
@ -651,8 +641,6 @@ TEST_F(LatticeRegionTest, region_intersect)
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 21);
}
@ -669,8 +657,6 @@ TEST_F(LatticeRegionTest, region_plane)
lmp->input->one("write_dump all atom init.lammpstrj");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
ASSERT_EQ(lmp->atom->natoms, 16);
}

View File

@ -1,7 +1,7 @@
---
lammps_version: 21 Jul 2020
date_generated: Mon Aug 10 15:02:20 202
epsilon: 7.5e-14
epsilon: 2.5e-13
prerequisites: ! |
atom full
pair lj/charmm/coul/long/soft