scine_puffin.jobs.rms_kinetic_modeling

Classes

RmsKineticModeling()

Micro-kinetic modeling with the puffin-interface to the reaction mechanism simulator (RMS).

class scine_puffin.jobs.rms_kinetic_modeling.RmsKineticModeling[source]

Micro-kinetic modeling with the puffin-interface to the reaction mechanism simulator (RMS). Note: Running jobs with RMS as a backend requires an installation of RMS (including its Python bindings). This is not supported through the Puffin bootstrapping. See programs/rms.py for more information.

Order Name

rms_kinetic_modeling

Required Input
modeldb.Model

The electronic structure model to flag the new properties with.

Required Settings
aggregate_idsList[str]

The aggregate IDs (as strings).

reaction_idsList[str]

The reaction IDs (as strings).

aggregate_typesList[int]

The aggregate types. 0 for compounds, 1 for flasks.

eaList[float]

The activation energies for each reaction as the free energy difference to the reaction LHS (in J/mol).

enthalpiesList[float]

The enthalpy of each aggregate (in J/mol).

entropiesList[float]

The entropy of each aggregate (in J/mol).

arrhenius_prefactorsList[float]

The exponential prefactors.

arrhenius_temperature_exponentsList[float]

The temperature exponents in the Arrhenius equation.

start_concentrationsList[float

The start concentrations of each aggregate.

Optional Settings

Optional settings are read from the settings field, which is part of any Calculation stored in a SCINE Database.

The following options are available:

solverstr

ODE solver. Currently only “CVODE_BDF” is supported.

phase_typestr

The reactor phase. Options are ideal_gas (assumes P=const, T=const), ideal_dilute_solution (assumes V=const, T=const). Default is “ideal_gas”.

max_timefloat

Maximum integration time in seconds. Default 3600.0.

energy_model_programstr

The program with which the electronic structure model should be flagged. Default any.

viscosityfloat

The solvent viscosity (in Pa s). Needs phase=ideal_dilute_solution and diffusion_limited=true. If “none”, the viscosity is taken from tabulated values.

reactor_solventstr

The reactor solvent. If “none”, the solvent in the electronic structure model is used if any.

site_densityfloat

The density of surface sites. Default is “none”. Requires phase=ideal_surface. Not fully supported yet.

diffusion_limitedbool

If true, diffusion limits are enforced. Requires phase=ideal_dilute_solution. May lead to numerical instability of the ODE solver. Default False.

reactor_temperaturefloat

The reactor temperature (in K). If “none”, the temperature in the model is used. Default “none”.

reactor_pressurefloat

The reactor pressure (in Pa). If none, the pressure in the model is used. Default “none”.

absolute_tolerancefloat

The absolute tolerance of the ODE solver. High values lead to a faster but less reliable integration. Default 1e-20.

relative_tolerancefloat

The relative tolerance of the ODE solver. High values lead to a faster but less reliable integration. Default 1e-6.

solvent_aggregate_str_idstr

The aggregate ID of the solvent as a string. If “none”, the solvent is assumed to be unreactive.

solvent_concentrationfloat

The solvent concentration. Default is 55.3 (mol/L).

enforce_mass_balancebool

If true, an error is raised for any non-balanced reaction.

screen_sensitivitiesbool

If true, only parameters associated to aggregates and reactions with significant concentration flux are considered in the sensitivity analysis (flux > oaat_vertex_flux_threshold | flux > oaat_vertex_flux_threshold).

Required Packages
  • SCINE: Database (present by default)

  • rms

Generated Data

If successful (technically and chemically) the following data will be generated and added to the database:

Properties

The maximum and final concentration, and the vertex flux of each aggregate is added to its centroid. The edge flux for each reaction is added to the centroid of the first aggregate on the reaction’s LHS. Note, that the properties are NOT listed in the results to avoid large DB documents.

archive(archive: str) None

Archives all files existent in the job’s directory into tarball named with the job’s ID. The tarball is then moved to the given destination.

Parameters:
archivestr

The path to move the resulting tarball to.

capture_raw_output() Tuple[str, str]

Tries to capture the raw output of the calculation context and save it in the raw_output field of the configured calculation. This should never throw.

Notes

  • Requires run configuration

classmethod check_configuration(instance: T) typing_extensions.TypeGuard[T]
static check_duplicate_property(structure: db.Structure, properties: db.Collection, property_name: str, model: db.Model) db.ID | bool

Checks for a property that is an exact match for the one queried here. Exact match meaning that key and model both are matches.

Parameters:
propertiesdb.Collection (Scine::Database::Collection)

The collection housing all properties.

property_namestr

The name (key) of the queried property, e.g. electronic_energy.

modeldb.Model (Scine::Database::Model)

The model used in the calculation that resulted in this property.

structuredb.Structure (Scine::Database::Structure)

The structure to be checked in. The structure has to be linked to its collection.

Returns:
IDdb.ID (Scine::Database::ID)

Returns False if there is no existing property like the one queried or the ID of the first duplicate.

clear() None

Clears the directory in which the job was run.

complete_job() None

Saves the executing Puffin, changes status to db.Status.COMPLETE.

config: Configuration
configure_run(manager: db.Manager, calculation: db.Calculation, config: Configuration) None

Configures a job for a given Calculation to do tasks in the run function

Parameters:
managerdb.Manager (Scine::Database::Manager)

The manager of the database holding all collections

calculationdb.Calculation (Scine::Database::Calculation)

The calculation to be performed

configConfiguration

The configuration of the Puffin doing the job

fail_job() None

Saves the executing Puffin, changes status to db.Status.FAILED.

failed_file() str

Returns the path to the file indicating a failed calculation, None if job has not been prepared

postprocess_calculation_context() bool

Postprocesses a calculation context, pushing all errors and comments.

Returns:
True if the job succeeded, False otherwise.
prepare(job_dir: str, id: db.ID) None

Prepares the actual job. This function has to be implemented by any job that shall be added to Puffins job portfolio.

Parameters:
job_dirstr

The path to the directory in which all jobs are executed.

iddb.ID (Scine::Database::ID)

The calculation that triggered the execution of this job.

static required_programs() List[str][source]

This function has to be implemented by any job that shall be added to Puffins job portfolio.

Returns:
requirementsList[str]

A list of names of programs/packages that are required for the execution of the job.

run(manager: db.Manager, calculation: db.Calculation, config: Configuration) bool[source]

Runs the actual job. This function has to be implemented by any job that shall be added to Puffins job portfolio.

Parameters:
managerdb.Manager (Scine::Database::Manager)

The manager/database to work on/with.

calculationdb.Calculation (Scine::Database::Calculation)

The calculation that triggered the execution of this job.

configscine_puffin.config.Configuration

The configuration of Puffin.

stderr_path: str = 'stderr'
stdout_path: str = 'stdout'
store_property(properties: db.Collection, property_name: str, property_type: str, data: Any, model: db.Model, calculation: db.Calculation, structure: db.Structure, replace: bool = True) db.Property | None

Adds a single property into the database, connecting it with a given structure and calculation (it’s results section) and also

Parameters:
propertiesdb.Collection (Scine::Database::Collection)

The collection housing all properties.

property_namestr

The name (key) of the new property, e.g. electronic_energy.

property_typestr

The type of property to be added, e.g. NumberProperty.

dataAny (According to ‘property_type’)

The data to be stored in the property, the type of this object is dependent on the type of property requested. A NumberProperty will require a float, a VectorProperty will require a List[float], etc.

modeldb.Model (Scine::Database::Model)

The model used in the calculation that resulted in this property.

calculationdb.Calculation (Scine::Database::Calculation)

The calculation that resulted in this property. The calculation has to be linked to its collection.

structuredb.Structure (Scine::Database::Structure)

The structure for which the property is to be added. The properties field of the structure will receive an additional entry, or have an entry replaced, based on the options given to this function. The structure has to be linked to its collection.

replacebool

If true, replaces an existing property (identical name and model) with the new one. This option is true by default. If false, doesnothing in the previous case, and returns None

Returns:
propertyDerived of db.Property (Scine::Database::Property)

The property, a derived class of db.Property, linked to the properties’ collection, or None if no property was generated due to duplication.

success_file() str

Returns the path to the file indicating a successful calculation, empty string if job has not been prepared

use_n_cores(n_cores: int) int[source]
verify_connection() None

Verifies the connection to the database. Returns only if a connection is established, if it is not, the function will attempt to generate a connection every 10 seconds, indefinitely.

Notes

  • Requires run configuration

work_dir: str