Thanks Greg, I suspected that might be the case. I certainly don't want to turn off all sanitization, but I could write a bit of code to convert these salts back to my desired form as a separate step.
Alternatively, I guess I could disable or rewrite halogenCleanup() in MolOps.cpp. Is this the only function which would need to be changed? Best regards, Chris On 22 November 2017 at 07:59, Greg Landrum <greg.land...@gmail.com> wrote: > At the moment the only way to do this is to disable the "cleanup" > functionality in SanitizeMol(). This can be done, but it will also have the > consequence that things like the hypervalent N in nitro groups (i.e. > "-N(=O)=O") is not cleaned up. > > In [2]: m = Chem.MolFromSmiles('O=Cl(=O)(=O)[O-]',sanitize=False) > > In [3]: m.UpdatePropertyCache(strict=False) > > In [4]: > Chem.SanitizeMol(m,sanitizeOps=Chem.SANITIZE_ALL^Chem.SANITIZE_CLEANUP^Chem.SANITIZE_PROPERTIES) > Out[4]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE > > In [5]: Chem.MolToSmiles(m) > Out[5]: 'O=Cl(=O)(=O)[O-]' > > In [6]: m2 = Chem.MolFromSmiles('CN(=O)=O',sanitize=False) > > In [7]: m2.UpdatePropertyCache(strict=False) > > In [8]: > Chem.SanitizeMol(m2,sanitizeOps=Chem.SANITIZE_ALL^Chem.SANITIZE_CLEANUP^Chem.SANITIZE_PROPERTIES) > Out[8]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE > > In [10]: Chem.MolToSmiles(m2) > Out[10]: 'CN(=O)=O' > > > Note that this way of doing things disables all "unreasonable" valence > checking. > > -greg > > > On Tue, Nov 21, 2017 at 10:12 AM, Chris Earnshaw <cgearns...@gmail.com> > wrote: >> >> Hi >> >> Sometime between 2014 and now there appears to have been a change in >> the way hypervalent halogen structures are handled. The old behaviour >> (involving some tweaking of atomic_data.cpp to allow the higher >> oxidation states) was to have a neutral halogen with double bonds to >> most of the oxygens, e.g. >> chlorate O=Cl(=O)[O-] >> perchlorate O=Cl(=O)(=O)[O-] >> >> The current behaviour is to 'charge separate' the dative bonds, giving >> chlorate [O-][Cl2+]([O+])[O-] >> perchlorate [O-][Cl3+]([O-])([O+])[O-] >> >> Although this may be regarded as 'correct' (arguable!), it can cause >> problems of compatibility with other software and looks remarkably >> ugly. It's also inconsistent with the handling of hypervalent P and S >> compounds. Using the same convention, we should have - >> >> trimethylphosphine oxide C[P+]([O-])(C)C >> dimethylsulfoxide C[S+]([O-])C >> dimethylsulfone C[S2+]([O-])([O-])C >> >> - and I really don't want this to happen! >> >> Does anyone know a way to restore the old behaviour for chlorites, >> bromates, periodates etc.? >> >> Best regards, >> Chris Earnshaw >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdkit-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss