Hi David, In order to make kekulization work on imidazolium rings, I hard coded SMARTS in bondtyper.cpp, where I explicitly set the formal charge of one of the nitrogens to 1 and also set the bond order to 2 for two of the bonds in the ring. Doing this, kekulization works fine.
As pointed out by you, the SMARTS for bond typing should be defined in bondtyp.txt data file not hardcoded in the source file. I did it but kelulizataion fails again, as the result of which the imidazolium ring is considered as AL instead of AR. I think the problem is the formal charge which is set to 0 for all atoms by default. While, for rings like imidazolium, the formal charge of the nitrogen with four bonds is 1. In bondtyper.cpp, there are other examples were the formal charges are set explicitly, oxido-n+ (e.g., pyridine-N-oxide). I was wondering if there is some data file to tabulate formal charge for specific cases like this. I checked atomtyp.txt, not formal charge is stored there. Thanks, Mohammad Hi David, The data file _should_ be being used as long as openbabel can find it. The hardcoded values in the C++ source code are there as a fallback when the data files can't be found. I recently had a pull request merged that updates the C++ versions to match the data files (previously they were very out of date resulting in bad behavior when the data files couldn't be found due to, for example, openbabel being installed in strange place): https://github.com/openbabel/openbabel/pull/2328 If you want to improve the bond typing, change the data files, not the source code. If the problem is the source code has bad bond typing, update to a version with the pull request and rebuild. Thanks, David Koes Associate Professor Computational & Systems Biology University of Pittsburgh On 5/11/21 2:51 PM, David van der Spoel wrote: Hi, is anyone working on bondtyper.cpp? Apparently, the data file bondtyp.txt is not used at all and the information about bonding is hardcoded in the C++ source code. I would be happy to help, but before spending considerable effort it would be good to know if there is a plan for this part of the code. Cheers, -- David van der Spoel, Ph.D., Professor of Computational Molecular Biophysics Uppsala University. https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvirtualchemistry.org%2F&data=04%7C01%7Cdkoes%40pitt.edu%7C7c0df21efdda4474888708d914addb90%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C1%7C637563559213381322%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=lffer4K7HY%2BExwngNb%2F3r0JFz1yQYRiWrYXz7Pd7ZGY%3D&reserved=0
_______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel