Class ParameterParser¶
Defined in File parameter_parser.h
Class Documentation¶
-
class ParameterParser¶
Parser for parameter files used in Gaussian input creation.
Provides functionality to read parameter files with key-value pairs, handle multi-line values, and generate template parameter files. Supports comments and flexible formatting.
Public Functions
-
ParameterParser()¶
Constructor.
-
bool loadFromFile(const std::string &filename)¶
Load parameters from a file.
- Parameters:
filename – Path to the parameter file
- Returns:
true if successful, false otherwise
-
bool saveToFile(const std::string &filename) const¶
Save parameters to a file.
- Parameters:
filename – Path to save the parameter file
- Returns:
true if successful, false otherwise
-
std::string getString(const std::string &key, const std::string &default_value = "") const¶
Get a parameter value as string.
- Parameters:
key – Parameter name
default_value – Default value if parameter not found
- Returns:
Parameter value or default
-
int getInt(const std::string &key, int default_value = 0) const¶
Get a parameter value as integer.
- Parameters:
key – Parameter name
default_value – Default value if parameter not found
- Returns:
Parameter value or default
-
bool getBool(const std::string &key, bool default_value = false) const¶
Get a parameter value as boolean.
- Parameters:
key – Parameter name
default_value – Default value if parameter not found
- Returns:
Parameter value or default
-
void setString(const std::string &key, const std::string &value)¶
Set a parameter value.
- Parameters:
key – Parameter name
value – Parameter value
-
void setInt(const std::string &key, int value)¶
Set a parameter value from integer.
- Parameters:
key – Parameter name
value – Parameter value
-
void setBool(const std::string &key, bool value)¶
Set a parameter value from boolean.
- Parameters:
key – Parameter name
value – Parameter value
-
bool hasParameter(const std::string &key) const¶
Check if a parameter exists.
- Parameters:
key – Parameter name
- Returns:
true if parameter exists, false otherwise
-
bool generateTemplate(const std::string &calc_type, const std::string &filename) const¶
Generate a template parameter file for a specific calculation type.
- Parameters:
calc_type – Calculation type (sp, opt_freq, etc.)
filename – Output filename
- Returns:
true if successful, false otherwise
-
bool generateAllTemplates(const std::string &directory) const¶
Generate template files for all supported calculation types.
- Parameters:
directory – Directory to save template files
- Returns:
true if successful, false otherwise
-
bool generateGeneralTemplate(const std::string &filename) const¶
Generate a general parameter template with all possible parameters.
- Parameters:
filename – Output filename
- Returns:
true if successful, false otherwise
-
std::vector<std::string> getSupportedCalcTypes() const¶
Get list of supported calculation types.
- Returns:
Vector of calculation type names
-
void clear()¶
Clear all parameters.
-
ParameterParser()¶