PrevUpHomeNext

Class template velocity_verlet

boost::numeric::odeint::velocity_verlet — The Velocity-Verlet algorithm.

Synopsis

// 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;
};

Description

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.

Template Parameters

  1. typename Coor

    The type representing the coordinates.

  2. typename Velocity = Coor

    The type representing the velocities.

  3. typename Value = double

    The type value type.

  4. typename Acceleration = Coor

    The type representing the acceleration.

  5. typename Time = Value

    The time representing the independent variable - the time.

  6. typename TimeSq = Time

    The time representing the square of the time.

  7. typename Algebra = typename algebra_dispatcher< Coor >::algebra_type

    The algebra.

  8. typename Operations = typename operations_dispatcher< Coor >::operations_type

    The operations type.

  9. typename Resizer = initially_resizer

    The resizer policy type.

velocity_verlet public construct/copy/destruct

  1. velocity_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:

    algebra

    A copy of algebra is made and stored.

velocity_verlet public member functions

  1. order_type order(void) const;

    Returns:

    Returns the order of the stepper.

  2. template<typename System, typename StateInOut> 
      void do_step(System system, StateInOut & x, time_type t, time_type dt);
  3. template<typename System, typename StateInOut> 
      void do_step(System system, const StateInOut & x, time_type t, time_type dt);
  4. 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);
  5. template<typename StateIn> void adjust_size(const StateIn & x);
    Adjust the size of all temporaries in the stepper manually.

    Parameters:

    x

    A state from which the size of the temporaries to be resized is deduced.

  6. 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.
  7. template<typename AccelerationIn> void initialize(const AccelerationIn & ain);
  8. template<typename System, typename CoorIn, typename VelocityIn> 
      void initialize(System system, const CoorIn & qin, const VelocityIn & pin, 
                      time_type t);
  9. bool is_initialized(void) const;

    Returns:

    Returns if the stepper is initialized.

velocity_verlet private member functions

  1. template<typename System, typename CoorIn, typename VelocityIn> 
      void initialize_acc(System system, const CoorIn & qin, 
                          const VelocityIn & pin, time_type t);
  2. template<typename System, typename StateInOut> 
      void do_step_v1(System system, StateInOut & x, time_type t, time_type dt);
  3. template<typename StateIn> bool resize_impl(const StateIn & x);
  4. acceleration_type & get_current_acc(void);
  5. const acceleration_type & get_current_acc(void) const;
  6. acceleration_type & get_old_acc(void);
  7. const acceleration_type & get_old_acc(void) const;
  8. void toggle_current_acc(void);

PrevUpHomeNext