RASPA3 3.0.12
A molecular simulation code for computing adsorption and diffusion in nanoporous materials
Loading...
Searching...
No Matches
InputReader Class Referenceexport

Class responsible for reading and parsing simulation input files. More...

Collaboration diagram for InputReader:

Classes

struct  InsensitiveCompare
 Comparator for case-insensitive string comparison. More...
 

Public Types

enum class  SimulationType : int {
  MonteCarlo = 0 , MonteCarloTransitionMatrix = 1 , MolecularDynamics = 2 , Minimization = 3 ,
  Test = 4 , Breakthrough = 5 , MixturePrediction = 6 , Fitting = 7 ,
  ParallelTempering = 8
}
 Enumeration of supported simulation types. More...
 

Public Member Functions

 InputReader (const std::string inputFile)
 Constructs an InputReader object by loading and parsing the specified input file.
 
void parseMolecularSimulations (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data)
 Parses molecular simulation configurations from the provided JSON data.
 
void parseFitting (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data)
 Parses fitting simulation configurations from the provided JSON data.
 
void parseMixturePrediction (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data)
 Parses mixture prediction simulation configurations from the provided JSON data.
 
void parseBreakthrough (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data)
 Parses breakthrough simulation configurations from the provided JSON data.
 
void validateInput (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data)
 Validates the parsed input data to ensure correctness and completeness.
 
void parseUnits (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data)
 

Public Attributes

std::string inputString
 Raw input string loaded from the input file.
 
SimulationType simulationType {SimulationType::MonteCarlo}
 Type of simulation to be executed.
 
std::size_t numberOfBlocks {5}
 Number of simulation blocks.
 
std::size_t numberOfCycles {0}
 Total number of simulation cycles.
 
std::size_t numberOfInitializationCycles {0}
 Number of initialization cycles.
 
std::size_t numberOfEquilibrationCycles {0}
 Number of equilibration cycles.
 
std::size_t printEvery {5000}
 Interval for printing simulation progress.
 
std::size_t writeBinaryRestartEvery {5000}
 Interval for writing binary restart files.
 
std::size_t rescaleWangLandauEvery {5000}
 Interval for rescaling in Wang-Landau sampling.
 
std::size_t optimizeMCMovesEvery {5000}
 Interval for optimizing Monte Carlo moves.
 
std::size_t writeEvery {100}
 Interval for writing simulation data.
 
bool restartFromBinary {false}
 Flag to indicate if the simulation should restart from a binary file.
 
std::string restartFromBinaryFileName {"restart_data.bin"}
 Filename of the binary restart-file.
 
std::optional< unsigned long long > randomSeed {std::nullopt}
 Optional random seed for reproducibility.
 
std::size_t numberOfThreads {1}
 Number of threads to be used in the simulation.
 
ThreadPool::ThreadingType threadingType {ThreadPool::ThreadingType::Serial}
 Type of threading to be used.
 
ForceField forceField
 Force field used for defining interactions in the simulation.
 
std::vector< Systemsystems {}
 Vector of simulation systems configured for the simulation.
 
std::string displayName {"Column"}
 Name used for display purposes.
 
double temperature {-1.0}
 Simulation temperature.
 

Static Public Attributes

static const std::set< std::string, InsensitiveComparegeneralOptions
 Set of general option keys accepted in the input data.
 
static const std::set< std::string, InsensitiveComparesystemOptions
 Set of system-specific option keys accepted in the input data.
 
static const std::set< std::string, InsensitiveComparecomponentOptions
 Set of component-specific option keys accepted in the input data.
 

Detailed Description

Class responsible for reading and parsing simulation input files.

The InputReader class handles the parsing of simulation parameters from input files, validation of the input data, and initialization of simulation systems based on the parsed configurations. It supports various simulation types and manages related configurations such as threading, random seeds, and force fields.

Member Enumeration Documentation

◆ SimulationType

enum class InputReader::SimulationType : int
strong

Enumeration of supported simulation types.

Enumerator
MonteCarlo 

Standard Monte Carlo simulation.

MonteCarloTransitionMatrix 

Monte Carlo simulation using a transition matrix approach.

MolecularDynamics 

Molecular Dynamics simulation.

Minimization 

Energy minimization simulation.

Test 

Test simulation type for debugging or development.

Breakthrough 

Breakthrough simulation for adsorption studies.

MixturePrediction 

Simulation for predicting mixtures.

Fitting 

Simulation type for fitting parameters.

ParallelTempering 

Parallel Tempering simulation for enhanced sampling.

Constructor & Destructor Documentation

◆ InputReader()

InputReader::InputReader ( const std::string  inputFile)

Constructs an InputReader object by loading and parsing the specified input file.

This constructor reads the simulation configuration from the provided input file, parses the JSON data, validates the input, and initializes simulation systems based on the parsed configurations.

Parameters
inputFileThe path to the input file containing simulation parameters.
Exceptions
std::runtime_errorIf the input file does not exist, cannot be parsed, or contains invalid data.

Member Function Documentation

◆ parseBreakthrough()

void InputReader::parseBreakthrough ( const nlohmann::basic_json< nlohmann::raspa_map > &  parsed_data)

Parses breakthrough simulation configurations from the provided JSON data.

This function extracts and initializes parameters specific to breakthrough simulations, which are used to study adsorption phenomena in porous materials.

Parameters
parsed_dataThe JSON object containing the parsed input data.

◆ parseFitting()

void InputReader::parseFitting ( const nlohmann::basic_json< nlohmann::raspa_map > &  parsed_data)

Parses fitting simulation configurations from the provided JSON data.

This function extracts and initializes parameters specific to fitting simulations, allowing for the adjustment of simulation parameters to fit experimental data.

Parameters
parsed_dataThe JSON object containing the parsed input data.

◆ parseMixturePrediction()

void InputReader::parseMixturePrediction ( const nlohmann::basic_json< nlohmann::raspa_map > &  parsed_data)

Parses mixture prediction simulation configurations from the provided JSON data.

This function extracts and initializes parameters specific to mixture prediction simulations, enabling the study of mixtures within the simulation environment.

Parameters
parsed_dataThe JSON object containing the parsed input data.

◆ parseMolecularSimulations()

void InputReader::parseMolecularSimulations ( const nlohmann::basic_json< nlohmann::raspa_map > &  parsed_data)

Parses molecular simulation configurations from the provided JSON data.

This function extracts and initializes parameters specific to molecular simulations, such as system configurations, components, and simulation-specific settings.

Parameters
parsed_dataThe JSON object containing the parsed input data.

◆ validateInput()

void InputReader::validateInput ( const nlohmann::basic_json< nlohmann::raspa_map > &  parsed_data)

Validates the parsed input data to ensure correctness and completeness.

This function checks for the presence of required keys and the validity of their corresponding values within the provided JSON data. It throws exceptions if any discrepancies or missing information are detected.

Parameters
parsed_dataThe JSON object containing the parsed input data.
Exceptions
std::runtime_errorIf unknown input keys are found or required keys are missing.

Member Data Documentation

◆ componentOptions

const std::set<std::string, InsensitiveCompare> InputReader::componentOptions
static

Set of component-specific option keys accepted in the input data.

This set contains all the configuration keys that are recognized within each component's configuration in the input JSON. It is used to validate the presence of only known component-specific keys.

◆ generalOptions

const std::set<std::string, InsensitiveCompare> InputReader::generalOptions
static

Set of general option keys accepted in the input data.

This set contains all the general configuration keys that are recognized at the top level of the input JSON. It is used to validate the presence of only known keys.

◆ systemOptions

const std::set<std::string, InsensitiveCompare> InputReader::systemOptions
static

Set of system-specific option keys accepted in the input data.

This set contains all the configuration keys that are recognized within each system's configuration in the input JSON. It is used to validate the presence of only known system-specific keys.


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