Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yucongalicechen
Copy link
Contributor

Address Task 3 in #331.
@sbillinge ready for review

@@ -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.
Copy link
Contributor Author

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?

Copy link
Contributor

@sbillinge sbillinge left a 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):
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants