-
Notifications
You must be signed in to change notification settings - Fork 192
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
CifData: fast scanning and lazy parsing #1190
CifData: fast scanning and lazy parsing #1190
Conversation
formatting + fixing minor issues
Example: from aiida.orm.data.cif import CifData a = CifData('/path/to/file.cif', scan_type='flex') Also add test to check that results are identical.
parse_policy decides whether the CIF file is parsed at creation time of CifData or whether it is parsed only when needed. Example: from aiida.orm.data.cif import CifData a = CifData(file='/path/to/file.cif', parse_policy='lazy') (default is 'eager', which leaves the code unchanged)
One change is that the calls to The reason for this change is that otherwise one needs to start fighting against the "cleverness" of AiiDA, which calls all the I'll add something to |
added more tests... one is currently failing. need to think about how to conveniently populate formulae and spacegroups
Closing this PR until convergence reached. |
same for spacegroup_names
…ida_core into issue_1186_flexible_cif_class
same for get_spacegroup_numbers Instead, add a parse() method that will parse the CIF file, if desired.
@giovannipizzi Feedback appreciated :-) You are also welcome to assign someone else, if you don't have the time. |
@nmounet If you are not available, please unassign yourself and I will ask someone else. |
@giovannipizzi It seems the Nicolas currently has no time. |
Do you know why tests are failing? (Probably when you'll fix them I have to approve again) |
Yes... I removed the |
Many of the `prepare_...` functions have a `main_file_name` argument. It's completely unused in CifData, but I'm putting it back for the moment in order to avoid breaking other people's code.
Fix #1183
Fix #1186
Fast scanning
Adds a
scan_type
attribute to CifData.Using
scan_type='flex'
uses C-routines of PyCifRW and is several times faster than the python-based implementation for large CIF files.The default behavior is unchanged.
Example:
Lazy parsing
Adds a
parse_policy
attribute to CifData.Using
parse_policy='lazy'
delays parsing of CIF files until the values are actually needed.The default behavior is unchanged, except for the fact that the CIF object is now kept in memory after regular parsing (see #1186) (it will, however, not be written to the DB).
Example:
Note: 1st commit contains changes from formatter & linter