diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 75d531d9af..35ec32e544 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -17,9 +17,15 @@ jobs: with: fetch-depth: 2 + - name: Select Python version + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Building LAMMPS via CMake shell: bash run: | + python3 -m pip install numpy cmake -C cmake/presets/windows.cmake \ -D PKG_PYTHON=on \ -S cmake -B build \ diff --git a/src/CG-DNA/pair_oxdna2_coaxstk.cpp b/src/CG-DNA/pair_oxdna2_coaxstk.cpp index 8b3609983b..1b71d84696 100644 --- a/src/CG-DNA/pair_oxdna2_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna2_coaxstk.cpp @@ -119,8 +119,8 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) double rb_cs[3],rb_cst[3]; // Cartesian unit vectors in lab frame - double ax[3],ay[3],az[3]; - double bx[3],by[3],bz[3]; + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; diff --git a/src/CG-DNA/pair_oxdna_coaxstk.cpp b/src/CG-DNA/pair_oxdna_coaxstk.cpp index 49b25bb81b..6df434c012 100644 --- a/src/CG-DNA/pair_oxdna_coaxstk.cpp +++ b/src/CG-DNA/pair_oxdna_coaxstk.cpp @@ -130,7 +130,7 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) double rb_cs[3],rb_cst[3]; // Cartesian unit vectors in lab frame double ax[3],ay[3],az[3]; - double bx[3],by[3],bz[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; diff --git a/src/CG-DNA/pair_oxdna_excv.cpp b/src/CG-DNA/pair_oxdna_excv.cpp index ae5752028a..f47f92d63c 100644 --- a/src/CG-DNA/pair_oxdna_excv.cpp +++ b/src/CG-DNA/pair_oxdna_excv.cpp @@ -143,7 +143,7 @@ void PairOxdnaExcv::compute(int eflag, int vflag) AtomVecEllipsoid::Bonus *bonus = avec->bonus; int *ellipsoid = atom->ellipsoid; - int n,a,b,in,ia,ib,anum,bnum,atype,btype; + int a,b,in,ia,ib,anum,bnum,atype,btype; evdwl = 0.0; ev_init(eflag,vflag); diff --git a/src/CG-DNA/pair_oxdna_hbond.cpp b/src/CG-DNA/pair_oxdna_hbond.cpp index 3d2e803aa8..926e9207a0 100644 --- a/src/CG-DNA/pair_oxdna_hbond.cpp +++ b/src/CG-DNA/pair_oxdna_hbond.cpp @@ -149,8 +149,8 @@ void PairOxdnaHbond::compute(int eflag, int vflag) // vectors COM-h-bonding site in lab frame double ra_chb[3],rb_chb[3]; // Cartesian unit vectors in lab frame - double ax[3],ay[3],az[3]; - double bx[3],by[3],bz[3]; + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; diff --git a/src/CG-DNA/pair_oxdna_xstk.cpp b/src/CG-DNA/pair_oxdna_xstk.cpp index 61dc1a8100..ffaeacc137 100644 --- a/src/CG-DNA/pair_oxdna_xstk.cpp +++ b/src/CG-DNA/pair_oxdna_xstk.cpp @@ -126,8 +126,8 @@ void PairOxdnaXstk::compute(int eflag, int vflag) // vectors COM-h-bonding site in lab frame double ra_chb[3],rb_chb[3]; // Cartesian unit vectors in lab frame - double ax[3],ay[3],az[3]; - double bx[3],by[3],bz[3]; + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; diff --git a/src/CG-DNA/pair_oxrna2_xstk.cpp b/src/CG-DNA/pair_oxrna2_xstk.cpp index 1f069e6b2f..ee14103dca 100644 --- a/src/CG-DNA/pair_oxrna2_xstk.cpp +++ b/src/CG-DNA/pair_oxrna2_xstk.cpp @@ -121,8 +121,8 @@ void PairOxrna2Xstk::compute(int eflag, int vflag) double ra_chb[3],rb_chb[3]; // Cartesian unit vectors in lab frame - double ax[3],ay[3],az[3]; - double bx[3],by[3],bz[3]; + double ax[3],az[3]; + double bx[3],bz[3]; double **x = atom->x; double **f = atom->f; diff --git a/src/EXTRA-FIX/fix_numdiff.cpp b/src/EXTRA-FIX/fix_numdiff.cpp index 97067d316b..7265ec0b79 100644 --- a/src/EXTRA-FIX/fix_numdiff.cpp +++ b/src/EXTRA-FIX/fix_numdiff.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr), temp_f(nullptr) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr), temp_f(nullptr) { if (narg < 5) error->all(FLERR, "Illegal fix numdiff command"); @@ -109,9 +109,8 @@ void FixNumDiff::init() // check for PE compute - int icompute = modify->find_compute(id_pe); - if (icompute < 0) error->all(FLERR, "Compute ID for fix numdiff does not exist"); - pe = modify->compute[icompute]; + pe = modify->get_compute_by_id(id_pe); + if (!pe) error->all(FLERR, "PE compute ID for fix numdiff does not exist"); if (force->pair && force->pair->compute_flag) pair_compute_flag = 1; diff --git a/src/EXTRA-FIX/fix_numdiff_virial.cpp b/src/EXTRA-FIX/fix_numdiff_virial.cpp index ac7654e166..f2226f4a59 100644 --- a/src/EXTRA-FIX/fix_numdiff_virial.cpp +++ b/src/EXTRA-FIX/fix_numdiff_virial.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiffVirial::FixNumDiffVirial(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(nullptr), temp_x(nullptr), temp_f(nullptr) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), temp_x(nullptr), temp_f(nullptr) { if (narg < 5) error->all(FLERR, "Illegal fix numdiff/virial command"); if (igroup) error->all(FLERR, "Compute numdiff/virial must use group all"); @@ -121,9 +121,8 @@ void FixNumDiffVirial::init() { // check for PE compute - int icompute = modify->find_compute(id_pe); - if (icompute < 0) error->all(FLERR, "Compute ID for fix numdiff does not exist"); - pe = modify->compute[icompute]; + pe = modify->get_compute_by_id(id_pe); + if (!pe) error->all(FLERR, "PE compute ID for fix numdiff/virial does not exist"); if (force->pair && force->pair->compute_flag) pair_compute_flag = 1; @@ -210,7 +209,6 @@ void FixNumDiffVirial::calculate_virial() // loop over 6 strain directions // compute a finite difference force in each dimension - int flag, allflag; double nktv2p = force->nktv2p; double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index 3a596bfd05..11dc5625b9 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -282,10 +282,11 @@ void DynamicalMatrix::calculateMatrix() dynmat_clear(dynmat); if (me == 0 && screen) { - fprintf(screen,"Calculating Dynamical Matrix ...\n"); - fprintf(screen," Total # of atoms = " BIGINT_FORMAT "\n", natoms); - fprintf(screen," Atoms in group = " BIGINT_FORMAT "\n", gcount); - fprintf(screen," Total dynamical matrix elements = " BIGINT_FORMAT "\n", (dynlen*dynlen) ); + fputs("Calculating Dynamical Matrix ...\n", screen); + fmt::print(screen," Total # of atoms = {}\n" + " Atoms in group = {}\n" + " Total dynamical matrix elements = {}\n", + natoms, gcount, dynlen*dynlen); } // emit dynlen rows of dimalpha*dynlen*dimbeta elements diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index 7bc03aaf6f..0f70a591d8 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -232,6 +232,7 @@ void ThirdOrder::options(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR, "Illegal third_order command"); filename = arg[iarg + 1]; file_flag = 1; + iarg += 2; } else if (strcmp(arg[iarg],"fold") == 0) { if (iarg+2 > narg) error->all(FLERR, "Illegal Third Order command"); if (strcmp(arg[iarg+1],"yes") == 0) { @@ -300,11 +301,11 @@ void ThirdOrder::calculateMatrix() getNeighbortags(); if (comm->me == 0 && screen) { - fprintf(screen, "Calculating Third Order ...\n"); - fprintf(screen, " Total # of atoms = " BIGINT_FORMAT "\n", natoms); - fprintf(screen, " Atoms in group = " BIGINT_FORMAT "\n", gcount); - fprintf(screen, " Total third order elements = " - BIGINT_FORMAT "\n", (dynlen * dynlen * dynlen)); + fputs("Calculating Third Order ...\n", screen); + fmt::print(screen," Total # of atoms = {}\n" + " Atoms in group = {}\n" + " Total third order elements = {}\n", + natoms, gcount, dynlen*dynlen*dynlen); } update->nsteps = 0; @@ -436,31 +437,19 @@ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) clearerr(fp); if (folded){ for (int k = 0; k < atom->natoms; k++){ - norm = square(dynmat[k*3])+ - square(dynmat[k*3+1])+ - square(dynmat[k*3+2]); + norm = square(dynmat[k*3])+square(dynmat[k*3+1])+square(dynmat[k*3+2]); if (norm > 1.0e-16) - fprintf(fp, - BIGINT_FORMAT " %d " BIGINT_FORMAT " %d " BIGINT_FORMAT - " %7.8f %7.8f %7.8f\n", - i+1, a + 1, j+1, b + 1, k+1, - dynmat[k*3] * conversion, - dynmat[k*3+1] * conversion, - dynmat[k*3+2] * conversion); + fmt::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", + i+1, a+1, j+1, b+1, k+1, dynmat[k*3] * conversion, + dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); } } else { for (int k = 0; k < gcount; k++){ - norm = square(dynmat[k*3])+ - square(dynmat[k*3+1])+ - square(dynmat[k*3+2]); + norm = square(dynmat[k*3])+square(dynmat[k*3+1])+square(dynmat[k*3+2]); if (norm > 1.0e-16) - fprintf(fp, - BIGINT_FORMAT " %d " BIGINT_FORMAT " %d " BIGINT_FORMAT - " %7.8f %7.8f %7.8f\n", - i+1, a + 1, j+1, b + 1, groupmap[k]+1, - dynmat[k*3] * conversion, - dynmat[k*3+1] * conversion, - dynmat[k*3+2] * conversion); + fmt::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", + i+1, a+1, j+1, b+1, groupmap[k]+1, dynmat[k*3] * conversion, + dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); } } } else if (binaryflag && fp) { @@ -672,8 +661,7 @@ void ThirdOrder::create_groupmap() } //combine subgroup maps into total temporary groupmap - MPI_Allgatherv(sub_groupmap,gid,MPI_LMP_BIGINT, - temp_groupmap,recv,displs,MPI_LMP_BIGINT,world); + MPI_Allgatherv(sub_groupmap,gid,MPI_LMP_BIGINT,temp_groupmap,recv,displs,MPI_LMP_BIGINT,world); std::sort(temp_groupmap,temp_groupmap+gcount); //populate member groupmap based on temp groupmap diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index a310b82c07..b5843f0735 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -5,8 +5,8 @@ ######################################## # download and build googletest framework message(STATUS "Downloading and building googletest framework") -set(GTEST_URL "https://github.com/google/googletest/archive/release-1.11.0.tar.gz" CACHE STRING "URL of googletest source") -set(GTEST_MD5 "e8a8df240b6938bb6384155d4c37d937" CACHE STRING "MD5 sum for googletest source") +set(GTEST_URL "https://github.com/google/googletest/archive/43efa0a4efd40c78b9210d15373112081899a97c.tar.gz" CACHE STRING "URL of googletest source") +set(GTEST_MD5 "0259ff833c03cdbbedda4e5d02fbc6bd" CACHE STRING "MD5 sum for googletest source") mark_as_advanced(GTEST_URL) mark_as_advanced(GTEST_MD5) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml index d1bed9430b..eaf9bf1a7c 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:49 2021 -epsilon: 1e-13 +epsilon: 5e-12 prerequisites: ! | atom full pair lj/cut/tip4p/long