ARC
ARC copied to clipboard
Spcies Error with Scissors
A clear and concise description of what the bug is.
Hello, I was trying to use the scissors on a species [O]Cl and got an error, it seems to be independent with the definition of the coordinates of the species.
The code is:
spc1 = ARCSpecies(label="R3-X2", smiles="[O]Cl",bdes=[(1, 2)]) spc1.final_xyz = spc1.get_xyz() spc0,spc2 = spc1.scissors()
also tried to define the coordinates separately:
p_1_xyz = {'symbols': ('O', 'Cl'), 'isotopes': (16, 35), 'coords': ((0.8407400963991551, 0.0, 0.0), (-0.8407400963991551, 0.0, 0.0))} spc1 = ARCSpecies(label="R3-X2", smiles="[O]Cl",bdes=[(1, 2)],xyz=p_1_xyz) spc1.final_xyz = spc1.get_xyz() spc0,spc2 = spc1.scissors()
The error I get is :
Inconsistent combination of number of electrons, multiplicity and charge
Thanks :)
From digging around, the issue lies in lines 1780 - 1801 of species.py
This block determines which xyz belongs to which Molecule object after the split. If the number of atoms in the pairs are different, it has no problem deciding. If they're the same, it tries to decide, and apparently gets it wrong for your species.
I suggest at first to examine whether this block is necessary at all: could be that the atom order in the two Molecule objects that are formed from the split is already consistent with the two xyz's we have, then this block can be deleted (and tests must be added). If it is necessary, let's extract it into its own function that returns two pairs of (Molecule, xyz) tuples, fix it, and also add extensive testing.
A quick update: I have been working on this issue and currently managed to get the tests to pass, so technically the issue is resolved. However, I've found another issue, which I cannot currently correct. The problem is that we wish to compare between xyz and a molecule, and xyz's don't keep information about chemical bonds. Now, we sort the two by the chemical formula, but we need to work on the extreme edge case where the number of atoms is the same for both scissors results, and their composition is the same, but they are not isomorphic to each other (added that condition as well), so my solution is quite robust but not free of problems. I will continue to think of a solution, but for now, I technically have a working branch.