orex / supercell

The program allows you to create regular structure supercell from cif file with partial occupancy and/or substitutions.
GNU General Public License v2.0
91 stars 56 forks source link

Occupancy of 0.000 treated as 1.000 #28

Closed Gitdowski closed 4 years ago

Gitdowski commented 4 years ago

Dear Kirill,

I just stumbled upon a minor issue when introducing an occupancy factor of zero for in the cif file. (I know I could simply delete these atoms instead of setting it to zero. But it is easier for me this way in order to keep a better overview and for potential use of the cif file at some later point in case I want to change the occupancies again to non-zero values.) Instead of the zero occupation factor the supercell code uses 1.000 which screws up the composition and total charge of the supercell.

Example output if occupancy of all atoms A1 are set to 0.000 in the cif file: Group 5 (120 atomic positions in supercell): Site #1: A1 (occ. 1) -> FIXED with occupancy 1.000.

Quick and dirty solution; set it to a very small value and the supercell code will automatically fix the occupancy to zero: Group 5 (120 atomic positions in supercell): Site #1: A1 (occ. 1e-06) -> FIXED with occupancy 0.000.

However, it would be nice if an occupancy of 0.00 would be treated as such in order to avoid confusion for future users.

Best regards, Marcel

orex commented 4 years ago

Hello, Marcel.

I'm very happy about your feedback. You issues are always very useful. Thank you.

The problem is in openbabel library in cif file parsing. I've submitted an issue to openbabel team. If you compile openbabel by yourself, you can easily recompile it with a patch, described here. https://github.com/openbabel/openbabel/issues/2125

Kirill.