|
occ
|
Namespaces | |
| namespace | detail |
| namespace | kernel_detail |
| namespace | rotation_detail |
| namespace | rotation_utils |
| Utility functions for rotation matrix creation. | |
Classes | |
| struct | AnisotropicRepulsionParams |
| Parameters for anisotropic Born-Mayer repulsion potential. More... | |
| struct | BodyFrameData |
| Body-frame data for rigid body rotation support. More... | |
| struct | BuckinghamParams |
| Parameters for the Buckingham (exp-6) potential. More... | |
| struct | CartesianForceResult |
| Energy and force gradient for a single site pair. More... | |
| class | CartesianInteractions |
| High-level API for Cartesian T-tensor multipole interaction calculations. More... | |
| struct | CartesianMolecule |
| Collection of precomputed Cartesian sites for a molecule. More... | |
| struct | CartesianMultipole |
| Traceless Cartesian multipole moments Theta_{tuv}. More... | |
| struct | CartesianSite |
| A single site with precomputed Cartesian multipole and cached rank. More... | |
| struct | CoordinateSystem |
| Lightweight POD struct for multipole coordinate system transformations. More... | |
| class | CrystalEnergy |
| Crystal energy evaluator for rigid molecule assemblies. More... | |
| struct | CrystalEnergyResult |
| Result from crystal energy evaluation. More... | |
| struct | CrystalEnergyResultWithHessian |
| Result from crystal energy evaluation with Hessian. More... | |
| struct | CrystalEnergySetup |
| Complete specification of a crystal energy calculation. More... | |
| class | CrystalOptimizer |
| Rigid molecule crystal structure optimizer. More... | |
| struct | CrystalOptimizerResult |
| Result from crystal structure optimization. More... | |
| struct | CrystalOptimizerSettings |
| Settings for crystal structure optimization. More... | |
| struct | CutoffSpline |
| DMACRYS-style radial spline taper definition. More... | |
| struct | CutoffSplineValue |
| class | DerivativeTransform |
| Derivative transformation matrices for multipole interactions. More... | |
| struct | EnergyForceFields |
| Combined energy+force+fields kernel. More... | |
| struct | EulerJacobian |
| Jacobian relating Euler angle rates to angular velocity. More... | |
| struct | EwaldExplicitStrainTerms |
| Result of explicit Ewald strain derivative computation. More... | |
| struct | EwaldLatticeCache |
| Pre-computed reciprocal lattice vectors and coefficients for Ewald. More... | |
| struct | EwaldParams |
| Parameters for the Ewald summation. More... | |
| struct | EwaldResult |
| Result from Ewald correction computation. More... | |
| struct | EwaldResultWithHessian |
| Ewald correction with analytical site-position Hessian. More... | |
| struct | EwaldSite |
| A single charge+dipole site for Ewald summation. More... | |
| class | ForceFieldParams |
| Manages force field parameters for short-range interactions. More... | |
| struct | FullRigidBodyResult |
| Full rigid body result including multipole rotation contribution. More... | |
| struct | InteractionTensor |
| Cartesian interaction tensor T_{tuv} = d^{t+u+v}/dx^t dy^u dz^v (1/R) More... | |
| struct | InteractionTensorBatch |
| SOA interaction tensor batch: BatchSize tensors stored interleaved. More... | |
| class | LBFGS |
| L-BFGS optimizer for unconstrained minimization. More... | |
| struct | LBFGSResult |
| Result structure from L-BFGS optimization. More... | |
| struct | LBFGSSettings |
| Settings for L-BFGS optimizer. More... | |
| struct | LennardJonesParams |
| Parameters for the Lennard-Jones 12-6 potential. More... | |
| struct | MoleculeForceResult |
| Per-site forces for a molecule pair interaction. More... | |
| struct | MoleculeHessianData |
| Precomputed data for one molecule in the Hessian computation. More... | |
| struct | MoleculeState |
| State of a rigid molecule (COM position + orientation). More... | |
| class | MSTMIN |
| DMACRYS MSTMIN-style quasi-Newton optimizer. More... | |
| struct | MSTMINResult |
| Result from MSTMIN minimization. More... | |
| struct | MSTMINSettings |
| Settings for DMACRYS-style MSTMIN quasi-Newton optimizer. More... | |
| struct | MultipoleConfig |
| Configuration for multipole computation from a crystal structure. More... | |
| class | MultipoleESP |
| Electrostatic Potential (ESP) evaluation using multipoles and S-functions. More... | |
| class | MultipoleInteractions |
| High-level API for multipole electrostatic calculations. More... | |
| class | MultipoleSource |
| struct | NeighborPair |
| Neighbor pair information for crystal energy computation. More... | |
| struct | OrientSite |
| Parse Orient multipole format from a file or string. More... | |
| struct | PairEnergyDebug |
| struct | PairHessianResult |
| Result of Hessian computation for a pair of rigid bodies. More... | |
| class | RigidBodyDynamics |
| Rigid body molecular dynamics integrator. More... | |
| struct | RigidBodyForceResult |
| Rigid body force and torque (lever-arm only, no multipole rotation). More... | |
| class | RigidBodyProjection |
| Projection matrix for removing rigid-body modes from optimization. More... | |
| struct | RigidBodyState |
| State of a rigid body for molecular dynamics simulations. More... | |
| struct | RigidMolecule |
| A rigid molecule with multipole sites and atom geometry. More... | |
| class | SFunctionEvaluator |
| S-function evaluator with batch evaluation support. More... | |
| struct | SFunctionResult |
| Result of S-function evaluation including derivatives. More... | |
| class | SFunctions |
| S-functions for multipole interaction evaluation. More... | |
| struct | SFunctionTerm |
| Represents a single S-function term to evaluate. More... | |
| struct | SFunctionTermList |
| List of S-function terms for a multipole pair interaction. More... | |
| class | SFunctionTermListBuilder |
| Builds filtered S-function term lists from multipole pairs. More... | |
| class | ShortRangeInteraction |
| Class for computing short-range pairwise interactions. More... | |
| struct | SiteHessianDerivatives |
| Precomputed per-site rotation derivatives for Hessian computation. More... | |
| struct | StrainedResult |
| Result from strained crystal computation. More... | |
| struct | SymmetryMapping |
| Maps unit cell molecules to their symmetry-independent representatives. More... | |
| class | TorqueCalculation |
| Calculate forces and torques on rigid bodies from multipole interactions. More... | |
| struct | TorqueResult |
| Result structure for torque calculations. More... | |
| class | TrustRegion |
| Trust Region Newton optimizer with Steihaug-CG subproblem solver. More... | |
| struct | TrustRegionResult |
| Result from Trust Region Newton optimization. More... | |
| struct | TrustRegionSettings |
| Settings for Trust Region Newton optimization. More... | |
| class | TwoMoleculeProjection |
| Simple 2-molecule projection (most common case) More... | |
Typedefs | |
| using | RotationMatrix = Mat3 |
| Rotate multipole moments using Wigner D-matrices. | |
Enumerations | |
| enum class | OptimizationMethod { MSTMIN , LBFGS , TrustRegion , TrustRegionBFGS } |
| Optimization method selection. More... | |
| enum class | ForceFieldType { None , LennardJones , BuckinghamDE , Custom } |
| Force field type for repulsion-dispersion interactions. More... | |
Functions | |
| Eigen::Vector4d | quaternion_gradient (const Eigen::Quaterniond &q, const Vec3 &grad_angle_axis) |
| Convert angle-axis gradient to quaternion gradient. | |
| void | apply_quaternion_gradient_step (Eigen::Quaterniond &q, const Vec3 &grad_angle_axis, double step) |
| Apply quaternion gradient update (gradient descent step) | |
| CartesianForceResult | compute_site_pair_energy_force (const CartesianSite &siteA, const CartesianSite &siteB) |
| Compute energy AND force gradient for a single pair of precomputed sites. | |
| MoleculeForceResult | compute_molecule_forces (const CartesianMolecule &molA, const CartesianMolecule &molB) |
| Compute per-site forces for two molecules. | |
| RigidBodyForceResult | aggregate_rigid_body_forces (const std::vector< Vec3 > &site_forces, const std::vector< Vec3 > &site_positions, const Vec3 ¢er_of_mass, const Mat3 &rotation=Mat3::Identity()) |
| Aggregate per-site forces into rigid body force and lever-arm torque. | |
| FullRigidBodyResult | compute_molecule_forces_torques (const CartesianMolecule &molA, const CartesianMolecule &molB, double site_cutoff=0.0, int max_interaction_order=-1, const Vec3 &offset_B=Vec3::Zero(), const CutoffSpline *taper=nullptr) |
| Full force/torque including multipole rotation contribution. | |
| PairHessianResult | compute_charge_charge_hessian (const Vec3 &posA, double qA, const Vec3 &posB, double qB) |
| Compute analytical Hessian for charge-charge interactions only. | |
| PairHessianResult | compute_charge_dipole_hessian (const Vec3 &posA, double qA, const Vec3 &posB, const Vec3 &dipole_B, const Vec3 &body_dipole_B, const Mat3 &M, const std::array< Mat3, 3 > &dM, const std::array< Mat3, 9 > *d2M=nullptr) |
| Compute analytical Hessian for charge-dipole interactions. | |
| MoleculeHessianData | build_molecule_hessian_data (const CartesianMolecule &mol, bool signed_side) |
| Build per-molecule Hessian data (rotation derivatives of multipoles). | |
| PairHessianResult | compute_molecule_hessian_truncated (const CartesianMolecule &molA, const CartesianMolecule &molB, const Vec3 &offset_B=Vec3::Zero(), double site_cutoff=0.0, int max_interaction_order=-1, const CutoffSpline *taper=nullptr, bool taper_hessian=true) |
| Compute analytical rigid-body Hessian for a molecule pair. | |
| PairHessianResult | compute_molecule_hessian_truncated (const CartesianMolecule &molA, const CartesianMolecule &molB, const MoleculeHessianData &dataA, const MoleculeHessianData &dataB, const Vec3 &offset_B=Vec3::Zero(), double site_cutoff=0.0, int max_interaction_order=-1, const CutoffSpline *taper=nullptr, bool taper_hessian=true) |
| Overload using precomputed molecule Hessian data (avoids recomputing rotation derivatives per pair — call build_molecule_hessian_data once per molecule, then pass to all pairs involving that molecule). | |
| template<int Order> | |
| double | contract_ranked (const CartesianMultipole< 4 > &A, int rankA, const InteractionTensor< Order > &T, const CartesianMultipole< 4 > &B, int rankB) |
| Preweighted contraction: compute energy for multipoles with known ranks. | |
| template<int Order> | |
| kernel_detail::EnergyGradient | contract_ranked_with_force (const CartesianMultipole< 4 > &A, int rankA, const InteractionTensor< Order+1 > &T, const CartesianMultipole< 4 > &B, int rankB) |
| Preweighted contraction with force: compute energy AND gradient dE/dR. | |
| template<int Order, bool OtherSigned = false> | |
| void | compute_interaction_field (int rankLocal, const InteractionTensor< Order > &T, const CartesianMultipole< 4 > &other, int rankOther, CartesianMultipole< 4 > &field) |
| Compute per-site interaction field at a local site from another site's multipoles. | |
| template<int HigherOrder, bool OtherSigned = false> | |
| void | compute_interaction_field_from_tensor (int rankLocal, const InteractionTensor< HigherOrder > &T, const CartesianMultipole< 4 > &other, int rankOther, CartesianMultipole< 4 > &field) |
| Compute interaction field from a pre-computed T-tensor of higher order. | |
| template<int Order> | |
| EnergyForceFields | compute_pair_ef_and_fields (const CartesianMultipole< 4 > &cartA, int rankA, const CartesianMultipole< 4 > &cartB, int rankB, double Rx, double Ry, double Rz) |
| double | compute_molecule_interaction (const CartesianMolecule &molA, const CartesianMolecule &molB) |
| Compute total electrostatic interaction energy between two molecules. | |
| double | compute_site_pair_energy (const CartesianSite &siteA, const CartesianSite &siteB) |
| Compute interaction energy for a single pair of precomputed sites. | |
| double | compute_molecule_interaction_simd (const CartesianMolecule &molA, const CartesianMolecule &molB) |
| Compute total interaction energy using SIMD-batched T-tensor computation. | |
| template<int MaxL> | |
| void | spherical_to_cartesian (const occ::dma::Mult &sph, CartesianMultipole< MaxL > &cart) |
| Convert spherical multipole (Mult) to traceless Cartesian multipole. | |
| template<int MaxL> | |
| void | rotate_cartesian_multipole (const CartesianMultipole< MaxL > &body, const Mat3 &M, CartesianMultipole< MaxL > &lab) |
| Rotate a CartesianMultipole from body frame to lab frame. | |
| template<int MaxL> | |
| void | rotate_cartesian_multipole_derivative (const CartesianMultipole< MaxL > &body, const Mat3 &M, const Mat3 &M1, CartesianMultipole< MaxL > &d_lab) |
| Compute derivative of lab-frame multipole w.r.t. | |
| template<int MaxL> | |
| void | rotate_cartesian_multipole_second_derivative (const CartesianMultipole< MaxL > &body, const Mat3 &M, const Mat3 &M1k, const Mat3 &M1l, const Mat3 &M2kl, CartesianMultipole< MaxL > &d2_lab) |
| Compute second derivative of lab-frame multipole w.r.t. | |
| const std::array< Mat3, 6 > & | voigt_basis_matrices () |
| CrystalEnergySetup | from_structure_input (const occ::io::StructureInput &si) |
| Build CrystalEnergySetup from a StructureInput (explicit rigid bodies). | |
| CrystalEnergySetup | from_crystal_and_multipoles (const occ::crystal::Crystal &crystal, const std::vector< MultipoleSource > &multipoles) |
| Build CrystalEnergySetup from a Crystal + MultipleSources. | |
| CrystalEnergySetup | from_crystal (occ::crystal::Crystal &crystal, const MultipoleConfig &config={}) |
| Build CrystalEnergySetup from a Crystal by computing DMA multipoles. | |
| occ::io::StructureInput | to_structure_input (const CrystalEnergySetup &setup, const std::string &title="") |
| Convert a CrystalEnergySetup to a StructureInput for serialization. | |
| SymmetryMapping | build_symmetry_mapping (const crystal::Crystal &crystal) |
| Build symmetry mapping from crystal structure. | |
| std::vector< MoleculeState > | generate_uc_states (const std::vector< MoleculeState > &independent_states, const SymmetryMapping &mapping) |
| Generate all Z unit cell states from Z' independent states. | |
| void | accumulate_gradients (const std::vector< Vec3 > &uc_forces, const std::vector< Vec3 > &uc_torques, const SymmetryMapping &mapping, std::vector< Vec3 > &indep_forces, std::vector< Vec3 > &indep_torques) |
| Accumulate UC-level forces/torques back to independent molecules. | |
| Mat3 | voigt_strain_tensor (int voigt_index, double magnitude) |
| Build the 3x3 strain tensor for a single Voigt component. | |
| StrainedResult | compute_strained (const CrystalEnergySetup &setup, const Mat3 &strain, const std::vector< NeighborPair > *fixed_neighbors=nullptr, const std::vector< std::vector< bool > > *fixed_site_masks=nullptr) |
| Compute energy and gradient of a strained crystal. | |
| double | compute_strained_energy (const CrystalEnergySetup &setup, const Mat3 &strain, const std::vector< NeighborPair > *fixed_neighbors=nullptr, const std::vector< std::vector< bool > > *fixed_site_masks=nullptr) |
| Convenience: compute only energy at strained geometry. | |
| Vec6 | compute_strain_derivatives_fd (const CrystalEnergySetup &setup, double delta=1e-4) |
| Compute 6 strain derivatives dU/dE_i by central finite differences. | |
| Mat6 | compute_elastic_constants_fd (const CrystalEnergySetup &setup, double delta=1e-3) |
| Compute the 6x6 clamped elastic stiffness tensor C_ij analytically. | |
| Mat6 | compute_relaxed_elastic_constants_fd (const CrystalEnergySetup &setup, double delta=1e-3) |
| Compute relaxed-ion elastic constants via Schur complement. | |
| CutoffSplineValue | evaluate_cutoff_spline (double r, double r_on, double r_off, int order=3) |
| CutoffSplineValue | evaluate_cutoff_spline (double r, const CutoffSpline &spline) |
| EwaldLatticeCache | build_ewald_lattice_cache (const crystal::UnitCell &unit_cell, const EwaldParams ¶ms) |
| Build an EwaldLatticeCache from unit cell and parameters. | |
| EwaldResult | compute_ewald_correction (const std::vector< EwaldSite > &sites, const crystal::UnitCell &unit_cell, const std::vector< NeighborPair > &neighbors, const std::vector< std::vector< size_t > > &mol_site_indices, double cutoff_radius, bool use_com_gate, double elec_site_cutoff, const EwaldParams ¶ms, const CutoffSpline *taper=nullptr, const EwaldLatticeCache *lattice_cache=nullptr) |
| Compute Ewald correction: (Ewald total) - (truncated real-space sum). | |
| EwaldResultWithHessian | compute_ewald_correction_with_hessian (const std::vector< EwaldSite > &sites, const crystal::UnitCell &unit_cell, const std::vector< NeighborPair > &neighbors, const std::vector< std::vector< size_t > > &mol_site_indices, double cutoff_radius, bool use_com_gate, double elec_site_cutoff, const EwaldParams ¶ms, const CutoffSpline *taper=nullptr, const EwaldLatticeCache *lattice_cache=nullptr) |
| Compute Ewald correction and analytical site-position Hessian. | |
| std::vector< EwaldSite > | gather_ewald_sites (const std::vector< CartesianMolecule > &cart_mols, bool include_dipole) |
| Gather EwaldSites from CartesianMolecules (pure data extraction). | |
| std::vector< std::vector< size_t > > | build_mol_site_indices (const std::vector< CartesianMolecule > &cart_mols) |
| Build mol_site_indices from CartesianMolecules. | |
| template<int MaxL> | |
| void | compute_interaction_tensor (double Rx, double Ry, double Rz, InteractionTensor< MaxL > &T) |
| Compute Cartesian interaction tensor via Obara-Saika-style recurrence. | |
| template<int MaxL, int BatchSize> | |
| void | compute_interaction_tensor_batch_scalar (const double *__restrict__ Rx, const double *__restrict__ Ry, const double *__restrict__ Rz, InteractionTensorBatch< MaxL, BatchSize > &T) |
| template<int MaxL> | |
| void | compute_interaction_tensor_batch (const double *__restrict__ Rx, const double *__restrict__ Ry, const double *__restrict__ Rz, InteractionTensorBatch< MaxL, simd_batch_size > &T) |
| template<int Order, int BatchSize> | |
| double | contract_ranked_from_batch (const CartesianMultipole< 4 > &A, int rankA, const InteractionTensorBatch< Order, BatchSize > &T, int b, const CartesianMultipole< 4 > &B, int rankB) |
| Contract one pair from a batch tensor with precomputed multipoles. | |
| void | shift_multipole_to_origin (const CartesianMultipole< 4 > &input, int input_rank, const Vec3 &displacement, CartesianMultipole< 4 > &output) |
| Shift a Cartesian multipole from its current origin to a new origin. | |
| CartesianMolecule | merge_to_single_site (const CartesianMolecule &mol) |
| Merge all sites of a molecule into a single effective site. | |
| CartesianMolecule | merge_to_single_site (const CartesianMolecule &mol, const Vec3 &origin) |
| Merge all sites of a molecule into a single effective site at a specified origin. | |
| MultipoleSource | multipole_source_from_rigid_body (const RigidBodyState &rb) |
| void | sync_orientation (MultipoleSource &source, const RigidBodyState &rb) |
| dma::Mult | parse_orient_multipoles (int max_rank, const std::vector< std::string > &lines) |
| Parse Orient multipole components from a list of value strings. | |
| std::vector< OrientSite > | parse_orient_file (const std::string &filename) |
| Parse a complete Orient input file. | |
| Mat | wigner_d_matrix (const RotationMatrix &R, int lmax) |
| Wigner D-matrix for multipole rotation. | |
| occ::dma::Mult & | rotate_multipole (occ::dma::Mult &mult, const RotationMatrix &R) |
| Rotate a multipole moment object. | |
| occ::dma::Mult | rotated_multipole (const occ::dma::Mult &mult, const RotationMatrix &R) |
| Create a rotated copy of a multipole object. | |
| EwaldExplicitStrainTerms | compute_ewald_explicit_strain_terms (const std::vector< EwaldSite > &sites, const crystal::UnitCell &unit_cell, const std::vector< NeighborPair > &neighbors, const std::vector< std::vector< size_t > > &mol_site_indices, double cutoff_radius, bool use_com_gate, double elec_site_cutoff, const EwaldParams ¶ms, const CutoffSpline *taper, const EwaldLatticeCache *lattice_cache, bool include_strain_state=false) |
| Compute Ewald strain derivatives (gradient + Hessian) using AD6 dual numbers. | |
Variables | |
| constexpr int | simd_batch_size = MULTS_SIMD_WIDTH |
| Batch size for SIMD T-tensor computation. | |
| using occ::mults::RotationMatrix = typedef Mat3 |
Rotate multipole moments using Wigner D-matrices.
This module provides functionality to rotate multipole moments stored in occ::dma::Mult objects under 3D rotations. The implementation is based on the proven algorithms from Orient's rotations.f90, specifically the wigner() subroutine.
The rotation uses real spherical harmonic conventions matching Stone's "Theory of Intermolecular Forces" with Racah normalization.
Rotation matrix type
|
strong |
|
strong |
| void occ::mults::accumulate_gradients | ( | const std::vector< Vec3 > & | uc_forces, |
| const std::vector< Vec3 > & | uc_torques, | ||
| const SymmetryMapping & | mapping, | ||
| std::vector< Vec3 > & | indep_forces, | ||
| std::vector< Vec3 > & | indep_torques | ||
| ) |
Accumulate UC-level forces/torques back to independent molecules.
For each independent molecule, sums the (back-rotated) forces and torques from all its symmetry images.
Forces are projected onto allowed translational subspace. Torques are left unprojected so the SO(3) chain rule can be applied first (dE/dtheta from dE/dpsi), then projected in parameter space.
| RigidBodyForceResult occ::mults::aggregate_rigid_body_forces | ( | const std::vector< Vec3 > & | site_forces, |
| const std::vector< Vec3 > & | site_positions, | ||
| const Vec3 & | center_of_mass, | ||
| const Mat3 & | rotation = Mat3::Identity() |
||
| ) |
Aggregate per-site forces into rigid body force and lever-arm torque.
|
inline |
Apply quaternion gradient update (gradient descent step)
Updates the quaternion in the direction of steepest descent.
| q | Current orientation quaternion (will be modified in place) |
| grad_angle_axis | The angle-axis gradient |
| step | Step size (learning rate) |
| EwaldLatticeCache occ::mults::build_ewald_lattice_cache | ( | const crystal::UnitCell & | unit_cell, |
| const EwaldParams & | params | ||
| ) |
Build an EwaldLatticeCache from unit cell and parameters.
| std::vector< std::vector< size_t > > occ::mults::build_mol_site_indices | ( | const std::vector< CartesianMolecule > & | cart_mols | ) |
Build mol_site_indices from CartesianMolecules.
| MoleculeHessianData occ::mults::build_molecule_hessian_data | ( | const CartesianMolecule & | mol, |
| bool | signed_side | ||
| ) |
Build per-molecule Hessian data (rotation derivatives of multipoles).
| mol | CartesianMolecule with body frame data |
| signed_side | true for A-side (sign_inv_fact), false for B-side (inv_fact) |
| SymmetryMapping occ::mults::build_symmetry_mapping | ( | const crystal::Crystal & | crystal | ) |
Build symmetry mapping from crystal structure.
Uses Crystal's symmetry_unique_molecules() and unit_cell_molecules() to determine which UC molecules map to which independent molecules, and detects site symmetry constraints to reduce DOF for Z'<1.
| PairHessianResult occ::mults::compute_charge_charge_hessian | ( | const Vec3 & | posA, |
| double | qA, | ||
| const Vec3 & | posB, | ||
| double | qB | ||
| ) |
Compute analytical Hessian for charge-charge interactions only.
This is the simplest case where both multipoles are rank 0 (charges). The Hessian is entirely positional (no rotation dependence for point charges).
Energy: E = q_A * q_B / R Gradient: ∂E/∂R_k = q_A * q_B * T^(1)_k Hessian: ∂²E/∂R_k∂R_l = q_A * q_B * T^(2)_kl
| posA | Position of charge A |
| qA | Charge at A |
| posB | Position of charge B |
| qB | Charge at B |
| PairHessianResult occ::mults::compute_charge_dipole_hessian | ( | const Vec3 & | posA, |
| double | qA, | ||
| const Vec3 & | posB, | ||
| const Vec3 & | dipole_B, | ||
| const Vec3 & | body_dipole_B, | ||
| const Mat3 & | M, | ||
| const std::array< Mat3, 3 > & | dM, | ||
| const std::array< Mat3, 9 > * | d2M = nullptr |
||
| ) |
Compute analytical Hessian for charge-dipole interactions.
Site A has charge q_A, site B has dipole μ_B (in lab frame).
Energy: E = q_A * T^(1)_j * μ_B^j
Position Hessian: ∂²E/∂R_k∂R_l = q_A * T^(3)_jkl * μ_B^j
Position-Rotation Hessian (for B's rotation): ∂²E/∂R_k∂θ_B^m = q_A * T^(2)_jk * ∂μ_B^j/∂θ_B^m
Rotation-Rotation Hessian (for B's rotation): ∂²E/∂θ_B^m∂θ_B^n = q_A * T^(1)_j * ∂²μ_B^j/∂θ_B^m∂θ_B^n
| posA | Position of charge A |
| qA | Charge at A |
| posB | Position of dipole B (center) |
| dipole_B | Lab-frame dipole at B (already rotated) |
| body_dipole_B | Body-frame dipole at B (for rotation derivatives) |
| M | Rotation matrix (body to lab) for B |
| dM | Array of 3 rotation matrix derivatives ∂M/∂θ_k |
| d2M | Array of 9 second derivatives ∂²M/∂θ_k∂θ_l (optional, can be nullptr) |
| Mat6 occ::mults::compute_elastic_constants_fd | ( | const CrystalEnergySetup & | setup, |
| double | delta = 1e-3 |
||
| ) |
Compute the 6x6 clamped elastic stiffness tensor C_ij analytically.
| EwaldResult occ::mults::compute_ewald_correction | ( | const std::vector< EwaldSite > & | sites, |
| const crystal::UnitCell & | unit_cell, | ||
| const std::vector< NeighborPair > & | neighbors, | ||
| const std::vector< std::vector< size_t > > & | mol_site_indices, | ||
| double | cutoff_radius, | ||
| bool | use_com_gate, | ||
| double | elec_site_cutoff, | ||
| const EwaldParams & | params, | ||
| const CutoffSpline * | taper = nullptr, |
||
| const EwaldLatticeCache * | lattice_cache = nullptr |
||
| ) |
Compute Ewald correction: (Ewald total) - (truncated real-space sum).
The correction is: reciprocal + self - erf(inter) - erf(intra), where the erf terms cancel the real-space truncation error.
| sites | All charge+dipole sites (positions in Angstrom) |
| unit_cell | Crystal unit cell |
| neighbors | Neighbor pair list (for real-space erf correction) |
| mol_site_indices | Mapping: mol_index -> list of site indices in sites |
| cutoff_radius | COM cutoff for electrostatic pair gate (Angstrom) |
| use_com_gate | Apply COM gate to erf correction (match main loop) |
| elec_site_cutoff | Per-site cutoff in Angstrom (0 = none) |
| params | Ewald parameters (alpha, kmax, dipole flag) |
| taper | Optional DMACRYS-style real-space radial taper |
| EwaldResultWithHessian occ::mults::compute_ewald_correction_with_hessian | ( | const std::vector< EwaldSite > & | sites, |
| const crystal::UnitCell & | unit_cell, | ||
| const std::vector< NeighborPair > & | neighbors, | ||
| const std::vector< std::vector< size_t > > & | mol_site_indices, | ||
| double | cutoff_radius, | ||
| bool | use_com_gate, | ||
| double | elec_site_cutoff, | ||
| const EwaldParams & | params, | ||
| const CutoffSpline * | taper = nullptr, |
||
| const EwaldLatticeCache * | lattice_cache = nullptr |
||
| ) |
Compute Ewald correction and analytical site-position Hessian.
| EwaldExplicitStrainTerms occ::mults::compute_ewald_explicit_strain_terms | ( | const std::vector< EwaldSite > & | sites, |
| const crystal::UnitCell & | unit_cell, | ||
| const std::vector< NeighborPair > & | neighbors, | ||
| const std::vector< std::vector< size_t > > & | mol_site_indices, | ||
| double | cutoff_radius, | ||
| bool | use_com_gate, | ||
| double | elec_site_cutoff, | ||
| const EwaldParams & | params, | ||
| const CutoffSpline * | taper, | ||
| const EwaldLatticeCache * | lattice_cache, | ||
| bool | include_strain_state = false |
||
| ) |
Compute Ewald strain derivatives (gradient + Hessian) using AD6 dual numbers.
Evaluates dE/dE_i and d²E/dE_i dE_j for the Ewald correction terms (real-space erf, reciprocal-space, self-energy) under affine cell strain.
| sites | Ewald site positions, charges, and dipoles |
| unit_cell | Current unit cell |
| neighbors | Molecule pair list with cell shifts |
| mol_site_indices | Mapping from molecule index to site indices |
| cutoff_radius | COM cutoff for electrostatic pair gate |
| use_com_gate | Whether to apply COM-based pair gating |
| elec_site_cutoff | Per-site cutoff (0 = no cutoff) |
| params | Ewald alpha and kmax parameters |
| taper | Optional electrostatic radial taper |
| lattice_cache | Precomputed G-vectors (or nullptr) |
| include_strain_state | If true, compute mixed strain-site derivatives |
| void occ::mults::compute_interaction_field | ( | int | rankLocal, |
| const InteractionTensor< Order > & | T, | ||
| const CartesianMultipole< 4 > & | other, | ||
| int | rankOther, | ||
| CartesianMultipole< 4 > & | field | ||
| ) |
Compute per-site interaction field at a local site from another site's multipoles.
field[tuv] = sum_{j} T(ta+tb, ua+ub, va+vb) * w_other[j]
When other_signed=false: w_other = inv_fact * other (for B-side "other", no sign) When other_signed=true: w_other = sign_inv_fact * other (for A-side "other", (-1)^l sign)
Use other_signed=false when computing field at A from B's multipoles. Use other_signed=true when computing field at B from A's multipoles.
| void occ::mults::compute_interaction_field_from_tensor | ( | int | rankLocal, |
| const InteractionTensor< HigherOrder > & | T, | ||
| const CartesianMultipole< 4 > & | other, | ||
| int | rankOther, | ||
| CartesianMultipole< 4 > & | field | ||
| ) |
Compute interaction field from a pre-computed T-tensor of higher order.
Same as compute_interaction_field, but accepts InteractionTensor<HigherOrder> and only accesses elements up to rankLocal + rankOther. This avoids recomputing the T-tensor when we already have one at sufficient order.
| void occ::mults::compute_interaction_tensor | ( | double | Rx, |
| double | Ry, | ||
| double | Rz, | ||
| InteractionTensor< MaxL > & | T | ||
| ) |
Compute Cartesian interaction tensor via Obara-Saika-style recurrence.
Base case: T^{(m)}_{000} = (-1)^m (2m-1)!! / R^{2m+1}
Recurrence (same as compute_r_ints in rints.h): T^{(m)}_{t+1,u,v} = Rx * T^{(m+1)}_{t,u,v} + t * T^{(m+1)}_{t-1,u,v} (analogous for u,v directions)
Result: T_{tuv} = T^{(0)}_{tuv}
| Rx | x-component of displacement R = pos2 - pos1 |
| Ry | y-component of displacement |
| Rz | z-component of displacement |
| T | Output tensor |
|
inline |
| void occ::mults::compute_interaction_tensor_batch_scalar | ( | const double *__restrict__ | Rx, |
| const double *__restrict__ | Ry, | ||
| const double *__restrict__ | Rz, | ||
| InteractionTensorBatch< MaxL, BatchSize > & | T | ||
| ) |
| MoleculeForceResult occ::mults::compute_molecule_forces | ( | const CartesianMolecule & | molA, |
| const CartesianMolecule & | molB | ||
| ) |
Compute per-site forces for two molecules.
| FullRigidBodyResult occ::mults::compute_molecule_forces_torques | ( | const CartesianMolecule & | molA, |
| const CartesianMolecule & | molB, | ||
| double | site_cutoff = 0.0, |
||
| int | max_interaction_order = -1, |
||
| const Vec3 & | offset_B = Vec3::Zero(), |
||
| const CutoffSpline * | taper = nullptr |
||
| ) |
Full force/torque including multipole rotation contribution.
Requires body-frame data in both molecules. If site_cutoff > 0, skip site pairs with distance > site_cutoff (Angstrom). If max_interaction_order >= 0, skip site pairs where rankA + rankB > max_interaction_order. offset_B: translation applied to all B-site positions (avoids copying molB for cell shifts). If taper is provided and enabled, pair energy is multiplied by f(r), with force and torque terms including df/dr consistently.
| PairHessianResult occ::mults::compute_molecule_hessian_truncated | ( | const CartesianMolecule & | molA, |
| const CartesianMolecule & | molB, | ||
| const MoleculeHessianData & | dataA, | ||
| const MoleculeHessianData & | dataB, | ||
| const Vec3 & | offset_B = Vec3::Zero(), |
||
| double | site_cutoff = 0.0, |
||
| int | max_interaction_order = -1, |
||
| const CutoffSpline * | taper = nullptr, |
||
| bool | taper_hessian = true |
||
| ) |
Overload using precomputed molecule Hessian data (avoids recomputing rotation derivatives per pair — call build_molecule_hessian_data once per molecule, then pass to all pairs involving that molecule).
| PairHessianResult occ::mults::compute_molecule_hessian_truncated | ( | const CartesianMolecule & | molA, |
| const CartesianMolecule & | molB, | ||
| const Vec3 & | offset_B = Vec3::Zero(), |
||
| double | site_cutoff = 0.0, |
||
| int | max_interaction_order = -1, |
||
| const CutoffSpline * | taper = nullptr, |
||
| bool | taper_hessian = true |
||
| ) |
Compute analytical rigid-body Hessian for a molecule pair.
Includes all Cartesian multipole interaction terms present in the two molecules (up to rank 4 in current CartesianMolecule data), including translation/rotation coupling and rotation-rotation blocks.
NOTE: The function name is historical; this implementation is no longer "truncated" to charge-only/charge-dipole terms.
| molA | Molecule A with body frame data |
| molB | Molecule B with body frame data |
| double occ::mults::compute_molecule_interaction | ( | const CartesianMolecule & | molA, |
| const CartesianMolecule & | molB | ||
| ) |
Compute total electrostatic interaction energy between two molecules.
Iterates over all site pairs (i in molA, j in molB), dispatching to the appropriate tensor order for each pair. Multipole conversions and rank detection are already cached in the CartesianMolecule objects.
| double occ::mults::compute_molecule_interaction_simd | ( | const CartesianMolecule & | molA, |
| const CartesianMolecule & | molB | ||
| ) |
Compute total interaction energy using SIMD-batched T-tensor computation.
Groups pairs by interaction order and processes groups in SIMD batches of simd_batch_size pairs simultaneously. Falls back to scalar for remainder pairs in each group.
| EnergyForceFields occ::mults::compute_pair_ef_and_fields | ( | const CartesianMultipole< 4 > & | cartA, |
| int | rankA, | ||
| const CartesianMultipole< 4 > & | cartB, | ||
| int | rankB, | ||
| double | Rx, | ||
| double | Ry, | ||
| double | Rz | ||
| ) |
| Mat6 occ::mults::compute_relaxed_elastic_constants_fd | ( | const CrystalEnergySetup & | setup, |
| double | delta = 1e-3 |
||
| ) |
Compute relaxed-ion elastic constants via Schur complement.
C_relaxed = W_ee - W_ei * W_ii^{-1} * W_ie
| double occ::mults::compute_site_pair_energy | ( | const CartesianSite & | siteA, |
| const CartesianSite & | siteB | ||
| ) |
Compute interaction energy for a single pair of precomputed sites.
| CartesianForceResult occ::mults::compute_site_pair_energy_force | ( | const CartesianSite & | siteA, |
| const CartesianSite & | siteB | ||
| ) |
Compute energy AND force gradient for a single pair of precomputed sites.
| Vec6 occ::mults::compute_strain_derivatives_fd | ( | const CrystalEnergySetup & | setup, |
| double | delta = 1e-4 |
||
| ) |
Compute 6 strain derivatives dU/dE_i by central finite differences.
Uses a fixed neighbor list from the unstrained crystal to avoid discontinuities from the hard cutoff boundary.
| StrainedResult occ::mults::compute_strained | ( | const CrystalEnergySetup & | setup, |
| const Mat3 & | strain, | ||
| const std::vector< NeighborPair > * | fixed_neighbors = nullptr, |
||
| const std::vector< std::vector< bool > > * | fixed_site_masks = nullptr |
||
| ) |
Compute energy and gradient of a strained crystal.
Applies strain eps to the unit cell: direct' = (I + eps) * direct. Fractional coordinates are unchanged, so Cartesian positions shift according to the new lattice vectors.
|
inline |
Convenience: compute only energy at strained geometry.
| double occ::mults::contract_ranked | ( | const CartesianMultipole< 4 > & | A, |
| int | rankA, | ||
| const InteractionTensor< Order > & | T, | ||
| const CartesianMultipole< 4 > & | B, | ||
| int | rankB | ||
| ) |
Preweighted contraction: compute energy for multipoles with known ranks.
Precomputes wA[i] = (-1)^l / (t!u!v!) * A[i] and wB[j] = 1/(t!u!v!) * B[j] then contracts: E = sum_ij wA[i] * T(ta+tb, ua+ub, va+vb) * wB[j]
Only iterates over indices up to rankA and rankB respectively.
| Order | The interaction tensor order (= rankA + rankB) |
| double occ::mults::contract_ranked_from_batch | ( | const CartesianMultipole< 4 > & | A, |
| int | rankA, | ||
| const InteractionTensorBatch< Order, BatchSize > & | T, | ||
| int | b, | ||
| const CartesianMultipole< 4 > & | B, | ||
| int | rankB | ||
| ) |
Contract one pair from a batch tensor with precomputed multipoles.
Extracts the b-th tensor from the batch and contracts with the preweighted multipoles.
| kernel_detail::EnergyGradient occ::mults::contract_ranked_with_force | ( | const CartesianMultipole< 4 > & | A, |
| int | rankA, | ||
| const InteractionTensor< Order+1 > & | T, | ||
| const CartesianMultipole< 4 > & | B, | ||
| int | rankB | ||
| ) |
Preweighted contraction with force: compute energy AND gradient dE/dR.
Uses the T-tensor derivative property: dT(t,u,v)/dR_x = T(t+1,u,v) dT(t,u,v)/dR_y = T(t,u+1,v) dT(t,u,v)/dR_z = T(t,u,v+1)
Requires InteractionTensor<Order+1> to accommodate the shifted indices.
| Order | The interaction tensor order (= rankA + rankB) |
|
inline |
|
inline |
| CrystalEnergySetup occ::mults::from_crystal | ( | occ::crystal::Crystal & | crystal, |
| const MultipoleConfig & | config = {} |
||
| ) |
Build CrystalEnergySetup from a Crystal by computing DMA multipoles.
Full pipeline: Crystal → SCF → DMA → Williams typing → setup.
| CrystalEnergySetup occ::mults::from_crystal_and_multipoles | ( | const occ::crystal::Crystal & | crystal, |
| const std::vector< MultipoleSource > & | multipoles | ||
| ) |
Build CrystalEnergySetup from a Crystal + MultipleSources.
Uses Crystal's unit_cell_molecules() to extract orientations.
| CrystalEnergySetup occ::mults::from_structure_input | ( | const occ::io::StructureInput & | si | ) |
Build CrystalEnergySetup from a StructureInput (explicit rigid bodies).
No Crystal object needed — orientations are taken directly from the JSON.
| std::vector< EwaldSite > occ::mults::gather_ewald_sites | ( | const std::vector< CartesianMolecule > & | cart_mols, |
| bool | include_dipole | ||
| ) |
Gather EwaldSites from CartesianMolecules (pure data extraction).
| std::vector< MoleculeState > occ::mults::generate_uc_states | ( | const std::vector< MoleculeState > & | independent_states, |
| const SymmetryMapping & | mapping | ||
| ) |
Generate all Z unit cell states from Z' independent states.
Applies symmetry operations to produce the full set of UC molecule states.
| CartesianMolecule occ::mults::merge_to_single_site | ( | const CartesianMolecule & | mol | ) |
Merge all sites of a molecule into a single effective site.
The new origin is the charge-weighted centroid if the total charge is non-negligible, otherwise the geometric centroid.
| mol | Input molecule with multiple sites |
| CartesianMolecule occ::mults::merge_to_single_site | ( | const CartesianMolecule & | mol, |
| const Vec3 & | origin | ||
| ) |
Merge all sites of a molecule into a single effective site at a specified origin.
| mol | Input molecule with multiple sites |
| origin | The position for the merged site |
| MultipoleSource occ::mults::multipole_source_from_rigid_body | ( | const RigidBodyState & | rb | ) |
| std::vector< OrientSite > occ::mults::parse_orient_file | ( | const std::string & | filename | ) |
Parse a complete Orient input file.
| filename | Path to Orient input file |
| dma::Mult occ::mults::parse_orient_multipoles | ( | int | max_rank, |
| const std::vector< std::string > & | lines | ||
| ) |
Parse Orient multipole components from a list of value strings.
| max_rank | Maximum multipole rank (e.g., 4 for hexadecapole) |
| lines | Vector of strings containing whitespace-separated values |
Example: std::vector<std::string> lines = { "1.142734", "0.000000 0.163569 0.000000", "-0.115661 0.000000 0.000000 0.213489 0.000000" }; auto mult = parse_orient_multipoles(2, lines); // rank 2 = charge + dipole + quadrupole
|
inline |
Convert angle-axis gradient to quaternion gradient.
For optimization with quaternions, this computes the gradient in the tangent space of the unit quaternion manifold. The result can be used directly for gradient descent:
q_new = (q - step * grad_quat).normalized()
Or equivalently using quaternion multiplication:
delta_q = Quaternion(1, -step*g[0]/2, -step*g[1]/2, -step*g[2]/2) q_new = (delta_q * q).normalized()
| q | Current orientation quaternion (must be normalized) |
| grad_angle_axis | The angle-axis gradient (∂E/∂θ for rotations about lab axes) |
| void occ::mults::rotate_cartesian_multipole | ( | const CartesianMultipole< MaxL > & | body, |
| const Mat3 & | M, | ||
| CartesianMultipole< MaxL > & | lab | ||
| ) |
Rotate a CartesianMultipole from body frame to lab frame.
For each rank l, applies: lab(t,u,v) = sum_{a+b+c=l} K(tuv, abc; M) * body(a,b,c)
| void occ::mults::rotate_cartesian_multipole_derivative | ( | const CartesianMultipole< MaxL > & | body, |
| const Mat3 & | M, | ||
| const Mat3 & | M1, | ||
| CartesianMultipole< MaxL > & | d_lab | ||
| ) |
Compute derivative of lab-frame multipole w.r.t.
angle-axis parameter.
Given M1 = dM/dp_k, computes d(lab)/dp_k for the rotated multipole.
| void occ::mults::rotate_cartesian_multipole_second_derivative | ( | const CartesianMultipole< MaxL > & | body, |
| const Mat3 & | M, | ||
| const Mat3 & | M1k, | ||
| const Mat3 & | M1l, | ||
| const Mat3 & | M2kl, | ||
| CartesianMultipole< MaxL > & | d2_lab | ||
| ) |
Compute second derivative of lab-frame multipole w.r.t.
angle-axis parameters.
Given M1k = dM/dp_k, M1l = dM/dp_l, and M2kl = d²M/dp_k dp_l, computes d²(lab)/dp_k dp_l for the rotated multipole.
| occ::dma::Mult & occ::mults::rotate_multipole | ( | occ::dma::Mult & | mult, |
| const RotationMatrix & | R | ||
| ) |
Rotate a multipole moment object.
Applies a 3D rotation to all multipole components in a Mult object up to its maximum rank. The rotation preserves the multipole expansion while transforming to the new coordinate system.
| mult | Input multipole object (modified in place) |
| R | 3x3 rotation matrix |
| occ::dma::Mult occ::mults::rotated_multipole | ( | const occ::dma::Mult & | mult, |
| const RotationMatrix & | R | ||
| ) |
Create a rotated copy of a multipole object.
| mult | Input multipole object (unchanged) |
| R | 3x3 rotation matrix |
| void occ::mults::shift_multipole_to_origin | ( | const CartesianMultipole< 4 > & | input, |
| int | input_rank, | ||
| const Vec3 & | displacement, | ||
| CartesianMultipole< 4 > & | output | ||
| ) |
Shift a Cartesian multipole from its current origin to a new origin.
Given multipole moments M_{t'u'v'} at position r_s, computes moments about a new origin r_0 using the binomial shift formula:
M'_{tuv} = sum_{t'<=t, u'<=u, v'<=v} C(t,t') C(u,u') C(v,v')
where d = r_s - r_0 (displacement from new origin to old site).
The output is accumulated (added to), not overwritten. Caller must zero the output multipole before the first call if needed.
| input | Source multipole at the old origin |
| input_rank | Maximum rank of non-zero components in input |
| displacement | Vector d = r_s - r_0 (old site minus new origin) |
| output | Destination multipole (accumulated into) |
| void occ::mults::spherical_to_cartesian | ( | const occ::dma::Mult & | sph, |
| CartesianMultipole< MaxL > & | cart | ||
| ) |
Convert spherical multipole (Mult) to traceless Cartesian multipole.
The output Theta_{tuv} satisfies tracelessness: Theta_{t+2,u,v} + Theta_{t,u+2,v} + Theta_{t,u,v+2} = 0 for all valid (t,u,v) with t+u+v = l-2.
| MaxL | Maximum rank to convert (0..4 supported) |
| sph | Input spherical multipole (Stone convention) |
| cart | Output traceless Cartesian multipole |
| void occ::mults::sync_orientation | ( | MultipoleSource & | source, |
| const RigidBodyState & | rb | ||
| ) |
| occ::io::StructureInput occ::mults::to_structure_input | ( | const CrystalEnergySetup & | setup, |
| const std::string & | title = "" |
||
| ) |
Convert a CrystalEnergySetup to a StructureInput for serialization.
Uses the current molecule placements (COM, angle_axis, parity).
| const std::array< Mat3, 6 > & occ::mults::voigt_basis_matrices | ( | ) |
| Mat3 occ::mults::voigt_strain_tensor | ( | int | voigt_index, |
| double | magnitude | ||
| ) |
Build the 3x3 strain tensor for a single Voigt component.
Voigt convention: 0 -> E_1 = eps_11 (xx) 1 -> E_2 = eps_22 (yy) 2 -> E_3 = eps_33 (zz) 3 -> E_4 = 2*eps_23 (yz) 4 -> E_5 = 2*eps_13 (xz) 5 -> E_6 = 2*eps_12 (xy)
| Mat occ::mults::wigner_d_matrix | ( | const RotationMatrix & | R, |
| int | lmax | ||
| ) |
Wigner D-matrix for multipole rotation.
Computes the transformation matrix D required to rotate real spherical harmonic multipole components (Q00, Q10, Q11c, Q11s, ..., QLLc, QLLs) under a 3D rotation described by rotation matrix R.
| R | 3x3 rotation matrix (direction cosines) |
| lmax | Maximum multipole rank to include |
|
inlineconstexpr |
Batch size for SIMD T-tensor computation.