Repository navigation
Select condensed species by phase component - #169
Merged
Merged
Conversation
The reader builds the data of each phase component, keyed by Hill formula and then phase component, and the name-keyed data are made from it. DataBase keeps this table, plus the phase components added with add_species, and creates condensed species from them: - condensed_from_formula: all condensed phase components from a data file, stitched in order of temperature (e.g. O2Si_cd, quartz to cristobalite to liquid) - condensed_from_components: a chosen set stitched, named with a required suffix - condensed_from_component: one phase component, which keeps any volume model - components_of: the condensed phase components of a formula from a data file PurePhase.from_formula, from_components and from_component wrap these, with an optional database (the default database otherwise). Only phase components from a data file can be stitched together; added ones (e.g. diamond) are selected on their own. The default database now also gives C_graphite its volume. A custom DataBase subclass calls super().__init__(). The old interface (_s, from_species) is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 2 of the species-naming work, following #168. This adds a way to select condensed species by phase component (in the Holland and Powell sense: the gas, liquid or mineral that a set of data refers to). The old interface (
_sspecies,PurePhase.from_species,create_condensed(..., state=...)) is unchanged. Migrating usages (stage 3) and removing the old interface (stage 4) will follow in separate PRs.New interface
Each method takes an optional
database=; without it, the default database is used. The logic lives onDataBase(condensed_from_formula,condensed_from_components,condensed_from_componentandcomponents_of), and thePurePhasemethods call it.Rules
Stitching is done on demand with
stitch_glenn_propertiesfrom #168.formula=is needed only for a set of shared names such asliquid.GlennDataBase.from_file) and have no volume model. A single phase component can come from anywhere, includingadd_species, and keeps its volume model. Sofrom_formula("C")gives graphite with its volume, and diamond can only be selected on its own.Implementation
read_glenn_phase_componentsandglenn_phase_components. The name-keyed data are made from the same table, so existing lookups are unchanged.DataBasekeeps this table, plus a table of the phase components added withadd_species.C_graphitethe graphite volume, asdefault_propertiesalready does.DataBasesubclass must callsuper().__init__().Tests
test_phase_components(tests/test_database.py) checks:O2Si_cdmatchesO2Si_sat 1000 K andO2Si_lat 2500 K.C_cdmatchesC_sat 10⁴ bar, including the volume.Full suite: 243 passed. Pyright and the docs build (
-W) pass.🤖 Generated with Claude Code