Implement total_force_particles
This commit is contained in:
parent
ad10bf1948
commit
c611fa70a2
@ -21,6 +21,7 @@
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
#include "PenningTrap.hpp"
|
#include "PenningTrap.hpp"
|
||||||
|
#include "constants.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@ -85,7 +86,21 @@ arma::vec PenningTrap::total_force_external(int i)
|
|||||||
|
|
||||||
arma::vec PenningTrap::total_force_particles(int i)
|
arma::vec PenningTrap::total_force_particles(int i)
|
||||||
{
|
{
|
||||||
|
Particle p = this->particles.at(i);
|
||||||
|
|
||||||
|
arma::vec::fixed<3> res;
|
||||||
|
|
||||||
|
for (int j=0; j < this->particles.size(); j++) {
|
||||||
|
if (i == j) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
res += this->force_on_particle(i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
res *= K_E*p.q/p.m;
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
arma::vec PenningTrap::total_force(int i)
|
arma::vec PenningTrap::total_force(int i)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user