Support higher-body descriptors and extended l_max format
Summary
This MR adds support for the extended l_max descriptor flags introduced in recent
GPUMD versions. The l_max line in nep.in / nep.txt now accepts up to 7 values:
l_max L_max has_q_222 has_q_1111 has_q_112 has_q_123 has_q_233 has_q_134(Positions 1–2, has_q_222 / has_q_1111, correspond to calorine's existing l_max_4b
/ l_max_5b fields — same concept, GPUMD naming.) Positions 3–6 are boolean flags for
additional higher-body descriptor terms that were absent from calorine.
Changes
Python I/O — calorine/nep/model.py
Modeldataclass: addedhas_q_112,has_q_123,has_q_233,has_q_134integer fields.read_model(): extendedl_maxparsing to accept 1–7 values; added the four new fields to thel_max_enhformula that determinesn_descriptor_angular.Model.write(): emits thehas_q_*flags conditionally — trailing zeros are suppressed, but intermediate zeros are preserved when a later flag is non-zero.
CPU extension — src/nepy/
nep.h: addedhas_q_112,has_q_123,has_q_233,has_q_134to theparambstruct.nep.cpp: extended thel_maxparser to read all four flags; propagated them tonum_Land allfind_q/accumulate_f12call sites.nep_utilities.h: added the descriptor and force-gradient computation for all four terms, porting the reference implementation from~/repos/GPUMD/src/utilities/nep_utilities.cuh(float→double, GPU intrinsics removed). Includes theC4B_134constants andget_f12_4body_134helper function.
Tests
test_read_potential_case*: addedhas_q_112/123/233/134 == 0assertions for all existing models.test_extended_l_max_write_format: extended parametrize table withhas_q_134cases, including(0,0,0,1)→l_max 4 2 0 0 0 0 1and(1,1,1,1)→l_max 4 2 0 1 1 1 1.test_forces_numerical_*: numerical vs analytic force comparison for models withhas_q_112,has_q_123, andhas_q_233enabled.
Edited by Paul Erhart