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
"
26
#include "
cell_system/CellStructure.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
*/
34
inline
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
*/
50
inline
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
60
inline
void
velocity_verlet_rotator_1
(
Particle
&p,
double
time_step) {
61
if
(p.
can_rotate
())
62
propagate_omega_quat_particle
(p, time_step);
63
}
64
65
inline
void
velocity_verlet_rotator_2
(
Particle
&p,
double
time_step) {
66
if
(p.
can_rotate
())
67
convert_torque_propagate_omega
(p, time_step);
68
}
69
#endif
// ROTATION
CellStructure.hpp
ParticleRange.hpp
Particle.hpp
config.hpp
This file contains the defaults for ESPResSo.
propagate_omega_quat_particle
void propagate_omega_quat_particle(Particle &p, double time_step)
See .
Definition
rotation.cpp:125
convert_torque_propagate_omega
void convert_torque_propagate_omega(Particle &p, double time_step)
Definition
rotation.cpp:159
rotation.hpp
This file contains all subroutines required to process rotational motion.
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:395
Particle::can_rotate
bool can_rotate() const
Definition
Particle.hpp:460
Particle::mass
auto const & mass() const
Definition
Particle.hpp:452
Particle::v
auto const & v() const
Definition
Particle.hpp:433
Particle::pos
auto const & pos() const
Definition
Particle.hpp:431
Particle::is_fixed_along
bool is_fixed_along(unsigned int const axis) const
Definition
Particle.hpp:542
Particle::force
auto const & force() const
Definition
Particle.hpp:435
velocity_verlet_rotator_1
void velocity_verlet_rotator_1(Particle &p, double time_step)
Definition
velocity_verlet_inline.hpp:60
velocity_verlet_propagator_2
void velocity_verlet_propagator_2(Particle &p, double time_step)
Final integration step of the Velocity Verlet integrator.
Definition
velocity_verlet_inline.hpp:50
velocity_verlet_propagator_1
void velocity_verlet_propagator_1(Particle &p, double time_step)
Propagate the velocities and positions.
Definition
velocity_verlet_inline.hpp:34
velocity_verlet_rotator_2
void velocity_verlet_rotator_2(Particle &p, double time_step)
Definition
velocity_verlet_inline.hpp:65
src
core
integrators
velocity_verlet_inline.hpp
Generated on Fri Nov 8 2024 02:12:53 for ESPResSo by
1.9.8