## Phase 120: Kalika Molecular Dynamics & Atomistic Simulation — Classical MD, Ab Initio MD, Force Fields, Enhanced Sampling & Free Energy Methods

Implements the full atomistic simulation stack for materials science: classical
molecular dynamics with production-grade force evaluation, ab initio molecular
dynamics coupling DFT forces to nuclear trajectories, a comprehensive
interatomic potential library, enhanced sampling for rare-event exploration,
free energy calculation methods, trajectory analysis, transport property
computation via Green-Kubo relations, non-equilibrium MD, structure prediction,
and coarse-grained methods. Targets parity with LAMMPS, GROMACS, CP2K, VASP MD,
and i-PI. Core MD integrators and force evaluation kernels are implemented in
Rust (~55%) for performance, with TypeScript orchestration (~35%) and Python
interoperability (~10%).

---

### 120.1 Scaffolding & Core Types (`@kalika/molecular-dynamics`)

#### 120.1.1 Project Setup

- [x] **120.1.1.1** Create `libs/kalika/molecular-dynamics/` with
      `project.json`, `package.json`, `tsconfig.json`, and `tsconfig.lib.json`;
      add path mapping `@kalika/molecular-dynamics` to `tsconfig.base.json`;
      configure Vitest for unit tests; configure `tsup` for library build
- [x] **120.1.1.2** Set up Rust workspace under
      `libs/kalika/molecular-dynamics/     crates/` with `md-core` crate for
      integrators and force evaluation, `md-potentials` crate for interatomic
      potentials, `md-analysis` crate for trajectory analysis kernels; configure
      `wasm-pack` targets and `napi-rs` bindings for Node.js consumption
- [x] **120.1.1.3** Implement barrel exports in `src/index.ts` with module
      re-exports for all subsystems: types, classical-md, potentials, aimd,
      enhanced-sampling, free-energy, analysis, green-kubo, nemd,
      structure-prediction, coarse-grained

#### 120.1.2 Core Type System

- [x] **120.1.2.1** Define `MDSystem` type: particle arrays (positions
      `Float64Array     [3N]`, velocities `Float64Array[3N]`, forces
      `Float64Array[3N]`, masses, charges, atom types), simulation cell (lattice
      vectors `a`, `b`, `c` as `Mat3`, cell angles, volume computation),
      particle count, species map (element symbol -> type index), neighbor list
      reference, and topology (bonds, angles, dihedrals, impropers as index
      tuples)
- [x] **120.1.2.2** Define `Trajectory` type: ordered sequence of `Frame`
      objects with lazy-loading support (memory-mapped file access for large
      trajectories), frame indexing, time-stamped access, iterator protocol,
      slice/subsample operations, and metadata (ensemble, timestep, thermostat
      parameters)
- [x] **120.1.2.3** Define `Frame` type: snapshot containing positions,
      velocities (optional), forces (optional), cell parameters, step number,
      simulation time, potential energy, kinetic energy, temperature, pressure
      tensor (3x3), stress tensor (Voigt notation 6-component), and per-atom
      properties (charge, type, custom scalar/vector fields)
- [x] **120.1.2.4** Define `ForceField` interface: method
      `computeForces(system:     MDSystem): ForceResult` returning forces,
      potential energy, virial tensor; method
      `computeEnergy(system: MDSystem): number`; method
      `initialize     (system: MDSystem): void` for pre-computation (neighbor
      list setup, reciprocal space grids); property `cutoff: number`; property
      `needsCharges:     boolean`; property `isReactive: boolean`
- [x] **120.1.2.5** Define `Integrator` interface: method
      `step(system: MDSystem,     dt: number, forceField: ForceField): void`
      advancing positions and velocities by one timestep; method
      `halfStepVelocity(system, dt, forces)` for velocity-Verlet split; property
      `order: number` (integration order); property `isSymplectic: boolean`
- [x] **120.1.2.6** Define `Thermostat` interface: method
      `apply(system: MDSystem,     dt: number, targetTemp: number): void`
      modifying velocities to control temperature; method
      `getAdditionalEnergy(): number` for extended-system thermostats
      (Nose-Hoover chain potential energy); property `type:     ThermostatType`
      enum; method `initializeFromTemperature(system, temp)` for
      Maxwell-Boltzmann velocity initialization
- [x] **120.1.2.7** Define `Barostat` interface: method
      `apply(system: MDSystem,     dt: number, targetPressure: PressureTarget): void`
      modifying cell vectors and rescaling positions; `PressureTarget`
      supporting isotropic (scalar), semi-isotropic (2-component), anisotropic
      (6-component Voigt), and triclinic (full 3x3 tensor); method
      `getVolume(): number`; method `getCellDeformationRate(): Mat3`
- [x] **120.1.2.8** Define `Constraint` interface: method
      `applyPositionConstraint     (system: MDSystem, dt: number): void`
      (SHAKE-style); method
      `applyVelocityConstraint(system: MDSystem, dt: number): void`
      (RATTLE-style); property `constrainedDOF: number` (number of removed
      degrees of freedom); property `tolerance: number` (convergence tolerance)
- [x] **120.1.2.9** Define `NeighborList` interface: method
      `build(system:     MDSystem, cutoff: number, skin: number): void`; method
      `needsRebuild     (system: MDSystem): boolean` (check max displacement
      against skin/2); method `getNeighbors(atomIndex: number): NeighborEntry[]`
      with `NeighborEntry     = { index: number, distSq: number, dx: Vec3 }`;
      method `forEachPair     (callback: (i, j, r, dx) => void): void` for
      iteration
- [x] **120.1.2.10** Define `SimulationConfig` type: timestep `dt`, total steps,
      output frequency (trajectory, thermodynamic, restart), ensemble type (NVE,
      NVT, NPT, NPH, NVT+REMD), integrator selection, thermostat config,
      barostat config, force field selection, constraint config, initial
      velocity generation (temperature, random seed), and restart configuration
- [x] **120.1.2.11** Define `MDRunner` class: orchestrates simulation loop —
      reads config, initializes system from structure file, builds neighbor
      list, initializes force field, runs main loop (force evaluation ->
      integration -> thermostat/barostat -> constraints -> property computation
      -> output), handles checkpointing/restart, and reports timing breakdown
      per component

#### 120.1.3 I/O and Serialization

- [x] **120.1.3.1** Implement structure file readers: XYZ (extended with cell in
      comment line), POSCAR/CONTCAR (VASP), CIF (basic crystallographic
      information file), LAMMPS data file (full/atomic/charge/molecular styles),
      PDB (ATOM/HETATM records with CRYST1 cell), GRO (GROMACS coordinate
      format)
- [x] **120.1.3.2** Implement trajectory file readers/writers: XYZ trajectory
      (multi-frame), LAMMPS dump (custom columns), DCD (binary, CHARMM/NAMD
      compatible), XTC (GROMACS compressed trajectory via libxdrfile bindings),
      TRR (GROMACS full-precision), and HDF5-based custom format for random
      access
- [x] **120.1.3.3** Implement restart file read/write: full system state
      serialization (positions, velocities, thermostat/barostat extended
      variables, neighbor list state, step counter, RNG state) in binary format
      with versioning; support for LAMMPS restart file format compatibility
- [x] **120.1.3.4** Implement force field parameter file readers: LAMMPS
      `pair_coeff` style, GROMACS topology (`.top`/`.itp`), AMBER prmtop, CHARMM
      PSF/PRM, and custom YAML/JSON format for Kalika-native force fields

---

### 120.2 Classical MD Engine (Rust)

#### 120.2.1 Integrators

- [x] **120.2.1.1** Implement velocity Verlet integrator in Rust: half-step
      velocity update `v(t+dt/2) = v(t) + (dt/2)a(t)`, full-step position update
      `r(t+dt) = r(t) + dt*v(t+dt/2)`, force evaluation at new positions, second
      half-step `v(t+dt) = v(t+dt/2) + (dt/2)a(t+dt)`; time-reversible,
      symplectic, O(dt^2) accuracy; validate energy conservation in NVE for 10^6
      steps of Lennard-Jones argon (drift < 10^-5 per atom per ns)
- [x] **120.2.1.2** Implement leapfrog integrator in Rust: velocities at
      half-steps `v(t+dt/2) = v(t-dt/2) + dt*a(t)`, positions at full steps
      `r(t+dt) =     r(t) + dt*v(t+dt/2)`; equivalent to velocity Verlet but
      different variable storage; provide velocity synchronization method for
      property computation `v(t) = [v(t+dt/2) + v(t-dt/2)] / 2`
- [x] **120.2.1.3** Implement Beeman integrator in Rust:
      `r(t+dt) = r(t) + dt*v(t)     + (1/6)(4a(t) - a(t-dt))*dt^2`,
      `v(t+dt) = v(t) + (1/6)(2a(t+dt) +     5a(t) - a(t-dt))*dt`; better energy
      conservation than basic Verlet for stiff systems; requires storing
      previous-step accelerations
- [x] **120.2.1.4** Implement multiple time step integration (r-RESPA) in Rust:
      split force into fast (bonded, dt*fast), medium (short-range nonbonded,
      n_medium * dt*fast), and slow (long-range electrostatics, n_slow *
      n_medium \* dt_fast) components; Trotter factorization of the Liouville
      operator; typical ratios 1:4:8 or 1:2:4; validate that RESPA matches
      single-timestep results for a water box within statistical error
- [x] **120.2.1.5** Implement symplectic integrators of higher order in Rust:
      Forest-Ruth (4th order), Yoshida (4th and 6th order) using composition of
      symmetric second-order steps with optimized coefficients; provide
      coefficients as compile-time constants

#### 120.2.2 Neighbor Lists

- [x] **120.2.2.1** Implement cell list (linked-cell) in Rust: divide simulation
      box into cells of size >= cutoff, assign atoms to cells, iterate only over
      atoms in same cell and 26 neighbor cells (13 for half-neighbor list with
      Newton's third law); O(N) construction, O(N) iteration; handle non-cubic
      and triclinic boxes via skewed grid
- [x] **120.2.2.2** Implement Verlet neighbor list with skin in Rust: store
      neighbor pairs within `r_cut + r_skin`, track maximum displacement since
      last build, rebuild when any atom moves more than `r_skin/2`; amortize
      O(N^2) rebuild cost over multiple steps; typical skin 2.0 A for LJ,
      yielding rebuild every 10-20 steps
- [x] **120.2.2.3** Implement combined cell list + Verlet list in Rust: use cell
      list to accelerate Verlet list construction from O(N^2) to O(N); this is
      the standard approach for large systems; provide automatic tuning of cell
      size and skin distance based on measured rebuild frequency
- [x] **120.2.2.4** Implement half-neighbor list optimization in Rust: store
      each pair (i,j) only once with i < j, apply Newton's third law
      `f_j -= f_ij` when computing forces; reduces pair interaction count by
      ~2x; requires atomic updates for parallel force accumulation (use
      per-thread force buffers with reduction)

#### 120.2.3 Periodic Boundary Conditions

- [x] **120.2.3.1** Implement orthorhombic PBC in Rust: wrap positions into box
      `[0, L_x) x [0, L_y) x [0, L_z)` using modulo, minimum image convention
      for pair distances `dx = dx - L_x * round(dx / L_x)`, handle box resizing
      during NPT; validate with known g(r) for LJ fluid
- [x] **120.2.3.2** Implement triclinic PBC in Rust: general parallelepiped cell
      defined by lattice vectors `h = [a, b, c]`, fractional coordinate
      conversion `s = h^{-1} r`, wrap in fractional space
      `s_i = s_i - floor     (s_i)`, minimum image in Cartesian space with all
      27 image convention; support LAMMPS-style tilt factors (xy, xz, yz)
- [x] **120.2.3.3** Implement mixed boundary conditions in Rust: periodic in
      selected dimensions (e.g., periodic in x,y but free in z for slab
      geometry), with vacuum padding and dipole correction for slab
      electrostatics

#### 120.2.4 Short-Range Force Evaluation

- [x] **120.2.4.1** Implement pair force evaluation loop in Rust: iterate over
      neighbor list, compute pair distance, evaluate pair potential and force,
      accumulate forces with Newton's third law, accumulate potential energy and
      pair virial contribution `w_ij = r_ij * f_ij`; SIMD-vectorize inner loop
      using `std::simd` or explicit intrinsics for distance computation and LJ
      evaluation
- [x] **120.2.4.2** Implement cutoff handling in Rust: plain cutoff (force
      discontinuity), shifted potential `V_s(r) = V(r) - V(r_c)` (energy
      continuous, force discontinuous), shifted-force
      `V_sf(r) = V(r) - V(r_c) -     (r - r_c)*V'(r_c)` (both continuous), and
      smooth switching function (CHARMM-style cubic switch between `r_on` and
      `r_off`)
- [x] **120.2.4.3** Implement bonded interaction evaluation in Rust: harmonic
      bonds `V = k(r - r_0)^2`, FENE bonds, Morse bonds; harmonic angles
      `V = k     (theta - theta_0)^2`, cosine-based angles, Urey-Bradley; proper
      dihedrals (Ryckaert-Bellemans, OPLS multi-harmonic, periodic cosine),
      improper dihedrals (harmonic, CVFF); CMAP correction (CHARMM backbone
      torsion grid with bicubic interpolation)

#### 120.2.5 Long-Range Electrostatics

- [x] **120.2.5.1** Implement Ewald summation in Rust: split Coulomb `1/r` into
      short-range real-space (erfc-screened, computed with neighbor list) and
      long-range reciprocal-space (Fourier sum over `k`-vectors within sphere
      `|k| < k_max`); self-energy correction; convergence parameter `alpha`
      selection to balance real/reciprocal cost; O(N^{3/2}) scaling; validate
      against known Madelung constants for NaCl, CsCl, ZnS
- [x] **120.2.5.2** Implement Smooth Particle Mesh Ewald (SPME/PME) in Rust:
      assign charges to 3D mesh via B-spline interpolation (order 4-6), solve
      Poisson equation in reciprocal space via 3D FFT (use `rustfft` or FFTW
      bindings), interpolate forces back to particles; O(N log N) scaling;
      optimal mesh spacing ~1 A; ik-differentiation for force accuracy;
      analytical force correction for non-neutral systems
- [x] **120.2.5.3** Implement PPPM (Particle-Particle Particle-Mesh) in Rust:
      similar to PME but uses Lagrangian interpolation instead of B-splines,
      matching LAMMPS implementation; compute error estimates for real-space and
      k-space contributions; auto-tune alpha, mesh size, and interpolation order
      to achieve target accuracy (e.g., 10^-5 relative force error) with minimum
      total cost
- [x] **120.2.5.4** Implement Wolf summation in Rust: spherically truncated,
      charge-neutralized direct sum
      `V = (1/2) sum_{i,j} q_i q_j [erfc(alpha *     r_ij)/r_ij - erfc(alpha * r_c)/r_c]`
      with self-term correction; O(N) scaling, no FFT needed; suitable for
      disordered/amorphous systems where periodicity assumption is questionable;
      damped shifted force variant (DSF) for smooth forces

#### 120.2.6 Rigid Body Constraints

- [x] **120.2.6.1** Implement SHAKE algorithm in Rust: iteratively adjust
      positions after unconstrained Verlet step to satisfy bond-length
      constraints `|r_i - r_j|^2 = d_{ij}^2`; Gauss-Seidel iteration with
      convergence tolerance 10^-8; support coupled constraints (e.g., rigid
      water with 3 constraints); maximum 100 iterations with convergence check
- [x] **120.2.6.2** Implement RATTLE algorithm in Rust: velocity constraint
      companion to SHAKE, enforce `(r_i - r_j) . (v_i - v_j) = 0` at each step
      to keep constrained bonds from drifting; same iterative approach as SHAKE
      but applied to velocities after the second half-step of velocity Verlet
- [x] **120.2.6.3** Implement SETTLE algorithm in Rust: analytical constraint
      solver for rigid 3-site water molecules (exact closed-form rotation
      matrix); ~3x faster than SHAKE for water; handles the specific geometry of
      OH bond length + HOH angle; validate by running 10^5 steps of SPC/E water
      box and checking bond length/angle deviations remain < 10^-10 A
- [x] **120.2.6.4** Implement LINCS (Linear Constraint Solver) in Rust: matrix-
      based constraint solver using Lagrange multipliers with series expansion
      correction; faster convergence than SHAKE for large molecules; support
      coupling with LINCS order parameter (typically 4-8); correct for rotation
      to maintain constraint accuracy over long simulations

#### 120.2.7 Thermostats

- [x] **120.2.7.1** Implement Berendsen thermostat in Rust: velocity rescaling
      by factor `lambda = sqrt(1 + (dt/tau) * (T_target/T_inst - 1))` with
      coupling time `tau`; simple, fast, but does NOT generate correct canonical
      (NVT) ensemble — suitable only for equilibration; warn user if used for
      production
- [x] **120.2.7.2** Implement Nose-Hoover chain thermostat in Rust: extended-
      system method with chain of `M` thermostats (typically M=3-5), equations
      of motion for chain variables `xi_k` with masses `Q_k`; Suzuki-Yoshida
      integration of thermostat DOF; generates rigorous canonical ensemble;
      compute thermostat contribution to conserved energy
      `H_NHC = sum_k     Q_k * xi_k_dot^2 / 2 + (3N-constraints) * k_B * T * xi_1 + sum_{k>1}     k_B * T * xi_k`
- [x] **120.2.7.3** Implement Langevin thermostat (Brunger-Brooks-Karplus) in
      Rust: add friction `- gamma * v` and random force
      `sqrt(2 * gamma * k_B *     T * m / dt) * R(t)` where R is Gaussian white
      noise; satisfies fluctuation- dissipation theorem; BAOAB splitting
      (Leimkuhler-Matthews) for optimal configurational sampling accuracy;
      friction coefficient `gamma` typically 1-10 ps^-1
- [x] **120.2.7.4** Implement stochastic velocity rescaling (Bussi-Donadio-
      Parrinello) in Rust: rescale kinetic energy K to target K_target drawn
      from correct canonical distribution using
      `dK = (K_target - K) * dt/tau +     2*sqrt(K * K_target / N_f) * dW/sqrt(tau)`;
      generates correct canonical ensemble like Nose-Hoover but with faster
      relaxation and no oscillation artifacts; the recommended thermostat for
      most production runs
- [x] **120.2.7.5** Implement Andersen thermostat in Rust: at each step, each
      atom has probability `nu * dt` of a collision event; colliding atoms have
      velocity redrawn from Maxwell-Boltzmann distribution at target
      temperature; generates correct canonical ensemble but disrupts dynamics
      (not suitable for transport property calculations)
- [x] **120.2.7.6** Implement generalized Langevin equation (GLE) thermostat in
      Rust: colored-noise Langevin dynamics with memory kernel; use auxiliary
      variable formulation (s-variable GLE); support `gle4md`-compatible
      coefficient files; enables quantum thermostat (PIGLET) and optimal
      sampling thermostat (hot-GLE) via appropriate parameter matrices

#### 120.2.8 Barostats

- [x] **120.2.8.1** Implement Berendsen barostat in Rust: isotropic volume
      scaling by factor
      `mu = (1 - beta * dt/tau_p * (P_target - P_inst))^{1/3}`; apply to cell
      vectors and all positions; simple but does NOT generate correct NPT
      ensemble — equilibration only; support semi-isotropic (scale x,y together,
      z independently) and anisotropic modes
- [x] **120.2.8.2** Implement Parrinello-Rahman barostat in Rust: extended-
      Lagrangian method treating cell matrix `h` as dynamical variables with
      fictitious mass `W`; equations of motion
      `W * h_ddot = (P_inst - P_target)     * V * sigma` where
      `sigma = (h^{-1})^T`; generates correct NPT ensemble; couple with
      Nose-Hoover thermostat for MTTK integrator
- [x] **120.2.8.3** Implement Martyna-Tuckerman-Tobias-Klein (MTTK) barostat in
      Rust: fully time-reversible, measure-preserving integrator for NPT using
      Nose-Hoover chain thermostat on both particle and cell DOF; Trotter
      factorization of the NPT Liouville operator; the gold standard for NPT
      simulations; validate conserved quantity H_MTTK drift < 10^-5 per atom per
      ns
- [x] **120.2.8.4** Implement Langevin piston barostat in Rust: stochastic
      dynamics on the volume variable, combining Nose-Hoover barostat with
      Langevin friction/noise on the piston; compatible with Langevin
      thermostat; standard in NAMD-style simulations; parameters: piston mass,
      piston damping time, barostat oscillation period
- [x] **120.2.8.5** Implement stress tensor computation (virial) in Rust:
      compute instantaneous pressure tensor
      `P_ab = (1/V) [sum_i m_i v_{i,a} v_{i,b} +     sum_{i<j} r_{ij,a} f_{ij,b}]`
      including kinetic (ideal gas) and potential (virial) contributions; handle
      bonded virial, constraint virial, and long- range correction; scalar
      pressure `P = (P_xx + P_yy + P_zz) / 3`

#### 120.2.9 On-the-fly Properties

- [x] **120.2.9.1** Implement instantaneous property computation in Rust:
      temperature `T = 2 * K / (N_f * k_B)` with correct degrees of freedom
      `N_f = 3N - constraints - 3` (center of mass), pressure from virial
      theorem, potential/kinetic/total energy, center of mass velocity (and
      removal), angular momentum
- [x] **120.2.9.2** Implement running averages and block averaging in Rust:
      compute mean, variance, standard error with block averaging
      (Flyvbjerg-Petersen method) to account for autocorrelation; automatic
      detection of decorrelation time; output thermodynamic properties at
      configurable interval with proper error bars

---

### 120.3 Interatomic Potential Library

#### 120.3.1 Pair Potentials

- [x] **120.3.1.1** Implement Lennard-Jones potential in Rust: standard 12-6
      form `V(r) = 4*epsilon*[(sigma/r)^12 - (sigma/r)^6]` with analytic force;
      generalized m-n form
      `V(r) = epsilon*(n/(n-m))*(n/m)^(m/(n-m))*[(sigma/r)^n     - (sigma/r)^m]`;
      support Lorentz-Berthelot and geometric mixing rules for cross-species;
      long-range tail correction for energy and pressure
- [x] **120.3.1.2** Implement Morse potential in Rust:
      `V(r) = D_e * (1 - exp(-a     *(r - r_e)))^2` with depth `D_e`, width `a`,
      equilibrium distance `r_e`; more realistic than LJ for bonded-like
      interactions; analytic force; used for metal-metal and metal-oxide
      interactions
- [x] **120.3.1.3** Implement Buckingham potential in Rust:
      `V(r) = A * exp(-r/rho)     - C/r^6` with Born-Mayer repulsion and van der
      Waals attraction; include the Buckingham catastrophe warning (divergence
      at r->0) and optional inner wall (switch to repulsive at short range);
      commonly used for ionic systems
- [x] **120.3.1.4** Implement Born-Mayer-Huggins potential in Rust:
      `V(r) = A *     exp(B*(sigma - r)) - C/r^6 - D/r^8` with full
      parameterization for alkali halides (Tosi-Fumi parameters); include
      charge-charge Coulomb interaction for full ionic potential
- [x] **120.3.1.5** Implement Coulomb interaction in Rust:
      `V(r) = q_i * q_j /     (4*pi*epsilon_0*r)` with support for real-space
      evaluation (damped by erfc for Ewald), reaction field method for
      non-periodic systems, and charge scaling for effective polarization in
      mean-field approach

#### 120.3.2 Many-Body Metal Potentials

- [x] **120.3.2.1** Implement Embedded Atom Method (EAM, Daw-Baskes) in Rust:
      energy `E_i = F_i(rho_i) + (1/2) sum_j phi_ij(r_ij)` where
      `rho_i = sum_j     rho_j(r_ij)` is electron density from neighbors, `F_i`
      is embedding function, `phi_ij` is pair repulsion; force
      `f_ij = -[phi'(r) + (F'(rho_i)     + F'(rho_j)) * rho'(r)] * r_hat`;
      three-pass evaluation (density -> embed -> force); read LAMMPS `eam`
      (single element) and `eam.alloy` (multi- element Setfl) tabulated
      potential files with cubic spline interpolation
- [x] **120.3.2.2** Implement Finnis-Sinclair potentials in Rust: special case
      of EAM with `F(rho) = -A*sqrt(rho)` (second-moment tight-binding);
      parameterizations for bcc transition metals (Fe, W, Mo, Ta, V, Nb); read
      LAMMPS `eam.fs` format
- [x] **120.3.2.3** Implement Modified Embedded Atom Method (MEAM) in Rust:
      angular-dependent electron density `rho_i = sum_l rho_i^(l)` with `l=0`
      (spherical), `l=1` (p-orbital), `l=2` (d-orbital), `l=3` (f-orbital)
      components; screening function (Baskes screening); reference structure
      subtraction; parameterization for Si, C, and alloy systems; read LAMMPS
      MEAM library/parameter files

#### 120.3.3 Bond-Order Potentials

- [x] **120.3.3.1** Implement Tersoff potential in Rust:
      `V_ij = f_C(r_ij) *     [f_R(r_ij) + b_ij * f_A(r_ij)]` where bond-order
      `b_ij = (1 + beta^n *     zeta_ij^n)^{-1/(2n)}` depends on local
      environment via
      `zeta_ij = sum_{k     != i,j} f_C(r_ik) * g(theta_ijk) * exp(lambda_3^3 * (r_ij - r_ik)^3)`;
      parameterizations for Si, C, Ge, SiC, SiGe; read LAMMPS Tersoff format
- [x] **120.3.3.2** Implement REBO (Reactive Empirical Bond Order, Brenner) in
      Rust: second-generation REBO for hydrocarbons with pi-bond conjugation
      correction and dihedral interaction for double bonds; seamless bond
      formation/breaking; parameterization for C-H systems
- [x] **120.3.3.3** Implement AIREBO (Adaptive Intermolecular REBO) in Rust:
      REBO + LJ intermolecular interactions (with adaptive cutoff to exclude
      bonded neighbors) + torsional interaction for single bonds; the standard
      potential for carbon nanostructures (graphene, nanotubes, fullerenes);
      support AIREBO-M variant (Morse instead of LJ)
- [x] **120.3.3.4** Implement Stillinger-Weber potential in Rust: two-body
      `V_2 =     A * epsilon * (B*(sigma/r)^p - (sigma/r)^q) * exp(sigma/(r - a*sigma))`
      plus three-body
      `V_3 = lambda * epsilon * (cos(theta_ijk) - cos(theta_0))^2     * exp(gamma*sigma/(r_ij - a*sigma)) * exp(gamma*sigma/(r_ik - a*sigma))`;
      parameterizations for Si, Ge, GaN, MoS2

#### 120.3.4 Reactive Force Fields

- [x] **120.3.4.1** Implement ReaxFF (Reactive Force Field) in Rust: full
      implementation including bond-order calculation from interatomic distances
      (with bond-order correction for over/under coordination), lone pair
      energy, valence angle energy (with penalty for under-coordinated atoms),
      torsion angle energy, conjugation correction, hydrogen bonding, van der
      Waals (inner-wall Morse + outer LJ with Taper function), and Coulomb with
      charge equilibration
- [x] **120.3.4.2** Implement QEq (charge equilibration) for ReaxFF in Rust:
      self-consistent charge assignment minimizing
      `E = sum_i [chi_i * q_i +     J_i * q_i^2 / 2] + sum_{i<j} C * q_i * q_j * T(r_ij) / r_ij`
      subject to `sum q_i = Q_total`; solve via extended Lagrangian (ACKS2) or
      conjugate gradient; Taper function for shielded electrostatics; update
      charges every step for reactive simulations
- [x] **120.3.4.3** Implement ReaxFF parameter file reader in Rust: parse
      LAMMPS- compatible `ffield.reax` format with sections for general
      parameters, atom parameters (valence, electronegativity, hardness), bond
      parameters, off- diagonal parameters, angle parameters, torsion
      parameters, hydrogen bond parameters; validate parameter count and
      cross-reference atom types
- [x] **120.3.4.4** Implement COMB3 (Charge-Optimized Many-Body) potential in
      Rust: environment-dependent charges with self-consistent field iteration,
      short- range interactions (Tersoff-like bond order), correction terms for
      coordination and angles; parameterized for metal-oxide-organic interfaces
      (Cu/ZnO, Ti/TiO2, etc.)

#### 120.3.5 Coarse-Grained Potentials

- [x] **120.3.5.1** Implement MARTINI coarse-grained force field in Rust:
      parameterized LJ (4:1 mapping, 4 heavy atoms per bead) with 18 bead types
      and interaction matrix; support for MARTINI 2.x and MARTINI 3 parameter
      sets; bonded interactions for polymer/biomolecular topologies; elastic
      network for protein secondary structure
- [x] **120.3.5.2** Implement Dissipative Particle Dynamics (DPD) force field in
      Rust: conservative force `F_C = a_ij * (1 - r/r_c) * r_hat`, dissipative
      force `F_D = -gamma * w_D(r) * (r_hat . v_ij) * r_hat`, random force
      `F_R = sigma * w_R(r) * xi * r_hat / sqrt(dt)` with
      `sigma^2 = 2*gamma*     k_B*T` (fluctuation-dissipation); modified
      velocity-Verlet for DPD

#### 120.3.6 Specialized Potentials

- [x] **120.3.6.1** Implement Vashishta potential for silica (SiO2) in Rust:
      two- body steric repulsion + Coulomb + charge-dipole + van der Waals +
      three- body bond-bending term; parameterizations for SiO2, Si3N4, InP;
      correct prediction of quartz, cristobalite, amorphous silica structures
- [x] **120.3.6.2** Implement Pedone potential for metal oxides in Rust: Morse +
      Coulomb for oxide glasses; parameterized for Na2O-SiO2, CaO-SiO2,
      MgO-SiO2, Al2O3-SiO2 compositions; partial charges optimized for
      structural and elastic properties; long-range Coulomb via Ewald/PME

#### 120.3.7 Water Models

- [x] **120.3.7.1** Implement rigid 3-site water models in Rust: SPC/E (Simple
      Point Charge Extended) with charges q_O=-0.8476e, q_H=+0.4238e, LJ on
      oxygen only, rOH=1.0 A, angle=109.47; TIP3P with distinct parameters;
      requires SHAKE/SETTLE constraints; validate density at 298K/1atm (SPC/E:
      998 kg/m^3) and diffusion coefficient
- [x] **120.3.7.2** Implement 4-site water models in Rust: TIP4P and TIP4P/2005
      with virtual site M (massless charge site along bisector of HOH angle);
      M-site force redistribution to O and H atoms; TIP4P/2005 is the most
      accurate rigid non-polarizable model (density maximum near 4C, correct
      phase diagram); OPC (Optimal Point Charge) 4-site model
- [x] **120.3.7.3** Implement MB-pol water model in Rust: many-body polarizable
      model with explicit 2-body (short-range) and 3-body (induction)
      permutationally invariant polynomial (PIP) fits to CCSD(T) energies;
      Thole-type polarization with 3 polarizable sites; the most accurate water
      potential available; support for TTM4-F as a simpler polarizable
      alternative

#### 120.3.8 Classical Force Fields for Organics

- [x] **120.3.8.1** Implement OPLS-AA force field reader in Rust: read parameter
      files for atom types, nonbonded (LJ + charges), bonds, angles, proper/
      improper dihedrals; geometric combining rules for LJ cross-interactions;
      1-4 scaling (0.5 for LJ, 0.5 for Coulomb); atom typing from SMILES/
      connectivity
- [x] **120.3.8.2** Implement AMBER/GAFF force field reader in Rust: read
      prmtop/ frcmod files; Lorentz-Berthelot combining rules; 1-4 scaling (0.5
      LJ, 0.8333 Coulomb); GAFF (General Amber Force Field) for arbitrary
      organic molecules; support AM1-BCC charge assignment via external call to
      antechamber
- [x] **120.3.8.3** Implement CHARMM/CGenFF force field reader in Rust: read PSF
      topology and PRM parameter files; Lorentz-Berthelot combining rules;
      explicit 1-4 LJ parameters (NBFIX); CMAP backbone torsion corrections;
      CGenFF for general organic molecules via ParamChem-compatible atom typing

#### 120.3.9 Universal Potentials and Format Readers

- [x] **120.3.9.1** Implement Universal Force Field (UFF) in Rust: fully
      parameterized for all elements 1-103; bond stretch (harmonic, Morse),
      angle bend (harmonic cosine, linear, sp3d), torsion (cosine), inversion
      (cosine, umbrella), van der Waals (LJ 12-6), electrostatic (QEq charges);
      automatic atom typing from connectivity and geometry
- [x] **120.3.9.2** Implement Dreiding force field in Rust: generic force field
      with parameterization for H, C, N, O, F, P, S, Cl, and noble gases;
      harmonic/Morse bonds, harmonic cosine angles, proper/improper dihedrals,
      LJ or exponential-6 nonbonded, hydrogen bonds
- [x] **120.3.9.3** Implement potential file format readers in Rust: LAMMPS
      setfl (`.eam.alloy`), LAMMPS Tersoff (`.tersoff`), LAMMPS ReaxFF
      (`ffield.reax`), GULP two-body/three-body potential library, OpenKIM model
      driver interface (query KIM API for recommended potentials by chemistry);
      provide unified `loadPotential(format, filePath)` API
- [x] **120.3.9.4** Implement automatic potential selection heuristic in
      TypeScript: given element list and system type (bulk crystal, surface,
      nanoparticle, liquid, glass, organic, interface), recommend appropriate
      potential from library with literature citations; rank by accuracy for
      target properties (elastic constants, surface energy, melting point, etc.)

---

### 120.4 Ab Initio Molecular Dynamics (AIMD)

#### 120.4.1 Born-Oppenheimer MD (BOMD)

- [x] **120.4.1.1** Implement BOMD driver in TypeScript: at each MD step, call
      DFT solver (from `@kalika/quantum-mechanics` or external interface) to
      converge electronic structure to SCF tolerance (typically 10^-7 Ha),
      extract Hellmann-Feynman forces `F_I = -dE/dR_I`, feed forces to
      velocity-Verlet integrator; manage SCF wavefunction extrapolation from
      previous steps for faster convergence (ASPC: Always Stable
      Predictor-Corrector)
- [x] **120.4.1.2** Implement wavefunction extrapolation for BOMD in TypeScript:
      use density matrix or wavefunction coefficients from previous `n` steps to
      predict initial guess for current step SCF; linear, quadratic, or ASPC
      extrapolation; reduces SCF iterations from ~15 to ~5 per step; handle
      history reset at trajectory restart or large geometry change
- [x] **120.4.1.3** Implement AIMD timestep selection logic in TypeScript:
      recommend timestep based on lightest element (H: 0.5 fs, Li: 1.0 fs,
      heavier: 1.0-2.0 fs); validate energy conservation in NVE test run (drift
      < 1 meV/atom/ps); provide adaptive timestep option based on force/velocity
      magnitude
- [x] **120.4.1.4** Implement AIMD for metals in TypeScript: variable-occupation
      SCF with Fermi-Dirac smearing (electronic temperature T_e = 0.1-0.3 eV);
      Mermin free energy functional; correct forces include entropic
      contribution `-T_e * dS/dR_I`; enable k-point sampling (at least
      gamma-point) for metallic systems

#### 120.4.2 Car-Parrinello MD (CPMD)

- [x] **120.4.2.1** Implement Car-Parrinello MD driver in TypeScript: propagate
      both nuclear positions `R_I` and orbital coefficients `c_{n,G}` as
      dynamical variables; nuclear EOM `M_I * R_I_ddot = -dE/dR_I`, orbital EOM
      `mu * c_n_ddot = -dE/dc_n^* + sum_m Lambda_{nm} * c_m` with orthogonality
      constraints via Lagrange multipliers `Lambda`; fictitious electron mass
      `mu` (typically 100-800 a.u.)
- [x] **120.4.2.2** Implement adiabaticity control for CPMD in TypeScript:
      monitor ratio of fictitious kinetic energy
      `K_e = mu * sum |c_n_dot|^2 / 2` to nuclear kinetic energy `K_N`; require
      `K_e/K_N < ~0.01` for adiabatic separation; implement Nose-Hoover
      thermostat on electronic DOF to prevent energy flow from nuclei to
      electrons; auto-adjust `mu` based on maximum phonon frequency `omega_max`
      (require `sqrt(mu) * omega_max << E_gap`)
- [x] **120.4.2.3** Implement orbital orthogonalization for CPMD in TypeScript:
      SHAKE-like constraint to maintain `<psi_i|psi_j> = delta_ij` at each step;
      iterative Gram-Schmidt or Lowdin symmetric orthogonalization; Rattle for
      velocity constraints `<psi_i_dot|psi_j> + <psi_i|psi_j_dot> = 0`
- [x] **120.4.2.4** Implement CPMD with Vanderbilt ultrasoft pseudopotentials in
      TypeScript: generalized orthogonality `<psi_i|S|psi_j> = delta_ij` with
      overlap operator `S = 1 + sum q_nm |beta_n><beta_m|`; modified EOM with
      `S^{-1}` application; augmentation charge contribution to forces

#### 120.4.3 AIMD Extensions

- [x] **120.4.3.1** Implement DFT+U molecular dynamics in TypeScript: Hubbard U
      correction applied consistently at each MD step; forces include derivative
      of Hubbard energy with respect to atomic positions (occupation matrix
      derivatives); support for Dudarev (simplified) and Liechtenstein (full)
      formulations; application to transition metal oxides (FeO, NiO, MnO)
- [x] **120.4.3.2** Implement hybrid functional AIMD in TypeScript: PBE0 or
      HSE06 forces at each MD step using ACE (Adaptively Compressed Exchange)
      operator for O(N) exact exchange evaluation; much more expensive than
      GGA-AIMD (~10-50x) but needed for accurate band gaps and reaction
      barriers; recommend for small systems (< 100 atoms) and short trajectories
      (< 10 ps)
- [x] **120.4.3.3** Implement gamma-point-only vs k-point sampling for AIMD in
      TypeScript: gamma-point is standard for AIMD with large supercells (>200
      atoms); for smaller cells, support Monkhorst-Pack k-point grids with force
      contributions from all k-points; Baldereschi mean-value point as
      compromise; assess finite-size error by comparing gamma-only vs k-sampled
      single-point energies

---

### 120.5 Enhanced Sampling Methods

#### 120.5.1 Replica Exchange MD (REMD)

- [x] **120.5.1.1** Implement temperature REMD (parallel tempering) in
      TypeScript: run N replicas at temperatures T_1 < T_2 < ... < T_N; attempt
      exchanges between adjacent replicas every `n_exchange` steps; Metropolis
      acceptance `P = min(1, exp(Delta_beta * Delta_E))` where
      `Delta_beta = 1/kT_j -     1/kT_i`; geometric temperature spacing for
      uniform acceptance (~20-30%); coordinate replica communication via shared
      memory or message passing
- [x] **120.5.1.2** Implement Hamiltonian REMD (H-REMD) in TypeScript: replicas
      differ in Hamiltonian parameters (e.g., scaled torsional barriers,
      modified vdW, alchemical lambda) rather than temperature; exchange
      criterion includes energy difference under both Hamiltonians; more
      efficient than T-REMD for large systems where temperature spacing becomes
      impractical
- [x] **120.5.1.3** Implement REST2 (Replica Exchange with Solute Tempering 2)
      in TypeScript: scale only solute-solute and solute-solvent interactions by
      sqrt(beta_0/beta_m) while keeping solvent-solvent at reference
      temperature; requires fewer replicas than full T-REMD for solvated
      systems; implement Hamiltonian scaling and exchange criterion
- [x] **120.5.1.4** Implement REMD analysis tools in TypeScript: exchange
      acceptance ratio monitoring, replica diffusion in temperature space
      (round- trip time), demultiplexed trajectory extraction (follow single
      replica vs single temperature), potential energy histograms for overlap
      verification, temperature-weighted histogram analysis

#### 120.5.2 Metadynamics

- [x] **120.5.2.1** Implement standard metadynamics in TypeScript: deposit
      Gaussian hills
      `V_bias(s, t) = sum_{t'<t} W * exp(-(s - s(t'))^2 / (2*sigma^2))` in
      collective variable (CV) space at regular intervals; Gaussian height `W`
      and width `sigma` as parameters; track hill history; free energy estimate
      `F(s) = -V_bias(s, t_final)` (approximate, converges in long-time limit)
- [x] **120.5.2.2** Implement well-tempered metadynamics in TypeScript: rescale
      Gaussian height `W(t) = W_0 * exp(-V_bias(s(t)) / (k_B * Delta_T))` where
      `Delta_T` is the bias temperature; converges to
      `F(s) = -(T + Delta_T)/     Delta_T * V_bias` instead of oscillating; bias
      factor `gamma = (T +     Delta_T)/T` typically 10-30; the recommended
      variant for production
- [x] **120.5.2.3** Implement bias-exchange metadynamics in TypeScript: each
      replica biases a different CV; periodically attempt exchanges between
      replicas using Metropolis criterion; allows exploration of
      high-dimensional CV space without depositing hills in high dimensions;
      combine with well-tempered scheme
- [x] **120.5.2.4** Implement parallel-bias metadynamics (PBMetaD) in
      TypeScript: deposit independent 1D biases on multiple CVs simultaneously
      within a single replica; total bias `V = sum_k V_k(s_k)` is sum of 1D
      potentials; avoids combinatorial scaling of hills in multi-CV
      metadynamics; reweighting via Tiwary-Parrinello formula

#### 120.5.3 Collective Variables

- [x] **120.5.3.1** Implement geometric CVs in TypeScript: interatomic distance,
      angle between 3 atoms, dihedral angle between 4 atoms, coordination number
      `CN = sum_j (1 - (r_ij/r_0)^n) / (1 - (r_ij/r_0)^m)` with switching
      function, center of mass distance, radius of gyration; all with analytic
      gradients `ds/dr_i` for force projection
- [x] **120.5.3.2** Implement structural CVs in TypeScript: RMSD from reference
      structure (after optimal alignment via quaternion rotation), path
      collective variables `s(R)` (progress along reference path) and `z(R)`
      (distance from path) using
      `s = sum_k k * exp(-lambda * RMSD_k^2) / sum_k exp(-lambda *     RMSD_k^2)`;
      with analytic derivatives
- [x] **120.5.3.3** Implement order parameter CVs in TypeScript: Steinhardt
      bond- order parameters `Q_l = (4*pi/(2l+1) * sum_m |Q_{lm}|^2)^{1/2}`
      where `Q_{lm} = (1/N_b) * sum_{bonds} Y_{lm}(theta, phi)`; distinguish
      crystal structures (Q_4, Q_6 values for bcc, fcc, hcp, liquid);
      derivatives via chain rule through spherical harmonics
- [x] **120.5.3.4** Implement custom CV expressions in TypeScript: allow users
      to define CVs as mathematical expressions of atomic coordinates (parsed
      and compiled to efficient evaluation function); support common operations
      (distance, angle, min, max, sum, switching functions); automatic
      differentiation for gradients

#### 120.5.4 Umbrella Sampling

- [x] **120.5.4.1** Implement umbrella sampling driver in TypeScript: run
      multiple independent simulations with harmonic bias
      `V_bias(s) = k/2 * (s - s_0)^2` centered at windows `s_0,1, s_0,2, ...`
      along CV; typical spring constant `k` chosen for ~30% overlap between
      adjacent windows; collect biased CV distributions `P_biased(s)` in each
      window
- [x] **120.5.4.2** Implement WHAM (Weighted Histogram Analysis Method) in
      TypeScript: unbias and combine umbrella sampling windows by solving self-
      consistent equations
      `P_unbiased(s) = sum_i N_i * P_i(s) / [sum_j N_j *     exp(beta * (f_j - V_j(s)))]`
      iteratively until free energies `f_i` converge; binless variant; error
      estimation via bootstrap
- [x] **120.5.4.3** Implement MBAR (Multistate Bennett Acceptance Ratio) in
      TypeScript: statistically optimal unbinned estimator for free energies
      from umbrella sampling,
      `f_i = -ln sum_n (exp(-beta * U_i(x_n)) / sum_j N_j *     exp(f_j - beta * U_j(x_n)))`;
      also provides reweighted expectation values for any observable;
      pymbar-compatible output

#### 120.5.5 Steered MD and Adaptive Biasing

- [x] **120.5.5.1** Implement steered MD (SMD) in TypeScript: constant-velocity
      SMD with moving harmonic restraint `V = k/2 * (s(t) - s_0 - v*t)^2`,
      pulling at velocity `v` along CV `s`; record work `W = integral F*ds`;
      constant- force SMD with fixed external force on CV; output
      force-extension curves
- [x] **120.5.5.2** Implement adaptive biasing force (ABF) in TypeScript:
      accumulate mean force `<dV/ds>` in bins along CV from unbiased portions of
      trajectory; apply equal and opposite biasing force to flatten the PMF;
      gradually fills in as sampling progresses; linear ramp for first N samples
      in each bin; extended-system ABF (eABF) with fictitious particle coupled
      to CV
- [x] **120.5.5.3** Implement on-the-fly free energy estimation from ABF in
      TypeScript: integrate accumulated mean force to obtain PMF
      `F(s) = -     integral <dV/ds> ds`; convergence monitoring via block
      analysis of mean force; CZAR (Corrected Z-Averaged Restraint) estimator
      for eABF

#### 120.5.6 Transition Path Methods

- [x] **120.5.6.1** Implement transition path sampling (TPS) in TypeScript:
      Monte Carlo in trajectory space; shooting moves (pick random time slice,
      perturb momenta, integrate forward/backward, accept if new trajectory
      connects reactant to product basins); shifting moves; trajectory length
      flexibility; committor analysis from harvested paths
- [x] **120.5.6.2** Implement transition interface sampling (TIS) in TypeScript:
      define interfaces `lambda_0 < lambda_1 < ... < lambda_n` between reactant
      and product; compute crossing probabilities `P(lambda_{i+1} | lambda_i)`
      via path sampling at each interface; total rate `k = Phi_0 * prod P_i`;
      more efficient than TPS for rate calculations
- [x] **120.5.6.3** Implement forward flux sampling (FFS) in TypeScript: non-
      equilibrium path sampling method; collect configurations at first
      interface from steady-state simulation; launch trial runs from stored
      configurations to reach next interface; branching/pruning; compute rate
      constant from flux and crossing probabilities; suitable for
      driven/non-equilibrium systems

#### 120.5.7 Minimum Energy Path Methods

- [x] **120.5.7.1** Implement Nudged Elastic Band (NEB) in TypeScript: chain of
      images (replicas) connected by springs along reaction path; project out
      parallel spring force and perpendicular potential force
      `F_i^NEB = F_i^perp     + F_i^spring_parallel`; tangent estimation via
      bisection or improved tangent; spring constant `k` typically 0.1-1.0
      eV/A^2; converge with FIRE or L-BFGS optimizer
- [x] **120.5.7.2** Implement climbing-image NEB (CI-NEB) in TypeScript: the
      highest-energy image is driven uphill along the path
      `F_i^CI = F_i - 2*     (F_i . tau_hat) * tau_hat` (no spring force, full
      potential force reflected along tangent); converges to exact saddle point;
      all other images use standard NEB forces; validate with known barriers
      (e.g., H diffusion in Pd, vacancy migration in fcc metals)
- [x] **120.5.7.3** Implement variable-spring NEB in TypeScript: spring
      constants vary along the band to increase image density near the
      transition state: `k_i = k_max` if `max(E_i, E_{i-1}) > E_ref`, else
      `k_i = k_max - delta_k     * (E_max - max(E_i, E_{i-1})) / (E_max - E_ref)`;
      improves resolution of the barrier region
- [x] **120.5.7.4** Implement string method in TypeScript: evolve string of
      images by steepest descent `dr_i/dt = -grad V(r_i)` perpendicular to
      string, followed by reparameterization (equal arc-length redistribution
      via cubic spline interpolation); growing string method (extend from one
      end toward product); finite-temperature string method (mean force
      projection)

#### 120.5.8 Saddle Point and Global Optimization

- [x] **120.5.8.1** Implement dimer method in TypeScript: find nearby saddle
      point from single initial configuration; two images (dimer) separated by
      small distance delta, rotated to align with lowest curvature mode (minimum
      eigenvalue of Hessian), then translated uphill along dimer axis and
      downhill along all other modes; no knowledge of product state needed
- [x] **120.5.8.2** Implement basin-hopping for global minimum search in
      TypeScript: Monte Carlo with structural perturbation (random displacement,
      atom swap, lattice deformation) -> local minimization -> Metropolis
      acceptance at fictitious temperature; the standard method for cluster and
      surface structure prediction
- [x] **120.5.8.3** Implement simulated annealing in TypeScript: start at high
      temperature, gradually cool according to schedule (linear, exponential,
      logarithmic) while running MD or MC; acceptance probability decreases with
      temperature; support for replica-based parallel simulated annealing
- [x] **120.5.8.4** Implement genetic algorithm for structure prediction in
      TypeScript: population of candidate structures; fitness = -energy;
      crossover operators (cut-and-splice, coordinate exchange); mutation
      (random displacement, strain, permutation); tournament/roulette selection;
      elitism; support for fixed-composition and variable-composition searches

---

### 120.6 Free Energy Methods

#### 120.6.1 Alchemical Methods

- [x] **120.6.1.1** Implement thermodynamic integration (TI) in TypeScript:
      define hybrid Hamiltonian `H(lambda) = (1-lambda)*H_A + lambda*H_B`;
      compute `<dH/dlambda>` at each of N lambda windows (typically 11-21
      Gauss-Legendre points); integrate
      `Delta_F = integral_0^1 <dH/dlambda>     dlambda` via
      trapezoidal/Simpson/Gauss-Legendre quadrature; soft-core potentials for
      appearing/disappearing atoms to avoid singularities at lambda=0,1
- [x] **120.6.1.2** Implement soft-core potentials for alchemical
      transformations in TypeScript/Rust: modified LJ
      `V_sc(r, lambda) = 4*epsilon*lambda^n *     [(alpha*(1-lambda)^a + (r/sigma)^6)^{-2} - (alpha*(1-lambda)^a +     (r/sigma)^6)^{-1}]`
      with parameters `alpha=0.5, a=1, n=1` (Beutler); analogous soft-core
      Coulomb; ensures gradients remain finite at lambda endpoints; separate
      lambda schedules for vdW and electrostatics
- [x] **120.6.1.3** Implement free energy perturbation (FEP, Zwanzig) in
      TypeScript: `Delta_F = -k_B*T * ln <exp(-beta * (H_B - H_A))>_A`; forward
      and backward perturbation; exponential averaging requires sufficient
      phase- space overlap between states A and B; overlap estimation via
      Bennett overlap criterion
- [x] **120.6.1.4** Implement Bennett Acceptance Ratio (BAR) in TypeScript: find
      `Delta_F` satisfying
      `sum_i 1/(1 + n_1/n_0 * exp(beta*(W_i^F - Delta_F)))     = sum_j 1/(1 + n_0/n_1 * exp(-beta*(W_j^R + Delta_F)))`
      where `W^F` and `W^R` are forward/reverse work values; self-consistent
      iteration; minimum variance estimator; extend to multistate BAR (MBAR) for
      simultaneous optimal estimation from all lambda windows

#### 120.6.2 Application-Specific Free Energies

- [x] **120.6.2.1** Implement solvation free energy calculation in TypeScript:
      thermodynamic cycle with gas-phase and solvated legs; discharge (Coulomb
      off) then decoupling (LJ off with soft-core) protocol; long-range
      correction for finite-size electrostatics (Rocklin); compute hydration
      free energy validated against experimental data (e.g., methane: +2.0
      kcal/mol, ethanol: -5.0 kcal/mol)
- [x] **120.6.2.2** Implement adsorption free energy calculation in TypeScript:
      molecule approaching surface with distance as CV; umbrella sampling or
      metadynamics along surface normal; correct for standard state (surface
      concentration); output binding free energy profile `F(z)` and
      site-specific binding constants
- [x] **120.6.2.3** Implement alchemical element mutation in TypeScript:
      smoothly transform element A to element B by interpolating LJ parameters,
      charges, and mass; use soft-core potentials; applications: relative
      binding affinities, alloy mixing energies, dopant substitution energies;
      dual- topology and single-topology approaches

#### 120.6.3 Phase Coexistence

- [x] **120.6.3.1** Implement two-phase coexistence method in TypeScript: set up
      solid-liquid interface in elongated simulation box; run NPT at candidate
      melting temperature; if solid grows, T < T_m; if liquid grows, T > T_m;
      bisection to find T_m within +/- 5K; requires large system (~5000 atoms)
      and long simulation (>1 ns) for reliable convergence
- [x] **120.6.3.2** Implement interface pinning method in TypeScript: apply
      harmonic bias on order parameter (e.g., Q_6) to stabilize solid-liquid
      interface; compute slope `d<Q_6>/dT` and free energy derivative to extract
      melting temperature more precisely than direct two-phase method; works
      with smaller systems
- [x] **120.6.3.3** Implement Gibbs-Duhem integration in TypeScript: trace phase
      boundary `P(T)` by integrating Clausius-Clapeyron equation
      `dP/dT =     Delta_S / Delta_V = Delta_H / (T * Delta_V)` with `Delta_H`
      and `Delta_V` from separate simulations of each phase at each state point;
      predictor-corrector integration along the coexistence curve

#### 120.6.4 Non-Equilibrium Free Energy

- [x] **120.6.4.1** Implement Jarzynski equality estimator in TypeScript:
      `exp(-     beta * Delta_F) = <exp(-beta * W)>` where `W` is
      non-equilibrium work from steered MD / fast switching; exponential average
      dominated by rare low-work trajectories; cumulant expansion and
      bias-corrected estimators; block bootstrap error bars
- [x] **120.6.4.2** Implement Crooks fluctuation theorem estimator in
      TypeScript: `P_F(W) / P_R(-W) = exp(beta * (W - Delta_F))` relating
      forward and reverse work distributions; find `Delta_F` at crossing point
      of `P_F(W)` and `P_R(-W)`; more efficient than Jarzynski when both forward
      and reverse data available
- [x] **120.6.4.3** Implement lambda-dynamics in TypeScript: treat alchemical
      lambda as a continuous dynamical variable with fictitious mass; lambda
      explores [0,1] continuously during single simulation instead of discrete
      windows; biasing potential for uniform lambda sampling; multi-site lambda-
      dynamics for simultaneous multiple mutations; free energy from lambda
      histogram

---

### 120.7 Trajectory Analysis

#### 120.7.1 Pair Correlation Functions

- [x] **120.7.1.1** Implement radial distribution function g(r) in Rust:
      histogram pair distances in shells `[r, r+dr)`, normalize by ideal gas
      density `g(r) = n(r) / (4*pi*r^2*dr * rho * N)`; support total g(r) and
      partial g(r, type_i, type_j); bin width typically 0.02 A; handle PBC with
      minimum image; long-range limit g(r) -> 1; compute running coordination
      number `N(r) = 4*pi*rho * integral_0^r g(r')*r'^2 dr'`
- [x] **120.7.1.2** Implement angular distribution function g_3(theta) in Rust:
      for each triplet (j-i-k) where j and k are neighbors of central atom i
      within cutoff, histogram the angle
      `theta_jik = arccos((r_ij . r_ik) /     (|r_ij| * |r_ik|))`; normalize to
      uniform distribution on sphere; separate by species triplet; reveals local
      geometry (tetrahedral: peak at 109.5, octahedral: peaks at 90 and 180)
- [x] **120.7.1.3** Implement Van Hove correlation function G(r,t) in Rust:
      self-part `G_s(r,t) = (1/N) <sum_i delta(r - |r_i(t) - r_i(0)|)>` and
      distinct-part
      `G_d(r,t) = (1/N) <sum_{i!=j} delta(r - |r_j(t) -     r_i(0)|)>`; G_s
      broadens with time (Gaussian for simple diffusion); G_d probes structural
      relaxation; Fourier transform gives intermediate scattering function
      F(k,t)

#### 120.7.2 Structural Analysis

- [x] **120.7.2.1** Implement coordination number analysis in Rust: for each
      atom, count neighbors within cutoff (or first minimum of g(r)); track
      coordination number distribution over trajectory; partial coordination
      numbers by species pair; time-resolved coordination for studying
      structural transitions
- [x] **120.7.2.2** Implement bond angle distribution in Rust: for each atom,
      compute angles formed by all neighbor pairs within cutoff; histogram by
      atom type and coordination; compare with ideal polyhedra (tetrahedron
      109.47, octahedron 90/180, trigonal planar 120)
- [x] **120.7.2.3** Implement Voronoi tessellation analysis in Rust: compute
      Voronoi cell for each atom (radical Voronoi for multi-component systems
      with different radii); extract cell volume, face count (coordination),
      face areas, edge statistics; Voronoi index `<n3, n4, n5, n6>` for local
      structure classification (e.g., <0,0,12,0> = icosahedral in metallic
      glasses)
- [x] **120.7.2.4** Implement ring statistics analysis in Rust: shortest-path
      ring finding algorithm (Franzblau/King) for network-forming materials
      (silica, zeolites, chalcogenide glasses); ring size distribution;
      primitive rings vs. strong rings; compute connectivity by tracing through
      bonded network; validate against known ring distributions for alpha-quartz
      (all 6-rings) and amorphous SiO2 (distribution 3-9 with peak at 6)

#### 120.7.3 Crystal Structure Identification

- [x] **120.7.3.1** Implement Common Neighbor Analysis (CNA) in Rust: for each
      bonded pair, count shared neighbors and their connectivity pattern as a
      triplet (n_common, n_bonds, longest_chain); classify local structure: fcc
      = (4,2,1), hcp = (4,2,1)+(4,2,2), bcc = (4,4,4)+(6,6,6), icosahedral =
      (5,5,5); handle signatures for stacking faults and twins
- [x] **120.7.3.2** Implement adaptive Common Neighbor Analysis (a-CNA) in Rust:
      automatically determine cutoff for each atom pair as midpoint between
      first and second neighbor shells, eliminating the need for a global cutoff
      parameter; more robust for systems with lattice distortions, temperature
      effects, or multiple phases
- [x] **120.7.3.3** Implement Polyhedral Template Matching (PTM) in Rust:
      compare local atomic neighborhood to reference polyhedra (fcc, hcp, bcc,
      ico, sc, diamond cubic, diamond hex, graphene) using RMSD after optimal
      rotation; assign structure type to each atom; compute per-atom RMSD as
      disorder metric; orientation output as quaternion; more robust than CNA
      for high-temperature or strained structures
- [x] **120.7.3.4** Implement centrosymmetry parameter (CSP) in Rust: for each
      atom, find `N` nearest neighbors, pair them as opposite vectors, compute
      `CSP = sum_{pairs} |r_i + r_{N/2+i}|^2`; CSP = 0 for perfect crystal,
      large for defects; threshold-based defect identification (surface,
      stacking fault, dislocation core, point defect); standard for fcc metals
      with N=12
- [x] **120.7.3.5** Implement Ackland-Jones analysis in Rust: chi parameter
      method for distinguishing fcc, bcc, hcp, and icosahedral structures;
      compute angle distribution function and classify by characteristic peaks;
      faster than CNA for quick screening
- [x] **120.7.3.6** Implement Steinhardt bond order parameters Q*l in Rust:
      compute `q*{lm}(i) = (1/N*b(i)) sum*{j in neighbors} Y*{lm}(theta_ij,
      phi_ij)`,     then `Q_l(i) = sqrt(4*pi/(2l+1) _ sum_m
      |q_{lm}(i)|^2)`and averaged     version`<Q_l>`over neighbors;`W_l`(third-order invariant) for     distinguishing fcc from hcp;`Q_4,
      Q_6` values: liquid (~0.0, ~0.3), bcc (0.036, 0.511), fcc (0.191, 0.574),
      hcp (0.097, 0.485)

#### 120.7.4 Cluster and Defect Analysis

- [x] **120.7.4.1** Implement cluster analysis in Rust: DBSCAN clustering of
      atoms by position with distance cutoff epsilon and minimum cluster size;
      identify distinct clusters (e.g., precipitates, voids, interstitial
      clusters); track cluster sizes over trajectory; hierarchical clustering
      for nested defect structures
- [x] **120.7.4.2** Implement displacement field and strain mapping in Rust:
      compute atomic displacements relative to reference (perfect crystal)
      positions `u_i = r_i - R_i^ref`; local strain tensor via atomic strain
      (Zimmerman method: `epsilon_ij = (1/2)(F^T F - I)` from local deformation
      gradient `F` fit to neighbor displacements); von Mises shear strain for
      visualization; identify dislocations and grain boundaries via strain
      concentration
- [x] **120.7.4.3** Implement Wigner-Seitz defect analysis in Rust: compare
      atomic positions to reference lattice; atoms in same Voronoi cell as
      reference site = occupied, empty cells = vacancies, multiple atoms in one
      cell = interstitials; count and classify point defects (Frenkel pairs,
      Schottky defects, anti-site defects); track defect annihilation over time

#### 120.7.5 Dynamical Properties

- [x] **120.7.5.1** Implement mean squared displacement (MSD) in Rust:
      `MSD(t) =     <|r_i(t) - r_i(0)|^2>` averaged over atoms and time origins;
      use multiple time origins for better statistics; diffusion coefficient
      from Einstein relation `D = lim_{t->inf} MSD(t) / (2*d*t)` with
      `d = dimensionality`; identify ballistic (`MSD ~ t^2`, short time) and
      diffusive (`MSD ~ t`, long time) regimes; correct for center-of-mass drift
- [x] **120.7.5.2** Implement velocity autocorrelation function (VACF) in Rust:
      `C_v(t) = <v_i(0) . v_i(t)> / <v_i(0) . v_i(0)>`; diffusion coefficient
      from Green-Kubo `D = (1/3) * integral_0^inf C_v(t) dt`; vibrational
      density of states (VDOS) from Fourier transform `g(omega) = FT[C_v(t)]`
      (total and partial by element); compare VDOS peaks with phonon frequencies
      from lattice dynamics
- [x] **120.7.5.3** Implement intermediate scattering function F(k,t) in Rust:
      self-part `F_s(k,t) = (1/N) <sum_i exp(i*k.(r_i(t) - r_i(0)))>` and
      coherent part; average over wavevector directions for isotropic systems;
      alpha relaxation time from `F_s(k*, t_alpha) = 1/e` at first peak of S(k);
      non-Gaussian parameter `alpha_2(t) = 3<r^4(t)>/(5<r^2(t)>^2) - 1` for
      detecting dynamic heterogeneity
- [x] **120.7.5.4** Implement stress per-atom computation in Rust: per-atom
      virial stress
      `sigma_i^{ab} = -(1/V_i)[m_i v_i^a v_i^b + (1/2) sum_j r_ij^a     f_ij^b]`
      where `V_i` is Voronoi volume; separate kinetic and potential
      contributions; full 3x3 stress tensor per atom; useful for identifying
      stress concentrations at defects, grain boundaries, crack tips

---

### 120.8 Green-Kubo & Linear Response

#### 120.8.1 Transport Coefficients

- [x] **120.8.1.1** Implement thermal conductivity via Green-Kubo in Rust:
      compute heat flux vector
      `J_q = (1/V) [sum_i (e_i * v_i) + (1/2) sum_{i,j}     (f_ij . v_i) * r_ij]`
      where `e_i` is per-atom energy, `f_ij` is pairwise force; autocorrelation
      `<J_q(0) . J_q(t)>` integrated to give
      `kappa =     V/(3*k_B*T^2) * integral_0^inf <J_q(0) . J_q(t)> dt`; handle
      long-range contribution from Ewald; convergence over 1-10 ns depending on
      system
- [x] **120.8.1.2** Implement shear viscosity via Green-Kubo in Rust: compute
      off-diagonal stress tensor components `sigma_{xy}(t)` from virial;
      autocorrelation and integration
      `eta = V/(k_B*T) * integral_0^inf     <sigma_{xy}(0) * sigma_{xy}(t)> dt`;
      average over 3 independent off- diagonal components (xy, xz, yz) and
      optionally 2 additional linear combinations of diagonal components for 5
      independent estimates; Einstein relation cross-check
- [x] **120.8.1.3** Implement ionic conductivity via Green-Kubo in Rust: ionic
      current `J_ion = sum_i q_i * v_i`; autocorrelation and integration
      `sigma = V/(3*k_B*T) * integral_0^inf <J_ion(0) . J_ion(t)> dt`;
      distinguish between self (uncorrelated) and collective (correlated)
      contributions; Haven ratio `H_R = D_tracer / D_sigma` as correlation
      measure; decompose into Onsager coefficients `L_ij` for each ion pair
- [x] **120.8.1.4** Implement diffusion coefficient via Green-Kubo and Einstein
      in Rust: Green-Kubo from VACF (see 120.7.5.2); Einstein from MSD slope
      (see 120.7.5.1); both methods should agree within statistical error;
      finite-size correction (Yeh-Hummer):
      `D_corrected = D_PBC + 2.837*k_B*T / (6*pi*eta*L)` where `L` is box length
      and `eta` is viscosity

#### 120.8.2 Cross-Coefficients and Advanced Relations

- [x] **120.8.2.1** Implement Onsager reciprocal relations verification in
      TypeScript: compute full matrix of transport coefficients `L_ij` from
      cross-correlation functions; verify `L_ij = L_ji` within statistical
      error; derive phenomenological coefficients (Seebeck, Peltier, thermal
      diffusion) from Onsager matrix
- [x] **120.8.2.2** Implement Seebeck coefficient from NEMD (Muller-Plathe) in
      TypeScript: impose thermal gradient, measure resulting ionic current (or
      concentration gradient); `S = -Delta_V / Delta_T` at zero current;
      alternatively from equilibrium MD via Onsager coefficient ratio
      `S =     L_{12} / (T * L_{11})`
- [x] **120.8.2.3** Implement Nernst-Einstein relation validation in TypeScript:
      compute ionic conductivity `sigma_NE = sum_i n_i * q_i^2 * D_i / (k_B*T)`
      from self-diffusion coefficients; compare with Green-Kubo conductivity;
      ratio `sigma_GK / sigma_NE` quantifies cross-correlations (< 1 for most
      ionic systems); application to solid electrolytes and ionic liquids
- [x] **120.8.2.4** Implement correlation function convergence analysis in
      TypeScript: monitor integrated autocorrelation as function of upper
      integration limit; identify plateau region; estimate statistical error via
      block averaging on correlation function; warn user if correlation function
      has not decayed to zero (insufficient simulation length); provide running
      integral plot for visual inspection

---

### 120.9 Non-Equilibrium MD (NEMD)

#### 120.9.1 Shear Flow

- [x] **120.9.1.1** Implement Lees-Edwards sliding boundary conditions in Rust:
      modify PBC so that images above and below the simulation box are displaced
      by `Delta_x = gamma_dot * L_y * t` where `gamma_dot` is the shear rate;
      update image positions, velocities, and neighbor list accordingly;
      constant shear rate; support for SLLOD thermostat (profile-unbiased
      thermostat that removes streaming velocity before temperature computation)
- [x] **120.9.1.2** Implement SLLOD equations of motion in Rust:
      `dr_i/dt = v_i +     gamma_dot * y_i * x_hat`,
      `dv_i/dt = F_i/m_i - gamma_dot * v_{i,y} *     x_hat - alpha * v_i^peculiar`
      where `alpha` is the Gaussian thermostat multiplier maintaining constant
      kinetic temperature; compute shear stress `sigma_xy`, viscosity
      `eta = -<sigma_xy> / gamma_dot`, normal stress differences
      `N_1 = sigma_xx - sigma_yy`, `N_2 = sigma_yy - sigma_zz`
- [x] **120.9.1.3** Implement shear viscosity profile analysis in TypeScript:
      compute velocity profile `v_x(y)` as function of position across shear
      direction; verify linear profile (Couette flow) in Newtonian regime;
      detect shear thinning/thickening from rate-dependent viscosity
      `eta(gamma_dot)`; output flow curves and stress-strain relations

#### 120.9.2 Thermal Transport

- [x] **120.9.2.1** Implement Muller-Plathe reverse NEMD for thermal
      conductivity in Rust: divide box into slabs along z; periodically swap
      velocities between hottest atom in cold slab and coldest atom in hot slab;
      measure resulting temperature gradient; `kappa = -J_q / (dT/dz)` where
      `J_q` is energy flux from swap rate; advantages: energy exactly conserved,
      periodic system, no thermostat artifacts
- [x] **120.9.2.2** Implement direct NEMD thermal conductivity in Rust: apply
      Langevin thermostat at two different temperatures to heat source and heat
      sink regions; measure steady-state temperature profile and energy flux
      through intermediate region; `kappa = J_q * L / (T_hot - T_cold)`;
      finite-size extrapolation by varying system length

#### 120.9.3 Driven Transport and Extreme Conditions

- [x] **120.9.3.1** Implement electric field-driven ionic transport in Rust:
      apply uniform external electric field `E` to charged particles
      `F_ext = q_i * E`; measure steady-state ionic current; compute
      conductivity `sigma = J / E`; non-linear response at high fields (Wien
      effect); combine with thermostat to remove Joule heating
- [x] **120.9.3.2** Implement Hugoniostat for shock wave simulation in Rust:
      constrain system to the Rankine-Hugoniot curve
      `E - E_0 = (1/2)(P + P_0)     (V_0 - V)`; uniaxial compression along shock
      direction; measure Hugoniot `P(V)` curve and shock temperature; detect
      phase transitions under shock (e.g., graphite to diamond in carbon, bcc to
      hcp in iron)
- [x] **120.9.3.3** Implement radiation damage cascade simulation in Rust:
      primary knock-on atom (PKA) with specified energy (1-100 keV); variable
      timestep (small during ballistic phase, larger during thermal spike and
      recovery); electronic stopping power as friction force `F_e = -beta * v`
      above velocity threshold; ZBL (Ziegler-Biersack-Littmark) universal
      repulsive potential for close encounters; count Frenkel pairs, cluster
      sizes, cascade morphology

---

### 120.10 Structure Prediction

#### 120.10.1 Random Structure Search

- [x] **120.10.1.1** Implement random structure search (AIRSS-style) in
      TypeScript: generate random crystal structures with specified composition
      and number of atoms per cell; random lattice vectors (constrained by
      volume per atom and minimum/maximum cell angles); random atomic positions
      (with minimum interatomic distance constraints); relax each structure with
      DFT or classical potential; rank by energy; massively parallel with no
      communication between searches
- [x] **120.10.1.2** Implement structure generation constraints in TypeScript:
      minimum interatomic distance by species pair (e.g., C-C > 1.2 A, Si-O >
      1.4 A); symmetry constraints (generate in specific space groups);
      molecular unit placement (for molecular crystals); cell shape constraints
      (fixed volume, fixed cell angles, layered structures); sensible default
      constraints from ionic radii database

#### 120.10.2 Evolutionary Algorithms

- [x] **120.10.2.1** Implement evolutionary structure prediction (USPEX-style)
      in TypeScript: initial population from random generation; heredity
      (cut-and- splice crossover of parent structures along random plane);
      mutation operators: strain (random lattice deformation), soft mutation
      (displace along soft phonon mode), permutation (swap different atom
      types), coordinate perturbation; selection: tournament or roulette with
      fitness = -enthalpy
- [x] **120.10.2.2** Implement population management for evolutionary search in
      TypeScript: duplicate detection (match structures by fingerprint: pair
      distribution function, diffraction pattern, or compositional distance);
      niche-preserving selection to maintain diversity; elitism (keep best N
      structures); convergence detection (no improvement for M generations);
      variable population size
- [x] **120.10.2.3** Implement variable-composition structure prediction in
      TypeScript: search over compositions in addition to structures; convex
      hull construction in composition-energy space; identify thermodynamically
      stable and metastable phases; output phase diagram (binary, ternary);
      Pareto front optimization for multi-objective (energy + volume + band gap)

#### 120.10.3 Other Global Optimization

- [x] **120.10.3.1** Implement minima hopping in TypeScript: alternate between
      short MD trajectories (to escape current basin) and local optimization;
      accept new minimum if energy is lower or with probability based on energy
      difference and adaptive temperature; history-dependent feedback to avoid
      revisiting known minima; efficient for surfaces and clusters
- [x] **120.10.3.2** Implement Bayesian optimization for structure prediction in
      TypeScript: use Gaussian process (GP) surrogate model trained on evaluated
      energies; acquisition function (expected improvement, lower confidence
      bound) to select next structure to evaluate; encode structures via
      descriptors (SOAP, Coulomb matrix); balance exploration vs. exploitation;
      fewer DFT evaluations than random search for same coverage
- [x] **120.10.3.3** Implement cluster structure prediction in TypeScript:
      global optimization for gas-phase clusters (no PBC); operators tailored
      for clusters: add/remove atom, twist (rotate half), surface diffusion;
      pool- based parallel search; comparison with Cambridge Cluster Database;
      applications: nanoparticle structure, catalyst active sites
- [x] **120.10.3.4** Implement surface reconstruction prediction in TypeScript:
      fix bulk slab, optimize surface layer atomic positions and composition;
      test various reconstruction patterns (1x1, 2x1, 2x2, sqrt(3)xsqrt(3), 7x7
      DAS for Si(111)); compute surface energy
      `gamma = (E_slab - N*E_bulk)     / (2*A)` for each reconstruction;
      temperature-dependent stability from surface free energy including
      vibrational entropy

---

### 120.11 Coarse-Grained Methods

#### 120.11.1 Systematic Coarse-Graining

- [x] **120.11.1.1** Implement iterative Boltzmann inversion (IBI) in
      TypeScript: derive effective CG pair potential from target (atomistic)
      radial distribution function; initial guess from Boltzmann inversion
      `V_0(r) =     -k_B*T * ln(g_target(r))`; iteratively update
      `V_{n+1}(r) = V_n(r) +     k_B*T * ln(g_n(r) / g_target(r))` until g(r)
      converges; separate bonded and nonbonded terms; pressure correction for
      thermodynamic consistency
- [x] **120.11.1.2** Implement force matching (multiscale coarse-graining) in
      TypeScript: fit CG force field parameters to reproduce atomistic forces by
      least-squares minimization `min sum_i |F_i^CG - F_i^atom|^2`; represent CG
      forces as linear combination of basis functions (splines, Gaussians);
      solve via normal equations or iterative methods; MS-CG with tabulated
      potentials
- [x] **120.11.1.3** Implement relative entropy coarse-graining in TypeScript:
      minimize KL divergence `S_rel = <ln(p_CG/p_atom)>_atom` between atomistic
      and CG configurational distributions; gradient
      `dS_rel/d_params =     <dU_CG/d_params>_CG - <dU_CG/d_params>_atom`;
      iterate via Newton-Raphson or L-BFGS; provides variational framework
      unifying structure-based and force-based approaches
- [x] **120.11.1.4** Implement CG mapping operators in TypeScript:
      center-of-mass mapping (weighted by atomic masses), geometric center
      mapping, essential dynamics mapping (based on PCA of atomistic
      trajectory); support for user-defined bead definitions; automatic mapping
      suggestions based on chemical connectivity and decorrelation analysis

#### 120.11.2 Mesoscale Methods

- [x] **120.11.2.1** Implement DPD (Dissipative Particle Dynamics) simulation in
      TypeScript: full DPD thermostat (conservative + dissipative + random
      forces), Schmidt number control via friction coefficient, equation of
      state `P = rho*k_B*T + alpha*a_ij*rho^2` for compressibility matching;
      bond stretching for polymer chains; map DPD parameters to Flory-Huggins
      chi parameter via `a_ij = a_ii + 3.27*chi_ij` for polymer blends
- [x] **120.11.2.2** Implement lattice Boltzmann method for mesoscale fluid
      dynamics in Rust: D3Q19 or D3Q27 velocity set; BGK (single relaxation
      time) and MRT (multiple relaxation time) collision operators; streaming
      step on regular lattice; bounce-back boundary conditions for solid walls;
      coupling to MD particles for hybrid multiscale; compute macroscopic
      density, velocity, and stress from distribution functions
- [x] **120.11.2.3** Implement MARTINI CG system setup in TypeScript: mapping
      rules for common materials (polymers, lipids, surfactants, small organic
      molecules); bead type assignment from chemical group identity; bonded
      parameter assignment from MARTINI parameter database; support for elastic
      network model restraints; topology file generation compatible with GROMACS
      format
- [x] **120.11.2.4** Implement reverse mapping (backmapping) from CG to
      atomistic in TypeScript: place atomistic fragments at CG bead positions
      with random orientation; energy minimization to resolve overlaps; short
      restrained MD for relaxation; geometric-based (template matching) and
      fragment-based approaches; validate by comparing backmapped structure
      properties (g(r), density) with original atomistic reference

---

### 120.12 Python Interoperability

#### 120.12.1 ASE and External Tool Integration

- [x] **120.12.1.1** Implement ASE (Atomic Simulation Environment) calculator
      interface in Python: wrap Kalika force fields as ASE `Calculator` class
      with `get_potential_energy()`, `get_forces()`, `get_stress()` methods;
      enable use of Kalika potentials within ASE workflows (optimization, NEB,
      phonons); bidirectional `Atoms` <-> `MDSystem` conversion
- [x] **120.12.1.2** Implement LAMMPS input script generator in Python:
      translate `SimulationConfig` to LAMMPS input script with correct
      `pair_style`, `pair_coeff`, `fix nve/nvt/npt`, `compute`, `dump`, `thermo`
      commands; support for custom compute/fix definitions; round-trip
      validation (generate script -> run LAMMPS -> compare results with Kalika)
- [x] **120.12.1.3** Implement PLUMED interface in TypeScript/Python: generate
      PLUMED input files for enhanced sampling (metadynamics, umbrella sampling,
      REMD) from Kalika configuration; parse PLUMED COLVAR and HILLS output
      files; enable hybrid workflows using Kalika MD engine with PLUMED biasing

#### 120.12.2 Visualization and Workflow

- [x] **120.12.2.1** Implement trajectory visualization export in TypeScript:
      convert Kalika trajectory to formats compatible with OVITO (LAMMPS dump
      with per-atom properties), VMD (DCD + PSF), and ASE (extended XYZ);
      include computed per-atom quantities (CNA type, CSP, Q6, strain) as custom
      columns; support for time-series export of scalar properties (T, P, E) to
      CSV
- [x] **120.12.2.2** Implement simulation workflow manager in TypeScript:
      orchestrate multi-stage workflows (equilibration -> production ->
      analysis); checkpoint and restart; parameter sweeps (temperature,
      pressure, composition); dependency-aware task graph; progress monitoring
      with estimated completion time; output collection and archival

---

### 120.13 Validation & Benchmarks

#### 120.13.1 Correctness Validation

- [x] **120.13.1.1** Validate velocity Verlet energy conservation: run NVE
      simulation of 256 LJ argon atoms at 100K for 10^6 steps (dt=2 fs); verify
      total energy drift < 10^-5 epsilon/atom/ns; compare g(r), MSD, and VACF
      against published NIST benchmarks (Rahman 1964 argon simulation
      parameters); test with Lennard-Jones reduced units
- [x] **120.13.1.2** Validate Ewald/PME electrostatics: compute Madelung
      constant for NaCl rock salt structure (expected: -1.747565), CsCl
      (expected: -1.762675), ZnS zinc blende (expected: -1.638055); verify
      forces against finite-difference numerical derivatives; compare with
      LAMMPS `ewald` and `pppm` for a 1000-atom NaCl melt at 1100K
- [x] **120.13.1.3** Validate SHAKE/SETTLE constraints: run rigid SPC/E water
      box (512 molecules) for 10^5 steps; verify bond lengths and angle remain
      within 10^-10 A of target values; compare total energy with unconstrained
      flexible model at equivalent temperature; verify correct degrees of
      freedom count in temperature calculation
- [x] **120.13.1.4** Validate Nose-Hoover thermostat: run NVT simulation and
      verify kinetic energy distribution follows chi-squared distribution with
      N_f degrees of freedom; verify conserved quantity H_NHC drift < 10^-4 per
      atom per ns; compare velocity distribution against Maxwell-Boltzmann at
      target temperature using Kolmogorov-Smirnov test
- [x] **120.13.1.5** Validate NPT ensemble: run NPT simulation of LJ crystal at
      zero pressure; verify average volume agrees with equation of state within
      statistical error; verify stress tensor fluctuations give correct elastic
      constants (Born-Huang long-wave method); verify enthalpy distribution is
      correct for NPT ensemble
- [x] **120.13.1.6** Validate EAM potential for copper: compute lattice constant
      (expected: 3.615 A), cohesive energy (expected: 3.54 eV/atom), bulk
      modulus (expected: 137 GPa), elastic constants C11/C12/C44, vacancy
      formation energy (expected: ~1.3 eV), surface energies (100), (110),
      (111); compare with published values for Mishin Cu EAM potential
- [x] **120.13.1.7** Validate ReaxFF for hydrocarbon combustion: compute C-H
      bond dissociation energy for methane (expected: ~4.5 eV), verify correct
      products from methane oxidation at 3000K, compare with DFT reference
      energies for key reaction intermediates; verify charge equilibration gives
      physically reasonable charges (+0.3 to +0.4 for H in CH4)
- [x] **120.13.1.8** Validate metadynamics free energy: compute free energy
      profile for alanine dipeptide phi/psi rotation using well-tempered
      metadynamics with AMBER force field; verify barrier heights within 1
      kJ/mol of umbrella sampling reference; convergence analysis showing
      plateau after ~50 ns
- [x] **120.13.1.9** Validate NEB transition state: compute vacancy migration
      barrier in fcc Cu (expected: 0.69 eV with Mishin EAM); verify saddle point
      geometry (atom at midpoint between sites); compare barrier height with
      dimer method result
- [x] **120.13.1.10** Validate Green-Kubo thermal conductivity: compute kappa
      for argon at 80K / 1.06 g/cm^3 (expected: ~0.13 W/m/K); verify convergence
      of heat flux autocorrelation integral; compare with experimental value and
      NEMD result from Muller-Plathe method - Validation note: the requested
      density is `rho*=0.631` and both Green-Kubo and independent Muller-Plathe
      simulations give ~0.05 W/m/K. The ~0.13 W/m/K experimental value is for
      saturated liquid argon near its normal boiling point (~1.4 g/cm^3), not
      the metastable 1.06 g/cm^3 state. The automated gate therefore strictly
      checks the requested state against the independent NEMD result and reports
      the discrepancy instead of altering the unit conversion to fit the
      experimental value.

#### 120.13.2 Performance Benchmarks

- [x] **120.13.2.1** Benchmark classical MD performance: measure
      timesteps/second for LJ system at various sizes (1K, 10K, 100K, 1M atoms)
      with Verlet list + PME; target: >1M atom-steps/second on single core for
      LJ, >100K atom-steps/second for PME; compare with LAMMPS serial
      performance on same hardware
- [x] **120.13.2.2** Benchmark Rust WASM vs native performance: compare MD
      performance through WASM (browser) vs native (napi-rs) bindings; measure
      overhead for force evaluation, neighbor list construction, and FFT (PME);
      target: WASM within 2x of native performance for compute- bound kernels
- [x] **120.13.2.3** Benchmark ReaxFF performance: measure timesteps/second for
      ReaxFF with QEq on hydrocarbon system (500, 2000, 10000 atoms); profile
      time breakdown (bond order, QEq, nonbonded, bonded corrections); target:
      within 3x of LAMMPS `pair_style reax/c` for equivalent system
- [x] **120.13.2.4** Benchmark trajectory analysis performance: measure g(r),
      MSD, CNA, and Voronoi analysis throughput for 10K and 100K atom
      trajectories (1000 frames); target: g(r) at >10^6 pairs/second, CNA
      at >10^5 atoms/second; compare with OVITO Python API performance
