38 std::vector<Particle> particles;
43 double maxDisplacement;
48 int cellListUpdateFrequency;
49 std::vector<CellListNode*> cellList;
79Simulation(
const SimulationBox &box,
PotentialType potentialType,
SimulationType simtype,
double temperature,
int numParticles,
double maxDisplacement,
double r2cut,
float f_prime,
double mu,
unsigned int seed,
bool useCellList,
int cellListUpdateFrequency);
146 void run(
int numSteps,
int equilibrationTime,
int outputFrequency,
Logging &logger);
Manages logging of simulation data to files.
Definition logging.h:13
Manages the 2D simulation box, including periodic boundary conditions.
Definition initial.h:31
Manages the entire simulation process, including initialization, running the simulation,...
Definition simulation.h:35
int getNumParticles() const
Gets the number of particles in the simulation.
Definition simulation.cpp:309
void run(int numSteps, int equilibrationTime, int outputFrequency, Logging &logger)
Run the simulation.
Definition simulation.cpp:271
double calculatePressure() const
Calculates the pressure of the system using the virial theorem.
Definition simulation.cpp:411
double computeEnergy()
Calculates and updates the total energy of the system.
Definition simulation.cpp:243
double getPressure() const
Gets the pressure in the simulation.
Definition simulation.cpp:425
void clearCellList()
Clears the current cell list.
Definition simulation.cpp:319
double getEnergy() const
Gets the current energy of the system.
Definition simulation.cpp:305
void initializeParticles(bool randomPlacement)
Initializes particles in the simulation box.
Definition simulation.cpp:46
bool monteCarloMove()
Perform a single Monte Carlo move.
Definition simulation.cpp:77
double getTemperature() const
Gets the temperature in the simulation.
Definition simulation.cpp:314
bool monteCarloAddRemove()
Attempt to exchange a particle with a resorvoir.
Definition simulation.cpp:134
double tail_correction_energy_2d() const
Calculate tail correction for internal energy in 2D.
Definition simulation.cpp:439
double computeTotalForce() const
Computes the interaction forces of all particles.
Definition simulation.cpp:388
double energy
Definition simulation.h:57
void setParticlePosition(size_t index, double x, double y)
Sets the position of a specific particle.
Definition simulation.cpp:60
void buildCellList()
Definition simulation.cpp:333
void removeParticleFromCellList(int particleIndex, int cellIndex)
remove a particle from cell list.
Definition simulation.cpp:499
double tail_correction_pressure_2d() const
Calculate tail correction for pressure in 2D.
Definition simulation.cpp:473
double computeLocalEnergy(int particleIndex) const
Computes the interaction energy of a particle with particles in its cell and neighboring cells.
Definition simulation.cpp:350
Simulation(const SimulationBox &box, PotentialType potentialType, SimulationType simtype, double temperature, int numParticles, double maxDisplacement, double r2cut, float f_prime, double mu, unsigned int seed, bool useCellList, int cellListUpdateFrequency)
Constructs a Simulation object with the specified parameters.
Definition simulation.cpp:23
PotentialType
Enumeration of available potential types.
Definition potential.h:11
SimulationType selectSimulationType(const std::string &simulationName)
Selects the simulation type based on a string input.
Definition simulation.cpp:381
SimulationType
Definition simulation.h:17
Definition simulation.h:8
CellListNode * next
Pointer to the next node in the linked list.
Definition simulation.h:10
int particleIndex
Index of the particle in the particles vector.
Definition simulation.h:9
CellListNode(int idx)
Definition simulation.h:12