Propagates constant-temperature dynamics with Nose-Hoover coupling. More...
#include <CudaNoseHooverIntegrator.h>
Public Member Functions | |
| CudaNoseHooverIntegrator (const double timeStep) | |
| Constructs an unattached Nose-Hoover integrator. | |
| void | setReferenceTemperature (const double referenceTemperature) |
| Sets the Nose-Hoover reference temperature. | |
| void | setNoseHooverPistonMass (const double noseHooverPistonMass) |
| Sets the scalar Nose-Hoover coupling mass. | |
| void | setNoseHooverPistonVelocity (const double noseHooverPistonVelocity) |
| Sets the current Nose-Hoover extended-variable velocity. | |
| void | setNoseHooverPistonVelocityPrevious (const double noseHooverPistonVelocityPrevious) |
| Sets the previous Nose-Hoover extended-variable velocity. | |
| void | setNoseHooverPistonForce (const double noseHooverPistonForce) |
| Sets the current Nose-Hoover velocity-increment state. | |
| void | setNoseHooverPistonForcePrevious (const double noseHooverPistonForcePrevious) |
| Sets the previous Nose-Hoover velocity-increment state. | |
| void | setMaxPredictorCorrectorIterations (const int maxPredictorCorrectorIterations) |
| Sets the number of Nose-Hoover predictor-corrector iterations. | |
| void | useOldTemperature (const bool usingOldTemperature) |
| Selects the on-step temperature estimator. | |
| void | resetAverageTemperature (void) |
| Resets both running-temperature values and their sample count. | |
| double | getReferenceTemperature (void) const |
| Returns the reference temperature. | |
| bool | usingOldTemperature (void) const |
| Returns the native temperature-estimator selector. | |
| const CudaContainer< double > & | getNoseHooverPistonMass (void) const |
| Returns the scalar coupling-mass container. | |
| const CudaContainer< double > & | getNoseHooverPistonVelocity (void) const |
| Returns the current extended-variable velocity container. | |
| const CudaContainer< double > & | getNoseHooverPistonVelocityPrevious (void) const |
| Returns the previous extended-variable velocity container. | |
| const CudaContainer< double > & | getNoseHooverPistonForce (void) const |
| Returns the current velocity-increment container. | |
| const CudaContainer< double > & | getNoseHooverPistonForcePrevious (void) const |
| Returns the previous velocity-increment container. | |
| int | getMaxPredictorCorrectorIterations (void) const |
| Returns the predictor-corrector iteration count. | |
| const CudaContainer< double > & | getKineticEnergy (void) const |
| Returns both kinetic-energy estimators. | |
| const CudaContainer< double > & | getAverageTemperature (void) const |
| Returns both running-temperature estimators. | |
| CudaContainer< double > & | getNoseHooverPistonMass (void) |
| Returns mutable scalar coupling-mass storage. | |
| CudaContainer< double > & | getNoseHooverPistonVelocity (void) |
| Returns mutable current extended-variable velocity storage. | |
| CudaContainer< double > & | getNoseHooverPistonVelocityPrevious (void) |
| Returns mutable previous extended-variable velocity storage. | |
| CudaContainer< double > & | getNoseHooverPistonForce (void) |
| Returns mutable current velocity-increment storage. | |
| CudaContainer< double > & | getNoseHooverPistonForcePrevious (void) |
| Returns mutable previous velocity-increment storage. | |
| CudaContainer< double > & | getKineticEnergy (void) |
| Returns mutable kinetic-energy storage. | |
| CudaContainer< double > & | getAverageTemperature (void) |
| Returns mutable running-temperature storage. | |
| double | getInstantaneousTemperature (void) |
| Computes the selected instantaneous temperature. | |
Public Member Functions inherited from CudaIntegrator | |
| CudaIntegrator (void) | |
| Constructs an unattached base integrator with no time step. | |
| CudaIntegrator (const double timeStep) | |
| Constructs an unattached integrator with a time step. | |
| CudaIntegrator (const double timeStep, const int debugPrintFrequency) | |
| Constructs an integrator with a time step and debug interval. | |
| virtual | ~CudaIntegrator (void) noexcept |
| Destroys the base integrator and its CUDA streams. | |
| double | getTimeStep (void) const |
| Returns the public integrator time step. | |
| void | setTimeStep (const double dt) |
| Sets the public integrator time step. | |
| virtual void | setCharmmContext (std::shared_ptr< CharmmContext > ctx) final |
| Attaches a context and initializes concrete integrator state. | |
| const std::shared_ptr< CharmmContext > | getCharmmContext (void) const |
| Returns the retained context from a const integrator. | |
| std::shared_ptr< CharmmContext > | getCharmmContext (void) |
| Returns the retained context from a mutable integrator. | |
| virtual void | initialize (void) final |
| Reinitializes concrete integrator state from the attached context. | |
| virtual void | initializeFromRestartFile (const std::filesystem::path &rstFilePath) final |
| Initializes concrete integrator state from a restart file. | |
| virtual void | propagateOneStep (void) final |
| Propagates one concrete dynamics step without base-loop bookkeeping. | |
| void | propagate (const int numSteps) |
| Propagates dynamics and invokes scheduled subscriber updates. | |
| void | setDebugPrintFrequency (const int freq) |
| Sets the concrete-integrator debug-calculation interval. | |
| void | setNonbondedListUpdateFrequency (const int freq) |
| Sets the nonbonded neighbor-list update interval. | |
| void | subscribe (std::shared_ptr< Subscriber > sub) |
| Attaches one subscriber and caches its reporting interval. | |
| void | subscribe (const std::vector< std::shared_ptr< Subscriber > > &sublist) |
| Attaches subscribers sequentially in vector order. | |
| void | unsubscribe (std::shared_ptr< Subscriber > sub) |
| Removes one subscriber and its cached reporting interval. | |
| void | unsubscribe (const std::vector< std::shared_ptr< Subscriber > > &sublist) |
| Removes subscribers sequentially in vector order. | |
| const std::vector< std::shared_ptr< Subscriber > > & | getSubscribers (void) const |
| Returns the attached subscriber array. | |
| std::vector< std::shared_ptr< Subscriber > > & | getSubscribers (void) |
| Returns mutable access to the attached subscriber array. | |
| const std::vector< int > & | getReportFreqList (void) const |
| Returns the cached subscriber-frequency array. | |
| std::vector< int > & | getReportFreqList (void) |
| Returns mutable access to cached subscriber frequencies. | |
| void | setRemoveCenterOfMassFrequency (const int freq) |
| Sets the center-of-mass-removal interval. | |
| const CudaContainer< double4 > & | getCoordsDelta (void) const |
| Returns the current half-step displacement container. | |
| CudaContainer< double4 > & | getCoordsDelta (void) |
| Returns mutable current half-step displacement storage. | |
| const CudaContainer< double4 > & | getCoordsDeltaPrevious (void) const |
| Returns the previous half-step displacement container. | |
| CudaContainer< double4 > & | getCoordsDeltaPrevious (void) |
| Returns mutable previous half-step displacement storage. | |
| virtual std::map< std::string, std::string > | getIntegratorDescriptors (void) |
| Returns key/value descriptors for the concrete integrator. | |
| int | getCurrentPropagatedStep (void) const |
| Returns the wrapped completed-step counter. | |
| unsigned long long int | getTotNumSteps (void) const |
| Returns the total number of requested propagation steps. | |
| int | getNumSteps (void) const |
| Returns the most recently requested propagation length. | |
Protected Member Functions | |
| void | initializeImpl (void) override |
| Allocates and initializes Nose-Hoover state from the context. | |
| void | initializeFromRestartFileImpl (const std::filesystem::path &rstFilePath) override |
| Restores Nose-Hoover state from a CHARMM-style restart file. | |
| void | propagateOneStepImpl (void) override |
| Executes one synchronized Nose-Hoover propagation step. | |
| double | computeNoseHooverPistonMass (void) |
| Computes the default numeric coupling mass. | |
| void | removeCenterOfMassMotion (void) |
| Removes mass-weighted center-of-mass displacement. | |
Protected Member Functions inherited from CudaIntegrator | |
| void | requirePropagationReady (void) const |
| Validates shared state required for propagation. | |
| void | reportIfNeeded (const int istep) |
| Invokes subscribers scheduled for one local propagation step. | |
Protected Attributes | |
| double | m_ReferenceTemperature |
| Stores the reference temperature in kelvin. | |
| CudaContainer< double > | m_NoseHooverPistonMass |
| Stores the one-element Nose-Hoover coupling mass. | |
| CudaContainer< double > | m_NoseHooverPistonVelocity |
| Stores the current one-element extended-variable velocity. | |
| CudaContainer< double > | m_NoseHooverPistonVelocityPrevious |
| Stores the previous extended-variable velocity. | |
| CudaContainer< double > | m_NoseHooverPistonForce |
| Stores the current extended-variable velocity increment. | |
| CudaContainer< double > | m_NoseHooverPistonForcePrevious |
| Stores the previous extended-variable velocity increment. | |
| CudaContainer< double4 > | m_CoordsDeltaPredicted |
Stores one predicted double4 displacement per context atom. | |
| int | m_MaxPredictorCorrectorIterations |
| Stores the positive predictor-corrector iteration count. | |
| int | m_AverageWindowSize |
| Stores the number of samples accumulated into running averages. | |
| CudaContainer< double > | m_KineticEnergy |
| Stores two kinetic-energy estimators in kilocalories per mole. | |
| CudaContainer< double > | m_KineticEnergyPartialSums |
| Stores per-block partial sums for both kinetic estimators. | |
| CudaContainer< double > | m_AverageTemperature |
| Stores two running-temperature estimators in kelvin. | |
| bool | m_UsingOldTemperature |
| Selects element 1 instead of element 0 for native feedback. | |
Protected Attributes inherited from CudaIntegrator | |
| double | m_TimeStep |
| Stores the internal time step in AKMA time. | |
| double | m_Timfac |
| Stores the picoseconds-to-AKMA-time conversion factor. | |
| int | m_DebugPrintFrequency |
| Stores the non-negative concrete debug-calculation interval. | |
| std::shared_ptr< CharmmContext > | m_Context |
| Retains the context attached to this integrator. | |
| int | m_StepsSinceNeighborListUpdate |
| Stores the current per-call neighbor-list scheduling counter. | |
| int | m_CurrentPropagatedStep |
| Stores the wrapped number of completed base-loop steps. | |
| unsigned long long int | m_TotNumSteps |
| Stores the accumulated number of requested propagation steps. | |
| int | m_NumSteps |
| Stores the most recently accepted propagation request length. | |
| std::shared_ptr< CudaHolonomicConstraint > | m_HolonomicConstraint |
| Retains the optional holonomic-constraint helper. | |
| CudaContainer< double4 > | m_CoordsRef |
| Stores per-atom reference coordinates used by concrete steps. | |
| CudaContainer< double4 > | m_CoordsDelta |
| Stores current half-step displacements. | |
| CudaContainer< double4 > | m_CoordsDeltaPrevious |
| Stores previous half-step displacements. | |
| std::shared_ptr< cudaStream_t > | m_IntegratorStream |
| Owns the primary CUDA stream used by concrete integrator work. | |
| std::shared_ptr< cudaStream_t > | m_IntegratorMemcpyStream |
| Owns a reserved CUDA memcpy stream. | |
| bool | m_UsingHolonomicConstraints |
| Stores the constraint setting captured during context attachment. | |
| std::vector< std::shared_ptr< Subscriber > > | m_Subscribers |
| Retains subscribers in callback order. | |
| std::vector< int > | m_ReportFreqList |
| Stores the frequency snapshot for each attached subscriber. | |
| int | m_NonbondedListUpdateFrequency |
| Stores the positive nonbonded-list update interval in steps. | |
| int | m_RemoveCenterOfMassFrequency |
| Stores the positive center-of-mass-removal interval in steps. | |
| std::string | m_IntegratorTypeName |
| Stores the concrete integrator label used by subscribers. | |
Propagates constant-temperature dynamics with Nose-Hoover coupling.
The integrator maintains one Nose-Hoover extended variable, two kinetic energy estimators, two running-temperature estimators, and a predictor-corrector displacement buffer. Context attachment initializes the derived state and calculates a default coupling mass when no explicit mass has been supplied.
| CudaNoseHooverIntegrator::CudaNoseHooverIntegrator | ( | const double | timeStep | ) |
Constructs an unattached Nose-Hoover integrator.
| [in] | timeStep | Finite positive time step in picoseconds. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if timeStep is non-finite or not positive. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if stream or fixed-state allocation fails. |
| std::bad_alloc | If host or stream-owner allocation fails. |
|
protected |
Computes the default numeric coupling mass.
0.2 times the sum of context atom masses. The exact dimensional convention of the returned extended-system value is not established by the repository. | CudaContainer< double > & CudaNoseHooverIntegrator::getAverageTemperature | ( | void | ) |
Returns mutable running-temperature storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getAverageTemperature | ( | void | ) | const |
Returns both running-temperature estimators.
| double CudaNoseHooverIntegrator::getInstantaneousTemperature | ( | void | ) |
Computes the selected instantaneous temperature.
| ApoCharmmError | With code ApoCharmmErrorCode::NotInitialized if no context is attached. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if kinetic energy cannot be transferred to the host. |
usingOldTemperature() is true and element 0 otherwise. | CudaContainer< double > & CudaNoseHooverIntegrator::getKineticEnergy | ( | void | ) |
Returns mutable kinetic-energy storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getKineticEnergy | ( | void | ) | const |
Returns both kinetic-energy estimators.
| int CudaNoseHooverIntegrator::getMaxPredictorCorrectorIterations | ( | void | ) | const |
Returns the predictor-corrector iteration count.
| CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonForce | ( | void | ) |
Returns mutable current velocity-increment storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonForce | ( | void | ) | const |
Returns the current velocity-increment container.
| CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonForcePrevious | ( | void | ) |
Returns mutable previous velocity-increment storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonForcePrevious | ( | void | ) | const |
Returns the previous velocity-increment container.
| CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonMass | ( | void | ) |
Returns mutable scalar coupling-mass storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonMass | ( | void | ) | const |
Returns the scalar coupling-mass container.
| CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonVelocity | ( | void | ) |
Returns mutable current extended-variable velocity storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonVelocity | ( | void | ) | const |
Returns the current extended-variable velocity container.
| CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonVelocityPrevious | ( | void | ) |
Returns mutable previous extended-variable velocity storage.
| const CudaContainer< double > & CudaNoseHooverIntegrator::getNoseHooverPistonVelocityPrevious | ( | void | ) | const |
Returns the previous extended-variable velocity container.
| double CudaNoseHooverIntegrator::getReferenceTemperature | ( | void | ) | const |
Returns the reference temperature.
|
overrideprotectedvirtual |
Restores Nose-Hoover state from a CHARMM-style restart file.
| [in] | rstFilePath | Borrowed restart-file path. The path is not canonicalized or retained. |
Reimplemented from CudaIntegrator.
|
protected |
Removes mass-weighted center-of-mass displacement.
The method synchronizes the integrator stream, transfers velocity and previous-displacement storage to the host, applies the PBC-dependent correction, and transfers the displacement storage back to the device.
| void CudaNoseHooverIntegrator::resetAverageTemperature | ( | void | ) |
Resets both running-temperature values and their sample count.
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if the two-element temperature array cannot be reset on the device. |
| void CudaNoseHooverIntegrator::setMaxPredictorCorrectorIterations | ( | const int | maxPredictorCorrectorIterations | ) |
Sets the number of Nose-Hoover predictor-corrector iterations.
| [in] | maxPredictorCorrectorIterations | Positive, dimensionless iteration count. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if maxPredictorCorrectorIterations is not positive. |
| void CudaNoseHooverIntegrator::setNoseHooverPistonForce | ( | const double | noseHooverPistonForce | ) |
Sets the current Nose-Hoover velocity-increment state.
Despite the public name, the propagation kernel stores a change in the extended-variable velocity rather than a physical force.
| [in] | noseHooverPistonForce | Finite native increment value. The repository does not establish its public dimensional convention. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if the value is non-finite. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if the scalar cannot be copied to device storage. |
| void CudaNoseHooverIntegrator::setNoseHooverPistonForcePrevious | ( | const double | noseHooverPistonForcePrevious | ) |
Sets the previous Nose-Hoover velocity-increment state.
| [in] | noseHooverPistonForcePrevious | Finite native previous-increment value. The repository does not establish its public dimensional convention. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if the value is non-finite. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if the scalar cannot be copied to device storage. |
| void CudaNoseHooverIntegrator::setNoseHooverPistonMass | ( | const double | noseHooverPistonMass | ) |
Sets the scalar Nose-Hoover coupling mass.
| [in] | noseHooverPistonMass | Finite non-negative native coupling-mass value. The repository does not establish its public dimensional convention. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if noseHooverPistonMass is non-finite or negative. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if the scalar cannot be copied to device storage. |
| void CudaNoseHooverIntegrator::setNoseHooverPistonVelocity | ( | const double | noseHooverPistonVelocity | ) |
Sets the current Nose-Hoover extended-variable velocity.
| [in] | noseHooverPistonVelocity | Finite native extended-state value. The repository does not establish its public dimensional convention. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if the value is non-finite. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if the scalar cannot be copied to device storage. |
| void CudaNoseHooverIntegrator::setNoseHooverPistonVelocityPrevious | ( | const double | noseHooverPistonVelocityPrevious | ) |
Sets the previous Nose-Hoover extended-variable velocity.
| [in] | noseHooverPistonVelocityPrevious | Finite native previous-state value. The repository does not establish its public dimensional convention. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if the value is non-finite. |
| ApoCharmmError | With code ApoCharmmErrorCode::Cuda if the scalar cannot be copied to device storage. |
| void CudaNoseHooverIntegrator::setReferenceTemperature | ( | const double | referenceTemperature | ) |
Sets the Nose-Hoover reference temperature.
| [in] | referenceTemperature | Finite non-negative temperature in kelvin. |
| ApoCharmmError | With code ApoCharmmErrorCode::InvalidArgument if referenceTemperature is non-finite or negative. |
| void CudaNoseHooverIntegrator::useOldTemperature | ( | const bool | usingOldTemperature | ) |
Selects the on-step temperature estimator.
| [in] | usingOldTemperature | true selects array element 1, the on-step “old” estimator, for native instantaneous temperature and thermostat feedback. false selects element 0, the three-point “new” estimator. |
| bool CudaNoseHooverIntegrator::usingOldTemperature | ( | void | ) | const |
Returns the native temperature-estimator selector.
true when native feedback and instantaneous temperature use element 1; false when they use element 0.
|
protected |
Stores two running-temperature estimators in kelvin.
The element order matches m_KineticEnergy.
|
protected |
Stores two kinetic-energy estimators in kilocalories per mole.
Element 0 is the three-point estimator and element 1 is the on-step estimator.
|
protected |
Stores the current extended-variable velocity increment.
The propagation kernel treats this value as an increment despite the historical member name.