diff --git a/.github/workflows/flare.yml b/.github/workflows/flare.yml index c291b6b04..504b27918 100644 --- a/.github/workflows/flare.yml +++ b/.github/workflows/flare.yml @@ -16,7 +16,8 @@ jobs: matrix: omp: [OFF, ON] lapack: [OFF, ON] - name: "(OpenMP, Lapack) =" + python-version: ["3.7", "3.8"] + name: "(OpenMP, Lapack, Python) =" # The type of runner that the job will run on runs-on: ubuntu-latest @@ -30,6 +31,10 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - name: Install Sphinx and Breathe run: | @@ -90,7 +95,7 @@ jobs: - name: Install LAMMPS run: | git clone --depth 1 https://github.com/lammps/lammps.git lammps - + cd lammps/src cp pair_hybrid.* pair_lj_cut.* .. rm pair_*.cpp pair_*.h @@ -103,7 +108,7 @@ jobs: rm KOKKOS/pair_*.* mv pair_kokkos.* KOKKOS/ cd ../.. - + cd lammps_plugins ./install.sh $(pwd)/../lammps cd .. diff --git a/lammps_plugins/compute_flare_std_atom.cpp b/lammps_plugins/compute_flare_std_atom.cpp index 6ff45c552..1b809d6c2 100644 --- a/lammps_plugins/compute_flare_std_atom.cpp +++ b/lammps_plugins/compute_flare_std_atom.cpp @@ -405,6 +405,7 @@ void ComputeFlareStdAtom::read_file(char *filename) { MPI_Bcast(&cutoff, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&radial_string_length, 1, MPI_INT, 0, world); MPI_Bcast(&cutoff_string_length, 1, MPI_INT, 0, world); + MPI_Bcast(&kernel_string_length, 1, MPI_INT, 0, world); MPI_Bcast(radial_string, radial_string_length + 1, MPI_CHAR, 0, world); MPI_Bcast(cutoff_string, cutoff_string_length + 1, MPI_CHAR, 0, world); MPI_Bcast(kernel_string, kernel_string_length + 1, MPI_CHAR, 0, world); @@ -530,6 +531,7 @@ void ComputeFlareStdAtom::read_L_inverse(char *filename) { MPI_Bcast(&l_max, 1, MPI_INT, 0, world); MPI_Bcast(&n_kernels, 1, MPI_INT, 0, world); MPI_Bcast(&cutoff, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&kernel_string_length, 1, MPI_INT, 0, world); MPI_Bcast(&radial_string_length, 1, MPI_INT, 0, world); MPI_Bcast(&cutoff_string_length, 1, MPI_INT, 0, world); MPI_Bcast(radial_string, radial_string_length + 1, MPI_CHAR, 0, world); diff --git a/lammps_plugins/kokkos/pair_flare_kokkos.cpp b/lammps_plugins/kokkos/pair_flare_kokkos.cpp index 995c141bc..76653df28 100644 --- a/lammps_plugins/kokkos/pair_flare_kokkos.cpp +++ b/lammps_plugins/kokkos/pair_flare_kokkos.cpp @@ -721,6 +721,12 @@ void PairFLAREKokkos::coeff(int narg, char **arg) { PairFLARE::coeff(narg,arg); + if(!normalized) + error->all(FLERR, "for now, pair flare/kk only supports the normalized kernel"); + if(power != 2) + error->all(FLERR, "for now, pair flare/kk only supports the power-2 kernel"); + //TODO check chebyshev and quadratic + n_harmonics = (l_max+1)*(l_max+1); n_radial = n_species * n_max; n_bond = n_radial * n_harmonics; @@ -777,7 +783,7 @@ void PairFLAREKokkos::init_style() if (memstr != NULL) { maxmem = std::atof(memstr) * 1.0e9; } - printf("FLARE will use up to %.2f GB of device memory, controlled by MAXMEM environment variable\n", maxmem/1.0e9); + if(comm->me==0 || comm->me==comm->nprocs-1) printf("FLARE will use up to %.2f GB of device memory, controlled by MAXMEM environment variable\n", maxmem/1.0e9); } diff --git a/lammps_plugins/pair_flare.cpp b/lammps_plugins/pair_flare.cpp index f6b7d22d6..387c87800 100644 --- a/lammps_plugins/pair_flare.cpp +++ b/lammps_plugins/pair_flare.cpp @@ -299,6 +299,7 @@ void PairFLARE::read_file(char *filename) { MPI_Bcast(&cutoff, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&radial_string_length, 1, MPI_INT, 0, world); MPI_Bcast(&cutoff_string_length, 1, MPI_INT, 0, world); + MPI_Bcast(&kernel_string_length, 1, MPI_INT, 0, world); MPI_Bcast(radial_string, radial_string_length + 1, MPI_CHAR, 0, world); MPI_Bcast(cutoff_string, cutoff_string_length + 1, MPI_CHAR, 0, world); MPI_Bcast(kernel_string, kernel_string_length + 1, MPI_CHAR, 0, world); @@ -357,11 +358,15 @@ void PairFLARE::read_file(char *filename) { cutoff_function = cos_cutoff; // Set the kernel - if (!strcmp(kernel_string, "NormalizedDotProduct")) { + if (strcmp(kernel_string, "NormalizedDotProduct") == 0) { normalized = true; - } else { + } + else if (strcmp(kernel_string, "DotProduct") == 0){ normalized = false; } + else { + error->all(FLERR, "Kernel string not recognized, expected "); + } // Parse the beta vectors. memory->create(beta, beta_size * n_species, "pair:beta"); diff --git a/tests/test_lammps.py b/tests/test_lammps.py index 4e97acc0c..fb7729678 100644 --- a/tests/test_lammps.py +++ b/tests/test_lammps.py @@ -143,7 +143,7 @@ def test_lammps_uncertainty( if n_species > n_types: pytest.skip() - if (power == 1) and ("kokkos" in os.environ.get("lmp")): + if (power == 1 or kernel_type=="DotProduct") and ("kokkos" in os.environ.get("lmp")): pytest.skip() os.chdir(rootdir) @@ -211,7 +211,7 @@ def test_lammps_uncertainty( ### run fix fix_nve all nve compute unc all flare/std/atom {coeff_str} -dump dump_all all custom 1 traj.lammps id type x y z vx vy vz fx fy fz c_unc +dump dump_all all custom 1 traj.lammps id type x y z vx vy vz fx fy fz c_unc dump_modify dump_all sort id thermo_style custom step temp press cpu pxx pyy pzz pxy pxz pyz ke pe etotal vol lx ly lz atoms thermo_modify flush yes format float %23.16g