ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
symplectic_euler_inline.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010-2025 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 "
rotation.hpp
"
26
27
/** Propagate the velocities and positions. Integration steps before force
28
* calculation of the Symplectic Euler integrator: <br> \f[ v(t+\Delta t) =
29
* v(t) + \Delta t f(t)/m \f] <br> \f[ p(t+\Delta t) = p(t) + \Delta t
30
* v(t+\Delta t) \f]
31
*/
32
inline
void
symplectic_euler_propagator_1
(
Particle
&p,
double
time_step) {
33
for
(
unsigned
int
j
= 0;
j
< 3;
j
++) {
34
if
(!p.
is_fixed_along
(
j
)) {
35
/* Propagate velocities: v(t+dt) = v(t) + dt * a(t) */
36
p.
v
()[
j
] += time_step * p.
force
()[
j
] / p.
mass
();
37
38
/* Propagate positions: p(t + dt) = p(t) + dt * v(t+dt) */
39
p.
pos
()[
j
] += time_step * p.
v
()[
j
];
40
}
41
}
42
}
43
44
/** Final integration step of the Symplectic Euler integrator
45
* For symplectic Euler, there is no second step as all updates
46
* are done in step 1.
47
*/
48
inline
void
symplectic_euler_propagator_2
(
Particle
&,
double
) {
49
// No second step needed for symplectic Euler
50
// All propagation is done in step 1
51
}
52
53
#ifdef ESPRESSO_ROTATION
54
inline
void
symplectic_euler_rotator_1
(
Particle
&p,
double
time_step) {
55
if
(p.
can_rotate
()) {
56
// For rotation, we also use symplectic Euler scheme
57
// Update angular velocity first, then orientation
58
convert_torque_propagate_omega
(p, time_step);
59
propagate_omega_quat_particle
(p, time_step);
60
}
61
}
62
63
inline
void
symplectic_euler_rotator_2
(
Particle
&,
double
) {
64
// No second step needed for symplectic Euler rotation
65
}
66
#endif
// ESPRESSO_ROTATION
Particle.hpp
stream
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Definition
common_cuda.cu:34
config.hpp
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:450
Particle::can_rotate
bool can_rotate() const
Definition
Particle.hpp:515
Particle::mass
auto const & mass() const
Definition
Particle.hpp:507
Particle::v
auto const & v() const
Definition
Particle.hpp:488
Particle::pos
auto const & pos() const
Definition
Particle.hpp:486
Particle::is_fixed_along
bool is_fixed_along(unsigned int const axis) const
Definition
Particle.hpp:633
Particle::force
auto const & force() const
Definition
Particle.hpp:490
symplectic_euler_rotator_2
void symplectic_euler_rotator_2(Particle &, double)
Definition
symplectic_euler_inline.hpp:63
symplectic_euler_rotator_1
void symplectic_euler_rotator_1(Particle &p, double time_step)
Definition
symplectic_euler_inline.hpp:54
symplectic_euler_propagator_2
void symplectic_euler_propagator_2(Particle &, double)
Final integration step of the Symplectic Euler integrator For symplectic Euler, there is no second st...
Definition
symplectic_euler_inline.hpp:48
symplectic_euler_propagator_1
void symplectic_euler_propagator_1(Particle &p, double time_step)
Propagate the velocities and positions.
Definition
symplectic_euler_inline.hpp:32
src
core
integrators
symplectic_euler_inline.hpp
Generated on Mon Dec 8 2025 02:32:29 for ESPResSo by
1.9.8