mctools / ncrystal

NCrystal : a library for thermal neutron transport in crystals and other materials
https://mctools.github.io/ncrystal/
Other
38 stars 17 forks source link

Inconsistent structure formula loaded from CIF #128

Open nicriz opened 1 year ago

nicriz commented 1 year ago

Hi, I get a weird behaviour when trying to read a CIF file from Crystallography Open Database.

Loading the structure of the Al2O3 without forcing the space group gives me a consistent output for the structure (right number of atoms per unit cell):

c_cif_codZapphire_attempt1 = nc.NCMATComposer('codid::9009679')

Using cached Crystallography Open Database result for entry 9009679
Attempting to load CIF data with gemmi
Self-consistency of structure was verified by spglib
NCMAT v7
# Autogenerated by NCMATComposer
#
# Al2O3 (trigonal, SG-167)
#
# Atoms per unit cell: 12xAl+18xO
#
# Structure converted (with NCrystal.cifutils module) from:
#
#   "Crystal structure and compression of ruby to 46 kbar
#    P = 11 kbar"
#   Finger, L. W. and Hazen, R. M. [Journal of Applied Physics, 1978]
#   DOI: https://dx.doi.org/10.1063/1.324598
#   Crystallography Open Database entry 9009679
#   https://www.crystallography.net/cod/9009679.html
#
# IMPORTANT NOTICE: This is a mostly automatic conversion which has not been
#                   verified!  In particular the @DYNINFO sections might need
#                   post-editing. Before distributing this file to other people,
#                   please review this, amend the comments here to document,
#                   anything done, and remove this notice.
#
# Notice: The following WARNINGS were emitted when loading the CIF data:
#
#   NCrystalUserWarning : SG-167 available in multiple choices ("R -3 c:H", "R -3 c:R") and which one was not encoded explicitly in the _space_group_name_H-M_alt CIF field. Consider overriding the space group explicitly when loading this file.
#   NCrystalUserWarning : ignoring uiso info present in CIF input for "Al" since uiso_temperature parameter value is not provided
#   NCrystalUserWarning : ignoring uiso info present in CIF input for "O" since uiso_temperature parameter value is not provided
#
# WARNING: Fallback (dummy) Debye temperature values were used for 2 atoms!
#
# NOTICE: crystal structure was verified with spglib to be self-consistent.
#
@CELL
  lengths 4.7537 !! 12.9725
  angles 90 90 120
@SPACEGROUP
  167
@ATOMPOSITIONS
  Al 0 0 .148
  Al 0 0 .352
  Al 0 0 .648
  Al 0 0 .852
  Al 1/3 2/3 .01866666666666667
  Al 1/3 2/3 .31466666666666667
  Al 1/3 2/3 .51866666666666667
  Al 1/3 2/3 .81466666666666667
  Al 2/3 1/3 .18533333333333333
  Al 2/3 1/3 .48133333333333333
  Al 2/3 1/3 .68533333333333333
  Al 2/3 1/3 .98133333333333333
  O 0 .306 1/4
  O 0 .694 3/4
  O .02733333333333333 .36066666666666667 11/12
  O .02733333333333333 2/3 5/12
  O .306 0 1/4
  O .306 .306 3/4
  O 1/3 .36066666666666667 5/12
  O 1/3 .97266666666666667 11/12
  O .36066666666666667 .02733333333333333 7/12
  O .36066666666666667 1/3 1/12
  O .63933333333333333 2/3 11/12
  O .63933333333333333 .97266666666666667 5/12
  O 2/3 .02733333333333333 1/12
  O 2/3 .63933333333333333 7/12
  O .694 0 3/4
  O .694 .694 1/4
  O .97266666666666667 1/3 7/12
  O .97266666666666667 .63933333333333333 1/12
@DYNINFO
  # WARNING: Using fallback Debye temperature value!
  element Al
  fraction 2/5
  type vdosdebye
  debye_temp 300
@DYNINFO
  # WARNING: Using fallback Debye temperature value!
  element O
  fraction 3/5
  type vdosdebye
  debye_temp 300

I get obviously the warning about multiple choices available for SG-167 and the suggestion to force the choice of one of them. However none of the two choices (R -3 m:H and R -3 m:R) work when trying to run: c_choice = nc.NCMATComposer.from_cif('codid::9009679', uiso_temperature=300, override_spacegroup="R -3 m:H")

While the second one is not compatible with deduced space group (according to Gemmi), the first one throws the following error:

Using cached Crystallography Open Database result for entry 9009679
Attempting to load CIF data with gemmi
Self-consistency of structure was verified by spglib
ERROR NCBadInput: Formula encoded in CIF data ("Al2 O3") is not compatible with formula of loaded structure ("AlO6")

as if the default loaded structure was AlO6, which doesn't seem to be the case looking at the first ncmat output. I am wondering if the origin of this behaviour is to blame to NCrystal or to poor CIF file.

tkittel commented 12 months ago

Yeah, that looks a bit weird. I wonder if some of the space group fields are perhaps non-standard:

$> grep sym 9009679.cif
_symmetry_space_group_name_Hall  '-R 3 2"c'
_symmetry_space_group_name_H-M   'R -3 c :H'
_cod_original_sg_symbol_H-M      'R -3 c'
_space_group_symop_operation_xyz

Leaving this open for next time I have time to look at the CIF code.