boost::numeric::odeint::velocity_verlet — The Velocity-Verlet algorithm.
// In header: <boost/numeric/odeint/stepper/velocity_verlet.hpp> template<typename Coor, typename Velocity = Coor, typename Value = double, typename Acceleration = Coor, typename Time = Value, typename TimeSq = Time, typename Algebra = typename algebra_dispatcher< Coor >::algebra_type, typename Operations = typename operations_dispatcher< Coor >::operations_type, typename Resizer = initially_resizer> class velocity_verlet : public algebra_stepper_base< Algebra, Operations > { public: // types typedef algebra_stepper_base< Algebra, Operations > algebra_stepper_base_type; typedef algebra_stepper_base_type::algebra_type algebra_type; typedef algebra_stepper_base_type::operations_type operations_type; typedef Coor coor_type; typedef Velocity velocity_type; typedef Acceleration acceleration_type; typedef std::pair< coor_type, velocity_type > state_type; typedef std::pair< velocity_type, acceleration_type > deriv_type; typedef state_wrapper< acceleration_type > wrapped_acceleration_type; typedef Value value_type; typedef Time time_type; typedef TimeSq time_square_type; typedef Resizer resizer_type; typedef stepper_tag stepper_category; typedef unsigned short order_type; // construct/copy/destruct velocity_verlet(const algebra_type & = algebra_type()); // public member functions order_type order(void) const; template<typename System, typename StateInOut> void do_step(System, StateInOut &, time_type, time_type); template<typename System, typename StateInOut> void do_step(System, const StateInOut &, time_type, time_type); template<typename System, typename CoorIn, typename VelocityIn, typename AccelerationIn, typename CoorOut, typename VelocityOut, typename AccelerationOut> void do_step(System, CoorIn const &, VelocityIn const &, AccelerationIn const &, CoorOut &, VelocityOut &, AccelerationOut &, time_type, time_type); template<typename StateIn> void adjust_size(const StateIn &); void reset(void); template<typename AccelerationIn> void initialize(const AccelerationIn &); template<typename System, typename CoorIn, typename VelocityIn> void initialize(System, const CoorIn &, const VelocityIn &, time_type); bool is_initialized(void) const; // private member functions template<typename System, typename CoorIn, typename VelocityIn> void initialize_acc(System, const CoorIn &, const VelocityIn &, time_type); template<typename System, typename StateInOut> void do_step_v1(System, StateInOut &, time_type, time_type); template<typename StateIn> bool resize_impl(const StateIn &); acceleration_type & get_current_acc(void); const acceleration_type & get_current_acc(void) const; acceleration_type & get_old_acc(void); const acceleration_type & get_old_acc(void) const; void toggle_current_acc(void); // public data members static const order_type order_value; };
The Velocity-Verlet algorithm is a method for simulation of molecular dynamics systems. It solves the ODE a=f(r,v',t) where r are the coordinates, v are the velocities and a are the accelerations, hence v = dr/dt, a=dv/dt.
typename Coor
The type representing the coordinates.
typename Velocity = Coor
The type representing the velocities.
typename Value = double
The type value type.
typename Acceleration = Coor
The type representing the acceleration.
typename Time = Value
The time representing the independent variable - the time.
typename TimeSq = Time
The time representing the square of the time.
typename Algebra = typename algebra_dispatcher< Coor >::algebra_type
The algebra.
typename Operations = typename operations_dispatcher< Coor >::operations_type
The operations type.
typename Resizer = initially_resizer
The resizer policy type.
velocity_verlet
public
construct/copy/destructvelocity_verlet(const algebra_type & algebra = algebra_type());Constructs the
velocity_verlet
class. This constructor can be used as a default constructor if the algebra has a default constructor.
Parameters: |
|
velocity_verlet
public member functionsorder_type order(void) const;
Returns: |
Returns the order of the stepper. |
template<typename System, typename StateInOut> void do_step(System system, StateInOut & x, time_type t, time_type dt);
template<typename System, typename StateInOut> void do_step(System system, const StateInOut & x, time_type t, time_type dt);
template<typename System, typename CoorIn, typename VelocityIn, typename AccelerationIn, typename CoorOut, typename VelocityOut, typename AccelerationOut> void do_step(System system, CoorIn const & qin, VelocityIn const & pin, AccelerationIn const & ain, CoorOut & qout, VelocityOut & pout, AccelerationOut & aout, time_type t, time_type dt);
template<typename StateIn> void adjust_size(const StateIn & x);Adjust the size of all temporaries in the stepper manually.
Parameters: |
|
void reset(void);Resets the internal state of this stepper. After calling this method it is safe to use all
do_step
method without explicitly initializing the stepper. template<typename AccelerationIn> void initialize(const AccelerationIn & ain);
template<typename System, typename CoorIn, typename VelocityIn> void initialize(System system, const CoorIn & qin, const VelocityIn & pin, time_type t);
bool is_initialized(void) const;
Returns: |
Returns if the stepper is initialized. |
velocity_verlet
private member functionstemplate<typename System, typename CoorIn, typename VelocityIn> void initialize_acc(System system, const CoorIn & qin, const VelocityIn & pin, time_type t);
template<typename System, typename StateInOut> void do_step_v1(System system, StateInOut & x, time_type t, time_type dt);
template<typename StateIn> bool resize_impl(const StateIn & x);
acceleration_type & get_current_acc(void);
const acceleration_type & get_current_acc(void) const;
acceleration_type & get_old_acc(void);
const acceleration_type & get_old_acc(void) const;
void toggle_current_acc(void);