Molecular Dynamics  v0.4
Project for the Practical hosted by the Scientific Computing Chair
HarmonicForce.h
Go to the documentation of this file.
1 //
2 // Created by daniel on 27.06.24.
3 //
4 
5 #pragma once
7 
8 
9 class HarmonicForce : public Force {
10 private:
11  double k;
12  double r0;
13 
14 public:
21  HarmonicForce(double k, double r0);
22 
32  std::array<double, 3> compute(Particle &target, Particle &source) override;
33 
39  std::array<double, 3> computeOptimized(Particle &target, Particle &source, std::array<double, 3> &difference,
40  double distance) override;
41 };
Interface representing the force that the source exerts on the target.
Definition: Force.h:14
Definition: HarmonicForce.h:9
std::array< double, 3 > compute(Particle &target, Particle &source) override
Actual computation of the harmonic force occurring.
Definition: HarmonicForce.cpp:9
HarmonicForce(double k, double r0)
Initialise the harmonic force. This force acts between neighbors in a membrane.
Definition: HarmonicForce.cpp:7
std::array< double, 3 > computeOptimized(Particle &target, Particle &source, std::array< double, 3 > &difference, double distance) override
We needed this to integrate our optimization in our code to prevent breaking the inheritance hierachy...
Definition: HarmonicForce.cpp:15
double r0
Definition: HarmonicForce.h:12
double k
Definition: HarmonicForce.h:11
Definition: Particle.h:16