mdse.parser.parse_yml
Functions
|
Expands a single parameter for a given simulation if it is specified as a list or a range. |
|
Reads from a YAML file, then un-nests the MD simulations by expanding any parameters specified as lists or ranges. |
|
Reads a YAML file containing MD simulation configurations and returns it as a dictionary. |
|
Expands nested parameters (lists or ranges) in the simulations_config dictionary for each simulation. |
- mdse.parser.parse_yml.expand_parameter(simulation_to_expand, parameter)
Expands a single parameter for a given simulation if it is specified as a list or a range.
If the parameter is a list, creates a new simulation for each value in the list.
If the parameter is a range, creates a new simulation for each value in the range.
If the parameter is a single value or not present, returns the simulation unchanged.
- Parameters:
simulation_to_expand (tuple) – (simulation_name, simulation_config)
parameter (str) – The parameter to expand (e.g., ‘Temp’, ‘Type’, ‘Time’)
- Returns:
List of (simulation_name, simulation_config) tuples, one for each expanded value.
- Return type:
list
- mdse.parser.parse_yml.main_read(filename)
Reads from a YAML file, then un-nests the MD simulations by expanding any parameters specified as lists or ranges.
Returns a list where each element is a fully expanded MD simulation configuration as a dictionary.
- Parameters:
filename (str) – Name of the .yaml config file
- Returns:
List of expanded MD simulation configurations (dicts)
- Return type:
list
- mdse.parser.parse_yml.read_yaml_simulations(filename)
Reads a YAML file containing MD simulation configurations and returns it as a dictionary.
- Parameters:
filename (str) – Name of the config YAML file.
- Returns:
Dictionary where each key is a simulation name and each value is its parameter dictionary.
- Return type:
dict
- mdse.parser.parse_yml.unnest_simulation_parameters(all_simulations)
Expands nested parameters (lists or ranges) in the simulations_config dictionary for each simulation.
For each simulation, if a parameter is specified as a list or a range, it creates multiple simulation configs, one for each value in the list or range. This is repeated for all parameters in parameters_to_expand.
- Parameters:
all_simulations (dict) – Dictionary of all simulations from the YAML file.
- Returns:
List of dictionaries, each representing a fully un-nested simulation configuration.
- Return type:
list