Repository navigation
fix: fix Structure loading with close-duplicate atom - #183
stevenhua0320 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v3.4.0 #183 +/- ##
==========================================
+ Coverage 99.17% 99.19% +0.01%
==========================================
Files 15 15
Lines 2439 2489 +50
==========================================
+ Hits 2419 2469 +50
Misses 20 20 🚀 New features to boost your workflow:
|
sbillinge
left a comment
There was a problem hiding this comment.
I think we need good tests for this. @stevenhua0320 we may want to work with Tieqiong to get a cif file that is not working currently so we can test that it works correctly after the fix.
|
@stevenhua0320 I am moving this to the 3.5.0 release as I want this to be fixed carefully and with excellent tests. Actually, it is an important fix, so it would be good if you were interested in working with @cadenmyers13 to write good tests and then to put in a fix, but we don't need to hold up 3.4.0 for this. |
|
@stevenhua0320 Im happy to help with writing a test for this. LMK when you want to |
|
I checked a related origin-setting case from diffpy/diffpy.srfit#213. A shifted copy of the bundled silicon CIF contains a complete list of 192 symmetry operations and a valid H–M symbol. Current main and #183 applied to current main both expand it to 32 sites, with a first calculated PDF peak at 1.92 Å. Keeping the explicit operations gives 8 sites and the same 2.35 Å peak as the unshifted control. A compact parser regression is a |
|
Thanks for reporting that @CAOShurong @stevenhua0320 please could you implement the regression test suggested by @CAOShurong and reproduce it? We should discuss the right behavior we want to use. This example points out that we don't use the symmetry operations coded into the file. I think this was on purpose, because it is more error prone, so we use tabulated symmetry operations for the spacegroup. These issues point out that when an unconventional origin is used, but the CIF generator coded the corrected symmetry operations in the file, we silently ignore them and get the wrong structure as a result. It is a big change to move the default behavior to reading the hard-coded symmetry operations first and falling back to tabulated ones, and I suspect there are quite a few faulty CIFs out there that would be working and now break if we did that. One option is to set some kind of flag so the default behavior is unchanged but can be overridden. This seems the gentlest. It won't solve the issue that @Tieqiong had oringially when he was trying to read CIF files at scale from a database, though it would give him a route to trouble-shooting the problem because if he found atoms too close to each other, he could maybe retry the CIF read using the hard-coded symmetry operations, something like that? |
|
also, @stevenhua0320, since the fix that Tieqiong proposed didn't work, I suggest that we revert that one too. |
@sbillinge ready to review. This is the potential solution proposed by @Tieqiong last summer diffpy/diffpy.pdfgui#291. We change the order of the source that we trust most as the priority. After this is merged and released, we could ask whether this fix would solve this by asking people to test it.