pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Error in Tensor symmetrization with certain monoclinic structures

Open matthewkuner opened this issue 2 years ago • 2 comments

https://github.com/materialsproject/pymatgen/blob/82f108a3cba5f12b88b95fecb4e3b775ca9de6c6/pymatgen/core/tensors.py#L460

For the structure below, an error occurs when attempting to create the IEEE rotation matrix. I believe it is due to this structure, which is identified as monoclinic by the SpaceGroupAnalyzer, having all 90 degree angles.

Full Formula (Ti5 Nb1) Reduced Formula: Ti5Nb abc : 2.828602 4.619089 8.000496 angles: 90.000000 90.000000 90.000000 pbc : True True True Sites (6) # SP a b c velocities --- ---- -------- --- -------- --------------- 0 Ti. 0.261493 0.5 0.16032 [0.0, 0.0, 0.0] 1 Ti 0.584333 0 0.331188 [0.0, 0.0, 0.0] 2 Ti 0 0.5 0.5 [0.0, 0.0, 0.0] 3 Ti 0.415667 0 0.668812 [0.0, 0.0, 0.0] 4 Ti 0.738507 0.5 0.83968 [0.0, 0.0, 0.0] 5 Nb 0 0 0 [0.0, 0.0, 0.0]

Does anyone have any ideas how to fix this issue? Perhaps @mkhorton ?

matthewkuner avatar Jun 12 '23 17:06 matthewkuner

Based on git blame from 7 years ago, @montoyjh might know more.

@matthewkuner Could you specify what the error is and post the output of structure.to('material_id.json') in HTML <details> (just start typing /details and let GH auto-complete).

janosh avatar Jun 13 '23 19:06 janosh

@janosh the error I get is:

/global/home/users/matthewkuner/.conda/envs/atomate2/lib/python3.9/site-packages/pymatgen/core/tensors.py", line 476, in get_ieee_rotation\n c = [vec / mag for (mag, vec) in sorted(zip(lengths[n_umask], vecs[n_umask]))][0]\nIndexError: list index out of range\n

Details

{"@module": "pymatgen.core.structure", "@class": "Structure", "charge": 0.0, "lattice": {"matrix": [[1.6330944037650026, 1.6330944037650026, 1.6330944037650026], [3.266188807530005, 0.0, -3.266188807530005], [-3.266188807530005, 6.53237761506001, -3.266188807530005]], "pbc": [true, true, true], "a": 2.828602480877387, "b": 4.61908850888014, "c": 8.000495982037968, "alpha": 90.0, "beta": 90.0, "gamma": 90.0, "volume": 104.53100201054758}, "sites": [{"species": [{"element": "Ti", "occu": 1}], "abc": [0.2614933717186148, 0.5, 0.1603201177754059], "xyz": [1.536501991440391, 1.4743149105751572, -1.7296868160896142], "label": "Ti", "properties": {"velocities": [0.0, 0.0, 0.0]}}, {"species": [{"element": "Ti", "occu": 1}], "abc": [0.5843327795853241, 0.0, 0.3311882512203042], "xyz": [-0.1274527670439516, 3.117717310919628, -0.1274527670439516], "label": "Ti", "properties": {"velocities": [0.0, 0.0, 0.0]}}, {"species": [{"element": "Ti", "occu": 1}], "abc": [0.0, 0.5, 0.5], "xyz": [0.0, 3.266188807530005, -3.266188807530005], "label": "Ti", "properties": {"velocities": [0.0, 0.0, 0.0]}}, {"species": [{"element": "Ti", "occu": 1}], "abc": [0.4156672204146759, 0.0, 0.6688117487796958], "xyz": [-1.5056416367210512, 5.047754707905385, -1.5056416367210512], "label": "Ti", "properties": {"velocities": [0.0, 0.0, 0.0]}}, {"species": [{"element": "Ti", "occu": 1}], "abc": [0.7385066282813852, 0.5, 0.8396798822245941], "xyz": [0.09659241232461158, 6.691157108249856, -3.1695963952053936], "label": "Ti", "properties": {"velocities": [0.0, 0.0, 0.0]}}, {"species": [{"element": "Nb", "occu": 1}], "abc": [0.0, 0.0, 0.0], "xyz": [0.0, 0.0, 0.0], "label": "Nb", "properties": {"velocities": [0.0, 0.0, 0.0]}}]}

matthewkuner avatar Jun 13 '23 21:06 matthewkuner