-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
125 molar amount missing in solution #127
Conversation
Reviewer's Guide by SourceryThis PR adds support for tracking the molar amount (amount of substance) of solution components and improves the calculation of molar concentrations. The implementation includes automatic calculation of mass and molar amounts based on available properties, and updates the concentration calculation to use the new amount_of_substance field directly. Updated class diagram for SolutionComponentclassDiagram
class SolutionComponent {
+float mass
+float density
+float amount_of_substance
+calculate_molar_concentration(volume: Quantity, logger: BoundLogger)
+normalize(archive: EntryArchive, logger: BoundLogger)
}
class MolarConcentration {
+float calculated_concentration
+float measured_concentration
}
SolutionComponent --> MolarConcentration
note for SolutionComponent "Added amount_of_substance attribute and updated methods for calculation."
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ka-sarthak - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@schumannj Can you check if it works as intended? You can pull this branch and create solution entries. |
Hi Sartak. I had a look at the code and it looks good so far. I will try out locally now. |
There is one thing I was wondering about, in how far things get overwritten, if an entry gets reprocessed and e.g. a single value, e.g. mass gets corrected. How does nomad figure out which quantities are written in person and what was calculated previously. Not entirely sure if that could be a problem. And probably not really related to this issue. I try to see if I can make an example. |
I think NOMAD does not provide a way to keep track of what came from the user and what is written by the normalizer. Every time the normalizer runs, Currently |
I find this is a difficult question. and really depends on how it is used. Initially I was thinking of having nomad calculate the mass from a desired concentration/amount_of_substance and then correcting the mass accoring to the real value that was measured on the balance. But maybe this is to much overthinking. I guess the most important thing is for the community plugins to represent the final data for publishing. |
I just tested the branch. Looks in principle good. I noticed that when I create a solution with 1L of H2O and 1.5 mol NaCl, the mass of the total solution is only given as the mass of the solute. |
Ah I see, there is a warning in the logs, it is missing the mass, of course. should this rather be an error? so it flags up more visibly? But maybe not, once the density is picked up from pubchem it should be resolved anyway. |
Yeah, thing is we are not getting density from the PubChem, so you have to supply either the mass, or both volume and density, to calculate the mass |
Oh why not? it is marked as a todo in the code. I thought this was planned. Oh I guess there are too many different values to choose from. |
Exactly, it depends on the external factors like temperature and pressure. So it's much safer to get this input from the user |
Or they can simply add mass and volume. The final density of the solution will be computed based on these values for all the components. |
Makes sense. Then you can remove the line 171. |
I will make all the units for density to be |
The options for the units of mass are very diverse, I have never seen all those crazy units, where are they suddenly coming from? has nomad.units been updated? but I cannot find mg or mikro gram. (Probably not an issue for here.) |
Ah yeah, there's a bunch of new empirical units. Like |
Resolves #125
Summary by Sourcery
Add 'amount_of_substance' to the SolutionComponent class and enhance mass calculation logic. Improve description formatting for concentration fields in MolarConcentration.
New Features:
Enhancements: