-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Compute density for a given cif file #338
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
base: main
Are you sure you want to change the base?
Conversation
@@ -214,6 +217,49 @@ def get_package_info(package_names, metadata=None): | |||
return metadata | |||
|
|||
|
|||
def compute_density_from_cif(sample_composition, cif_data): | |||
"""Compute the theoretical density from given CIF metadata. |
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.
This function computes the theoretical density from a single cif json file retrived from COD API. I haven't taken care of the errors yet (for example, missing data from json file). Not sure what is the best approach here but I'm thinking about returning N/A for density when any error happens?
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.
please see comments. This is not quite right yet.
@@ -214,6 +217,49 @@ def get_package_info(package_names, metadata=None): | |||
return metadata | |||
|
|||
|
|||
def compute_density_from_cif(sample_composition, cif_data): |
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.
maybe material_density_from_cif
?
---------- | ||
sample_composition : str | ||
The chemical formula of the material, e.g. "NaCl". | ||
cif_data : dict |
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.
We should think about this. I wonder if it makes sense that we carry material data around always in structure object. We could use diffpy.structure
, but if we are moving in that direction we could use ASE structure containers.
Then we would like to pass around always whatever our "standard" structure object is and we get rid of mention of cif everywhere. We then would have loaders that loaded cif from file into our structure container (SC), and that loaded COD-json into SC, and pymatgent whatever int SC and so on. Since this function is, given a structure, calculate a density it should be taking our base structure object and returning density (it doesn't need to take chemical formula obviously since this is in the SC
|
||
Parameters | ||
---------- | ||
sample_composition : str |
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.
maybe chemical_formula
for the variable name?
Address Task 3 in #331.
@sbillinge ready for review