ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
velocity_verlet_inline.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "config/config.hpp"
23
24#include "Particle.hpp"
25#include "ParticleRange.hpp"
27#include "rotation.hpp"
28
29/** Propagate the velocities and positions. Integration steps before force
30 * calculation of the Velocity Verlet integrator: <br> \f[ v(t+0.5 \Delta t) =
31 * v(t) + 0.5 \Delta t f(t)/m \f] <br> \f[ p(t+\Delta t) = p(t) + \Delta t
32 * v(t+0.5 \Delta t) \f]
33 */
34inline void velocity_verlet_propagator_1(Particle &p, double time_step) {
35 for (unsigned int j = 0; j < 3; j++) {
36 if (!p.is_fixed_along(j)) {
37 /* Propagate velocities: v(t+0.5*dt) = v(t) + 0.5 * dt * a(t) */
38 p.v()[j] += 0.5 * time_step * p.force()[j] / p.mass();
39
40 /* Propagate positions (only NVT): p(t + dt) = p(t) + dt *
41 * v(t+0.5*dt) */
42 p.pos()[j] += time_step * p.v()[j];
43 }
44 }
45}
46
47/** Final integration step of the Velocity Verlet integrator
48 * \f[ v(t+\Delta t) = v(t+0.5 \Delta t) + 0.5 \Delta t f(t+\Delta t)/m \f]
49 */
50inline void velocity_verlet_propagator_2(Particle &p, double time_step) {
51 for (unsigned int j = 0; j < 3; j++) {
52 if (!p.is_fixed_along(j)) {
53 /* Propagate velocity: v(t+dt) = v(t+0.5*dt) + 0.5*dt * a(t+dt) */
54 p.v()[j] += 0.5 * time_step * p.force()[j] / p.mass();
55 }
56 }
57}
58
59#ifdef ROTATION
60inline void velocity_verlet_rotator_1(Particle &p, double time_step) {
61 if (p.can_rotate())
63}
64
65inline void velocity_verlet_rotator_2(Particle &p, double time_step) {
66 if (p.can_rotate())
68}
69#endif // ROTATION
This file contains the defaults for ESPResSo.
void propagate_omega_quat_particle(Particle &p, double time_step)
See .
Definition rotation.cpp:125
void convert_torque_propagate_omega(Particle &p, double time_step)
Definition rotation.cpp:159
This file contains all subroutines required to process rotational motion.
Struct holding all information for one particle.
Definition Particle.hpp:395
bool can_rotate() const
Definition Particle.hpp:460
auto const & mass() const
Definition Particle.hpp:452
auto const & v() const
Definition Particle.hpp:433
auto const & pos() const
Definition Particle.hpp:431
bool is_fixed_along(unsigned int const axis) const
Definition Particle.hpp:542
auto const & force() const
Definition Particle.hpp:435
void velocity_verlet_rotator_1(Particle &p, double time_step)
void velocity_verlet_propagator_2(Particle &p, double time_step)
Final integration step of the Velocity Verlet integrator.
void velocity_verlet_propagator_1(Particle &p, double time_step)
Propagate the velocities and positions.
void velocity_verlet_rotator_2(Particle &p, double time_step)