Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6c0399c
WIP: add CPU SNAP potential support
Oct 14, 2026
bd0f0a2
Merge remote-tracking branch 'origin/develop' into feature/snap-cpu-d…
Oct 29, 2026
3c456f7
feat: add CPU SNAP potential support
Oct 29, 2026
0137a83
fix: avoid global dependency in SNAP factory
Oct 29, 2026
c81603d
fix: keep SNAP factory dependency budget neutral
Oct 29, 2026
f55e7ee
refactor: align SNAP module and file naming
Oct 29, 2026
70178c5
test: use ABACUS-generated SNAP fixture
Oct 29, 2026
64e53b9
refactor: split SNAP descriptor derivatives
Oct 29, 2026
47543b3
ci: rerun PR checks
Oct 29, 2026
bf20cc5
fix: validate and implement SNAP inner switching and boundary forces
Nov 1, 2026
fa972d4
refactor: keep SNAP model validation focused
Nov 1, 2026
5de89a4
refactor: reuse SNAP environment during force derivatives
Nov 1, 2026
2f0dff3
fix: confirm SNAP model paths in stdout and running log
Nov 1, 2026
7e4bc50
docs: define SNAP chemical channel order and test mapping
Nov 1, 2026
0b6f111
test: cross-check angular quadratic SNAP forces and virial
Nov 1, 2026
709b6ec
refactor: add cell-independent SNAP contribution accumulator
Nov 1, 2026
45dd062
refactor: use SNAP accumulator for MDCell contributions
Nov 1, 2026
8fbec3f
refactor: use SNAP accumulator for UnitCell contributions
Nov 1, 2026
68d5575
refactor: centralize SNAP regression models and test layout
Nov 2, 2026
be7660a
refactor: shorten SNAP source and test file names
Nov 2, 2026
892a384
refactor: shorten SNAP identifiers to 15 characters
Nov 2, 2026
b7c780b
fix: report SNAP evaluation errors through WARNING_QUIT
Nov 2, 2026
8def046
test: name SNAP model fixtures for each regression case
Nov 2, 2026
c784e44
refactor: restore descriptive SNAP source naming
Nov 2, 2026
9e3a452
test: use numbered SNAP model filenames
Nov 2, 2026
c8ae6fe
refactor: shorten SNAP Clebsch-Gordan filenames
Nov 2, 2026
f12fb78
fix: skip zero-weight SNAP neighbors in force derivatives
Nov 2, 2026
33c11ba
test: cover angular chemical channel permutation and forces
Nov 2, 2026
0140a22
perf: index SNAP Clebsch-Gordan coefficients
Nov 2, 2026
3c24ea2
refactor: require explicit SNAP central element in accumulation
Nov 2, 2026
13ebc3e
refactor: remove unused SNAP helpers and derivative values
Nov 2, 2026
70f2417
fix: report SNAP failures from nonzero MPI ranks
Nov 2, 2026
74259aa
fix(snap): validate model data and reuse descriptor work
Nov 2, 2026
0a4bda2
fix(snap): reject radial factors above one
Nov 2, 2026
ae972f3
Merge remote-tracking branch 'origin/develop' into feature/snap-cpu-d…
Nov 3, 2026
3a554ae
fix(snap): cover chemical cache and restore device log
Nov 3, 2026
ef22d49
fix(snap): remove arbitrary distance cutoff and relocate MPI check
Nov 3, 2026
9cf6a10
test(snap): remove Python MPI error harness
Nov 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion docs/advanced/md.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,25 @@ And the filename of DP model is specified by keyword [pot_file](./input_files/in

## NEP

If ABACUS is compiled with the Neuroevolution Potential ([NEP](https://gpumd.org/potentials/nep.html)), MD simulations using NEP models are enabled. To use this feature, set [esolver_type](./input_files/input-main.md#esolver_type) to `nep` and specify the potential file path with the [pot_file](./input_files/input-main.md#pot_file) keyword in your INPUT file.
If ABACUS is compiled with the Neuroevolution Potential ([NEP](https://gpumd.org/potentials/nep.html)), MD simulations using NEP models are enabled. To use this feature, set [esolver_type](./input_files/input-main.md#esolver_type) to `nep` and specify the potential file path with the [pot_file](./input_files/input-main.md#pot_file) keyword in your INPUT file.

## SNAP

CPU SNAP calculations use `esolver_type snap`, with the coefficient file in
`pot_file` and the LAMMPS-style parameter file in `snap_param_file`. The
implementation supports linear and quadratic coefficients, chemical channels,
outer cutoff switching, and `switchinnerflag` with `sinner` and `dinner`.

For `chemflag 1`, the chemical-channel axes of each flattened coefficient vector
follow the element order in the STRU file. Coefficient blocks are matched by
element name, so their order within `pot_file` is not significant. Reordering
the elements in STRU without reordering the chemical-channel coefficients can
change the potential. The values in `sinner` and `dinner` also follow STRU
element order. This corresponds to the first-appearance order of elements in
LAMMPS `pair_coeff` mappings.

The CPU implementation accepts but does not use the LAMMPS GPU execution
options `chunksize` and `parallelthresh`. Unknown SNAP parameter keywords are
rejected. Each element-pair cutoff must exceed `rmin0`; a contributing neighbor
at or below `rmin0` causes an error. The radial mapping parameter `rfac0` must
satisfy `0 < rfac0 <= 1` so that its angle does not cross pi inside a pair cutoff.
7 changes: 7 additions & 0 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ VPATH=./src_global:\
./source_base/module_out:\
./source_md:\
./source_md/module_plumed:\
./source_md/module_snap:\
./source_basis/module_pw:\
./source_base/module_fft:\
./source_esolver:\
Expand Down Expand Up @@ -344,6 +345,7 @@ OBJS_ESOLVER=esolver_factory.o\
esolver_lj.o\
esolver_dp.o\
esolver_nep.o\
esolver_snap.o\
esolver_of.o\
esolver_of_tddft.o\
esolver_of_interface.o\
Expand Down Expand Up @@ -561,6 +563,11 @@ OBJS_MD=fire.o\
nhchain.o\
plumed_interface.o\
run_md.o\
module_snap/snap_calculator.o\
module_snap/snap_descriptor.o\
module_snap/snap_derivative.o\
module_snap/snap_model.o\
module_snap/snap_cg.o\
verlet.o\

OBJS_NEIGHBOR=sltk_atom.o\
Expand Down
1 change: 1 addition & 0 deletions source/source_esolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ list(
esolver_lj.cpp
esolver_dp.cpp
esolver_nep.cpp
esolver_snap.cpp
esolver_of.cpp
esolver_of_tddft.cpp
esolver_of_interface.cpp
Expand Down
31 changes: 25 additions & 6 deletions source/source_esolver/esolver_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "esolver_dfpt_pw.h"
#include "esolver_sdft_pw.h"
#include "esolver_ks_pw_tddft.h"
#include "source_base/global_variable.h"
#include "source_base/module_device/device.h"
#include "source_hamilt/module_xc/general_exx_info.h"
#include "source_io/module_parameter/parameter.h"
Expand All @@ -23,10 +24,12 @@
#endif
#include "esolver_dp.h"
#include "esolver_nep.h"
#include "esolver_snap.h"
#include "esolver_lj.h"
#include "esolver_of.h"
#include "esolver_of_tddft.h"

#include <sstream>
#include <stdexcept>

namespace ModuleESolver
Expand Down Expand Up @@ -113,12 +116,17 @@ std::string determine_type(const Input_para& inp)
{
esolver_type = "nep_pot";
}
else if (inp.esolver_type == "snap")
{
esolver_type = "snap_pot";
}
else if (esolver_type == "none")
{
ModuleBase::WARNING_QUIT("ESolver", "No such esolver_type combined with basis_type");
}

GlobalV::ofs_running << "\n #ENERGY SOLVER# " << esolver_type << std::endl;
std::ostream& running_log = GlobalV::ofs_running;
running_log << "\n #ENERGY SOLVER# " << esolver_type << std::endl;

auto device_info = inp.device;

Expand All @@ -129,8 +137,14 @@ std::string determine_type(const Input_para& inp)
c = std::toupper(c);
}
}
base_device::information::output_device_info(std::cout, inp.device);
base_device::information::output_device_info(GlobalV::ofs_running, inp.device);
std::ostringstream device_summary;
base_device::information::output_device_info(device_summary, inp.device);
const std::string summary = device_summary.str();
if (!summary.empty())
{
std::cout << summary;
running_log << summary;
}
/***auto end_time = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::duration<double>>(end_time - start_time);
std::cout << "hipGetDeviceInfo took " << duration.count() << " seconds" << std::endl;***/
Expand All @@ -142,7 +156,7 @@ ESolver* init_esolver(const Input_para& inp)
{
// determine type of esolver based on INPUT information
const std::string esolver_type = determine_type(inp);
const bool gamma_only = PARAM.globalv.gamma_only_local;
const bool gamma_only = inp.gamma_only;
#ifdef __LCAO
const LRRuntime lr_runtime{GlobalV::ofs_running, GlobalV::ofs_warning, GlobalV::MY_RANK};
#endif
Expand Down Expand Up @@ -384,11 +398,16 @@ ESolver* init_esolver(const Input_para& inp)
}
else if (esolver_type == "dp_pot")
{
return new ESolver_DP(PARAM.mdp.pot_file);
return new ESolver_DP(inp.mdp.pot_file);
}
else if (esolver_type == "nep_pot")
{
return new ESolver_NEP(PARAM.mdp.pot_file);
return new ESolver_NEP(inp.mdp.pot_file);
}
else if (esolver_type == "snap_pot")
{
const int rank = GlobalV::MY_RANK;
return new ESolver_SNAP(inp.mdp.pot_file, inp.mdp.snap_param_file, GlobalV::ofs_running, rank);
}
throw std::invalid_argument("esolver_type = " + std::string(esolver_type) + ". Wrong in " + std::string(__FILE__)
+ " line " + std::to_string(__LINE__));
Expand Down
Loading
Loading