32 std::string indent = std::string(depth * 2,
' ');
39 RadialDistributionFunctionInterceptor::operator std::string()
const {
40 return fmt::format(
"RadialDistributionFunction: bin_width={}, sample_every_x_percent={}", bin_width, sample_every_x_percent);
45 double bin_end = (bin_index + 1) *
bin_width;
47 double bin_volume = 4.0 / 3.0 * M_PI * (std::pow(bin_end, 3) - std::pow(bin_start, 3));
49 return N / bin_volume;
53 std::map<size_t, size_t> samples_per_bin_index;
56 auto& particle = *it1;
58 auto& other_particle = *it2;
60 if (particle == other_particle)
continue;
64 size_t bin_index = std::floor(distance /
bin_width);
65 samples_per_bin_index[bin_index]++;
69 if (samples_per_bin_index.rbegin() != samples_per_bin_index.rend()) {
70 for (
size_t i = 0; i <= samples_per_bin_index.rbegin()->first; i++) {
71 if (samples_per_bin_index.find(i) == samples_per_bin_index.end()) {
72 samples_per_bin_index[i] = 0;
77 for (
auto& [bin_index, samples] : samples_per_bin_index) {
const std::string ansi_end
const std::string ansi_orange_bold
static std::shared_ptr< spdlog::logger > logger
Publically accessible shared pointer to the logger.
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...
double sample_every_x_percent
void logSummary(int depth) const override
Logs the summary of the radial distribution function.
void onSimulationStart(Simulation &simulation) override
This function is sets the particle_updates to 0 and initializes the start time of the simulation.
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.
double calculateLocalDensity(size_t N, size_t bin_index) const
std::unique_ptr< CSVWriter > csv_writer
void saveCurrentRadialDistribution(size_t iteration, Simulation &simulation)
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.
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.
std::string to_string(const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"})
auto L2Norm(const Container &c)