Add Maxwell-Boltzmann method for velocities

This commit is contained in:
2023-10-29 20:50:54 -03:00
parent 94da4cd500
commit de4231f207
7 changed files with 149 additions and 25 deletions

View File

@@ -11,33 +11,58 @@
#pragma once
#include <functional>
#include <vector>
#include "Atom.hpp"
typedef std::function<double(double)> PotentialFunction;
typedef std::function<double(double)> ForceFunction;
class System {
private:
std::vector<Atom> atoms; ///< Atoms in the system
std::vector<Atom> atomsOld; ///< Atoms in the system in the previous step
std::vector<double> forceTable; ///< Force table
std::vector<double> forceTableOld; ///< Force table in the previous step
std::vector<double> potentialTable; ///< Potential table
ForceFunction forceGenerator; ///< Force generator
PotentialFunction potentialGenerator; ///< Potential generator
double rcut; ///< Cutoff radius
double rcut2; ///< Cutoff radius squared
std::size_t tableResolution = 1000; ///< Resolution of the force table
double timeDelta = 0; ///< Time delta between steps
/**
* @brief Initialize the force table
* @brief Initialize the force and potential tables
*
*/
void initForceTable();
void initTables();
/**
* @brief Initialize the potential table
* @brief Evaluate interaction forces between atoms
*
*/
void initPotentialTable();
void evaulateForces();
public:
explicit System(double timeDelta);
explicit System(double timeDelta,
double rcut,
PotentialFunction potentialFunction,
ForceFunction forceFunction,
std::size_t tableResolution = 1000);
void step();
/**
* @brief Step the system to the first step using euler method
*
*/
void stepFirst();
/**