schema_version: 1
benchmark_id: lammps-tip4p-long-nve-pair-kspace
package_id: lammps
goal_context:
  target: Optimize the TIP4P long-range water NVE workflow by reducing pair plus PPPM cost in lj/cut/tip4p/long and pppm/tip4p without changing the physical model, accuracy, timestep, or stable NVE behavior.
  initial_hypothesis: The first useful direction is to eliminate redundant TIP4P M-site reconstruction and related per-oxygen bookkeeping across pair traversal, PPPM particle mapping, rho accumulation, and IK field interpolation.
  intent_level: guidance
repo:
  editable_paths:
    - src/KSPACE/pair_lj_cut_tip4p_long.cpp
    - src/KSPACE/pair_lj_cut_tip4p_long.h
    - src/KSPACE/pppm_tip4p.cpp
    - src/KSPACE/pppm_tip4p.h
  immutable_paths:
    - .fermilink-optimize/**
    - skills/**
    - examples/**
    - unittest/**
    - doc/**
    - cmake/**
campaign:
  max_iterations: 120
  stop_on_consecutive_rejections: 30
worker:
  max_iterations: 8
  wait_seconds: 1
controller:
  timeout_seconds: 1800
  warmup_runs: 1
  measured_runs: 3
  objective:
    primary_metric: weighted_median_pair_plus_kspace_seconds
    direction: minimize
    min_relative_improvement: 0.02
  reject_on:
    - crash
    - timeout
    - missing_metrics
    - correctness_failure
correctness:
  mode: field_tolerances
  field_tolerances:
    - field: etotal_series
      relative_delta: 1.0e-6
    - field: energy_drift_per_atom_per_step
      abs_delta: 1.0e-8
    - field: pe_series
      relative_delta: 1.0e-6
    - field: ke_series
      relative_delta: 1.0e-6
    - field: temp_series
      relative_delta: 1.0e-6
    - field: press_series
      relative_delta: 1.0e-5
    - field: density_series
      relative_delta: 1.0e-8
    - field: forces_xyz
      rms_delta: 1.0e-8
      abs_delta: 1.0e-8
    - field: atom_count
      abs_delta: 0.0
runtime:
  mode: direct
  command:
    - python3
    - .fermilink-optimize/autogen/benchmark_runner.py
    - --benchmark
    - '{benchmark}'
    - --emit-json
  env:
    OMP_NUM_THREADS: "1"
    FERMILINK_GOAL_INPUT_ROOT: .fermilink-optimize/inputs/all
  pre_commands:
    - - bash
      - -lc
      - mkdir -p build && cd build && cmake -C ../cmake/presets/most.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=off ../cmake && cmake --build . -j4
cases:
  - id: train-16r-short
    weight: 1.0
    input_script: in.tip4p_nve
    data_file: water_216_data.lmp
    mpi_ranks: 16
    omp_num_threads: 1
    expected_atoms: 41472
    run_steps: 1200
    thermo_every: 100
    timer_mode: full
    timestep: 0.5
    pair_style: lj/cut/tip4p/long 1 2 1 1 0.278072379 17.007
    kspace_style: pppm/tip4p 0.0001
    neighbor: 2.0 bin
    pppm_diff_mode: ik
    replicate:
      - 4
      - 4
      - 4
  - id: train-32r-short
    weight: 1.0
    input_script: in.tip4p_nve
    data_file: water_216_data.lmp
    mpi_ranks: 32
    omp_num_threads: 1
    expected_atoms: 41472
    run_steps: 1200
    thermo_every: 100
    timer_mode: full
    timestep: 0.5
    pair_style: lj/cut/tip4p/long 1 2 1 1 0.278072379 17.007
    kspace_style: pppm/tip4p 0.0001
    neighbor: 2.0 bin
    pppm_diff_mode: ik
    replicate:
      - 4
      - 4
      - 4
  - id: train-16r-long
    weight: 1.0
    input_script: in.tip4p_nve_long
    data_file: water_216_data.lmp
    mpi_ranks: 16
    omp_num_threads: 1
    expected_atoms: 41472
    run_steps: 10000
    thermo_every: 100
    timer_mode: full
    timestep: 0.5
    pair_style: lj/cut/tip4p/long 1 2 1 1 0.278072379 17.007
    kspace_style: pppm/tip4p 0.0001
    neighbor: 2.0 bin
    pppm_diff_mode: ik
    replicate:
      - 4
      - 4
      - 4
  - id: test-32r-long
    weight: 0.5
    input_script: in.tip4p_nve_long
    data_file: water_216_data.lmp
    mpi_ranks: 32
    omp_num_threads: 1
    expected_atoms: 41472
    run_steps: 10000
    thermo_every: 100
    timer_mode: full
    timestep: 0.5
    pair_style: lj/cut/tip4p/long 1 2 1 1 0.278072379 17.007
    kspace_style: pppm/tip4p 0.0001
    neighbor: 2.0 bin
    pppm_diff_mode: ik
    replicate:
      - 4
      - 4
      - 4
  - id: test-64r-short
    weight: 0.25
    input_script: in.tip4p_nve
    data_file: water_216_data.lmp
    mpi_ranks: 64
    omp_num_threads: 1
    expected_atoms: 41472
    run_steps: 1200
    thermo_every: 100
    timer_mode: full
    timestep: 0.5
    pair_style: lj/cut/tip4p/long 1 2 1 1 0.278072379 17.007
    kspace_style: pppm/tip4p 0.0001
    neighbor: 2.0 bin
    pppm_diff_mode: ik
    replicate:
      - 4
      - 4
      - 4
split:
  train_case_ids:
    - train-16r-short
    - train-32r-short
    - train-16r-long