Skip to content
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

Various bug and consistency fixes for CifData and StructureData #2374

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Jan 8, 2019

Fixes #2373

Bug fixes:

  • CifData.has_partial_occupancies
  • CifData.has_unknown_species

Added properties:

  • CifData.has_unknown_atomic_sites

Consistency changes:

  • Kind.is_alloy -> property
  • Kind.has_vacancies -> property
  • StructureData.is_alloy -> property
  • StructureData.has_vacancies -> property

@sphuber sphuber force-pushed the fix_2373_cif_has_partial_occupancies branch from 508d9d7 to b78e2bd Compare January 8, 2019 16:20
@sphuber sphuber requested a review from giovannipizzi January 8, 2019 16:20
@coveralls
Copy link

coveralls commented Jan 8, 2019

Coverage Status

Coverage increased (+0.07%) to 69.058% when pulling 23895b2 on sphuber:fix_2373_cif_has_partial_occupancies into 65c60d5 on aiidateam:provenance_redesign.

@sphuber sphuber force-pushed the fix_2373_cif_has_partial_occupancies branch from b78e2bd to 524edee Compare January 9, 2019 15:36
For `CifData` with values of the `_atom_site_occupancy` tag that cannot
be parsed into a float, the `has_partial_occupancies` property would
except. Here we properly check whether the value can be cast to a float
after removing any parentheses that may be present.
The `CifData.has_unknown_species` return whether the chemical formula
contains any unknown species, which were defined as those species that
are not listed in `aiida.common.constants.elements`. This was intended
to filter out those cif files that contained species that could not be
parsed into a `StructureData` that could actually be used for a
condensed matter calculation, since the presence of an unknown species
would render that impossible.

However, recently, the specie `X` was added to the internal dictionary
of elements, breaking the method. Here we explicitly ignore `X` in the
`has_unknown_species` method, returning its implementation to its
original intention.
This property will verify that all coordinates of all atomic sites can
be properly converted into float values. If just one coordinate cannot
be successfully converted to a float, the cif is said to have unknown
atomic sites, as it will not be able to be parsed into a usable
`StructureData` object for further calculations.
The `Kind` and `StructureData` were using an inconsisten mixture of
methods and properties for boolean attributes, such as `has_vacancies`
and `is_alloy`. To conform to `CifData` these are now all turned into
properties.
@sphuber sphuber force-pushed the fix_2373_cif_has_partial_occupancies branch from 524edee to 23895b2 Compare January 9, 2019 15:40
@sphuber sphuber merged commit dd0b1b9 into aiidateam:provenance_redesign Jan 9, 2019
@sphuber sphuber deleted the fix_2373_cif_has_partial_occupancies branch January 9, 2019 16:20
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.

3 participants