-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add alias field to species definition in YAML input files #14
Comments
@bryanwweber ... Certainly looks like a reasonable extension. As a friendly amendment, I believe the alias fields could be added from Another idea @speth mentioned in a different PR are smiles. PS: once the YAML emitters are done (see #11), writing/saving |
Indeed, this was why I envisioned multiple possible aliases.
How did you envision this would work? |
A file could serve as a dictionary specifying mappings, e.g. CH4: methane
C3H8: [propane, CCC] which could be passed as an argument, e.g.
As mentioned, once the YAML emitters are done, things would get more intuitive. Until then, my main point is that manually editing may be too cumbersome for most. |
In the case of identifiers like SMILES or InChI, I feel like it would be preferable to be able to store them in fields with those names, rather than a generic |
Hey, @bryanwweber I am new here and have been working on this issue. So do we need to overload the add_species_alias method in the C++ version which currently supports 1 alias.... or do we need to create a new method in the ck2yaml file in python as said by @ischoegl. I think the later will be a bit cleaner. |
If I recall correctly, you can add as many aliases as you want in the C++ code, so there’s no need to change anything there. What would be of interest here is to add those aliases in a programmatic/automated way, e.g. using some form of YAML. |
@sin-ha I think the answer is that the C++ code will need to be modified, so that the field defined in the YAML file will be read and assigned to the right place. I think an example YAML file could look like: phases:
- name: gas
species-aliases: [SMILES, InChI, alias]
...
species:
- name: H2O
SMILES: O
InChI: 1/H2O/...
alias: [water, dihydrogen monoxide]
...
- name: H2
alias: hydrogen In the As far as adding these to a YAML input file, I think the |
Correct, the C++ YAML parser will require modifications. |
Abstract
Recent work has allowed the idea of species aliases, names by which species can be referenced in user code without having to change the species
name
. This concept is extremely useful, and it would be useful add a field in the YAML specification of a species to define this in the input file.Motivation
Although it is possible to currently define an alias programmatically, these definitions are not persistent. Persisting the definition of an alias would save work for the user.
Possible Solutions
Current species definition syntax:
Proposed definition (both should be allowed):
The
alias
key is singular on purpose, although it is possible for multiplealias
es to be defined. I think the more common case will be to have a singlealias
, therefore I prefer that name, but this could be iterated on,References
Original implementation of aliases: Cantera/cantera#714
The text was updated successfully, but these errors were encountered: