namespace atmd¶
Overview¶
The atomic dimer search (class AtomicDimer) and its status types. More…
namespace atmd {
// enums
enum DimerOracleProgressAction;
enum DimerProposalGlobalizationAction;
enum DimerRelaxationCycleKind;
enum DimerRelaxationTerminationReason;
enum DimerResidualGlobalizationAction;
enum DimerSurrogateActionTermination;
enum HssvdModeSelectionPolicy;
// structs
struct DimerRelaxationBacktrackResult;
struct DimerRelaxationCycleCertificate;
struct DimerSaddleMeritBacktrackResult;
struct DimerSurrogateActionCertificate;
// classes
class AtomicDimer;
class OracleBudgetExhausted;
// global variables
gpr::Index_t kMaxStalledDegenerateProbes = 30;
int kMaxConsecutiveOracleFailures = 8;
// global functions
bool shouldLogDimerFinalState(const gpr::Index_t debug_level);
void writeDimerCampaignSummary(std::ostream& os, double energy, bool converged, double energy_zero = 0.0);
Eigen::Index selectHssvdModeIndex(const Eigen::VectorXd& eigenvalues, const Eigen::MatrixXd& eigenvectors, const Eigen::VectorXd& reference, HssvdModeSelectionPolicy policy);
const gpr::Coord& selectHssvdModeReference(const gpr::Coord& initial_reference, const gpr::Coord& current_orientation, HssvdModeSelectionPolicy policy, bool preserve_initial_reference);
DimerOracleProgressAction selectDimerOracleProgressAction(bool path_leashed_recovery, bool oracle_certified, double best_oracle_force, double trial_oracle_force);
bool is_subsystem(const gpr::AtomsConfiguration& atoms_config);
bool dimerPhaseBudgetAllows(gpr::Index_t phase, gpr::Index_t limit);
bool dimerSearchStalled(gpr::Index_t consecutive_degenerate_probes);
bool dimerGeometriesCoincide(const gpr::Coord& a, const gpr::Coord& b);
bool refusalRepeatsIndexZeroExpansion(const gpr::Coord& midpoint, const gpr::Coord& expansion_midpoint, double curvature, double curvature_resolution, double separation);
DimerRelaxationCycleCertificate certifyDimerRelaxationCycle(const gpr::Coord& current, const gpr::Coord& proposed, const gpr::Coord* preceding, double force_current, double force_preceding);
bool repeatedProjectedTrustStep(const gpr::Coord& step, double curvature, const gpr::Coord& previous_step, double previous_curvature);
bool shouldTerminateDimerRelaxationForLostProgress(double curvature, double current_residual, double proposed_residual);
bool shouldBacktrackDimerRelaxationForResidualDecrease(double curvature, double current_residual);
double dimerPosteriorActionForceScale(double current_residual, double force_tolerance);
bool posteriorForceResolved(double proposed_force_variance, double action_scale);
bool measuredRadiusClipRequestsOracle(bool clipped, double proposed_force_variance, double action_scale);
DimerResidualGlobalizationAction resolvedPointKeepsTheSurrogateWalk(DimerResidualGlobalizationAction action, double proposed_force_variance, double action_scale);
double posteriorResolvedStep(double force_sigma, double curvature);
double rejectedTrialRadius(double shrunk, double displacement, double force_sigma, double curvature, double prediction_error, double force_increase = std::numeric_limits<double>::quiet_NaN(), bool transverse_residual_exceeds_step = false);
double modelAgreementTrustDistance(double configured, double length_scale, double force_error, double force_scale, double energy_error, double energy_scale);
bool dimerOracleTrialNeedsRefit(double reference_force, double trial_force, double measured_change, double prediction_error, double force_tolerance);
DimerProposalGlobalizationAction selectDimerProposalGlobalizationAction(double curvature, double current_residual, double force_tolerance, double proposed_force_variance, double posterior_action_force_scale);
DimerProposalGlobalizationAction selectDimerProposalGlobalizationAction(double curvature, double current_residual, double force_tolerance, double proposed_force_variance);
DimerResidualGlobalizationAction selectDimerResidualGlobalizationAction(double curvature, double current_residual, bool backtrack_accepted);
DimerResidualGlobalizationAction selectDimerPosteriorResidualGlobalizationAction(DimerProposalGlobalizationAction proposal_action, double curvature, double current_residual, bool backtrack_accepted);
DimerRelaxationBacktrackResult backtrackDimerRelaxationForResidualDecrease(const gpr::Coord& current, const gpr::Coord& proposed, double current_residual, const std::function<double(const gpr::Coord&)>& evaluate_residual);
DimerSaddleMeritBacktrackResult backtrackDimerSaddleMerit(const gpr::Coord& current, const gpr::Coord& proposed, const gpr::Coord& gradient, const gpr::Coord& orientation, double curvature, const std::function<double(const gpr::Coord&)>& energy_change);
int convergenceExitCode(const AtomicDimer& dimer);
} // namespace atmd
Detailed Documentation¶
The atomic dimer search (class AtomicDimer) and its status types.
Global Variables¶
gpr::Index_t kMaxStalledDegenerateProbes = 30
A search that is not a burst stops once this many consecutive probes added no distinct observation: the structural image-1 recovery has had many chances, and the outer loop would otherwise repeat the same rejected observation until the caller kills it.
int kMaxConsecutiveOracleFailures = 8
Consecutive trial geometries at which the oracle may fail (raise, or return a non-finite energy or force) before the dimer search stops with an error. Each failure is a rejected trial: no training row, a shorter next step.
Global Functions¶
void writeDimerCampaignSummary(std::ostream& os, double energy, bool converged, double energy_zero = 0.0)
One-line paper-campaign fields. Independent of debug_level so run_one.sh can parse saddle energy and convergence on every cell.
Eigen::Index selectHssvdModeIndex(const Eigen::VectorXd& eigenvalues, const Eigen::MatrixXd& eigenvectors, const Eigen::VectorXd& reference, HssvdModeSelectionPolicy policy)
Select an HS-SVD eigenmode. Reference-connected selection follows the negative-curvature mode with greatest overlap to the supplied mode; when no negative mode exists it returns the lowest-curvature mode.
const gpr::Coord& selectHssvdModeReference(const gpr::Coord& initial_reference, const gpr::Coord& current_orientation, HssvdModeSelectionPolicy policy, bool preserve_initial_reference)
Reference-connected OCI mode tracking uses the immutable path axis at each rotation phase. Other dimer policies continue from the current orientation.
DimerOracleProgressAction selectDimerOracleProgressAction(bool path_leashed_recovery, bool oracle_certified, double best_oracle_force, double trial_oracle_force)
A path-leashed recovery burst accepts only strict progress measured on the true PES. Standalone searches and surrogate-filled phases keep exploring.
bool dimerPhaseBudgetAllows(gpr::Index_t phase, gpr::Index_t limit)
Nonpositive phase limits leave termination to the dimer’s convergence, cycle, curvature, trust, and alignment certificates. Positive limits are explicit caller budgets.
bool dimerGeometriesCoincide(const gpr::Coord& a, const gpr::Coord& b)
Numerical geometry identity for cycle detection and measured-force rescue.
bool refusalRepeatsIndexZeroExpansion(const gpr::Coord& midpoint, const gpr::Coord& expansion_midpoint, double curvature, double curvature_resolution, double separation)
A final-stencil refusal repeats a complete index-zero expansion when it lies within one dimer separation of that expansion’s midpoint and its own measured curvature is not resolvably negative: the forward differences of both carry that much truncation, so a new expansion measures the same Hessian.
DimerRelaxationCycleCertificate certifyDimerRelaxationCycle(const gpr::Coord& current, const gpr::Coord& proposed, const gpr::Coord* preceding, double force_current, double force_preceding)
Terminal certificate for a condition-driven dimer relaxation step. ~proposed~ is the map image of ~current~. ~preceding~ is the geometry accepted on the previous inner step (null/empty on the first step). ~force_*~ are surrogate force scales (max abs component) used only to choose the lower-force member of a period-two cycle; ties keep current.
bool repeatedProjectedTrustStep(const gpr::Coord& step, double curvature, const gpr::Coord& previous_step, double previous_curvature)
The surrogate trust-region step repeated. Its displacement and curvature agree to the HS-SVD singular-value cutoff (sqrt(eps)), so another inner iteration applies the same proposal. The geometry need not yet coincide: a limited step can translate for several iterations before a coordinate cycle closes, and each of those iterations rebuilds the same posterior.
bool shouldTerminateDimerRelaxationForLostProgress(double curvature, double current_residual, double proposed_residual)
A trusted negative-curvature MMF proposal must reduce the translated-force residual. Non-finite residuals terminate in every curvature regime. The strict comparison supplies condition-driven terminality without an iteration count or a fitted progress tolerance.
bool shouldBacktrackDimerRelaxationForResidualDecrease(double curvature, double current_residual)
A trusted negative-curvature MMF step follows a translated-force root. Backtracking keeps each surrogate proposal on a strict residual descent path; coordinate resolution bounds the search when no descent point exists.
double dimerPosteriorActionForceScale(double current_residual, double force_tolerance)
Resolve a surrogate action against the larger of its live force signal and the final convergence scale. This is the denominator of the dimensionless posterior action ratio tr(Sigma_F) / max(||F||^2, tau^2).
bool posteriorForceResolved(double proposed_force_variance, double action_scale)
The posterior force is resolved when its variance is below the squared action scale. A non-finite variance is not resolved.
bool measuredRadiusClipRequestsOracle(bool clipped, double proposed_force_variance, double action_scale)
A clip onto the measured-trial radius is an oracle only while the clipped point is still unresolved. A resolved clip is already inside the model, so the surrogate keeps the bounded step.
DimerResidualGlobalizationAction resolvedPointKeepsTheSurrogateWalk(DimerResidualGlobalizationAction action, double proposed_force_variance, double action_scale)
A lost-progress rule measures the trial so the next fit can move. When the posterior force is already resolved, that measurement repeats a force the model has, and the surrogate walk continues instead.
double posteriorResolvedStep(double force_sigma, double curvature)
Displacement on which the curvature changes the force by one posterior standard deviation. A shorter step is inside the noise of the model.
double rejectedTrialRadius(double shrunk, double displacement, double force_sigma, double curvature, double prediction_error, double force_increase = std::numeric_limits<double>::quiet_NaN(), bool transverse_residual_exceeds_step = false)
Radius after a rejected trial.
The rho = 0 shrink is undone toward the posterior resolution when that resolution lies inside the failed step, by the fraction of the posterior the force-change error used (force_sigma / prediction_error, at most one). When the resolution lies beyond the step, the failed displacement is still inside one posterior standard deviation of curvature, so the shrink is undone all the way when three posterior facts hold together: the measured force increase is at most one standard deviation, the curvature’s own force change over the step covers that increase (|curvature| * displacement >= force_increase), and the step did not leave a larger residual on a transverse mode than on the modes it moved. A transverse residual the radius did not bound is not a reason to put the radius back, and a worsening the curvature does not cover is not either.
bool dimerOracleTrialNeedsRefit(double reference_force, double trial_force, double measured_change, double prediction_error, double force_tolerance)
A worsening measured trial needs another fit when its force prediction error exceeds the accepted center’s force scale or convergence floor. The trial cannot enlarge its own error budget by reversing the force. Accurate uphill steps remain admissible during escape from a minimum.
DimerProposalGlobalizationAction selectDimerProposalGlobalizationAction(double curvature, double current_residual, double force_tolerance, double proposed_force_variance, double posterior_action_force_scale)
Use posterior force resolution as the global trust certificate and reserve monotone residual line search for the local minimum-mode root basin.
DimerResidualGlobalizationAction selectDimerResidualGlobalizationAction(double curvature, double current_residual, bool backtrack_accepted)
Select how a trust-bounded dimer translation proceeds after residual globalization. A stalled negative-curvature trial is measured rather than rejected at the source geometry or followed by further surrogate steps.
DimerResidualGlobalizationAction selectDimerPosteriorResidualGlobalizationAction(DimerProposalGlobalizationAction proposal_action, double curvature, double current_residual, bool backtrack_accepted)
Posterior resolution certifies global surrogate motion. Once the translated force enters its local convergence basin, residual globalization supplies the stronger root-finding certificate. An unresolved proposal is measured.
DimerRelaxationBacktrackResult backtrackDimerRelaxationForResidualDecrease(const gpr::Coord& current, const gpr::Coord& proposed, double current_residual, const std::function<double(const gpr::Coord&)>& evaluate_residual)
Search the trusted proposal segment for strict residual descent. Midpoint contraction ends when a decreasing point is found or the candidate coincides with the source geometry at coordinate resolution.
DimerSaddleMeritBacktrackResult backtrackDimerSaddleMerit(const gpr::Coord& current, const gpr::Coord& proposed, const gpr::Coord& gradient, const gpr::Coord& orientation, double curvature, const std::function<double(const gpr::Coord&)>& energy_change)
Local saddle merit of Gould, Ortner and Packwood (2016): F(x+s)-F(x) = E(x+s)-E(x)-2(g.v)(s.v)-lambda(s.v)^2. Its gradient at x is the reflected dimer gradient. Armijo contraction permits transverse descent without requiring the force norm to decrease.