torbjornbjorkman / cif2cell

Generating geometries for electronic structure calculations from CIF files.
GNU General Public License v3.0
41 stars 23 forks source link

version 2.0 is giving error while reading cif files which are working fine with version 1.2.10 #34

Open karpathyan opened 1 year ago

karpathyan commented 1 year ago

Hi, I'm trying to convert some CIF files using cif2cell with the latest version (v 2.0). However, I'm getting an error while reading the CIF file. Strangeley, the same CIF files are reading fine with the older version of cif2cell ( 1.2.10 ).

here is the error I'm getting while running the following command

cif2cell sd_0459244.cif 
Traceback (most recent call last):
  File "/home/my_username/venv/lib/python3.11/site-packages/cif2cell/uctools.py", line 1231, in getFromCIF
    eqsites = SymOpsHall[self.HallSymbol]
              ~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'Unknown'

Could you please check this error? Thanks for your time.

Here is a copy of the CIF file I used

##CIF_1.1

data_sm_global
#Used dictionaries
loop_
_audit_conform_dict_name
_audit_conform_dict_version
_audit_conform_dict_location
cif_core.dic    2.4.2   .
cif_pd.dic      1.0.1   .
cif_sm.dic      0.1     'redaktion.landolt-boernstein(at)springer.com'

#About this content and reference
_sm_credits_copyright
;
;

_audit_creation_method
;
;

_publ_section_references
;
;

#Phase classification
_sm_phase_labels                'FeCo2Al rt'
_chemical_name_mineral          ''
_sm_chemical_compound_class     'intermetallic'
_sm_phase_prototype             'Cu2 MnAl'
_sm_pearson_symbol              'cF16'
_symmetry_Int_Tables_number     225
_sm_sample_details
;powder (determination of cell and structural parameters)
;
_sm_measurement_details
;automatic diffractometer (determination of cell and structural parameters), 
X-rays, Cu Kα (determination of cell and structural parameters)
;
_sm_interpretation_details
;cell parameters determined and type with fixed coordinates assigned
;

data_sm_isp_SD0459244-standardized_unitcell
#Cell Parameters
_cell_length_a                  5.73
_cell_length_b                  5.73
_cell_length_c                  5.73
_cell_angle_alpha               90
_cell_angle_beta                90
_cell_angle_gamma               90
_sm_length_ratio_ab             1.000
_sm_length_ratio_bc             1.000
_sm_length_ratio_ca             1.000
_cell_volume                    188.1
_symmetry_space_group_name_H-M  'Fm-3m'
_symmetry_Int_Tables_number     225
_cell_formula_units_Z           4
_sm_cell_transformation
;No transformation from published to standardized cell parameters necessary.
;

#Atom Coordinates
loop_
_atom_site_label
_atom_site_type_symbol
_atom_site_Wyckoff_symbol
_sm_site_symmetry
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
_sm_coordination_number
_sm_atomic_environment_type
Co 'Co' .8c .-43m 0.25 0.25 0.25 1 14 'rhombic dodecahedron, Fe<sub>4</sub>Al<sub>4</sub>Co<sub>6</sub>'
Al 'Al' .4b .m-3m 0.5 0.5 0.5 1 14 'rhombic dodecahedron, Co<sub>8</sub>Fe<sub>6</sub>'
Fe 'Fe' .4a .m-3m 0 0 0 1 14 'rhombic dodecahedron, Co<sub>8</sub>Al<sub>6</sub>'

_sm_atom_site_transformation
;No transformation from published to standardized cell parameters necessary.
;

data_sm_isp_SD0459244-published_cell
#Cell Parameters
_cell_length_a                  5.73
_cell_length_b                  5.73
_cell_length_c                  5.73
_cell_angle_alpha               90
_cell_angle_beta                90
_cell_angle_gamma               90
_sm_length_ratio_ab             1.000
_sm_length_ratio_bc             1.000
_sm_length_ratio_ca             1.000
_cell_volume                    188.13
_symmetry_space_group_name_H-M  'Fm-3m'
_symmetry_Int_Tables_number     225
_cell_formula_units_Z           4

#Atom Coordinates
loop_
_atom_site_label
_atom_site_type_symbol
_atom_site_Wyckoff_symbol
_sm_site_symmetry
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
_sm_coordination_number
_sm_atomic_environment_type
Fe 'Fe' .4a .m-3m 0 0 0 1 ? '?'
Al 'Al' .4b .m-3m 0.5 0.5 0.5 1 ? '?'
Co 'Co' .8c .-43m 0.25 0.25 0.25 1 ? '?'

data_sm_isp_SD0459244-niggli_reduced_cell
#Cell Parameters
_cell_length_a                  4.0517
_cell_length_b                  4.0517
_cell_length_c                  4.0517
_cell_angle_alpha               60
_cell_angle_beta                60
_cell_angle_gamma               60
_sm_length_ratio_ab             1.000
_sm_length_ratio_bc             1.000
_sm_length_ratio_ca             1.000
_cell_volume                    47.03
_symmetry_space_group_name_H-M  ''
_symmetry_Int_Tables_number     ?
_cell_formula_units_Z           4

#Atom Coordinates
loop_
_atom_site_label
_atom_site_type_symbol
_atom_site_Wyckoff_symbol
_sm_site_symmetry
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
_sm_coordination_number
_sm_atomic_environment_type
? ? ? ? ? ? ? ? ? ?
dr-geeno commented 1 year ago

Hi @karpathyan , I think I solved the problem for the error you mentioned, but then another error came up, unrelated to that.

***Error: cell setup: Unable to read crystallographic parameters

Which means the program has problems extracting the cell parameters, but that is done through the external library CifFile (PyCifRW).

A workaround that I found is to open the file using other programs, such as VESTA, resave as a .cif file, remove the last two phases and then run cif2cell.

Modified cif file:

#======================================================================
# CRYSTAL DATA
#----------------------------------------------------------------------
data_VESTA_phase_1

_chemical_name_common                  'sm_isp_SD0459244-standardized_unitcell'
_cell_length_a                         5.730000
_cell_length_b                         5.730000
_cell_length_c                         5.730000
_cell_angle_alpha                      90.000000
_cell_angle_beta                       90.000000
_cell_angle_gamma                      90.000000
_cell_volume                           188.132519
_space_group_name_H-M_alt              'F m -3 m'
_space_group_IT_number                 225

loop_
_space_group_symop_operation_xyz
   'x, y, z'
   '-x, -y, -z'
   '-x, -y, z'
   'x, y, -z'
   '-x, y, -z'
   'x, -y, z'
   'x, -y, -z'
   '-x, y, z'
   'z, x, y'
   '-z, -x, -y'
   'z, -x, -y'
   '-z, x, y'
   '-z, -x, y'
   'z, x, -y'
   '-z, x, -y'
   'z, -x, y'
   'y, z, x'
   '-y, -z, -x'
   '-y, z, -x'
   'y, -z, x'
   'y, -z, -x'
   '-y, z, x'
   '-y, -z, x'
   'y, z, -x'
   'y, x, -z'
   '-y, -x, z'
   '-y, -x, -z'
   'y, x, z'
   'y, -x, z'
   '-y, x, -z'
   '-y, x, z'
   'y, -x, -z'
   'x, z, -y'
   '-x, -z, y'
   '-x, z, y'
   'x, -z, -y'
   '-x, -z, -y'
   'x, z, y'
   'x, -z, y'
   '-x, z, -y'
   'z, y, -x'
   '-z, -y, x'
   'z, -y, x'
   '-z, y, -x'
   '-z, y, x'
   'z, -y, -x'
   '-z, -y, -x'
   'z, y, x'
   'x, y+1/2, z+1/2'
   '-x, -y+1/2, -z+1/2'
   '-x, -y+1/2, z+1/2'
   'x, y+1/2, -z+1/2'
   '-x, y+1/2, -z+1/2'
   'x, -y+1/2, z+1/2'
   'x, -y+1/2, -z+1/2'
   '-x, y+1/2, z+1/2'
   'z, x+1/2, y+1/2'
   '-z, -x+1/2, -y+1/2'
   'z, -x+1/2, -y+1/2'
   '-z, x+1/2, y+1/2'
   '-z, -x+1/2, y+1/2'
   'z, x+1/2, -y+1/2'
   '-z, x+1/2, -y+1/2'
   'z, -x+1/2, y+1/2'
   'y, z+1/2, x+1/2'
   '-y, -z+1/2, -x+1/2'
   '-y, z+1/2, -x+1/2'
   'y, -z+1/2, x+1/2'
   'y, -z+1/2, -x+1/2'
   '-y, z+1/2, x+1/2'
   '-y, -z+1/2, x+1/2'
   'y, z+1/2, -x+1/2'
   'y, x+1/2, -z+1/2'
   '-y, -x+1/2, z+1/2'
   '-y, -x+1/2, -z+1/2'
   'y, x+1/2, z+1/2'
   'y, -x+1/2, z+1/2'
   '-y, x+1/2, -z+1/2'
   '-y, x+1/2, z+1/2'
   'y, -x+1/2, -z+1/2'
   'x, z+1/2, -y+1/2'
   '-x, -z+1/2, y+1/2'
   '-x, z+1/2, y+1/2'
   'x, -z+1/2, -y+1/2'
   '-x, -z+1/2, -y+1/2'
   'x, z+1/2, y+1/2'
   'x, -z+1/2, y+1/2'
   '-x, z+1/2, -y+1/2'
   'z, y+1/2, -x+1/2'
   '-z, -y+1/2, x+1/2'
   'z, -y+1/2, x+1/2'
   '-z, y+1/2, -x+1/2'
   '-z, y+1/2, x+1/2'
   'z, -y+1/2, -x+1/2'
   '-z, -y+1/2, -x+1/2'
   'z, y+1/2, x+1/2'
   'x+1/2, y, z+1/2'
   '-x+1/2, -y, -z+1/2'
   '-x+1/2, -y, z+1/2'
   'x+1/2, y, -z+1/2'
   '-x+1/2, y, -z+1/2'
   'x+1/2, -y, z+1/2'
   'x+1/2, -y, -z+1/2'
   '-x+1/2, y, z+1/2'
   'z+1/2, x, y+1/2'
   '-z+1/2, -x, -y+1/2'
   'z+1/2, -x, -y+1/2'
   '-z+1/2, x, y+1/2'
   '-z+1/2, -x, y+1/2'
   'z+1/2, x, -y+1/2'
   '-z+1/2, x, -y+1/2'
   'z+1/2, -x, y+1/2'
   'y+1/2, z, x+1/2'
   '-y+1/2, -z, -x+1/2'
   '-y+1/2, z, -x+1/2'
   'y+1/2, -z, x+1/2'
   'y+1/2, -z, -x+1/2'
   '-y+1/2, z, x+1/2'
   '-y+1/2, -z, x+1/2'
   'y+1/2, z, -x+1/2'
   'y+1/2, x, -z+1/2'
   '-y+1/2, -x, z+1/2'
   '-y+1/2, -x, -z+1/2'
   'y+1/2, x, z+1/2'
   'y+1/2, -x, z+1/2'
   '-y+1/2, x, -z+1/2'
   '-y+1/2, x, z+1/2'
   'y+1/2, -x, -z+1/2'
   'x+1/2, z, -y+1/2'
   '-x+1/2, -z, y+1/2'
   '-x+1/2, z, y+1/2'
   'x+1/2, -z, -y+1/2'
   '-x+1/2, -z, -y+1/2'
   'x+1/2, z, y+1/2'
   'x+1/2, -z, y+1/2'
   '-x+1/2, z, -y+1/2'
   'z+1/2, y, -x+1/2'
   '-z+1/2, -y, x+1/2'
   'z+1/2, -y, x+1/2'
   '-z+1/2, y, -x+1/2'
   '-z+1/2, y, x+1/2'
   'z+1/2, -y, -x+1/2'
   '-z+1/2, -y, -x+1/2'
   'z+1/2, y, x+1/2'
   'x+1/2, y+1/2, z'
   '-x+1/2, -y+1/2, -z'
   '-x+1/2, -y+1/2, z'
   'x+1/2, y+1/2, -z'
   '-x+1/2, y+1/2, -z'
   'x+1/2, -y+1/2, z'
   'x+1/2, -y+1/2, -z'
   '-x+1/2, y+1/2, z'
   'z+1/2, x+1/2, y'
   '-z+1/2, -x+1/2, -y'
   'z+1/2, -x+1/2, -y'
   '-z+1/2, x+1/2, y'
   '-z+1/2, -x+1/2, y'
   'z+1/2, x+1/2, -y'
   '-z+1/2, x+1/2, -y'
   'z+1/2, -x+1/2, y'
   'y+1/2, z+1/2, x'
   '-y+1/2, -z+1/2, -x'
   '-y+1/2, z+1/2, -x'
   'y+1/2, -z+1/2, x'
   'y+1/2, -z+1/2, -x'
   '-y+1/2, z+1/2, x'
   '-y+1/2, -z+1/2, x'
   'y+1/2, z+1/2, -x'
   'y+1/2, x+1/2, -z'
   '-y+1/2, -x+1/2, z'
   '-y+1/2, -x+1/2, -z'
   'y+1/2, x+1/2, z'
   'y+1/2, -x+1/2, z'
   '-y+1/2, x+1/2, -z'
   '-y+1/2, x+1/2, z'
   'y+1/2, -x+1/2, -z'
   'x+1/2, z+1/2, -y'
   '-x+1/2, -z+1/2, y'
   '-x+1/2, z+1/2, y'
   'x+1/2, -z+1/2, -y'
   '-x+1/2, -z+1/2, -y'
   'x+1/2, z+1/2, y'
   'x+1/2, -z+1/2, y'
   '-x+1/2, z+1/2, -y'
   'z+1/2, y+1/2, -x'
   '-z+1/2, -y+1/2, x'
   'z+1/2, -y+1/2, x'
   '-z+1/2, y+1/2, -x'
   '-z+1/2, y+1/2, x'
   'z+1/2, -y+1/2, -x'
   '-z+1/2, -y+1/2, -x'
   'z+1/2, y+1/2, x'

loop_
   _atom_site_label
   _atom_site_occupancy
   _atom_site_fract_x
   _atom_site_fract_y
   _atom_site_fract_z
   _atom_site_adp_type
   _atom_site_U_iso_or_equiv
   _atom_site_type_symbol
   Co         1.0     0.250000     0.250000     0.250000    Uiso  ? Co
   Al         1.0     0.500000     0.500000     0.500000    Uiso  ? Al
   Fe         1.0     0.000000     0.000000     0.000000    Uiso  ? Fe

Output of cif2cell:

CIF2CELL 2.1.0
2023-10-03 16:06
Output for None

 BIBLIOGRAPHIC INFORMATION
Failed to get author information, No journal information 
 INPUT CELL INFORMATION
Symmetry information:
Cubic crystal system.
Space group number     : 225
Hall symbol            : -F 4 2 3
Hermann-Mauguin symbol : Fm-3m

Lattice parameters:
          a           b           c 
  5.7300000   5.7300000   5.7300000 
      alpha        beta       gamma 
 90.0000000  90.0000000  90.0000000 
Representative sites :
Atom           a1          a2          a3 
Co      0.2500000   0.2500000   0.2500000
Al      0.5000000   0.5000000   0.5000000
Fe      0.0000000   0.0000000   0.0000000

 OUTPUT CELL INFORMATION
Symmetry information:
Cubic crystal system.
Space group number     : 225
Hall symbol            : -F 4 2 3
Hermann-Mauguin symbol : Fm-3m

Bravais lattice vectors :
  0.5000000   0.5000000   0.0000000 
  0.5000000   0.0000000   0.5000000 
  0.0000000   0.5000000   0.5000000 
All sites, (lattice coordinates):
Atom           a1          a2          a3 
Co      0.2500000   0.2500000   0.2500000
Co      0.7500000   0.7500000   0.7500000
Al      0.5000000   0.5000000   0.5000000
Fe      0.0000000   0.0000000   0.0000000

Unit cell volume  :  47.0331293 A^3
Unit cell density :   4.2670348 u/A^3 =  47.8158417 g/cm^3

Hope this helps.