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

  • Model dataclass: added has_q_112, has_q_123, has_q_233, has_q_134 integer fields.
  • read_model(): extended l_max parsing to accept 1–7 values; added the four new fields to the l_max_enh formula that determines n_descriptor_angular.
  • Model.write(): emits the has_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: added has_q_112, has_q_123, has_q_233, has_q_134 to the paramb struct.
  • nep.cpp: extended the l_max parser to read all four flags; propagated them to num_L and all find_q / accumulate_f12 call 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 (floatdouble, GPU intrinsics removed). Includes the C4B_134 constants and get_f12_4body_134 helper function.

Tests

  • test_read_potential_case*: added has_q_112/123/233/134 == 0 assertions for all existing models.
  • test_extended_l_max_write_format: extended parametrize table with has_q_134 cases, including (0,0,0,1)l_max 4 2 0 0 0 0 1 and (1,1,1,1)l_max 4 2 0 1 1 1 1.
  • test_forces_numerical_*: numerical vs analytic force comparison for models with has_q_112, has_q_123, and has_q_233 enabled.
Edited by Paul Erhart

Merge request reports

Loading