`read_cif` loses atoms that are close to each other in CIF format
Checklist
-
The issue remains in the development version of ASE. -
An minimal example is provided to reproduce the issue.
Summary
I am encountering an issue where ase.io.read
retains only one of two atoms when the coordinates are very close. The example structure Crystal.cif
(attached) includes 8 atoms, with 3 pairs closely positioned (labeled as site1--site8, site2--site7, site3--site6). The function returns an Atoms
object with only 5 atoms, where the other 3 overlapping atoms are absent. This is problematic for tasks that involve cleaning structures with overlapping atoms.
I suspected this might be related to site tolerance settings, akin to those in pymatgen
's CifParser
, but I was unable to find any relevant settings in the code. I'm submitting this ticket to seek help from more experienced contributors.
In addition, the function io.cif.read_cif
is returning a generator
object, contrary to the Union
type as suggested in the API documentation. An update or clarification in the documentation would be appreciated.
Reproducible code of the issue:
import ase.io
from ase.neighborlist import neighbor_list
cif = "Crystal.cif"
a = ase.io.read(cif)
# a = ase.io.cif.read_cif(fileobj = cif, index=0) # gives a generator, but gives the same output below
for atom in a:
print(f"{atom.symbol}-{atom.index}, Position: {atom.scaled_position}")
Output:
C-0, Position: [0.1191 0.5596 0.5713]
C-1, Position: [0.4404 0.5595 0.5713]
C-2, Position: [0.4405 0.8809 0.5713]
C-3, Position: [0.07117 0.21573 0.93523]
C-4, Position: [0.14457 0.21573 0.93523]