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 */
32inline 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 */
49 // No second step needed for symplectic Euler
50 // All propagation is done in step 1
51}
52
53#ifdef ESPRESSO_ROTATION
54inline 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
60 }
61}
62
63inline void symplectic_euler_rotator_2(Particle &, double) {
64 // No second step needed for symplectic Euler rotation
65}
66#endif // ESPRESSO_ROTATION
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
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:450
bool can_rotate() const
Definition Particle.hpp:515
auto const & mass() const
Definition Particle.hpp:507
auto const & v() const
Definition Particle.hpp:488
auto const & pos() const
Definition Particle.hpp:486
bool is_fixed_along(unsigned int const axis) const
Definition Particle.hpp:633
auto const & force() const
Definition Particle.hpp:490
void symplectic_euler_rotator_2(Particle &, double)
void symplectic_euler_rotator_1(Particle &p, double time_step)
void symplectic_euler_propagator_2(Particle &, double)
Final integration step of the Symplectic Euler integrator For symplectic Euler, there is no second st...
void symplectic_euler_propagator_1(Particle &p, double time_step)
Propagate the velocities and positions.