Add Space class

The Space class handles the simulation space
This commit is contained in:
2023-10-29 20:50:54 -03:00
parent de4231f207
commit bec25fec40
7 changed files with 314 additions and 25 deletions

View File

@@ -15,9 +15,7 @@
#include <vector>
#include "Atom.hpp"
typedef std::function<double(double)> PotentialFunction;
typedef std::function<double(double)> ForceFunction;
#include "Potentials.hpp"
class System {
private:
@@ -28,8 +26,7 @@ private:
std::vector<double> forceTableOld; ///< Force table in the previous step
std::vector<double> potentialTable; ///< Potential table
ForceFunction forceGenerator; ///< Force generator
PotentialFunction potentialGenerator; ///< Potential generator
Potential *potential; ///< Potential function
double rcut; ///< Cutoff radius
double rcut2; ///< Cutoff radius squared
@@ -38,6 +35,8 @@ private:
double timeDelta = 0; ///< Time delta between steps
double lx, ly, lz; ///< Box size, if periodic boundary conditions are used
/**
* @brief Initialize the force and potential tables
*
@@ -50,12 +49,18 @@ private:
*/
void evaulateForces();
/**
* @brief Build the grid based on the cutoff radius.
*
* This function partitions the space into cells of size rcut x rcut x rcut.
*/
void buildGrid();
public:
explicit System(double timeDelta,
double rcut,
PotentialFunction potentialFunction,
ForceFunction forceFunction,
std::size_t tableResolution = 1000);
explicit System(double timeDelta,
double rcut,
Potential *potential,
std::size_t tableResolution = 1000);
void step();
@@ -84,4 +89,13 @@ public:
*
*/
void printAtoms();
/**
* @brief Set the simulation box size
*
* @param lx
* @param ly
* @param lz
*/
void setBoxSize(double lx, double ly, double lz);
};