Skip to content

Commit

Permalink
fixes to eclusionen test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
avdudchenko committed Oct 20, 2024
1 parent bb66e73 commit 3e2ec83
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
18 changes: 11 additions & 7 deletions src/reaktoro_pse/core/reaktoro_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,17 @@ def track_registered_phases(self, phase, inputs):
return self.registered_phases[phase]

def process_phase_species(self, phase_type, phases_list):
phases = phase_type(rkt.speciate(phases_list))
system = rkt.ChemicalSystem(self.database, phases)
spc_list = []
for specie in system.species():
if specie.name() not in str(self.exclude_species_list):
spc_list.append(specie.name())
return phase_type(" ".join(spc_list)), spc_list
if len(phases_list) > 1:
phases = phase_type(rkt.speciate(phases_list))

system = rkt.ChemicalSystem(self.database, phases)
spc_list = []
for specie in system.species():
if specie.name() not in str(self.exclude_species_list):
spc_list.append(specie.name())
return phase_type(" ".join(spc_list)), spc_list
else:
return phase_type(" ".join(phases_list)), phases_list

def register_aqueous_phase(self, aqueous_phases=None):
"""register possible mineral phases"""
Expand Down
1 change: 1 addition & 0 deletions src/reaktoro_pse/examples/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

def test_desal():
m, m_open = simple_desalination.main()

assert (
pytest.approx(m.desal_properties[("scalingTendency", "Gypsum")].value, 1e-3)
== 0.604051223942643
Expand Down
9 changes: 6 additions & 3 deletions src/reaktoro_pse/tests/test_reaktoro_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ def test_blockBuild_with_speciation_block(build_rkt_state_with_species):
== expected_scaling["speciation_block"][key]
)
m.property_block.update_jacobian_scaling(new_scaling)
scaling_result = m.property_block.display_jacobian_scaling()

assert "speciation_block" in scaling_result
for key in scaling_result["speciation_block"]:
assert scaling_result["speciation_block"][key] == 1
new_scaling = {}
for key in scaling_result["property_block"]:
new_scaling[key] = 1
Expand All @@ -247,10 +252,8 @@ def test_blockBuild_with_speciation_block(build_rkt_state_with_species):
)
m.property_block.update_jacobian_scaling(new_scaling)
scaling_result = m.property_block.display_jacobian_scaling()
assert "speciation_block" in scaling_result

assert "property_block" in scaling_result
for key in scaling_result["speciation_block"]:
assert scaling_result["speciation_block"][key] == 1
for key in scaling_result["property_block"]:
assert scaling_result["property_block"][key] == 1

Expand Down

0 comments on commit 3e2ec83

Please sign in to comment.