forked from andeplane/molecular-dynamics-fys3150
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsystem.h
44 lines (40 loc) · 1.39 KB
/
system.h
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
#ifndef SYSTEM_H
#define SYSTEM_H
#include "atom.h"
#include "math/vec3.h"
#include <vector>
class Potential; class Integrator;
using std::vector;
class System
{
private:
vec3 m_systemSize;
vector<Atom*> m_atoms;
Potential* m_potential = nullptr;
Integrator* m_integrator = nullptr;
double m_time = 0;
int m_steps = 0;
public:
System();
~System();
void resetForcesOnAllAtoms();
void createFCCLattice(int numberOfUnitCellsEachDimension, double latticeConstant, double temperature);
void applyPeriodicBoundaryConditions();
void removeTotalMomentum();
void calculateForces();
void step(double dt);
// Setters and getters
vector<Atom *>& atoms() { return m_atoms; } // Returns a reference to the std::vector of atom pointers
vec3 systemSize() { return m_systemSize; }
void setSystemSize(vec3 systemSize) { m_systemSize = systemSize; }
Potential *potential() { return m_potential; }
void setPotential(Potential *potential) { m_potential = potential; }
double time() { return m_time; }
void setTime(double time) { m_time = time; }
Integrator *integrator() { return m_integrator; }
void setIntegrator(Integrator *integrator) { m_integrator = integrator; }
int steps() { return m_steps; }
void setSteps(int steps) { m_steps = steps; }
double volume() { return m_systemSize[0]*m_systemSize[1]*m_systemSize[2]; }
};
#endif