Bug with Molecular Formula

Please consider submitting issues to GitHub which will enable tracking bug reports and suggestions. These will be closed and updated automatically when they are fixed – including notifications.

I believe this to be a bug with Avogadro:
The molecular formula doesn’t align with the number of reported atoms when I press analyze properties molecular formula. Also, I have to press molecular formula twice before it pops up.

Environment Information

Avogadro version: 2
Operating system and version: MacOS

Steps to Reproduce

Can you show us the system or share a file?

save.xyz (1.3 KB)

The formula takes into account the unit cell boundaries. How many atoms you have depends a bit on how this is supposed to “fill.”

By my count, the “up” chains of 4 atoms are fully in your unit cell. So that’s 3*4 = 12 atoms.
Then there are two “down” chains in the middle of the box with 3 atoms each fully in the box and two atoms on an edge, so when I “fill,” I should get another 8 atoms = 20 atoms.

Finally, you have one chain on the left edge of the box. That’s three atoms 1/2 each, plus a corner atom. The three atoms should “fill” on the other side, so that’s 3 full = 23. It’s less clear on how the corner atom should count with its translational copies.

So yes, maybe it’s 24? Or 23? Or 23.5?

Do you need the formula to say something particular? It looks like you intentionally generated a slab.

@Eitan_Feldman1 If you submit the .xyz to openbabel

obabel save.xyz -oreport | head

you can read the Hill formula (here \ce{Ti_{24}}). If you can, a .cif file would be more suitable here - regardless if the structure model is 2D, or 3D - because this would describe the atomic positions with (typically fractional) coordinates within the unit cell. The assigned symmetry would include symmetry operators like

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

which affects the wanted readout if atoms are on special sites / are multiplied in number by the symmetry within the unit cell.

In the inspection with Jmol, the six arrays appear in a zig-zag arrangement, one of them (second from the left hand side) a bit more, than the others: