.. index:: pair: namespace; gpr::optim .. _doxid-namespacegpr_1_1optim: namespace gpr::optim ==================== .. toctree:: :hidden: enum_gpr_optim_RefinedCurvatureSign.rst enum_gpr_optim_RigidMotionMetric.rst enum_gpr_optim_SaddleSearchFamily.rst enum_gpr_optim_SecantAccounting.rst enum_gpr_optim_SecantHessianMethod.rst enum_gpr_optim_SecantSeedStatus.rst enum_gpr_optim_SecantSeedSupport.rst enum_gpr_optim_StencilAction.rst enum_gpr_optim_VibrationalStencil.rst struct_gpr_optim_CompletedSecondMode.rst struct_gpr_optim_EndpointConnectivityReport.rst struct_gpr_optim_EndpointSpectrum.rst struct_gpr_optim_ForceStopCertificateResult.rst struct_gpr_optim_ForceStopMeasurement.rst struct_gpr_optim_ForceStopStencilPlan.rst struct_gpr_optim_ForceStopStencilQuery.rst struct_gpr_optim_FragmentRotations.rst struct_gpr_optim_IrcCertificateRecord.rst struct_gpr_optim_KnownOracleRow.rst struct_gpr_optim_MeasuredCurvatureSpectrum.rst struct_gpr_optim_MeasuredDirectionalCubic.rst struct_gpr_optim_MeasuredHessianColumn.rst struct_gpr_optim_MeasuredIndexDecision.rst struct_gpr_optim_MinimizationConfig.rst struct_gpr_optim_MinimizationLayoutStamp.rst struct_gpr_optim_MinimizationResult.rst struct_gpr_optim_MinimumSpectrumCache.rst struct_gpr_optim_NegativePairRejection.rst struct_gpr_optim_NegativeRitzPairRefinement.rst struct_gpr_optim_PairRitzProbe.rst struct_gpr_optim_RefinedCurvatureActions.rst struct_gpr_optim_RefinedWeakModes.rst struct_gpr_optim_RelaxedEndpointCache.rst struct_gpr_optim_RestrictedPartitionedRfoStep.rst struct_gpr_optim_SecantConsistency.rst struct_gpr_optim_SecantCurvatureCounts.rst struct_gpr_optim_SecantForceSample.rst struct_gpr_optim_SecantHessianConfig.rst struct_gpr_optim_SecantNewtonFactor.rst struct_gpr_optim_SecantSeed.rst struct_gpr_optim_SmoothedCurvatureSpectrum.rst struct_gpr_optim_SoftModeRefusal.rst struct_gpr_optim_SpectralTrustRegionStep.rst struct_gpr_optim_StationaryCurvaturePosterior.rst struct_gpr_optim_StencilIndex.rst struct_gpr_optim_StencilIndexCertificate.rst struct_gpr_optim_SubspaceRitzProbe.rst struct_gpr_optim_WeakModeContinuation.rst class_gpr_optim_RgminStep.rst class_gpr_optim_SecantHessian.rst class_gpr_optim_SketchedHessianH0.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block namespace optim { // typedefs typedef std::function(const Eigen::VectorXd&positions)> :ref:`OracleFn`; // enums enum :ref:`RefinedCurvatureSign`; enum :ref:`RigidMotionMetric`; enum :ref:`SaddleSearchFamily`; enum :ref:`SecantAccounting`; enum :ref:`SecantHessianMethod`; enum :ref:`SecantSeedStatus`; enum :ref:`SecantSeedSupport`; enum :ref:`StencilAction`; enum :ref:`VibrationalStencil`; // structs struct :ref:`CompletedSecondMode`; struct :ref:`EndpointConnectivityReport`; struct :ref:`EndpointSpectrum`; struct :ref:`ForceStopCertificateResult`; struct :ref:`ForceStopMeasurement`; struct :ref:`ForceStopStencilPlan`; struct :ref:`ForceStopStencilQuery`; struct :ref:`FragmentRotations`; struct :ref:`IrcCertificateRecord`; struct :ref:`KnownOracleRow`; struct :ref:`MeasuredCurvatureSpectrum`; struct :ref:`MeasuredDirectionalCubic`; struct :ref:`MeasuredHessianColumn`; struct :ref:`MeasuredIndexDecision`; struct :ref:`MinimizationConfig`; struct :ref:`MinimizationLayoutStamp`; struct :ref:`MinimizationResult`; struct :ref:`MinimumSpectrumCache`; struct :ref:`NegativePairRejection`; struct :ref:`NegativeRitzPairRefinement`; struct :ref:`PairRitzProbe`; struct :ref:`RefinedCurvatureActions`; struct :ref:`RefinedWeakModes`; struct :ref:`RelaxedEndpointCache`; struct :ref:`RestrictedPartitionedRfoStep`; struct :ref:`SecantConsistency`; struct :ref:`SecantCurvatureCounts`; struct :ref:`SecantForceSample`; struct :ref:`SecantHessianConfig`; struct :ref:`SecantNewtonFactor`; struct :ref:`SecantSeed`; struct :ref:`SmoothedCurvatureSpectrum`; struct :ref:`SoftModeRefusal`; struct :ref:`SpectralTrustRegionStep`; struct :ref:`StationaryCurvaturePosterior`; struct :ref:`StencilIndex`; struct :ref:`StencilIndexCertificate`; struct :ref:`SubspaceRitzProbe`; struct :ref:`WeakModeContinuation`; // classes class :ref:`RgminStep`; class :ref:`SecantHessian`; class :ref:`SketchedHessianH0`; // global variables std::uint32_t :ref:`kMinimizationLayoutVersion` = 2; // global functions Eigen::RowVectorXd :ref:`consistentGradientPrediction`(const Eigen::Ref& measured_reference, const Eigen::Ref& predicted_reference, const Eigen::Ref& predicted_trial); double :ref:`gradientChangeAgreement`(const Eigen::Ref& measured_change, const Eigen::Ref& predicted_change); Eigen::RowVectorXd :ref:`gradientChangeVariance`(const Eigen::MatrixXd& covariance, Eigen::Index dimension, double likelihood_variance); bool :ref:`measuredForceChangeCalibrated`(double error, double variance, double force_scale); double :ref:`measuredTrialTrustAgreement`(double rho, bool calibrated, double displacement, double radius, double rho_grow); template bool :ref:`coordinatesCoincideAtRoundoff`(const Eigen::MatrixBase& left, const Eigen::MatrixBase& right); const char* :target:`endpointConnectivityLabel`(const :ref:`EndpointConnectivityReport`& report); double :ref:`atomicMassAmu`(int atomic_number); double :ref:`corderoRadius`(int atomic_number); std::string :ref:`bondGraph`(const Eigen::VectorXd& positions, const std::vector& atomic_numbers); Eigen::VectorXd :target:`massesFromAtomicNumbers`(const std::vector& numbers); double :ref:`labelledRmsd`(const Eigen::VectorXd& reference, const Eigen::VectorXd& mobile, const std::vector& atomic_numbers); double :ref:`permutationAwareRmsd`(const Eigen::VectorXd& reference, const Eigen::VectorXd& mobile_in, const std::vector& atomic_numbers); void :target:`appendIrcProfile`(std::ostream& line, const :ref:`EndpointConnectivityReport`& report); std::string :target:`formatEndpointConnectivity`(const :ref:`EndpointConnectivityReport`& report); Eigen::MatrixXd :ref:`ircStencilDirections`(const Eigen::VectorXd& center, const Eigen::VectorXd& masses, const Eigen::MatrixXd* held_directions, :ref:`VibrationalStencil` mode = :ref:`VibrationalStencil::Full`); bool :ref:`cartesianHessianColumns`(Eigen::MatrixXd& columns, double& resolution, const Eigen::VectorXd& center, double step, const Eigen::MatrixXd& directions, const std::function& gradient_at, Eigen::MatrixXd* raw_columns = nullptr); Eigen::MatrixXd :target:`cartesianRigidMotions`(const Eigen::VectorXd& positions); Eigen::VectorXd :ref:`projectOutRigidMotions`(const Eigen::VectorXd& positions, Eigen::VectorXd displacement); :ref:`EndpointSpectrum` :target:`spectrumOfColumns`(const Eigen::MatrixXd& hessian, double resolution, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double stiff_floor); :ref:`EndpointSpectrum` :ref:`spectrumAt`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const std::function& gradient_at, double stiff_floor = std::numeric_limits::infinity(), Eigen::MatrixXd* raw_columns = nullptr, const Eigen::MatrixXd* held_directions = nullptr); template :ref:`EndpointSpectrum` :ref:`probeVibrationalMinimum`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const GradientAt& gradient_at, double stiff_floor = std::numeric_limits::infinity()); template :ref:`EndpointSpectrum` :ref:`spectrumForMinimumCheck`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const GradientAt& gradient_at, :ref:`MinimumSpectrumCache`* cache = nullptr, double stiff_floor = std::numeric_limits::infinity()); :ref:`EndpointSpectrum` :ref:`spectrumOfModelHessian`(const Eigen::MatrixXd& raw, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double stiff_floor); double :ref:`endpointMatchBall`(double tolerance, double lambda_min, double half_separation); bool :ref:`labelledEndpointsResolve`(double separation, double harmonic_reactant, double harmonic_product); bool :target:`insideEndpointBall`(double to_this, double to_other, double ball); template :ref:`EndpointConnectivityReport` :ref:`reportEndpointConnectivity`(const Eigen::VectorXd& saddle, const Eigen::VectorXd& masses, double force_tolerance, const Eigen::VectorXd& reactant, const Eigen::VectorXd& product, const std::vector& atomic_numbers, Oracle oracle, :ref:`RelaxedEndpointCache`* cache = nullptr, double hessian_step = :ref:`defaultStencilStep`(), const std::function* stop = nullptr, const std::vector<:ref:`KnownOracleRow`>* known = nullptr, const Eigen::MatrixXd* model_hessian = nullptr, const Eigen::MatrixXd* held_directions = nullptr, :ref:`VibrationalStencil` stencil = :ref:`VibrationalStencil::Full`); bool :ref:`writeIrcCertificate`(const std::string& path, const :ref:`EndpointConnectivityReport`& report, const std::vector& atomic_numbers); bool :target:`readIrcCertificate`(const std::string& path, :ref:`IrcCertificateRecord`& record); :ref:`FragmentRotations` :target:`fragmentRotationDirections`(const Eigen::VectorXd& positions, const std::vector>& bonds); :ref:`MinimizationLayoutStamp` :ref:`libraryMinimizationLayout`(); :ref:`MinimizationResult` :ref:`gp_minimize`(:ref:`OracleFn` oracle, const Eigen::VectorXd& x_init, const :ref:`AtomsConfiguration`& atoms_config, const :ref:`MinimizationConfig`& config, const :ref:`policy::TrainingPolicy`* policy, const :ref:`Observation`* seed = nullptr, const :ref:`io::TrainedGpState`* gp_state = nullptr); :ref:`MinimizationResult` :ref:`gp_minimize`(:ref:`OracleFn` oracle, const Eigen::VectorXd& x_init, const :ref:`AtomsConfiguration`& atoms_config, const :ref:`MinimizationConfig`& config = {}); :ref:`MinimizationLayoutStamp` :target:`compiledMinimizationLayout`(); std::string :target:`minimizationLayoutMismatch`(const :ref:`MinimizationLayoutStamp`& driver, const :ref:`MinimizationLayoutStamp`& library); void :target:`requireMinimizationLayout`(); void :ref:`excludeNonPositiveCurvatureBlock`(Eigen::VectorXd& s, Eigen::VectorXd& y, Eigen::Index offset, Eigen::Index length); double :ref:`barzilaiBorweinInverseScale`(const Eigen::VectorXd& s, const Eigen::VectorXd& y, double fallback); Eigen::VectorXd :ref:`twoLoopRecursion`(const std::deque& s_hist, const std::deque& y_hist, const std::deque& rho_hist, const Eigen::VectorXd& force, double H0); Eigen::VectorXd :ref:`twoLoopRecursion`(const std::deque& s_hist, const std::deque& y_hist, const std::deque& rho_hist, const Eigen::VectorXd& force, const std::function& apply_H0); :ref:`MeasuredDirectionalCubic` :ref:`refinedDirectionalCubic`(const :ref:`RefinedCurvatureActions`& stencil, const Eigen::VectorXd& center_gradient, const Eigen::VectorXd& mode, double step); double :ref:`massWeightedMeasuredCurvatureResolution`(const :ref:`gpr::Coord`& positions, const :ref:`gpr::AtomsConfiguration`& configuration, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& actions); double :ref:`refinedIndexOnePositiveLowerBound`(const :ref:`MeasuredCurvatureSpectrum`& complete, Eigen::Index dimension, const :ref:`RefinedCurvatureActions`& refined); :ref:`MeasuredCurvatureSpectrum` :ref:`analyzeMeasuredCurvature`(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action); Eigen::MatrixXd :ref:`measuredIndexZeroHessian`(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& physical, const Eigen::MatrixXd& action); Eigen::VectorXd :ref:`measuredModeExpansion`(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& physical, const Eigen::VectorXd& action); double :ref:`measuredCurvaturePriorScale`(const Eigen::MatrixXd& prior, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action); Eigen::MatrixXd :ref:`completeMeasuredHessian`(const Eigen::MatrixXd& prior, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action); double :ref:`curvatureAtWavenumber`(double wavenumber, const Eigen::VectorXd& direction, const Eigen::VectorXd& atomic_masses); :ref:`CompletedSecondMode` :ref:`completedSecondMode`(const Eigen::MatrixXd& completed, const Eigen::MatrixXd& basis, Eigen::Index k = 1); :ref:`CompletedSecondMode` :ref:`completedAdditionalNegativeMode`(const Eigen::MatrixXd& completed, const Eigen::MatrixXd& basis, const Eigen::VectorXd& negative_mode); Eigen::VectorXd :ref:`nextMeasuredCurvatureDirection`(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action, const :ref:`MeasuredCurvatureSpectrum`& spectrum, const Eigen::MatrixXd& physical, const Eigen::MatrixXd& preferred, const Eigen::MatrixXd& prior = Eigen::MatrixXd{}); Eigen::MatrixXd :ref:`nextMeasuredCurvatureDirections`(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action, const :ref:`MeasuredCurvatureSpectrum`& spectrum, const Eigen::MatrixXd& physical, const Eigen::MatrixXd& preferred, Eigen::Index count, const Eigen::MatrixXd& prior = Eigen::MatrixXd{}); :ref:`MeasuredCurvatureSpectrum` :ref:`analyzeRefinedMeasuredCurvature`(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& at_h, const Eigen::MatrixXd& at_2h); template :ref:`MeasuredCurvatureSpectrum` :ref:`refineMeasuredCurvature`(const Eigen::VectorXd& center, const Eigen::MatrixXd& basis, double step, Evaluate&& evaluate, :ref:`RefinedCurvatureActions`* actions = nullptr); template double :ref:`refinePositiveCurvatureComplement`(const :ref:`MeasuredCurvatureSpectrum`& complete, Eigen::Index dimension, const Eigen::VectorXd& center, double step, Evaluate&& evaluate); Eigen::VectorXd :ref:`movingAtomicMasses`(const :ref:`gpr::AtomsConfiguration`& config, Eigen::Index n_moving); Eigen::MatrixXd :ref:`physicalCurvatureBasis`(const :ref:`gpr::Coord`& positions, const :ref:`gpr::AtomsConfiguration`& config, bool exclude_rotations = true, :ref:`RigidMotionMetric` metric = :ref:`RigidMotionMetric::MassWeighted`); Eigen::MatrixXd :ref:`vibrationalStencilDirections`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, bool periodic, bool anchored, const Eigen::VectorXi* frozen = nullptr); Eigen::MatrixXd :ref:`stencilDirectionsForMode`(:ref:`VibrationalStencil` mode, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, bool periodic, bool anchored, const Eigen::VectorXi* frozen = nullptr); bool :ref:`directionsAreCoordinateAxes`(const Eigen::MatrixXd& directions); Eigen::MatrixXd :ref:`centralDifferencePoints`(const Eigen::VectorXd& center, double step, const Eigen::MatrixXd& directions); Eigen::MatrixXd :ref:`massWeightedPhysicalCurvatureBasis`(const :ref:`gpr::Coord`& positions, const :ref:`gpr::AtomsConfiguration`& config, bool exclude_rotations = true); Eigen::MatrixXd :ref:`transportPhysicalDirections`(const Eigen::MatrixXd& directions, const Eigen::MatrixXd& physical); Eigen::MatrixXd :ref:`transportMeasuredHessianActions`(const :ref:`gpr::Coord`& positions, const :ref:`gpr::Coord`& gradient, const Eigen::MatrixXd& measured_basis, const Eigen::MatrixXd& measured_action, const Eigen::MatrixXd& physical, bool include_rotations = true); Eigen::MatrixXd :ref:`hessianColumnsFromDirections`(const Eigen::VectorXd& center, const Eigen::VectorXd& center_gradient, const Eigen::MatrixXd& directions, const Eigen::MatrixXd& actions); :ref:`RestrictedPartitionedRfoStep` :ref:`restrictedPartitionedRfoStep`(const Eigen::VectorXd& curvatures, const Eigen::VectorXd& gradient, const Eigen::MatrixXd& cartesian_modes, double radius); Eigen::VectorXd :ref:`richardsonExtrapolate`(const Eigen::VectorXd& at_h, const Eigen::VectorXd& at_2h); Eigen::VectorXd :target:`richardsonTruncation`(const Eigen::VectorXd& at_h, const Eigen::VectorXd& at_2h); double :target:`refinedCurvatureResolution`(double refined_resolution, double anharmonic_scale); :ref:`RefinedCurvatureSign` :target:`refinedCurvatureSign`(double curvature, double refined_resolution, double anharmonic_scale); bool :ref:`curvatureResolvedByStencil`(double measured, double anharmonic_scale); bool :ref:`curvatureResolvedByThirdDerivative`(double measured, double third, double step); double :ref:`richardsonForwardExtrapolate`(double at_h, double at_2h); double :target:`richardsonForwardTruncation`(double at_h, double at_2h); bool :ref:`curvatureResolvedBySurrogate`(double measured, double surrogate); int :ref:`certifiedCurvatureSign`(double extrapolated, double estimate); void :target:`writeSecantCurvatureCounts`(std::ostream& out, const :ref:`SecantCurvatureCounts`& counts); void :ref:`recordSecantObservation`(:ref:`SecantHessian`& secant, const Eigen::VectorXd& position, const Eigen::VectorXd& gradient, double energy, :ref:`SecantCurvatureCounts`& counts, :ref:`SecantAccounting` accounting = :ref:`SecantAccounting::Count`); const char* :target:`secantSeedStatusName`(:ref:`SecantSeedStatus` status); std::optional :ref:`secantResolvedNegativeMode`(const :ref:`SecantHessian`& secant); :ref:`SecantSeed` :target:`secantSeedDirection`(const :ref:`SecantHessian`& secant, const Eigen::VectorXd& current_direction); std::optional :ref:`secantPositiveInverseScale`(const :ref:`SecantHessian`& secant); :ref:`SecantNewtonFactor` :target:`secantNewtonFactor`(const :ref:`SecantHessian`& secant); :ref:`SecantSeedStatus` :ref:`seedHessianOnSecantRange`(Eigen::MatrixXd& model, const Eigen::MatrixXd& secant_hessian); :ref:`SecantSeedStatus` :ref:`seedHessianOnMeasuredStepRange`(Eigen::MatrixXd& model, const Eigen::MatrixXd& secant_hessian, const Eigen::MatrixXd& measured_steps); :ref:`SecantSeedStatus` :ref:`seedHessianFromSecant`(Eigen::MatrixXd& model, const :ref:`SecantHessian`& secant, const Eigen::MatrixXd& weight, :ref:`SecantSeedSupport` support = :ref:`SecantSeedSupport::WholeHessian`); template :ref:`SecantHessian` :ref:`secantFittedToResidual`(:ref:`SecantHessianMethod` method, const std::vector<:ref:`SecantForceSample`>& samples, Prior&& prior); int :ref:`bofillThroughLoadedRgsaddle`(std::int64_t n, double* hessian_row_major, const double* step, const double* gradient_change); std::string :ref:`bofillRgsaddleAbiRefusal`(); void :ref:`setBofillRgsaddleLibrary`(const char* path); :ref:`SmoothedCurvatureSpectrum` :ref:`smoothMeasuredCurvature`(const Eigen::MatrixXd& prior, const std::vector<:ref:`MeasuredHessianColumn`>& columns, const :ref:`SmoothedCurvatureSpectrum`* previous = nullptr, const :ref:`linalg::MpiContext`& context = :ref:`linalg::MpiContext::local`()); Eigen::VectorXd :ref:`nextSmoothedCurvatureDirection`(const :ref:`SmoothedCurvatureSpectrum`& spectrum, Eigen::Index k); double :ref:`measuredUpperBound`(const :ref:`SmoothedCurvatureSpectrum`& spectrum, const std::vector<:ref:`MeasuredHessianColumn`>& columns, Eigen::Index k); Eigen::VectorXd :ref:`softestUnmeasuredDirection`(const :ref:`SmoothedCurvatureSpectrum`& spectrum); Eigen::Index :ref:`coarseColumnToRefine`(const :ref:`SmoothedCurvatureSpectrum`& spectrum, const std::vector<:ref:`MeasuredHessianColumn`>& columns, Eigen::Index k); Eigen::VectorXd :ref:`spectralResidualStep`(const Eigen::VectorXd& eigenvalues, const Eigen::MatrixXd& modes, const Eigen::VectorXd& gradient, double radius); :ref:`SpectralTrustRegionStep` :ref:`spectralTrustRegionStep`(const Eigen::VectorXd& curvatures, const Eigen::MatrixXd& modes, Eigen::Index mode_index, const Eigen::VectorXd& force, double radius, const std::vector>& measured_negative); double :ref:`measuredCubicColumnContribution`(double overlap, double mode_quadratic, double axis_quadratic); double :ref:`axisStencilDirectionalCubic`(const Eigen::MatrixXd& axes, const Eigen::MatrixXd& second_differences, const Eigen::VectorXd& mode); :ref:`StationaryCurvaturePosterior` :target:`stationaryCurvaturePosterior`(double c, double c_spread, double f, double f_spread, double b, double b_spread, Eigen::Index samples = detail::kSpectrumSamples); Eigen::MatrixXd :ref:`massWeightedRigidMotions`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses); Eigen::MatrixXd :ref:`vibrationalComplement`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses); :ref:`StencilIndex` :ref:`analyzeStencilIndex`(const Eigen::MatrixXd& columns, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, const Eigen::MatrixXd* measured = nullptr); template :ref:`RefinedWeakModes` :ref:`refineWeakModes`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, const Eigen::MatrixXd& weak, double step, const Gradients& gradients, double noise_multiplier = 0.0); template :ref:`SoftModeRefusal` :target:`refuseSecondNegativeMode`(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, const Eigen::MatrixXd& mass_weighted_modes, double step, const Gradients& gradients, double noise_multiplier = 0.0); double :ref:`rotatedPositiveRestrictionLowerBound`(const Eigen::MatrixXd& block, const Eigen::MatrixXd& errors, const Eigen::MatrixXd& coupling, const Eigen::VectorXd& tail, double allowance); template :ref:`StencilIndexCertificate` :ref:`certifyStencilIndex`(const :ref:`StencilIndex`& index, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const Gradients& gradients, Eigen::Index minimum_weak = 0, double noise_multiplier = 0.0); template :ref:`MeasuredIndexDecision` :ref:`decideMeasuredIndex`(const Eigen::MatrixXd& columns, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const Gradients& gradients, const Eigen::MatrixXd* measured = nullptr); :ref:`WeakModeContinuation` :target:`boundedWeakModeContinuation`(const Eigen::VectorXd& direction, double third, double step, double lower, double resolution, double step_bound); :ref:`WeakModeContinuation` :target:`weakModeContinuation`(const :ref:`StencilIndexCertificate`& certificate, const Eigen::VectorXd& centre_gradient, double resolution, double step_bound); template :ref:`NegativePairRejection` :target:`rejectMeasuredNegativePair`(const Eigen::MatrixXd& previous_cartesian_hessian, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, const Eigen::VectorXd& centre_gradient, double step, double step_bound, const Gradients& gradients); :ref:`StencilAction` :target:`nextStencilAction`(bool higher_order, bool weak_higher_order, bool weak_uncertified, int& continuations, int maximum_continuations); double :ref:`defaultStencilStep`(); double :ref:`stencilStepOrDefault`(double requested); int :ref:`forceStopAdaptiveStepReductions`(); template :ref:`StencilIndexCertificate` :ref:`certifyAdaptiveStencilIndex`(const :ref:`StencilIndex`& index, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const Gradients& gradients, double noise_multiplier = 0.0); template :ref:`PairRitzProbe` :target:`probePairRitz`(const Eigen::VectorXd& center, const Eigen::VectorXd& masses, const Eigen::VectorXd& u, const Eigen::VectorXd& v, double step, const Gradients& gradients); template :ref:`SubspaceRitzProbe` :target:`probeSubspaceRitz`(const Eigen::VectorXd& center, const Eigen::VectorXd& masses, const Eigen::MatrixXd& candidates, double step, const Gradients& gradients); bool :ref:`forceStopMeasurementInconclusiveOrHigher`(const :ref:`ForceStopMeasurement`& measured); int :ref:`forceStopSoftRefinementLimit`(); int :ref:`forceStopRefinementCertified`(); int :ref:`forceStopRefinementStillHigher`(); bool :ref:`sameStencilGeometry`(const Eigen::VectorXd& first, const Eigen::VectorXd& second); int :ref:`forceStopMinModeEscapes`(); :ref:`ForceStopStencilPlan` :target:`planForceStopStencil`(:ref:`ForceStopStencilQuery` query); :ref:`ForceStopStencilPlan` :target:`planForceStopStencil`(:ref:`SaddleSearchFamily` family, bool requested); bool :ref:`forceStopCertificatePlanned`(const :ref:`ForceStopStencilPlan`& plan); Eigen::Index :ref:`forceStopHeldColumn`(const Eigen::MatrixXd& held, const Eigen::VectorXd& query, double relative = 1e-6); Eigen::MatrixXd :ref:`forceStopLowestModes`(const Eigen::MatrixXd& columns, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, Eigen::Index count, const Eigen::MatrixXd* measured = nullptr); bool :ref:`forceStopStencilCertifies`(bool measured, bool first_order); template :ref:`ForceStopCertificateResult` :ref:`runForceStopCertificate`(Measure measure, Refine refine, :ref:`ForceStopStencilPlan` plan, const :ref:`ForceStopMeasurement`* prior = nullptr); const char* :target:`vibrationalStencilName`(:ref:`VibrationalStencil` mode); bool :target:`parseVibrationalStencil`(std::string_view text, :ref:`VibrationalStencil`& out); :ref:`VibrationalStencil` :target:`vibrationalStencilFromInt`(int value); double :ref:`maxAtomDisplacement`(const Eigen::VectorXd& delta); } // namespace optim .. _details-namespacegpr_1_1optim: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Typedefs -------- .. index:: pair: typedef; OracleFn .. _doxid-namespacegpr_1_1optim_1a4da8cc38ee380b0f9978553e218434bc: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function(const Eigen::VectorXd&positions)> OracleFn Oracle function: positions -> (energy, gradient). Global Variables ---------------- .. index:: pair: variable; kMinimizationLayoutVersion .. _doxid-namespacegpr_1_1optim_1a9caa66d32a9a999d2d79fd8379c508c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::uint32_t kMinimizationLayoutVersion = 2 Layout of :ref:`MinimizationConfig ` and :ref:`MinimizationResult `. Bump when either struct's layout changes, including a reorder that keeps the size. 2: :ref:`MinimizationResult::prior_observations `. Global Functions ---------------- .. index:: pair: function; consistentGradientPrediction .. _doxid-namespacegpr_1_1optim_1adce6000463705204a6f5774503982268: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::RowVectorXd consistentGradientPrediction(const Eigen::Ref& measured_reference, const Eigen::Ref& predicted_reference, const Eigen::Ref& predicted_trial) Anchor a local force-merit model to its measured reference gradient. Both predictions must come from the same posterior. Their difference retains its curvature while cancelling a constant gradient bias. .. index:: pair: function; gradientChangeAgreement .. _doxid-namespacegpr_1_1optim_1ae618e5f84591da6b47680c43a9393259: .. ref-code-block:: cpp :class: doxyrest-title-code-block double gradientChangeAgreement(const Eigen::Ref& measured_change, const Eigen::Ref& predicted_change) Agreement of measured and predicted gradient changes, in [-1, 1]. Dimer steps can increase the force norm, so model validity is independent of a monotone force merit. Zero changes carry no radius information. .. index:: pair: function; gradientChangeVariance .. _doxid-namespacegpr_1_1optim_1ab75096b882a6667b28144adc2c039f68: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::RowVectorXd gradientChangeVariance(const Eigen::MatrixXd& covariance, Eigen::Index dimension, double likelihood_variance) Marginal variances of a noisy gradient difference at two query points. Joint channels contain two energies followed by two values per gradient coordinate. Correlated latent errors cancel through the cross covariance; independent likelihood errors contribute twice their physical variance. .. index:: pair: function; measuredForceChangeCalibrated .. _doxid-namespacegpr_1_1optim_1a138c9fe70c6ff021f1d67b03a23ef901: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool measuredForceChangeCalibrated(double error, double variance, double force_scale) Statistical agreement certifies a force-change model only when the error also resolves the physical force scale on which the step acts. Likelihood regularization cannot enlarge that scale as a root is approached. .. index:: pair: function; measuredTrialTrustAgreement .. _doxid-namespacegpr_1_1optim_1a67b2fb8ed2144362c019d45ca1381c40: .. ref-code-block:: cpp :class: doxyrest-title-code-block double measuredTrialTrustAgreement(double rho, bool calibrated, double displacement, double radius, double rho_grow) Radius agreement for a measured gradient-change model. A discrepancy resolved beyond its predictive spread uses rho. An unresolved discrepancy does not justify contraction; a trial at the boundary enlarges the domain in which the search can resolve a change. Final force acceptance is separate. .. index:: pair: function; coordinatesCoincideAtRoundoff .. _doxid-namespacegpr_1_1optim_1af94efbb5c6c352f68808852421d75806: .. ref-code-block:: cpp :class: doxyrest-title-code-block template bool coordinatesCoincideAtRoundoff(const Eigen::MatrixBase& left, const Eigen::MatrixBase& right) Numerical stagnation in stored Cartesian coordinates. Each component has a binary64 roundoff allowance; acquisition distances and force tolerances do not define geometry identity. .. index:: pair: function; atomicMassAmu .. _doxid-namespacegpr_1_1optim_1af549d585235be5952795c047819fec1a: .. ref-code-block:: cpp :class: doxyrest-title-code-block double atomicMassAmu(int atomic_number) Standard atomic weight (amu) for the elements in the Baker and Birkholz sets. An unlisted element keeps unit mass; the caller can pass masses it already trusts instead. .. index:: pair: function; corderoRadius .. _doxid-namespacegpr_1_1optim_1a5eb683714a6a8496c7202e2c39bcca57: .. ref-code-block:: cpp :class: doxyrest-title-code-block double corderoRadius(int atomic_number) Cordero et al., Dalton Trans. 2008, angstrom. An unlisted element contributes no edges. .. index:: pair: function; bondGraph .. _doxid-namespacegpr_1_1optim_1aede5379d3517b4320ca9683020fdf3e4: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string bondGraph(const Eigen::VectorXd& positions, const std::vector& atomic_numbers) Bonds as sorted index pairs. The cutoff is 1.2 times the sum of the Cordero radii. Atom order is the file order, which the walk keeps. .. index:: pair: function; labelledRmsd .. _doxid-namespacegpr_1_1optim_1a02a11e401d39472fdb6786a405fbbdee: .. ref-code-block:: cpp :class: doxyrest-title-code-block double labelledRmsd(const Eigen::VectorXd& reference, const Eigen::VectorXd& mobile, const std::vector& atomic_numbers) Rigidly aligned RMSD in the file's atom order. Rigid motion is removed and atoms are not re-paired. The bond graph is indexed the same way, so a label swap that keeps the permutation-aware distance at zero stays a real separation here. .. index:: pair: function; permutationAwareRmsd .. _doxid-namespacegpr_1_1optim_1a0dbafef211980b114cdb7c319b5ee6df: .. ref-code-block:: cpp :class: doxyrest-title-code-block double permutationAwareRmsd(const Eigen::VectorXd& reference, const Eigen::VectorXd& mobile_in, const std::vector& atomic_numbers) RMSD after a rigid alignment and a re-pairing that only exchanges atoms of the same element. The length is the root mean square over atoms. One start pairs by sorted distances, which a rotation does not change; the other pairs in the lab frame. Both are repeated until the assignment stops improving, and the smaller RMSD is kept. The certificate distance does not use this: a degenerate rearrangement would then sit on top of itself. .. index:: pair: function; ircStencilDirections .. _doxid-namespacegpr_1_1optim_1a30298386e4f09659eb7590114dd0a790: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd ircStencilDirections(const Eigen::VectorXd& center, const Eigen::VectorXd& masses, const Eigen::MatrixXd* held_directions, :ref:`VibrationalStencil` mode = :ref:`VibrationalStencil::Full`) :ref:`Directions ` of the IRC's Hessian stencils at a free geometry: the held validation directions when they fit, so rows measured at the saddle are read again, and otherwise the requested stencil. Full is every coordinate. Vibrational is vibrationalStencilDirections. .. index:: pair: function; cartesianHessianColumns .. _doxid-namespacegpr_1_1optim_1a6fbc929189c624171e26e0eadf639586: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool cartesianHessianColumns(Eigen::MatrixXd& columns, double& resolution, const Eigen::VectorXd& center, double step, const Eigen::MatrixXd& directions, const std::function& gradient_at, Eigen::MatrixXd* raw_columns = nullptr) Central-difference Hessian along ``directions``, as Cartesian columns: ``columns.col(j)`` is d(gradient)/dx_j (hessianColumnsFromDirections, which reads the center gradient when rigid columns were removed). The resolution is the antisymmetric residual of the measured block: of the whole matrix for a complete stencil, of directions^T raw directions when the rigid columns were rebuilt rather than measured. .. index:: pair: function; projectOutRigidMotions .. _doxid-namespacegpr_1_1optim_1ad06903a68a9442229fb7c1cf2f7005de: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd projectOutRigidMotions(const Eigen::VectorXd& positions, Eigen::VectorXd displacement) Component of ``displacement`` orthogonal to rigid translation and rotation at ``positions``. The rank is the numerical rank of that basis. .. index:: pair: function; spectrumAt .. _doxid-namespacegpr_1_1optim_1a90eeab9d41458dbe283beea75515f27d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EndpointSpectrum` spectrumAt(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const std::function& gradient_at, double stiff_floor = std::numeric_limits::infinity(), Eigen::MatrixXd* raw_columns = nullptr, const Eigen::MatrixXd* held_directions = nullptr) The spectrum of one Hessian stencil along ``held_directions``, or along the default full Cartesian stencil at ``positions`` (ircStencilDirections). .. index:: pair: function; probeVibrationalMinimum .. _doxid-namespacegpr_1_1optim_1a293914617543d633f801d2f425fd0a39: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`EndpointSpectrum` probeVibrationalMinimum(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const GradientAt& gradient_at, double stiff_floor = std::numeric_limits::infinity()) Lanczos on the Cartesian vibrational complement, with true-oracle Hessian-vector products. Central differences along the orthonormal complement of rigid motion are the vibrational operator. A Ritz value is an upper bound on the lowest eigenvalue (Courant Fischer), so one below minus the measured asymmetry, with its full-space residual inside both that asymmetry and the gap to the next Ritz value, proves a negative mode. The same residual test cannot prove there is no negative mode: a direction outside an invariant subspace can carry either sign (scripts/derive_krylov_index_certificate.py). Positive definiteness is the spectrum at exhaustion of the complement. A Krylov subspace that stalls is extended by the least-represented complement direction. The probe reports nothing when that extension is impossible or a product cannot be measured; the caller then builds the complete stencil. .. index:: pair: function; spectrumForMinimumCheck .. _doxid-namespacegpr_1_1optim_1ab6707544c6c7f57faef61c9c3db7dc13: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`EndpointSpectrum` spectrumForMinimumCheck(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const GradientAt& gradient_at, :ref:`MinimumSpectrumCache`* cache = nullptr, double stiff_floor = std::numeric_limits::infinity()) Vibrational Lanczos when the probe produced a spectrum. The complete stencil (spectrumAt) is used only when the probe cannot be measured. A spectrum stored at these coordinates is returned as it stands. A curvature inside the measured asymmetry is not a second stencil: the sign test is the same comparison, ``lowest < -resolution``. .. index:: pair: function; spectrumOfModelHessian .. _doxid-namespacegpr_1_1optim_1a4a270c6deccbd607a2c581c5b23eb227: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`EndpointSpectrum` spectrumOfModelHessian(const Eigen::MatrixXd& raw, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double stiff_floor) A symmetric matrix from a model, judged with the same resolution as a measured stencil: the singular value of its antisymmetric part. .. index:: pair: function; endpointMatchBall .. _doxid-namespacegpr_1_1optim_1aac42b72c80a23bd0141aa11db4b5f229: .. ref-code-block:: cpp :class: doxyrest-title-code-block double endpointMatchBall(double tolerance, double lambda_min, double half_separation) Match ball around a relaxed minimum. A residual max-atom force ``tolerance`` moves a quadratic minimum by at most ``tolerance / λ_min`` in RMSD. The Cartesian gradient then has L2 norm at most ``tolerance * sqrt(N)``, the displacement has L2 norm at most that over λ_min, and dividing by ``sqrt(N)`` cancels the atom count. Rigid motions are absent from λ_min and from the Kabsch RMSD, so they do not belong in the ball. Each of the walk and the relaxed endpoint can sit one residual from the true minimum, so the RMSD between them is at most twice that. The ball is also not larger than half the RMSD between the two relaxed minima. .. index:: pair: function; labelledEndpointsResolve .. _doxid-namespacegpr_1_1optim_1a3fd75c2c8ba89ce19cac850e749760b4: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool labelledEndpointsResolve(double separation, double harmonic_reactant, double harmonic_product) The harmonic radius is the largest distance the force tolerance still counts as one minimum. The endpoints are two centres when the labelled separation exceeds both radii. A smaller separation is one minimum counted twice: the field is ball=na, and the radius used for a resolved pair is unchanged. .. index:: pair: function; reportEndpointConnectivity .. _doxid-namespacegpr_1_1optim_1a088a75e42a48b8f2560a5999370a79e3: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`EndpointConnectivityReport` reportEndpointConnectivity(const Eigen::VectorXd& saddle, const Eigen::VectorXd& masses, double force_tolerance, const Eigen::VectorXd& reactant, const Eigen::VectorXd& product, const std::vector& atomic_numbers, Oracle oracle, :ref:`RelaxedEndpointCache`* cache = nullptr, double hessian_step = :ref:`defaultStencilStep`(), const std::function* stop = nullptr, const std::vector<:ref:`KnownOracleRow`>* known = nullptr, const Eigen::MatrixXd* model_hessian = nullptr, const Eigen::MatrixXd* held_directions = nullptr, :ref:`VibrationalStencil` stencil = :ref:`VibrationalStencil::Full`) Relax the deposited endpoints once, walk downhill both ways from the saddle with the same L-BFGS and the same force tolerance, and decide whether those walks are the two relaxed minima. ``held_directions`` are the directions of a stencil the search measured at the saddle, whose rows ``known`` carries; the saddle Hessian is measured along them. .. index:: pair: function; writeIrcCertificate .. _doxid-namespacegpr_1_1optim_1a446f5667ab48c259542cbde37745a43d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool writeIrcCertificate(const std::string& path, const :ref:`EndpointConnectivityReport`& report, const std::vector& atomic_numbers) Exact record of the saddle, the mode, and both walk ends. Hex floating point round-trips, so a replay from the written saddle sees the same bits the walk used. .. index:: pair: function; libraryMinimizationLayout .. _doxid-namespacegpr_1_1optim_1a8b5be4de1ea57940499e89ccb95fdda5: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`MinimizationLayoutStamp` libraryMinimizationLayout() What libgpridge was built with. Defined in the library, not inline. .. index:: pair: function; gp_minimize .. _doxid-namespacegpr_1_1optim_1a400757a75da0977edee0672c3e35772b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`MinimizationResult` gp_minimize(:ref:`OracleFn` oracle, const Eigen::VectorXd& x_init, const :ref:`AtomsConfiguration`& atoms_config, const :ref:`MinimizationConfig`& config, const :ref:`policy::TrainingPolicy`* policy, const :ref:`Observation`* seed = nullptr, const :ref:`io::TrainedGpState`* gp_state = nullptr) GP-accelerated geometry minimization with a training policy. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - oracle - Energy and gradient evaluator. * - x_init - Starting Cartesian coordinates, flattened in atom order. * - atoms_config - Atomic configuration for the GP kernel. * - config - Surrogate and minimization settings. * - policy - Training policy. Null keeps the engine's decisions. * - seed - Observations already paid for. A row at x_init is reused and is not an oracle call. Null starts from the oracle. * - gp_state - Saved hyperparameters. Null keeps a cold first fit. .. index:: pair: function; gp_minimize .. _doxid-namespacegpr_1_1optim_1a5f267b3fbbc78ade0498f94de44b209b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`MinimizationResult` gp_minimize(:ref:`OracleFn` oracle, const Eigen::VectorXd& x_init, const :ref:`AtomsConfiguration`& atoms_config, const :ref:`MinimizationConfig`& config = {}) GP-accelerated geometry minimization. The four-argument overload is the original symbol. A defaulted fifth parameter would change that mangled name, so the policy is a separate overload and is not defaulted. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - oracle - Energy/gradient evaluation function * - x_init - Initial positions (flat 3\*N_atoms vector) * - atoms_config - Atomic configuration for GP kernel * - config - Minimization parameters .. rubric:: Returns: :ref:`MinimizationResult ` .. index:: pair: function; excludeNonPositiveCurvatureBlock .. _doxid-namespacegpr_1_1optim_1a7fe1ce2a371321247fb414d78f039b66: .. ref-code-block:: cpp :class: doxyrest-title-code-block void excludeNonPositiveCurvatureBlock(Eigen::VectorXd& s, Eigen::VectorXd& y, Eigen::Index offset, Eigen::Index length) Remove a block's nonpositive secant contribution. Positive curvature is retained, including the reflected unstable direction at an index-one saddle. Invalid blocks and nonfinite curvature leave the pair unchanged for the caller's full-pair validity check. .. index:: pair: function; barzilaiBorweinInverseScale .. _doxid-namespacegpr_1_1optim_1a6f9058aa794b9dece98790e4cc2d07c1: .. ref-code-block:: cpp :class: doxyrest-title-code-block double barzilaiBorweinInverseScale(const Eigen::VectorXd& s, const Eigen::VectorXd& y, double fallback) Scalar BB2 inverse-curvature seed for L-BFGS H0. Uses the Barzilai-Borwein two-point spectral scale gamma_k = (s_k^T y_k)/(y_k^T y_k) as the scalar inverse-Hessian seed for the two-loop recursion (doi:10.1093/imanum/8.1.141). Degenerate, non-finite, or non-positive curvature pairs return the caller's fallback. .. index:: pair: function; twoLoopRecursion .. _doxid-namespacegpr_1_1optim_1a88f28da11c3ef35a9e5d9abc3347572b: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd twoLoopRecursion(const std::deque& s_hist, const std::deque& y_hist, const std::deque& rho_hist, const Eigen::VectorXd& force, double H0) Nocedal two-loop recursion (the LBFGS kernel). Computes z = H^{-1} (-force) where H is the inverse-Hessian approximation reconstructed from m curvature pairs (s_k, y_k) and their reciprocal dot products rho_k = 1 / (y_k . s_k). The caller applies the step as x <- x - z (force-convention: z points downhill when force is the negative gradient). H0 is the initial-iter inverse-Hessian diagonal scaling. The scalar BB2 seed is gamma = s\_{m-1}^T y\_{m-1} / y\_{m-1}^T y\_{m-1}; on empty history (m == 0) the caller supplies the fallback scale. No internal mutation of the history; the caller owns appending, trimming, and resetting. gpr::neb::detail::GlobalLBFGSOptimizer calls into this kernel so the recursion is defined once. .. index:: pair: function; twoLoopRecursion .. _doxid-namespacegpr_1_1optim_1a1770be68af9459f64a9325296a6ecb1a: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd twoLoopRecursion(const std::deque& s_hist, const std::deque& y_hist, const std::deque& rho_hist, const Eigen::VectorXd& force, const std::function& apply_H0) Two-loop recursion with a caller-supplied H0 application. Identical to the scalar overload except H0 is consumed via ``apply_H0(q) -> H0 q``. Used by callers that supply a Nystrom-sketched (or otherwise structured) initial inverse Hessian: the scalar form is just ``apply_H0 = [&](v){ return H0_scalar * v; }``. The kernel does not touch the H0 functor's internals it is the caller's responsibility to keep the sketch consistent with the history vectors it pairs with (typically: rebuild the sketch once per outer iter at the same band position the latest (s, y) was collected from). .. index:: pair: function; refinedDirectionalCubic .. _doxid-namespacegpr_1_1optim_1a3a69966faeaf09883b495a8be315f312: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`MeasuredDirectionalCubic` refinedDirectionalCubic(const :ref:`RefinedCurvatureActions`& stencil, const Eigen::VectorXd& center_gradient, const Eigen::VectorXd& mode, double step) The complete cubic within a refined two-dimensional plane. Even gradient residuals at h and h/2 identify its four symmetric coefficients. Richardson extrapolation removes the leading fifth-energy-derivative term. The error is an empirical stencil estimate plus roundoff, not a global Taylor bound. .. index:: pair: function; massWeightedMeasuredCurvatureResolution .. _doxid-namespacegpr_1_1optim_1abe84f8f7e738dee7320f5646aff83b0c: .. ref-code-block:: cpp :class: doxyrest-title-code-block double massWeightedMeasuredCurvatureResolution(const :ref:`gpr::Coord`& positions, const :ref:`gpr::AtomsConfiguration`& configuration, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& actions) Empirical resolution in the mass-weighted physical coordinates of the refinement, in eV/(A^2 amu). The Cartesian measured map is B (B^T A) B^T with zero action outside the measured space. Its congruence on D Q is C^T (B^T A) C, where D = M^(-1/2), Q is the physical basis of the refinement and C = B^T D Q. Raw actions retain the measured asymmetry. .. index:: pair: function; refinedIndexOnePositiveLowerBound .. _doxid-namespacegpr_1_1optim_1aa6ba71ceb740eb1fec82964206c5cbda: .. ref-code-block:: cpp :class: doxyrest-title-code-block double refinedIndexOnePositiveLowerBound(const :ref:`MeasuredCurvatureSpectrum`& complete, Eigen::Index dimension, const :ref:`RefinedCurvatureActions`& refined) Lower bound on the positive codimension-one restriction, conditional on the complete stencil and refined weak directions' empirical error bounds. Nonpositive results do not certify the index. .. index:: pair: function; analyzeMeasuredCurvature .. _doxid-namespacegpr_1_1optim_1a8470262bcfc3a5d13ae6338f2b489639: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`MeasuredCurvatureSpectrum` analyzeMeasuredCurvature(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action) Symmetrize measured Hessian actions and retain their common empirical resolution. Asymmetry and roundoff do not bound symmetric truncation error. .. index:: pair: function; measuredIndexZeroHessian .. _doxid-namespacegpr_1_1optim_1a8a8c41f578b4f517403307a14d5a62ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd measuredIndexZeroHessian(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& physical, const Eigen::MatrixXd& action) Cartesian Hessian of a complete measured expansion that resolves no negative curvature. The basis must span the supplied physical space, so the excluded rigid directions carry zero curvature. Empty when the expansion is incomplete or invalid, or when its lowest curvature lies below minus its own resolution. .. index:: pair: function; measuredModeExpansion .. _doxid-namespacegpr_1_1optim_1a8f772311431960f1b7c141a32226ae2e: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd measuredModeExpansion(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& physical, const Eigen::VectorXd& action) Independent part of a measured lowest-mode action at a fixed midpoint. Two projection passes keep stiff directions out of the retained basis; a residual within projection roundoff supplies no new measured column. .. index:: pair: function; measuredCurvaturePriorScale .. _doxid-namespacegpr_1_1optim_1ac9448aba4ebdf2f0f6643411b84deb0e: .. ref-code-block:: cpp :class: doxyrest-title-code-block double measuredCurvaturePriorScale(const Eigen::MatrixXd& prior, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action) Positive least-squares scale of a prior's measured Hessian actions. Orthogonal changes of physical basis and curvature units preserve this fit. A zero or oppositely correlated prior supplies no positive scale. Leave-one-direction-out prediction must improve on the unscaled prior. This calibrates probe proposals; measured actions determine the index. .. index:: pair: function; completeMeasuredHessian .. _doxid-namespacegpr_1_1optim_1a37993165220176303de10855dcc753cc: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd completeMeasuredHessian(const Eigen::MatrixXd& prior, const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action) Least-change symmetric completion of measured columns over a prior. An orthonormal basis fixes its measured block and cross terms; the unmeasured block keeps the prior. Incompatible columns are symmetrized within the measured block. This operator supplies proposals, not signs. .. index:: pair: function; curvatureAtWavenumber .. _doxid-namespacegpr_1_1optim_1aae33f308339dd5344bda6e6a093fd8e8: .. ref-code-block:: cpp :class: doxyrest-title-code-block double curvatureAtWavenumber(double wavenumber, const Eigen::VectorXd& direction, const Eigen::VectorXd& atomic_masses) Cartesian curvature of a displacement whose harmonic wavenumber is ``wavenumber`` (cm^-1): (2 pi c nu)^2 u^T M u / u^T u, in eV/A^2 for masses in amu. A softer direction is below that frequency resolution whatever its sign. Zero when no masses are given or the sizes disagree. .. index:: pair: function; completedSecondMode .. _doxid-namespacegpr_1_1optim_1a151fcf725283c4c1fde9cf62a3ee196e: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CompletedSecondMode` completedSecondMode(const Eigen::MatrixXd& completed, const Eigen::MatrixXd& basis, Eigen::Index k = 1) The direction a completion proposes for measurement: its k-th lowest mode (the second by default). ``completed`` is a symmetric completion of the columns measured along the orthonormal ``basis``. This supplies a proposal, not a sign. .. index:: pair: function; completedAdditionalNegativeMode .. _doxid-namespacegpr_1_1optim_1ab95ad806f388a3533eee2ffd8e466831: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CompletedSecondMode` completedAdditionalNegativeMode(const Eigen::MatrixXd& completed, const Eigen::MatrixXd& basis, const Eigen::VectorXd& negative_mode) Eliminate a measured negative direction by congruence before choosing another probe. For H = [a b^T; b D], a < 0, the remaining inertia is that of D - b b^T/a. Lifting its mode y to [-b^T y/a; y] preserves the sign of its quadratic form. This orders measurements only; the measured Ritz pair and the final oracle stencil decide the index. .. index:: pair: function; nextMeasuredCurvatureDirection .. _doxid-namespacegpr_1_1optim_1ab757dd9f6361b5af6d8eb4d93ace0a4d: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd nextMeasuredCurvatureDirection(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action, const :ref:`MeasuredCurvatureSpectrum`& spectrum, const Eigen::MatrixXd& physical, const Eigen::MatrixXd& preferred, const Eigen::MatrixXd& prior = Eigen::MatrixXd{}) Expand toward the second mode of a measured completion when a prior is available, then the second Ritz residual. An invariant subspace needs an independent seed; the physical basis guarantees complement coverage. .. index:: pair: function; nextMeasuredCurvatureDirections .. _doxid-namespacegpr_1_1optim_1a9e966d16ba2e9bbb980345ae6459ba94: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd nextMeasuredCurvatureDirections(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& action, const :ref:`MeasuredCurvatureSpectrum`& spectrum, const Eigen::MatrixXd& physical, const Eigen::MatrixXd& preferred, Eigen::Index count, const Eigen::MatrixXd& prior = Eigen::MatrixXd{}) Expand by independent physical directions that can share an oracle batch. The leading column follows the completed prior or second Ritz residual. Further residuals and physical seeds fill its orthogonal complement. .. index:: pair: function; analyzeRefinedMeasuredCurvature .. _doxid-namespacegpr_1_1optim_1a74f3e8fe644489937299d82b548901ba: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`MeasuredCurvatureSpectrum` analyzeRefinedMeasuredCurvature(const Eigen::MatrixXd& basis, const Eigen::MatrixXd& at_h, const Eigen::MatrixXd& at_2h) Refine a measured subspace using central stencils at h and 2h. The projected leading truncation correction supplies an empirical resolution; it is not a bound on arbitrary higher derivatives of the potential. .. index:: pair: function; refineMeasuredCurvature .. _doxid-namespacegpr_1_1optim_1ac7515f63cc4fae76df98dec1836eea6a: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`MeasuredCurvatureSpectrum` refineMeasuredCurvature(const Eigen::VectorXd& center, const Eigen::MatrixXd& basis, double step, Evaluate&& evaluate, :ref:`RefinedCurvatureActions`* actions = nullptr) Measure central actions at h and h/2 in one owned batch. The evaluator accepts row-wise Cartesian positions, returns their energy gradients, and owns distribution and retention of every true observation. .. index:: pair: function; refinePositiveCurvatureComplement .. _doxid-namespacegpr_1_1optim_1a2d24a024d06466df11607ea7ae807f30: .. ref-code-block:: cpp :class: doxyrest-title-code-block template double refinePositiveCurvatureComplement(const :ref:`MeasuredCurvatureSpectrum`& complete, Eigen::Index dimension, const Eigen::VectorXd& center, double step, Evaluate&& evaluate) Refine every unresolved positive mode while retaining the measured lower bound on the rest of the complete physical space. The evaluator owns every acquisition, including repeated positions and their multiplicities. .. index:: pair: function; movingAtomicMasses .. _doxid-namespacegpr_1_1optim_1aa11602e3939a99fc8ca86ed5d8b5892c: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd movingAtomicMasses(const :ref:`gpr::AtomsConfiguration`& config, Eigen::Index n_moving) Positive finite masses in the packed moving-coordinate order. With a mobility mask, input masses describe the full frame and moving entries are selected in mask order. Empty input masses select unit masses. .. index:: pair: function; physicalCurvatureBasis .. _doxid-namespacegpr_1_1optim_1a13c1289888b810fc94f702d576369cdb: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd physicalCurvatureBasis(const :ref:`gpr::Coord`& positions, const :ref:`gpr::AtomsConfiguration`& config, bool exclude_rotations = true, :ref:`RigidMotionMetric` metric = :ref:`RigidMotionMetric::MassWeighted`) Cartesian orthonormal basis for the physical vibrational subspace. If R spans rigid displacements and M contains atomic masses, the Cartesian image of the mass-weighted vibrational space is ker(R^T M). Congruence on this space preserves the index without changing Cartesian probe lengths. .. index:: pair: function; vibrationalStencilDirections .. _doxid-namespacegpr_1_1optim_1af7583a044863804c5840f1e641573c43: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd vibrationalStencilDirections(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, bool periodic, bool anchored, const Eigen::VectorXi* frozen = nullptr) Displacement directions of the vibrational stencil: the orthonormal Cartesian basis B of ker(R^T M), 3N-6 columns (3N-5 for a linear molecule, 3N-3 in a periodic cell, where rotations are not symmetries). An anchored geometry keeps every coordinate, and so does a lone atom, whose energy can only vary in an external field. Frozen atoms (nonzero ``frozen`` flags, one per atom) anchor the rest and never move: the directions are then the moving atoms' coordinate axes. With Q the mass-weighted vibrational basis, M^{-1/2} Q = B C for C = B^T M^{-1/2} Q, so Q^T M^{-1/2} H M^{-1/2} Q = C^T (B^T H B) C reads only H B: the vibrational index needs no rigid column and no invariance of the oracle. .. index:: pair: function; stencilDirectionsForMode .. _doxid-namespacegpr_1_1optim_1ab668aff2694ffc8c86b50629d9ac6b12: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd stencilDirectionsForMode(:ref:`VibrationalStencil` mode, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, bool periodic, bool anchored, const Eigen::VectorXi* frozen = nullptr) Full measures every Cartesian coordinate: all 3 coordinates for N=1, and all 3N when atoms are frozen, so measureVibrationalIndex(frozen, Full) probes all 3N. Vibrational uses vibrationalStencilDirections. A lone atom is the identity in both. .. index:: pair: function; directionsAreCoordinateAxes .. _doxid-namespacegpr_1_1optim_1a6d60f5fe212c4efc2e913b4fcdc411e7: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool directionsAreCoordinateAxes(const Eigen::MatrixXd& directions) True when every direction is a distinct coordinate axis: the stencil of a geometry whose other coordinates are frozen. No coordinate axis is orthogonal to the mass-weighted translations, so a vibrational basis never reads as one. .. index:: pair: function; centralDifferencePoints .. _doxid-namespacegpr_1_1optim_1ae90f356c9b8fcf2774039dbdfe067848: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd centralDifferencePoints(const Eigen::VectorXd& center, double step, const Eigen::MatrixXd& directions) Central-difference geometries along each direction: column 2k is center + step d_k and column 2k+1 is center - step d_k. Every stencil forms its points here, so a held row is found again bit for bit. .. index:: pair: function; massWeightedPhysicalCurvatureBasis .. _doxid-namespacegpr_1_1optim_1a67dfd10c44260cb2e83ccc587646587d: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd massWeightedPhysicalCurvatureBasis(const :ref:`gpr::Coord`& positions, const :ref:`gpr::AtomsConfiguration`& config, bool exclude_rotations = true) Orthonormal physical step directions in mass-weighted coordinates. Cartesian directions in ker(R^T M) map through sqrt(M) to the complement of the mass-weighted rigid motions. Frozen anchors retain every moving coordinate; periodic cells exclude translations and retain rotations. .. index:: pair: function; transportPhysicalDirections .. _doxid-namespacegpr_1_1optim_1aa63b8aa3b543335c34d5440cab6abe8d: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd transportPhysicalDirections(const Eigen::MatrixXd& directions, const Eigen::MatrixXd& physical) Reproject search directions in their supplied order. Curvature signs require fresh measurements; projection alone carries no certificate. .. index:: pair: function; transportMeasuredHessianActions .. _doxid-namespacegpr_1_1optim_1aaaadeeabbb5c1260da4694ae801afa5c: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd transportMeasuredHessianActions(const :ref:`gpr::Coord`& positions, const :ref:`gpr::Coord`& gradient, const Eigen::MatrixXd& measured_basis, const Eigen::MatrixXd& measured_action, const Eigen::MatrixXd& physical, bool include_rotations = true) Express measured Cartesian Hessian actions in another complete physical basis at the same geometry. Rigid translations have zero action; rotational invariance gives H (omega x R) = omega x gradient, including at nonstationary points. These identities supply the rigid part removed when changing between mass-weighted and Cartesian constraints. .. index:: pair: function; hessianColumnsFromDirections .. _doxid-namespacegpr_1_1optim_1a1337c5c18d0cf1a79100ba37d850b5cb: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd hessianColumnsFromDirections(const Eigen::VectorXd& center, const Eigen::VectorXd& center_gradient, const Eigen::MatrixXd& directions, const Eigen::MatrixXd& actions) Cartesian Hessian columns of a stencil measured along orthonormal ``directions``, with ``actions.col(k)`` the central difference of the gradient along direction k. A complete set is the measurement itself. Otherwise the removed rigid columns are the identities of transportMeasuredHessianActions, about the measured center gradient: rotations when more than translations were removed. The columns along the directions stay the measured ones, so the vibrational block of the result is the measured block exactly, and only full-Cartesian consumers read the rigid columns: the spectrum and its resolution are taken on the measured block (analyzeStencilIndex). Coordinate-axis directions leave frozen coordinates, which carry no curvature: the result is the measured moving block with zero frozen rows and columns. Empty when the inputs cannot form that matrix. .. index:: pair: function; restrictedPartitionedRfoStep .. _doxid-namespacegpr_1_1optim_1aae0eedb2414b4aacdd08830b5f6868ae: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`RestrictedPartitionedRfoStep` restrictedPartitionedRfoStep(const Eigen::VectorXd& curvatures, const Eigen::VectorXd& gradient, const Eigen::MatrixXd& cartesian_modes, double radius) Restricted partitioned RFO on an ascending Hessian spectrum. ``rgsaddle_prfo_step`` mass-weights a Cartesian Hessian and brackets alpha by doubling and bisection. ``rgsaddle_trust_update`` is Sella's rho schedule. Neither is this secular problem on a supplied basis whose columns need not be orthonormal, so this walk does not call them and there is no second copy kept for a build without rgsaddle. Mode zero is maximized and its complement is minimized. The full-column- rank map cartesian_modes converts eigenbasis coefficients to Cartesian displacement; its columns need not be orthonormal. Both partitions share alpha = c^2, with c >= 1, and the Cartesian norm supplies the restriction. Regular steps satisfy (D - mu I) s = -g and mu = c^2 g.s in each partition. A feasible pure step has c = 1. A binding step retains the feasible side of a continuous secular branch until the c bracket reaches floating-point resolution; no monotonicity of the Cartesian norm is required. An exact homogeneous hard case retains a boundary direction, rather than claiming a finite alpha resolves a vanishing affine coordinate. Scalar secular arithmetic uses the extended exponent range of long double. Targets where long double has only binary64 range can decline extreme inputs. .. index:: pair: function; richardsonExtrapolate .. _doxid-namespacegpr_1_1optim_1aae7c214ac18edbca7192e53e176a13cb: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd richardsonExtrapolate(const Eigen::VectorXd& at_h, const Eigen::VectorXd& at_2h) Central-difference curvature measurements along a direction drop every even power of the displacement, so the separations h and 2h combine into an estimate exact through the quartic force term (scripts/derive_richardson_transverse_curvature.py, proofs/lean/GPRidge/RichardsonCurvature.lean): c_R = (4 c(h) - c(2h)) / 3, delta = (c(2h) - c(h)) / 3 = d h^2, where delta is the truncation term the single-separation estimate carried. The same combination applies entrywise to the measured Hessian actions the Rayleigh-Ritz curvatures are built from. .. index:: pair: function; curvatureResolvedByStencil .. _doxid-namespacegpr_1_1optim_1ad432554b8f6dd7459bb3d33e5a52c4b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool curvatureResolvedByStencil(double measured, double anharmonic_scale) Screen for refining a single-separation curvature: its magnitude against the stencil's own anharmonicity scale, the even residual (F(h) + F(-h))/2 - F(0) = b h^2 of the same three measurements over h. This is not a sign certificate. The even residual is F''(0) h^2 / 2 and vanishes on a symmetric direction whatever the truncation is; the certificate is curvatureResolvedByThirdDerivative. .. index:: pair: function; curvatureResolvedByThirdDerivative .. _doxid-namespacegpr_1_1optim_1aaa875bfd1419806b38f369121cd78ddb: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool curvatureResolvedByThirdDerivative(double measured, double third, double step) One central difference resolves the sign of the curvature only against an explicit third-derivative bound. If abs(phi''') <= third on [-step, step], abs((phi(step) - phi(-step)) / (2 \* step) - phi'(0)) <= third \* step \* step / 6 (``centralCurvature_error``). The even residual ``(φ(step) + φ(-step)) / 2 - φ(0)`` is ``φ''(0) step² / 2`` and does not bound that error: ``φ(t) = t - 100 t³`` at ``step = 0.2`` has even residual 0 and a central quotient of ``-3``, while the true curvature is ``+1``. .. index:: pair: function; richardsonForwardExtrapolate .. _doxid-namespacegpr_1_1optim_1ad98ef9b2ac8f785419761a49df5d1c10: .. ref-code-block:: cpp :class: doxyrest-title-code-block double richardsonForwardExtrapolate(double at_h, double at_2h) One measured side only (the dimer axis: the midpoint and one image): the forward difference c_f(h) = (F(h) - F(0))/h carries c + b h + d h^2, and 2 c_f(h) - c_f(2h) = c - 2 d h^2 is exact through the quadratic force term; c_f(2h) - c_f(h) = b h + 3 d h^2 is the first-order truncation the single estimate carried. .. index:: pair: function; curvatureResolvedBySurrogate .. _doxid-namespacegpr_1_1optim_1ac975ebde3a49b9f311e8ae0e1c08170c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool curvatureResolvedBySurrogate(double measured, double surrogate) With one measured side there is no even residual; the surrogate's disagreement with the measurement is the only resolution scale a single-separation estimate carries. .. index:: pair: function; certifiedCurvatureSign .. _doxid-namespacegpr_1_1optim_1af25d0db9bd996209574be25f46fbfc36: .. ref-code-block:: cpp :class: doxyrest-title-code-block int certifiedCurvatureSign(double extrapolated, double estimate) The sign of the extrapolated curvature certified against its truncation estimate: +1 or -1 when the magnitude exceeds the estimate, 0 when the measurement cannot resolve the sign. .. index:: pair: function; recordSecantObservation .. _doxid-namespacegpr_1_1optim_1a501cd998af7c2f679522f2b63024f34d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void recordSecantObservation(:ref:`SecantHessian`& secant, const Eigen::VectorXd& position, const Eigen::VectorXd& gradient, double energy, :ref:`SecantCurvatureCounts`& counts, :ref:`SecantAccounting` accounting = :ref:`SecantAccounting::Count`) Record one true-force geometry. A nonzero displacement that the selected update refuses is a rejected pair; the first geometry is neither. The energy joins the reference only with the geometry it was measured at. .. index:: pair: function; secantResolvedNegativeMode .. _doxid-namespacegpr_1_1optim_1a36c8d1b0d784f36c440b1bce9ee4aba8: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::optional secantResolvedNegativeMode(const :ref:`SecantHessian`& secant) Lowest Ritz vector of the secant Hessian on the measured-step span when its Ritz value is a resolved negative curvature. Curvature outside that span is not measured; in particular, a one-step Bofill update from zero can create a spurious negative eigenvalue on a convex surface. Empty when the secant has no accepted pair or the projection resolves no negative mode. .. index:: pair: function; secantPositiveInverseScale .. _doxid-namespacegpr_1_1optim_1a287ff5a05e6d747d1e9b20e50a348e50: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::optional secantPositiveInverseScale(const :ref:`SecantHessian`& secant) Inverse curvature 1 / (u^T H u) along the latest accepted step, when that curvature is positive. Empty means the secant does not define a descent scale. .. index:: pair: function; seedHessianOnSecantRange .. _doxid-namespacegpr_1_1optim_1a5dc2574f93f7ca5473b28a3d864a83e7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`SecantSeedStatus` seedHessianOnSecantRange(Eigen::MatrixXd& model, const Eigen::MatrixXd& secant_hessian) Replace ``model`` on the range of ``secant_hessian`` with that Hessian's action and leave the orthogonal complement unchanged. An eigenvalue is in the range when its magnitude exceeds the square root of epsilon times the largest magnitude, so the criterion has no units. A secant with no such eigenvalue carries no curvature to seed, and ``model`` stays as it is. .. index:: pair: function; seedHessianOnMeasuredStepRange .. _doxid-namespacegpr_1_1optim_1ab8a30cc80c5a40dc732838c82fbdb5f5: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`SecantSeedStatus` seedHessianOnMeasuredStepRange(Eigen::MatrixXd& model, const Eigen::MatrixXd& secant_hessian, const Eigen::MatrixXd& measured_steps) As above, but only on the Ritz pairs of ``secant_hessian`` projected onto the span of ``measured_steps``. Curvature outside that span is not evidence for modifying the model. The tolerance is relative to the largest projected magnitude. ``measured_steps`` must be expressed in the coordinates of ``model`` and ``secant_hessian``. .. index:: pair: function; seedHessianFromSecant .. _doxid-namespacegpr_1_1optim_1aa0e2ded01492d3f11a804985c59b0c18: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`SecantSeedStatus` seedHessianFromSecant(Eigen::MatrixXd& model, const :ref:`SecantHessian`& secant, const Eigen::MatrixXd& weight, :ref:`SecantSeedSupport` support = :ref:`SecantSeedSupport::WholeHessian`) Seed ``model`` from ``secant``, whose Hessian is first weighted entry by entry by ``weight`` (the mass weighting the model lives in). Refuses, leaving ``model`` unchanged, when the secant has no accepted pair or was measured in another dimension. ``support`` picks the part of the weighted Hessian that is taken. A MeasuredSteps seed projects onto the measured steps in the weighted coordinates: ``weight`` is the outer product w w^T of the coordinate scale w (M^{-1/2} for a mass weighting), so a Cartesian step s becomes s / w. The two agree only when w is constant. In that mode the diagonal of ``weight`` must be positive and finite, otherwise std::invalid_argument is thrown. .. index:: pair: function; secantFittedToResidual .. _doxid-namespacegpr_1_1optim_1a2f6918bbddd75e76be0bf77ece2ba062: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`SecantHessian` secantFittedToResidual(:ref:`SecantHessianMethod` method, const std::vector<:ref:`SecantForceSample`>& samples, Prior&& prior) Fit q to (E - m, F - grad m). ``prior`` writes the exact prior energy and Cartesian gradient at a geometry. The returned secant is the production residual quadratic. .. index:: pair: function; bofillThroughLoadedRgsaddle .. _doxid-namespacegpr_1_1optim_1a6bcad8285dae4f983952b7f6390978f3: .. ref-code-block:: cpp :class: doxyrest-title-code-block int bofillThroughLoadedRgsaddle(std::int64_t n, double* hessian_row_major, const double* step, const double* gradient_change) Bofill through the linked librgsaddle (``rgsaddle_hessian_bofill``). ``hessian_row_major`` is n by n. Returns 1 when the runtime wrote an update, 0 when it refused and left the buffer unchanged, and -1 when the linked ABI stamp is not major 1 with minor at least 3. ``:ref:`bofillRgsaddleAbiRefusal ``` names that required ABI and the stamp that was found. .. index:: pair: function; bofillRgsaddleAbiRefusal .. _doxid-namespacegpr_1_1optim_1a424d54cbbe43224d4d2f3e402b6094e9: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string bofillRgsaddleAbiRefusal() Refusal text for a Bofill call the linked ABI rejects. Names the required rgsaddle ABI major and minor 3, and the major and minor (or stamp status) that were found. .. index:: pair: function; setBofillRgsaddleLibrary .. _doxid-namespacegpr_1_1optim_1acfcea2685847a6a862036303f9b93d44: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setBofillRgsaddleLibrary(const char* path) Records the index-test choice before the first Bofill call. The update uses the linked library, so the path is not opened. Null or empty clears the recorded choice. .. index:: pair: function; smoothMeasuredCurvature .. _doxid-namespacegpr_1_1optim_1a7d88f679c9d105661d29aa6edd7bfad7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`SmoothedCurvatureSpectrum` smoothMeasuredCurvature(const Eigen::MatrixXd& prior, const std::vector<:ref:`MeasuredHessianColumn`>& columns, const :ref:`SmoothedCurvatureSpectrum`* previous = nullptr, const :ref:`linalg::MpiContext`& context = :ref:`linalg::MpiContext::local`()) Condition measured Hessian columns, then distribute independent spectrum samples over the supplied process group. Local contexts enter no MPI. .. index:: pair: function; nextSmoothedCurvatureDirection .. _doxid-namespacegpr_1_1optim_1a5d6978def319c0704ba31b9331208232: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd nextSmoothedCurvatureDirection(const :ref:`SmoothedCurvatureSpectrum`& spectrum, Eigen::Index k) The direction to measure for the k-th eigenvalue: the part of its posterior mode outside the measured span, normalized. Empty when the mode lies in the span to floating-point resolution, in which case no further column changes the eigenvalue's first-order posterior. .. index:: pair: function; measuredUpperBound .. _doxid-namespacegpr_1_1optim_1a31b26f890d1f3fa82b1654b77ba67d21: .. ref-code-block:: cpp :class: doxyrest-title-code-block double measuredUpperBound(const :ref:`SmoothedCurvatureSpectrum`& spectrum, const std::vector<:ref:`MeasuredHessianColumn`>& columns, Eigen::Index k) Bauer-Fike verdict on a mode: with u in the measured span, H u is a combination of measured columns, the Rayleigh quotient theta and the residual ||H u - theta u|| are measured, and some eigenvalue of H lies within the residual of theta (Bauer 1960, Parlett 1998 Thm 4.5.1). The upper bound theta + ||r|| below zero certifies a negative eigenvalue from measurements alone. Returns the bound; +infinity when the mode leaves the measured span beyond floating-point resolution. .. index:: pair: function; softestUnmeasuredDirection .. _doxid-namespacegpr_1_1optim_1a165e05491e7a5f55efe1b2be68327f7f: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd softestUnmeasuredDirection(const :ref:`SmoothedCurvatureSpectrum`& spectrum) The softest direction of the posterior mean restricted to the unmeasured complement, normalized; empty when nothing is unmeasured. .. index:: pair: function; coarseColumnToRefine .. _doxid-namespacegpr_1_1optim_1a706762408ee6f23e97d914c38563f491: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::Index coarseColumnToRefine(const :ref:`SmoothedCurvatureSpectrum`& spectrum, const std::vector<:ref:`MeasuredHessianColumn`>& columns, Eigen::Index k) The coarse column with the largest overlap with the k-th posterior mode, the one whose refinement most reduces that eigenvalue's spread; -1 when every overlapping column is refined already. .. index:: pair: function; spectralResidualStep .. _doxid-namespacegpr_1_1optim_1a34e92ba5f2c563d23ff2a982d565f7fa: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd spectralResidualStep(const Eigen::VectorXd& eigenvalues, const Eigen::MatrixXd& modes, const Eigen::VectorXd& gradient, double radius) Minimize ||g + H s||^2 within a Euclidean trust radius on a supplied orthonormal Hessian spectrum. The normal equations give s_i = -lambda_i g_i / (lambda_i^2 + shift), with shift >= 0. This is a local force-root proposal; the measured saddle index decides whether a converged root belongs to the saddle search. .. index:: pair: function; spectralTrustRegionStep .. _doxid-namespacegpr_1_1optim_1a080453b10b49a123fc7260dcd8aa3c99: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`SpectralTrustRegionStep` spectralTrustRegionStep(const Eigen::VectorXd& curvatures, const Eigen::MatrixXd& modes, Eigen::Index mode_index, const Eigen::VectorXd& force, double radius, const std::vector>& measured_negative) The exact trust-region minimizer (More and Sorensen 1983) of the modified quadratic model m(s) = -F.s + s^T M s / 2 with M = sum_k mu_k q_k q_k^T on the eigenbasis ~modes~ (columns) with ~curvatures~, the selected curvature reversed (Banerjee 1985; Baker 1986). A transverse mode with nonpositive curvature has no minimizer and is left out unless a direction in ~measured_negative~ (Cartesian direction, measured curvature) covers it by majority overlap, in which case its measured curvature enters and the step descends along it to the boundary. The Levenberg shift is solved on the secular equation so the step lies within ~radius~. .. index:: pair: function; measuredCubicColumnContribution .. _doxid-namespacegpr_1_1optim_1a223199583b725aeaa4f90415c640b743: .. ref-code-block:: cpp :class: doxyrest-title-code-block double measuredCubicColumnContribution(double overlap, double mode_quadratic, double axis_quadratic) Contribution of a measured axis u to the cubic along v. The measured gradient second difference supplies T[u,u]; overlap is u dot v. Summing over orthonormal measured axes retains every symmetric cubic coefficient with a repeated axis index. Coefficients with three distinct unmeasured index combinations are zero in this model; two axes determine a full bivariate cubic. Reversing u preserves this contribution, while reversing v reverses its sign. .. index:: pair: function; axisStencilDirectionalCubic .. _doxid-namespacegpr_1_1optim_1a1ef4da5e497e66053a3f36375cb548a3: .. ref-code-block:: cpp :class: doxyrest-title-code-block double axisStencilDirectionalCubic(const Eigen::MatrixXd& axes, const Eigen::MatrixXd& second_differences, const Eigen::VectorXd& mode) Cubic coefficient along ``mode`` from measured axis stencils: column j of ``second_differences`` is the gradient second difference along the orthonormal axis u_j (column j of ``axes``), that is T[u_j, u_j, .]. The sum of measuredCubicColumnContribution over the axes is odd in the mode, as the cubic coefficient is, so a mode and its negative give opposite signs. .. index:: pair: function; massWeightedRigidMotions .. _doxid-namespacegpr_1_1optim_1ac403b83320dd3dc50cc3d96c850b1d5f: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd massWeightedRigidMotions(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses) Mass-weighted translations and rotations as columns, about the centre of mass. .. index:: pair: function; vibrationalComplement .. _doxid-namespacegpr_1_1optim_1a9f791147171ec235af7ddf2ddf07be01: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd vibrationalComplement(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses) Orthonormal basis of the mass-weighted coordinates orthogonal to the rigid motions at ``positions`` : the left singular vectors of the rigid basis beyond its numerical rank (five for a linear molecule, six otherwise). .. index:: pair: function; analyzeStencilIndex .. _doxid-namespacegpr_1_1optim_1aae4ea38b059afd47e3b87fbaf4735446: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`StencilIndex` analyzeStencilIndex(const Eigen::MatrixXd& columns, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, const Eigen::MatrixXd* measured = nullptr) ``columns`` holds the Cartesian Hessian actions: column j is the central difference of the gradient along Cartesian coordinate j. ``measured``, when it has fewer orthonormal Cartesian columns than there are coordinates, names the directions the stencil displaced along; the other columns of ``columns`` were rebuilt, not measured. The resolution is then the antisymmetric norm of the mass-weighted block on the image sqrt(M) ``measured``, which reads only the measured columns. The spectrum is the vibrational complement's when the image contains it (a free molecule, whose image it is, or a periodic cell, whose image adds the rotations), and otherwise the image's own block (the moving coordinates of a geometry with frozen atoms). Either block reads only measured columns. .. index:: pair: function; refineWeakModes .. _doxid-namespacegpr_1_1optim_1acafedd9ba52397bbd73d8f29dff48a6b: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`RefinedWeakModes` refineWeakModes(const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, const Eigen::MatrixXd& weak, double step, const Gradients& gradients, double noise_multiplier = 0.0) ``weak`` holds mass-weighted mode columns. ``gradients`` takes Cartesian positions as columns and returns their gradients as rows, so the host can evaluate the whole batch at once. The difference of the two stencils estimates truncation only when the oracle is exact. With gradient noise of standard deviation s in each coarse curvature, the half step doubles it, the difference has standard deviation sqrt(5) s and the Richardson value sqrt(65)/3 s, so one third of the absolute coarse-minus-fine difference understates the error of the Richardson value by a factor of about 3.6. A positive ``noise_multiplier`` m adds m times the root mean square of the coarse-minus-fine curvatures, pooled over the refined modes, to every entry of the error envelope. m = 3.6 is three standard deviations of the Richardson value when the differences are noise. .. index:: pair: function; rotatedPositiveRestrictionLowerBound .. _doxid-namespacegpr_1_1optim_1a7b7d68344cf7c8b2f85831db15ab9331: .. ref-code-block:: cpp :class: doxyrest-title-code-block double rotatedPositiveRestrictionLowerBound(const Eigen::MatrixXd& block, const Eigen::MatrixXd& errors, const Eigen::MatrixXd& coupling, const Eigen::VectorXd& tail, double allowance) A second comparison bound in the eigenbasis of the weak block. For abs(D) <= E, and abs(U^T D U) <= abs(U)^T E abs(U); the complete tail coupling is bounded by C abs(U). The Gram defect accounts for a computed rotation that is not exactly orthogonal. All bounds remain conditional on E. .. index:: pair: function; certifyStencilIndex .. _doxid-namespacegpr_1_1optim_1adb6cba61ecd91b4eab2b194db998e358: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`StencilIndexCertificate` certifyStencilIndex(const :ref:`StencilIndex`& index, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const Gradients& gradients, Eigen::Index minimum_weak = 0, double noise_multiplier = 0.0) Refine unresolved modes in one batch and retain the complete positive restriction, including its coupling to the resolved complement. The same comparison matrix determines the independent validation's bound. .. index:: pair: function; decideMeasuredIndex .. _doxid-namespacegpr_1_1optim_1a3e1181ebfc7dfe72e405fb7a234ef5fc: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`MeasuredIndexDecision` decideMeasuredIndex(const Eigen::MatrixXd& columns, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const Gradients& gradients, const Eigen::MatrixXd* measured = nullptr) ``measured`` is analyzeStencilIndex's. .. index:: pair: function; defaultStencilStep .. _doxid-namespacegpr_1_1optim_1aa200ff1be444c26c85f973f106fc2cb2: .. ref-code-block:: cpp :class: doxyrest-title-code-block double defaultStencilStep() Cartesian displacement of a central-difference stencil when the caller names none, in the coordinate unit. A stencil on a learned potential needs a step that keeps the noise of the gradient below the curvature it resolves; 0.01 A does so for the potentials the drivers support. .. index:: pair: function; stencilStepOrDefault .. _doxid-namespacegpr_1_1optim_1a3ed0928685a8db149e1814429560700c: .. ref-code-block:: cpp :class: doxyrest-title-code-block double stencilStepOrDefault(double requested) The requested stencil step, or the default when none was requested. .. index:: pair: function; forceStopAdaptiveStepReductions .. _doxid-namespacegpr_1_1optim_1a4c0337dcb5d1085242128e93c537988a: .. ref-code-block:: cpp :class: doxyrest-title-code-block int forceStopAdaptiveStepReductions() Step halvings while a weak block's error keeps falling. Truncation error shrinks with the step, so an unbounded loop chases it to underflow without ever signing the mode. .. index:: pair: function; certifyAdaptiveStencilIndex .. _doxid-namespacegpr_1_1optim_1a5128381abd80895962bea865735060f2: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`StencilIndexCertificate` certifyAdaptiveStencilIndex(const :ref:`StencilIndex`& index, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, double step, const Gradients& gradients, double noise_multiplier = 0.0) Refine the uncertainty that prevents a terminal decision. A weak block whose own sign is unresolved gets a smaller stencil; a positive weak block coupled to an unresolved complement gets another measured mode. Identical Cartesian requests reuse their measured gradients. A smaller step must reduce the whole weak-block error before another reduction is tried; one positive Rayleigh bound does not resolve that block's sign. .. index:: pair: function; forceStopMeasurementInconclusiveOrHigher .. _doxid-namespacegpr_1_1optim_1ac5f4500a06bd0aaece3e4b5e882ff743: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool forceStopMeasurementInconclusiveOrHigher(const :ref:`ForceStopMeasurement`& measured) A measured stencil that is not index-one. Higher-order and unresolved both qualify: neither certifies the stopped geometry. .. index:: pair: function; forceStopSoftRefinementLimit .. _doxid-namespacegpr_1_1optim_1a7530e39232f0db747c60cadaa8f9ddaf: .. ref-code-block:: cpp :class: doxyrest-title-code-block int forceStopSoftRefinementLimit() How many soft-mode refinements follow a higher-order stencil. One walk, then a fresh stencil. A second walk was still higher-order on the cells that needed an escape, and it paid another full stencil. .. index:: pair: function; forceStopRefinementCertified .. _doxid-namespacegpr_1_1optim_1a0abee6dbcb4d6c8d2d83049e1b9cdf38: .. ref-code-block:: cpp :class: doxyrest-title-code-block int forceStopRefinementCertified() ``refine`` returns this when the soft-mode walk itself reached an index-one point inside the force tolerance. The certificate accepts that point. Another full stencil is not started: the walk already measured the modes, and a fresh 3N stencil after the report line is what kept a converged search from printing its call total. .. index:: pair: function; forceStopRefinementStillHigher .. _doxid-namespacegpr_1_1optim_1ae9366eea0aa36b21ed958175446da739: .. ref-code-block:: cpp :class: doxyrest-title-code-block int forceStopRefinementStillHigher() ``refine`` returns this when the soft-mode walk is still higher-order. The low modes were measured, so another full Cartesian stencil is not started. The certificate refines again or leaves along the extra mode. .. index:: pair: function; sameStencilGeometry .. _doxid-namespacegpr_1_1optim_1a9fdc2a988cfd1e375512d40101716bc6: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool sameStencilGeometry(const Eigen::VectorXd& first, const Eigen::VectorXd& second) Two geometries share one stencil when a later request has not moved. .. index:: pair: function; forceStopMinModeEscapes .. _doxid-namespacegpr_1_1optim_1ae844c88b9e6c655c79f1bd3e20b730ee: .. ref-code-block:: cpp :class: doxyrest-title-code-block int forceStopMinModeEscapes() Min-mode escapes after a higher-order certificate, for every search. .. index:: pair: function; forceStopCertificatePlanned .. _doxid-namespacegpr_1_1optim_1a5243b9b0240d832aea85823da15bbc0d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool forceStopCertificatePlanned(const :ref:`ForceStopStencilPlan`& plan) True when the plan spends evaluations on an index certificate at this stage: a stencil to measure, or stored columns to read. .. index:: pair: function; forceStopHeldColumn .. _doxid-namespacegpr_1_1optim_1a665f1bcaf6082dafabf9fa66a6a9db0c: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::Index forceStopHeldColumn(const Eigen::MatrixXd& held, const Eigen::VectorXd& query, double relative = 1e-6) True when ``query`` is a column already stored at ``held``. A later certificate at an unchanged geometry uses the stored gradient. .. index:: pair: function; forceStopLowestModes .. _doxid-namespacegpr_1_1optim_1a94e751f38cacad59389a937f2d94444e: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd forceStopLowestModes(const Eigen::MatrixXd& columns, const Eigen::VectorXd& positions, const Eigen::VectorXd& masses, Eigen::Index count, const Eigen::MatrixXd* measured = nullptr) Lowest Cartesian modes of a measured Hessian, lowest curvature first. ``measured`` is analyzeStencilIndex's. .. index:: pair: function; forceStopStencilCertifies .. _doxid-namespacegpr_1_1optim_1ac38f4b9c94c9ee57843a8ca5d55d2df4: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool forceStopStencilCertifies(bool measured, bool first_order) An unmeasured stop is uncertified. ``0fa3c694`` returned there. Certification is the measured stencil reporting one negative mode. .. index:: pair: function; runForceStopCertificate .. _doxid-namespacegpr_1_1optim_1af636e529218f26a18ac644958c7ae2f6: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`ForceStopCertificateResult` runForceStopCertificate(Measure measure, Refine refine, :ref:`ForceStopStencilPlan` plan, const :ref:`ForceStopMeasurement`* prior = nullptr) One certificate for every search. ``measure`` reads one stencil at the stopped geometry. ``refine`` moves only along the soft modes of a higher-order stencil. It returns a negative value when it cannot, ``:ref:`forceStopRefinementStillHigher() ``` when the low modes are still higher-order and a full stencil would only repeat that, ``:ref:`forceStopRefinementCertified() ``` when the walk reached an index-one point inside the force tolerance, and a positive call count when the point has to be measured again. A higher-order result that survives that walk sets ``needs_min_mode_escape``. The force loop is not resumed. A following saddle defers the stencil. A prior measurement at this geometry is the hand-off: its columns are not requested again, and an inconclusive or higher-order reading is given to that saddle. .. index:: pair: function; maxAtomDisplacement .. _doxid-namespacegpr_1_1optim_1abb8ed2e066f46874e729742e7f98577f: .. ref-code-block:: cpp :class: doxyrest-title-code-block double maxAtomDisplacement(const Eigen::VectorXd& delta) Largest displacement of one atom, with a short coordinate tail counted as a final group.