materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.48k stars 852 forks source link

Should we let the `StructureMatcher` method work at the affine space group classification level instead of the crystallographic space group classification level? #3612

Open hongyi-zhao opened 7 months ago

hongyi-zhao commented 7 months ago

See my following testing:

$ python ./pymatgenStructureMatcher.py 5/POSCAR 6/POSCAR -s0.53 -l 0.01 -a5
Structures are similar: True
Transformation Information:
(array([[ 1,  0,  0],
       [ 0, -1,  0],
       [ 0,  1,  1]]), array([-4.07660017e-17, -4.16198382e-01,  3.28125000e-01]), [3, 58, 59, 60, 33, 8, 0, 1, 56, 12, 13, 68, 25, 70, 71, 63, 10, 11, 21, 22, 23, 24, 15, 44, 36, 37, 20, 30, 49, 32, 7, 34, 35, 27, 28, 47, 48, 40, 41, 42, 43, 26, 18, 19, 46, 39, 31, 50, 51, 52, 53, 45, 38, 29, 64, 4, 5, 6, 61, 62, 54, 55, 2, 66, 67, 14, 69, 16, 17, 9, 57, 65, 75, 102, 77, 78, 79, 80, 72, 73, 101, 93, 85, 86, 87, 88, 98, 81, 91, 83, 84, 94, 95, 96, 97, 89, 90, 82, 92, 76, 103, 104, 105, 106, 107, 99, 100, 74, 144, 145, 146, 138, 139, 140, 147, 148, 149, 141, 142, 143, 123, 124, 125, 108, 109, 110, 126, 127, 128, 111, 112, 113, 129, 130, 131, 114, 115, 116, 117, 118, 119, 132, 133, 134, 120, 121, 122, 135, 136, 137, 186, 187, 188, 174, 175, 176, 189, 190, 191, 177, 178, 179, 159, 160, 161, 150, 151, 152, 153, 154, 155, 162, 163, 164, 156, 157, 158, 165, 166, 167, 180, 181, 182, 168, 169, 170, 183, 184, 185, 171, 172, 173])

As you can see, according to the Classification systems of the space group, the StructureMatcher method implemented currently works at the affine space group classification level instead of the crystallographic space group classification level, aka, it permits the non-proper rotation which doesn't preserve orientation.

But as Bernd pointed out here on page 35, as shown below:

Since crystals occur in physical space and physical space can only be transformed by orientation preserving mappings, space groups are only regarded as equivalent if they are conjugate by an orientation preserving affine mapping, i.e. by an affine mapping that has linear part with positive determinant.

image

So, should we let the StructureMatcher method work at the affine space group classification level instead of the crystallographic space group classification level?

Attached are all the test files mentioned above. Please check them.

test_StructureMatcher.zip

See here for the related discussion.

Regards, Zhao

janosh commented 7 months ago

this sounds interesting and i can see why you might want to allow only orientation-preserving rotations. but i don't have enough background to say why the current behavior was chosen in the first place. potentially there were reasons i'm unaware of. hoping others with more context can chime in

mkhorton commented 7 months ago

Is this the same issue encountered here with judging equivalence of structures with enantiomorphic space groups?

hongyi-zhao commented 7 months ago

@mkhorton Yes. This is the exact case in a 3-dimensional space. But in higher dimensions, this is a more complicated problem to solve and I have given a gap implementation based on the algorithm suggested by Bernd.

wladerer commented 6 months ago

I think it is best to consider that once you get to this kind of granularity of equivalence, the deviations in total energies may be below the threshold of chemical accuracy 1 2- even by the standards of the highest levels of theory.

With that said, there are in fact very important observable differences in chiral crystals. Circular dichroism and (reciprocal space) topology being two properties that are sensitive to such symmetries. 3

Solving this problem is incredibly interesting, but I am unsure how much it will benefit the users of pymatgen, especially if this routine incurs additional additional computational overhead. And naturally, this new feature will require additional maintenance that requires a niche expertise.

I think the best thing, which might actually help address #2593 , is to diversify the routines offered in StructureMatcher ? It would allow for the users to determine what degree of specificity they really care about and perhaps that can reduce the computational load if they are looking for a course grain matching.

But I suppose we have to wonder if readily available solutions exist elsewhere, then does pymatgen bear this responsibility?

janosh commented 6 months ago

thanks @wladerer, that's a lot of helpful context! 👍

I think the best thing, which might actually help address https://github.com/materialsproject/pymatgen/issues/2593, is to diversify the routines offered in StructureMatcher?

i'm open to that. sounds like that's the most actionable way forward to address #2593 and potentially even this issue