-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiteration.hpp
50 lines (38 loc) · 1.55 KB
/
iteration.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef ITERATION_HPP
#define ITERATION_HPP
#include "particle.hpp"
// ABPs
void iterate_ABP_WCA(System* system, int Niter);
// Updates system to next step according to the dynamics of active Brownian
// particles with WCA potential, using custom dimensionless parameters
// relations.
void iterate_ABP_WCA(System0* system, int Niter);
// Updates system to next step according to the dynamics of active Brownian
// particles with WCA potential.
// ROTORS
void iterate_rotors(Rotors* rotors, int Niter);
// Updates system to next step according to the dynamics of interacting
// Brownian rotors.
// FUNCTIONS
template<class SystemClass> void ABP_WCA(SystemClass* system) {
// Compute interactions with WCA potentials between all particles of the
// system.
pairs_ABP<SystemClass>(system,
[&system](int index1, int index2) { system->WCA_force(index1, index2); });
}
template<class SystemClass, typename F, typename G> void aligningTorque(
SystemClass* system, F getOrientation, G getTorque) {
// Compute aligning torques between all particles of the system given a
// function returning a pointer to the orientation and an other to the applied
// torque on a particle specified by its index.
double torque;
for (int i=0; i < system->getNumberParticles(); i++) {
for (int j=i + 1; j < system->getNumberParticles(); j++) {
torque = 2.0*system->getTorqueParameter()/system->getNumberParticles()
*sin(getOrientation(i)[0] - getOrientation(j)[0]);
getTorque(i)[0] += torque;
getTorque(j)[0] -= torque;
}
}
}
#endif