def test_equilibrate_overload_6(setup, num_regression): """ An integration test that checks result's reproducibility of the calculation of a problem using equilibrate(ChemicalState& state, const Partition& partition, const EquilibriumOptions& options) @param setup a tuple that has some objects from problem setup (system, problem) """ (system, problem) = setup # find a state based on the equilibrium setup state = equilibrate(problem) # change pressure and temperature state.setTemperature(problem.temperature() + 5) state.setPressure(problem.pressure() + 5) options = EquilibriumOptions() partition = Partition(system) # compute equilibrium for state with new temperature and pressure equilibriumResult = equilibrate(state, partition, options) stateDict = convert_reaktoro_state_to_dict(state) num_regression.check(stateDict, default_tolerance=dict(atol=1e-5, rtol=1e-16))
def test_kinetic_path_solve_final_state(num_regression, setup, time_span): """ An integration test that checks result's reproducibility of the calculation of a kinetic problem and only check the final state @param setup a tuple that has some objects from kineticProblemSetup.py (state, reactions, partition) @param time_span time information about the kinetic problem. time_span.ti = initial time time_span.tf = final time time_span.unit = ti and tf units """ (state, reactions, partition) = setup path = KineticPath(reactions) path.setPartition(partition) path.solve(state, time_span.ti, time_span.tf, time_span.unit) stateDic = convert_reaktoro_state_to_dict(state) num_regression.check(stateDic)
def check(self, state, tol=None, default_tol=None, exclude=None): num_regression.check( convert_reaktoro_state_to_dict(state, exclude), basename=None, tolerances=tol, default_tolerance=default_tol, data_index=None, fill_different_shape_with_nan=True, )
def test_equilibrium_solver_solve_overload_2(setup, num_regression): """ An integration test that checks result's reproducibility of the calculation of an equilibrium of a state using EquilibriumSolver::solve(ChemicalState& state, const EquilibriumProblem& problem) @param setup a tuple that has some objects from problem setup (system, problem) """ (system, problem) = setup state = ChemicalState(system) solver = EquilibriumSolver(system) solver.solve(state, problem) stateDict = convert_reaktoro_state_to_dict(state) num_regression.check(stateDict, default_tolerance=dict(atol=1e-5, rtol=1e-16))
def test_equilibrate_overload_2(setup, num_regression): """ An integration test that checks result's reproducibility of the calculation of a problem using equilibrate(const EquilibriumProblem& problem, const EquilibriumOptions& options) and equilibrate(const EquilibriumInverseProblem& problem, const EquilibriumOptions& options) @param setup a tuple that has some objects from problem setup (system, problem) """ (system, problem) = setup options = EquilibriumOptions() equilibriumState = equilibrate(problem, options) stateDict = convert_reaktoro_state_to_dict(equilibriumState) num_regression.check(stateDict, default_tolerance=dict(atol=1e-5, rtol=1e-16))
def test_equilibrium_solver_approx_overload_3(setup, num_regression): """ An integration test that checks result's reproducibility of the calculation of an equilibrium of a state using EquilibriumSolver::approximate(ChemicalState& state, double T, double P, VectorConstRef be) @param setup a tuple that has some objects from problem setup (system, problem) """ (system, problem) = setup state = ChemicalState(system) solver = EquilibriumSolver(system) solver.approximate(state, problem.temperature(), problem.pressure(), problem.elementAmounts()) stateDict = convert_reaktoro_state_to_dict(state) num_regression.check(stateDict, default_tolerance=dict(atol=1e-5, rtol=1e-16))