4 #include <unordered_map>
15 csv_writer->initialize({
"iteration",
"var(t)"});
29 throw std::runtime_error(
30 "Particle container size changed during simulation. This is not supported by the diffusion function interceptor.");
48 std::string indent = std::string(depth * 2,
' ');
54 DiffusionFunctionInterceptor::operator std::string()
const {
return ""; }
64 double total_displacement = 0;
70 std::array<double, 3> displacement = particle.getX() - old_particle_position;
73 if (std::holds_alternative<SimulationParams::LinkedCellsType>(simulation.
params.
container_type)) {
75 auto& box_size = container.domain_size;
77 for (
size_t i = 0; i < displacement.size(); i++) {
78 if (std::abs(displacement[i]) > box_size[i] / 2) {
79 displacement[i] = box_size[i] - std::abs(displacement[i]);
86 total_displacement += distance;
const std::string ansi_end
const std::string ansi_orange_bold
double sample_every_x_percent
void saveCurrentParticlePositions(const Simulation &simulation)
void operator()(size_t iteration, Simulation &simulation) override
This function is called on every nth iteration. It counts the number of particle updates which have b...
std::unique_ptr< CSVWriter > csv_writer
void onSimulationEnd(size_t iteration, Simulation &simulation) override
This function is empty as the thermostat doesnt need to do anything at the end of the simulation.
void logSummary(int depth) const override
Logs the summary of the radial distribution function.
std::vector< std::array< double, 3 > > old_particle_positions
void onSimulationStart(Simulation &simulation) override
This function is sets the particle_updates to 0 and initializes the start time of the simulation.
double calculateCurrentDiffusion(const Simulation &simulation) const
size_t last_sampled_iteration
static std::shared_ptr< spdlog::logger > logger
Publically accessible shared pointer to the logger.
size_t every_nth_iteration
double delta_t
Time step of a single simulation iteration.
std::filesystem::path output_dir_path
Path to the directory in which to save the simulation output.
size_t start_iteration
Start iteration of the simulation.
std::variant< DirectSumType, LinkedCellsType > container_type
Type of the particle container.
double end_time
End time of the simulation.
Class to run a simulation.
std::unique_ptr< ParticleContainer > particle_container
Reference to the ParticleContainer on whose content the simulation is performed.
const SimulationParams & params
Reference to the simulation parameters object.
auto L2Norm(const Container &c)