Skip to content

CIF import can tamper c for R-3c when _symmetry_equiv_pos_as_xyz is present #67

@clemisch

Description

@clemisch

I have two CIFs for Corundum: Corundum_PDF5.cif from PDF5 and Corundum_AM.cif from American Mineralogist.

Loading Corundum_PDF5.cif via pyobjcryst silently sets c = a (rhombohedral constraint), even though the CIF has hexagonal c. This produces incorrect powder reflections. The same structure in Corundum_AM.cif loads correctly.

Repro:

from pyobjcryst.crystal import CreateCrystalFromCIF

def read_cell_c(path):
    for line in open(path):
        s = line.strip()
        if s.startswith("_cell_length_c"):
            return s.split()[-1]
    return None


def show(label, cif_path, crystal):
    spg = crystal.GetSpaceGroup()
    print(
        label, "CIF c=", read_cell_c(cif_path), 
        "-> objcryst a,b,c=", round(crystal.a, 6), round(crystal.b, 6), round(crystal.c, 6), 
        "spg=", spg.GetName(), 
        "ext=", spg.GetExtension()
    )

am = CreateCrystalFromCIF("Corundum_AM.cif")
pdf5 = CreateCrystalFromCIF("Corundum_PDF5.cif")

show("AM  ", "Corundum_AM.cif", am)
show("PDF5", "Corundum_PDF5.cif", pdf5)

prints

AM   CIF c= 12.9877 -> objcryst a,b,c= 4.757 4.757 12.9877 spg= R -3 c:H ext= H
                                                   ^^^^^^^ correct
PDF5 CIF c= 12.99253(8) -> objcryst a,b,c= 4.75932 4.75932 4.75932 spg= R -3 c:H ext= H
                                                           ^^^^^^^ incorrect c=a

Why it happens (suspected):

  • Corundum_PDF5.cif has _symmetry_equiv_pos_as_xyz, which triggers the symmetry/origin probing in CreateCrystalFromCIF (ObjCryst/ObjCryst/CIF.cpp).
  • That probing temporarily sets space-group extension :R, and UnitCell::UpdateLatticePar() enforces c = a for :R (ObjCryst/ObjCryst/UnitCell.cpp:507-515).
  • When the code later switches back to :H, the original c is already lost and not restored.

Corundum_AM.cif uses _space_group_symop_operation_xyz (DDL2), which is not parsed, so the probing path never runs and c stays correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions