ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
System::System Class Reference

Main system class. More...

#include <System.hpp>

+ Inheritance diagram for System::System:
+ Collaboration diagram for System::System:

Public Member Functions

 System (Private)
 
auto get_time_step () const
 Get time_step.
 
void set_time_step (double value)
 Set time_step.
 
auto get_sim_time () const
 Get sim_time.
 
void set_sim_time (double value)
 Set sim_time.
 
auto get_force_cap () const
 Get force_cap.
 
void set_force_cap (double value)
 Set force_cap.
 
auto get_min_global_cut () const
 Get min_global_cut.
 
void set_min_global_cut (double value)
 Set min_global_cut.
 
void set_box_l (Utils::Vector3d const &box_l)
 Change the box dimensions.
 
void tune_verlet_skin (double min_skin, double max_skin, double tol, int int_steps, bool adjust_max_skin)
 Tune the Verlet skin.
 
void set_cell_structure_topology (CellStructureType topology)
 Change cell structure topology.
 
void rebuild_cell_structure ()
 Rebuild cell lists.
 
double maximal_cutoff () const
 Calculate the maximal cutoff of all interactions.
 
double get_interaction_range () const
 Get the interaction range.
 
unsigned get_global_ghost_flags () const
 Returns the ghost flags required for running pair kernels for the global state, e.g.
 
bool long_range_interactions_sanity_checks () const
 Check electrostatic and magnetostatic methods are properly initialized.
 
std::shared_ptr< Observable_statcalculate_energy ()
 Calculate the total energy.
 
std::shared_ptr< Observable_statcalculate_pressure ()
 Calculate the pressure from a virial expansion.
 
void calculate_forces ()
 Calculate all forces.
 
void calculate_long_range_fields ()
 Calculate dipole fields.
 
double particle_short_range_energy_contribution (int pid)
 Compute the short-range energy of a particle.
 
int integrate (int n_steps, int reuse_forces)
 Integrate equations of motion.
 
int integrate_with_signal_handler (int n_steps, int reuse_forces, bool update_accumulators)
 
void thermostat_force_init ()
 Calculate initial particle forces from active thermostats.
 
void lb_couple_particles (double time_step)
 Calculate particle-lattice interactions.
 
void update_dependent_particles ()
 Update particles with properties depending on other particles, namely virtual sites and ICC charges.
 
void update_used_propagations ()
 Update the global propagation bitmask.
 
void check_kT (double value) const
 Veto temperature change.
 
Hook procedures

These procedures are called if several significant changes to the system happen which may make a reinitialization of subsystems necessary.

void on_boxl_change (bool skip_method_adaption=false)
 Called when the box length has changed.
 
void on_node_grid_change ()
 
void on_periodicity_change ()
 
void on_cell_structure_change ()
 
void on_thermostat_param_change ()
 
void on_temperature_change ()
 
void on_verlet_skin_change ()
 
void on_timestep_change ()
 
void on_integration_start ()
 
void on_short_range_ia_change ()
 
void on_non_bonded_ia_change ()
 
void on_coulomb_change ()
 
void on_dipoles_change ()
 
void on_constraint_change ()
 Called every time a constraint is changed.
 
void on_lb_boundary_conditions_change ()
 Called when the LB boundary conditions change (geometry, slip velocity, or both).
 
void on_particle_local_change ()
 Called every time a particle local property changes.
 
void on_particle_change ()
 Called every time a particle property changes.
 
void on_particle_charge_change ()
 Called every time a particle charge changes.
 
void on_observable_calc ()
 called before calculating observables, i.e.
 
void veto_boxl_change (bool skip_particle_checks=false) const
 

Static Public Member Functions

static std::shared_ptr< Systemcreate ()
 

Public Attributes

GpuParticleData gpu
 
ResourceCleanup cleanup_queue
 
Coulomb::Solver coulomb
 
Dipoles::Solver dipoles
 
LB::Solver lb
 
EK::Solver ek
 
std::shared_ptr< BoxGeometrybox_geo
 
std::shared_ptr< LocalBoxlocal_geo
 
std::shared_ptr< CellStructurecell_structure
 
std::shared_ptr< Propagationpropagation
 
std::shared_ptr< InteractionsNonBondednonbonded_ias
 
std::shared_ptr< Thermostat::Thermostatthermostat
 
std::shared_ptr< ComFixedcomfixed
 
std::shared_ptr< Galileigalilei
 
std::shared_ptr< BondBreakage::BondBreakagebond_breakage
 
std::shared_ptr< LeesEdwards::LeesEdwardslees_edwards
 

Protected Member Functions

void update_local_geo ()
 
void update_icc_particles ()
 

Protected Attributes

bool reinit_thermo
 Whether the thermostat has to be reinitialized before integration.
 
double time_step
 Molecular dynamics integrator time step.
 
double sim_time
 Molecular dynamics integrator simulation time.
 
double force_cap
 Molecular dynamics integrator force capping.
 
double min_global_cut
 Minimal global interaction cutoff.
 

Detailed Description

Main system class.

Most components follow the composite pattern and the opaque pointer pattern. See System class design for more details.

Definition at line 65 of file core/system/System.hpp.

Constructor & Destructor Documentation

◆ System()

System::System::System ( Private  )

Definition at line 66 of file core/system/System.cpp.

References INACTIVE_CUTOFF.

Member Function Documentation

◆ calculate_energy()

◆ calculate_forces()

◆ calculate_long_range_fields()

void System::System::calculate_long_range_fields ( )

Calculate dipole fields.

Definition at line 141 of file energy.cpp.

Referenced by Observables::ParticleDipoleFields::evaluate().

◆ calculate_pressure()

◆ check_kT()

void System::System::check_kT ( double  value) const

Veto temperature change.

Definition at line 120 of file core/system/System.cpp.

◆ create()

std::shared_ptr< System > System::System::create ( )
static

◆ get_force_cap()

auto System::System::get_force_cap ( ) const
inline

Get force_cap.

Definition at line 93 of file core/system/System.hpp.

◆ get_global_ghost_flags()

unsigned System::System::get_global_ghost_flags ( ) const

Returns the ghost flags required for running pair kernels for the global state, e.g.

the force calculation.

Returns
Required data parts;

Definition at line 462 of file core/system/System.cpp.

References collision_params, Cells::DATA_PART_BONDS, Cells::DATA_PART_MOMENTUM, Cells::DATA_PART_POSITION, Cells::DATA_PART_PROPERTIES, OFF, THERMO_BOND, and THERMO_DPD.

◆ get_interaction_range()

double System::System::get_interaction_range ( ) const

Get the interaction range.

Definition at line 395 of file core/system/System.cpp.

References INACTIVE_CUTOFF.

◆ get_min_global_cut()

auto System::System::get_min_global_cut ( ) const
inline

Get min_global_cut.

Definition at line 99 of file core/system/System.hpp.

◆ get_sim_time()

auto System::System::get_sim_time ( ) const
inline

Get sim_time.

Definition at line 87 of file core/system/System.hpp.

◆ get_time_step()

auto System::System::get_time_step ( ) const
inline

◆ integrate()

int System::System::integrate ( int  n_steps,
int  reuse_forces 
)

Integrate equations of motion.

Parameters
n_stepsNumber of integration steps, can be zero
reuse_forcesDecide when to re-calculate forces

This function calls two hooks for propagation kernels such as velocity verlet, velocity verlet + npt box changes, and steepest_descent. One hook is called before and one after the force calculation. It is up to the propagation kernels to increment the simulation time.

This function propagates the system according to the choice of integrator stored in Propagation::integ_switch. The general structure is:

  • if reuse_forces is zero, recalculate the forces based on the current state of the system
  • Loop over the number of simulation steps:
    1. initialization (e.g., RATTLE)
    2. First hook for propagation kernels
    3. Update dependent particles and properties (RATTLE, virtual sites)
    4. Calculate forces for the current state of the system. This includes forces added by the Langevin thermostat and the Lattice-Boltzmann-particle coupling
    5. Second hook for propagation kernels
    6. Update dependent properties (Virtual sites, RATTLE)
    7. Run single step algorithms (Lattice-Boltzmann propagation, collision detection, NpT update)
  • Final update of dependent properties and statistics/counters

High-level documentation of the integration and thermostatting schemes can be found in doc/sphinx/system_setup.rst and /doc/sphinx/running.rst

Returns
number of steps that have been integrated, or a negative error code

Definition at line 435 of file integrate.cpp.

References bonded_ia_params, check_runtime_errors(), comm_cart, convert_initial_torques(), correct_position_shake(), correct_velocity_shake(), Cells::DATA_PART_PROPERTIES, BondedInteractionsMap::get_n_rigid_bonds(), handle_collisions(), INTEG_ERROR_RUNTIME, INTEG_ERROR_SIGINT, INTEG_METHOD_BD, INTEG_METHOD_NPT_ISO, INTEG_METHOD_STEEPEST_DESCENT, INTEG_REUSE_FORCES_ALWAYS, INTEG_REUSE_FORCES_NEVER, integrator_step_1(), integrator_step_2(), lb_tracers_add_particle_force_to_fluid(), lb_tracers_propagate(), LEES_EDWARDS, Cells::RESORT_LOCAL, resort_particles_if_needed(), PropagationMode::ROT_VS_RELATIVE, runtimeErrorMsg, save_old_position(), synchronize_npt_state(), PropagationMode::TRANS_LB_MOMENTUM_EXCHANGE, PropagationMode::TRANS_LB_TRACER, PropagationMode::TRANS_VS_RELATIVE, and vs_relative_update_particles().

Referenced by run_full_force_calc(), and time_calc().

◆ integrate_with_signal_handler()

int System::System::integrate_with_signal_handler ( int  n_steps,
int  reuse_forces,
bool  update_accumulators 
)

◆ lb_couple_particles()

void System::System::lb_couple_particles ( double  time_step)

Calculate particle-lattice interactions.

Definition at line 307 of file particle_coupling.cpp.

References LB::is_tracer(), LB::lb_coupling_sanity_checks(), and runtimeErrorMsg.

◆ long_range_interactions_sanity_checks()

bool System::System::long_range_interactions_sanity_checks ( ) const

Check electrostatic and magnetostatic methods are properly initialized.

Returns
true if sanity checks failed.

Definition at line 380 of file core/system/System.cpp.

References runtimeErrorMsg.

◆ maximal_cutoff()

double System::System::maximal_cutoff ( ) const

Calculate the maximal cutoff of all interactions.

Definition at line 360 of file core/system/System.cpp.

References collision_detection_cutoff(), communicator, INACTIVE_CUTOFF, and maximal_cutoff_bonded().

◆ on_boxl_change()

void System::System::on_boxl_change ( bool  skip_method_adaption = false)

Called when the box length has changed.

This routine is relatively fast, and changing the box length every time step as for example necessary for NpT is more or less ok.

Parameters
skip_method_adaptionskip the long-range methods adaptions

Definition at line 159 of file core/system/System.cpp.

References Constraints::constraints.

Referenced by velocity_verlet_npt_propagate_pos().

◆ on_cell_structure_change()

void System::System::on_cell_structure_change ( )

Definition at line 223 of file core/system/System.cpp.

References clear_particle_node().

◆ on_constraint_change()

void System::System::on_constraint_change ( )

Called every time a constraint is changed.

Definition at line 284 of file core/system/System.cpp.

◆ on_coulomb_change()

void System::System::on_coulomb_change ( )

Definition at line 270 of file core/system/System.cpp.

Referenced by CoulombTuningAlgorithm::on_solver_change().

◆ on_dipoles_change()

void System::System::on_dipoles_change ( )

Definition at line 277 of file core/system/System.cpp.

Referenced by DipolarTuningAlgorithm::on_solver_change().

◆ on_integration_start()

◆ on_lb_boundary_conditions_change()

void System::System::on_lb_boundary_conditions_change ( )

Called when the LB boundary conditions change (geometry, slip velocity, or both).

Definition at line 286 of file core/system/System.cpp.

Referenced by ScriptInterface::walberla::LBFluid::do_call_method().

◆ on_node_grid_change()

void System::System::on_node_grid_change ( )

Definition at line 191 of file core/system/System.cpp.

◆ on_non_bonded_ia_change()

◆ on_observable_calc()

void System::System::on_observable_calc ( )

called before calculating observables, i.e.

energy, pressure or the integrator (forces). Initialize any methods here which are not initialized immediately (P3M etc.).

Definition at line 337 of file core/system/System.cpp.

References clear_particle_node().

◆ on_particle_change()

◆ on_particle_charge_change()

void System::System::on_particle_charge_change ( )

Called every time a particle charge changes.

Definition at line 313 of file core/system/System.cpp.

◆ on_particle_local_change()

void System::System::on_particle_local_change ( )

Called every time a particle local property changes.

Definition at line 290 of file core/system/System.cpp.

Referenced by ReactionMethods::ReactionAlgorithm::make_reaction_attempt().

◆ on_periodicity_change()

void System::System::on_periodicity_change ( )

Definition at line 204 of file core/system/System.cpp.

References INTEG_METHOD_SD, runtimeErrorMsg, and u.

◆ on_short_range_ia_change()

void System::System::on_short_range_ia_change ( )

Definition at line 259 of file core/system/System.cpp.

◆ on_temperature_change()

void System::System::on_temperature_change ( )

Definition at line 248 of file core/system/System.cpp.

◆ on_thermostat_param_change()

◆ on_timestep_change()

void System::System::on_timestep_change ( )

Definition at line 253 of file core/system/System.cpp.

◆ on_verlet_skin_change()

void System::System::on_verlet_skin_change ( )

Definition at line 237 of file core/system/System.cpp.

◆ particle_short_range_energy_contribution()

double System::System::particle_short_range_energy_contribution ( int  pid)

Compute the short-range energy of a particle.

Iterate through particles inside cell and neighboring cells and compute energy contribution for a specific particle.

Parameters
pidParticle id
Returns
Non-bonded energy of the particle.

Definition at line 115 of file energy.cpp.

References calc_non_bonded_pair_energy(), do_nonbonded(), and get_ptr().

◆ rebuild_cell_structure()

void System::System::rebuild_cell_structure ( )

Rebuild cell lists.

Use e.g. after a skin change.

Definition at line 155 of file core/system/System.cpp.

◆ set_box_l()

void System::System::set_box_l ( Utils::Vector3d const &  box_l)

Change the box dimensions.

Definition at line 402 of file core/system/System.cpp.

◆ set_cell_structure_topology()

void System::System::set_cell_structure_topology ( CellStructureType  topology)

Change cell structure topology.

Definition at line 139 of file core/system/System.cpp.

References HYBRID, NSQUARE, and REGULAR.

◆ set_force_cap()

void System::System::set_force_cap ( double  value)

Set force_cap.

Definition at line 129 of file core/system/System.cpp.

◆ set_min_global_cut()

void System::System::set_min_global_cut ( double  value)

Set min_global_cut.

Definition at line 134 of file core/system/System.cpp.

◆ set_sim_time()

void System::System::set_sim_time ( double  value)

Set sim_time.

Definition at line 765 of file integrate.cpp.

◆ set_time_step()

void System::System::set_time_step ( double  value)

Set time_step.

Definition at line 107 of file core/system/System.cpp.

◆ thermostat_force_init()

void System::System::thermostat_force_init ( )

Calculate initial particle forces from active thermostats.

Definition at line 313 of file integrate.cpp.

References convert_vector_body_to_space(), friction_thermo_langevin(), friction_thermo_langevin_rotation(), PropagationMode::ROT_LANGEVIN, and PropagationMode::TRANS_LANGEVIN.

◆ tune_verlet_skin()

void System::System::tune_verlet_skin ( double  min_skin,
double  max_skin,
double  tol,
int  int_steps,
bool  adjust_max_skin 
)

Tune the Verlet skin.

Choose the optimal Verlet list skin between min_skin and max_skin by bisection to tolerance tol.

Definition at line 128 of file tuning.cpp.

References time_calc().

◆ update_dependent_particles()

void System::System::update_dependent_particles ( )

Update particles with properties depending on other particles, namely virtual sites and ICC charges.

Definition at line 319 of file core/system/System.cpp.

References immersed_boundaries, ImmersedBoundaries::init_volume_conservation(), and vs_relative_update_particles().

◆ update_icc_particles()

void System::System::update_icc_particles ( )
protected

Definition at line 291 of file icc.cpp.

References get_ptr().

◆ update_local_geo()

void System::System::update_local_geo ( )
protected

◆ update_used_propagations()

void System::System::update_used_propagations ( )

Update the global propagation bitmask.

Definition at line 181 of file integrate.cpp.

References comm_cart, PropagationMode::NONE, and PropagationMode::SYSTEM_DEFAULT.

◆ veto_boxl_change()

void System::System::veto_boxl_change ( bool  skip_particle_checks = false) const

Definition at line 177 of file core/system/System.cpp.

References comm_cart, and Constraints::constraints.

Member Data Documentation

◆ bond_breakage

std::shared_ptr<BondBreakage::BondBreakage> System::System::bond_breakage

◆ box_geo

std::shared_ptr<BoxGeometry> System::System::box_geo

Definition at line 265 of file core/system/System.hpp.

Referenced by angular_momentum(), calc_part_distribution(), calc_re(), calc_rg(), calc_rh(), Galilei::calc_system_cms_position(), CoulombTuningAlgorithm::calculate_accuracy(), DipolarTuningAlgorithm::calculate_accuracy(), center_of_mass(), ClusterAnalysis::Cluster::center_of_mass_subcluster(), TuningAlgorithm::commit(), PairCriteria::DistanceCriterion::decide(), PairCriteria::EnergyCriterion::decide(), CoulombTuningAlgorithm::determine_mesh_limits(), TuningAlgorithm::determine_r_cut_limits(), ScriptInterface::walberla::LBFluid::do_call_method(), ScriptInterface::walberla::LatticeWalberla::do_construct(), dpd_stress(), draw_polymer_positions(), Observables::BondAngles::evaluate(), Observables::BondDihedrals::evaluate(), Observables::CosPersistenceAngles::evaluate(), Observables::CylindricalDensityProfile::evaluate(), Observables::CylindricalFluxDensityProfile::evaluate(), Observables::CylindricalVelocityProfile::evaluate(), Observables::DensityProfile::evaluate(), Observables::FluxDensityProfile::evaluate(), Observables::ForceDensityProfile::evaluate(), Observables::ParticleDistances::evaluate(), ClusterAnalysis::Cluster::fractal_dimension(), LB::Solver::get_interpolated_density(), LB::Solver::get_interpolated_velocity(), TuningAlgorithm::get_mc_time(), ReactionMethods::ReactionAlgorithm::get_random_position_in_box(), CoulombTuningAlgorithm::get_time(), gyration_tensor(), IBMTribend::IBMTribend(), IBMTriel::IBMTriel(), ClusterAnalysis::Cluster::longest_distance(), maybe_insert_particle(), mindist(), moment_of_inertia_matrix(), nbhood(), pack_particles(), ScriptInterface::Particles::ParticleHandle::ParticleHandle(), ParticleObservables::traits< Particle >::position(), ClusterAnalysis::Cluster::radius_of_gyration_subcluster(), register_integrator(), resort_particles_if_needed(), ClusterAnalysis::ClusterStructure::run_for_all_pairs(), ClusterAnalysis::ClusterStructure::run_for_bonded_particles(), EK::EKWalberla::sanity_checks(), ReactionMethods::ReactionAlgorithm::set_cyl_constraint(), ReactionMethods::ReactionAlgorithm::set_slab_constraint(), CoulombTuningAlgorithm::setup_logger(), DipolarTuningAlgorithm::setup_logger(), structure_factor(), ReactionMethods::ReactionAlgorithm::update_volume(), and velocity_verlet_npt_propagate_pos().

◆ cell_structure

◆ cleanup_queue

ResourceCleanup System::System::cleanup_queue

Definition at line 78 of file core/system/System.hpp.

◆ comfixed

std::shared_ptr<ComFixed> System::System::comfixed

◆ coulomb

◆ dipoles

Dipoles::Solver System::System::dipoles

Definition at line 262 of file core/system/System.hpp.

Referenced by Dipoles::get_dipoles().

◆ ek

◆ force_cap

double System::System::force_cap
protected

Molecular dynamics integrator force capping.

Definition at line 285 of file core/system/System.hpp.

◆ galilei

std::shared_ptr<Galilei> System::System::galilei

◆ gpu

GpuParticleData System::System::gpu

Definition at line 76 of file core/system/System.hpp.

◆ lb

◆ lees_edwards

std::shared_ptr<LeesEdwards::LeesEdwards> System::System::lees_edwards

◆ local_geo

◆ min_global_cut

double System::System::min_global_cut
protected

Minimal global interaction cutoff.

Particles with a distance smaller than this are guaranteed to be available on the same node (through ghosts).

Definition at line 291 of file core/system/System.hpp.

◆ nonbonded_ias

◆ propagation

◆ reinit_thermo

bool System::System::reinit_thermo
protected

Whether the thermostat has to be reinitialized before integration.

Definition at line 279 of file core/system/System.hpp.

◆ sim_time

double System::System::sim_time
protected

Molecular dynamics integrator simulation time.

Definition at line 283 of file core/system/System.hpp.

◆ thermostat

◆ time_step

double System::System::time_step
protected

Molecular dynamics integrator time step.

Definition at line 281 of file core/system/System.hpp.


The documentation for this class was generated from the following files: