Closed ka-sarthak closed 1 month ago
In general Andrea and I thinks this looks good. It will be a bit more Entity heavy than the last implementation but that could also be fine. The main thing we discussed was how the Solution class was structured. Was there a reason for having a separate section for the concentrations rather than filling them directly in the Solute class?
@hampusnasstrom @aalbino2 thanks for looking into it!
Was there a reason for having a separate section for the concentrations rather than filling them directly in the Solute class?
It was inspired by the classes from the last implementation where the component_concentration is a part of the properties of the solution. Since the concentration of each component depends on the final volume of the solution, I find it reasonable to make concentrations as a sub-section of the solution.
What do you think?
Main points from the Task Force meeting on 22.07.2024:
compound
should be dropped. Instead, an added material can be one of the following: solute, solvent, solution.component_composition
should include all the added materials, and pick the material recursively from the added solutions. If multiple components in the solution are the same pure substance, they should be combined into one. This can happen especially when multiple existing solutions sharing a common solvent are used to create a new solution. Here, we want the new solution to not have multiple components representing the same solvent, but instead one combined component.
To combine the components, the Solution.normalize
uses component.pure_substance.iupac
. If this is shared by two components, they will be combined into one: masses and volumes will be accumulated.
solvents
, solutes
, and elemental_composition
sub-sections are meant for viewing and not for editing. Ideally, they should be made non-editable subsections. I tried doing this with SectionProperties and Filter, but it did not work. Leaving it as a TODO comment for later.
When determining the molar concentration, the moles are calculated based on the mass and the molecular mass of the component. In the case of liquids, their density and volume are used to compute the mass. Once the moles are available, they are multiplied with purity_fraction
if available.
The question of whether the purity figure is vol/vol or weight/vol or weight/weight not relevant. Right? @aalbino2 @hampusnasstrom
BaseSolutionComponent
was needed to put together SolutionComponent
, which is a solid or liquid pure substance, and SolutionComponentReference
, which connects to a pre-existing solution. With the new factoring, however, this parent section is not required.
The AddSolution
step in the SolutionPreparation.steps
uses a SolutionReference
, and takes the solution_components from the referred solution and copies it into the current solution. Therefore, in the solution class, there is no need to save the reference as a solution component.
The SolidSolutionComponent
class provides nothing additional to its parent: SolutionComponent
. Removing it.
Add<Material>
steps SolutionPreparation
class populates the solution
sub-section instead of creating a new Solution
entry. This change is made to avoid using m_to_dict
method used create_archive
function, which is not resolving the references correctly. Once the method is fixed, the intended behavior of SolutionPreparation
will be re-instigated.
SolutionPreparation
entry now creates a Solution
entry and attaches a reference to it in the solution
sub-section. The missing part was to supply the context of the current entry archive to the newly generated archive. This led correct references.
@hampusnasstrom I made most of the changes you suggested. Please review again :)
@hampusnasstrom Thanks for a great review! Merging it now.