Greg-

Your explanation of "minium" perfectly matched my vague suspicions. Thanks for always being helpful and thorough with your answers.

I will use the try/catch for my code and start putting together the examples and bug on sourceforge.

Thanks!

-Marshall


On Mar 30, 2009, at 12:15 PM, Greg Landrum wrote:

Dear Marshall,

A quick (and partial) reply.

On Mon, Mar 30, 2009 at 7:22 PM, Marshall Levesque
<[email protected]> wrote:
Greg-

Here is how I fixed the nickel and copper (found this later) organomettalic
compounds within 'atomtyper.cpp':

#########  addAtomChargeFlags #####
       case 28: // Ni
         switch(totalValence){
         case 2:
           atomKey += "+2";
           break;
         default:
           if(tolerateChargeMismatch) atomKey += "+2";
BOOST_LOG(rdErrorLog) << "UFFTYPER: Unrecognized charge state for
atom: "<< atom->getIdx() << std::endl;
         }
         break;
       case 29: // Cu
         switch(totalValence){
         case 1:
           atomKey += "+1";
           break;
         case 2:
           atomKey += "+2";
           break;
         default:
           if(tolerateChargeMismatch) atomKey += "+1";
BOOST_LOG(rdErrorLog) << "UFFTYPER: Unrecognized charge state for
atom: "<< atom->getIdx() << std::endl;
         }
         break;

#######################

########  getAtomLabel  ########
             case 28:
             atomKey += '4';
             if(atom->getHybridization()!=Atom::SP3D){
BOOST_LOG(rdWarningLog) << "UFFTYPER: Warning: hybridization
set to Square Planar for atom "<< atom->getIdx() << std::endl;
             }
             break;
           case 29:
             atomKey += '3';
             if(atom->getHybridization()!=Atom::SP3){
BOOST_LOG(rdWarningLog) << "UFFTYPER: Warning: hybridization
set to Square Planar for atom "<< atom->getIdx() << std::endl;
             }
             break;
##########################

Thanks. I'll have to go through this a bit more and think about it.


Now I have found a problem with lead tetraoxide (aka minium or Pb3O4)

http://www.emolecules.com/cgi-bin/more?vid=474486

The problem here goes far, far beyond UFF parameters and
hybridization. Pb3O4 is not a molecular species, it forms a continuous
crystalline network connected by covalent bonds. In the language of
solid-state chemistry, it's an extended system, not a molecule. Pb3O4
isn't a molecular formula per se, it's just telling you the ratio of
the components in the crystal. Take a look at the wikipedia page for
minium (http://en.wikipedia.org/wiki/Minium) to see a picture of the
crystal structure. Basically, you can't represent this substance as a
SMILES at all and can't even do a reasonable approximation without
including a *lot* of atoms. Even if you could, the distance geometry
code and force field in the RDKit aren't likely to be able to do
anything sensible with it.


The initial error was similar to the previous Ni and Cu problems but I have
not found a fix using the same solution strategy:

[15:46:23] UFFTYPER: Unrecognized atom type: Pb3+3 (0)
[15:46:23] UFFTYPER: Unrecognized charge state for atom: 2
[15:46:23] UFFTYPER: Unrecognized atom type: Pb3+3 (2)
[15:46:23] UFFTYPER: Unrecognized charge state for atom: 4
[15:46:23] UFFTYPER: Unrecognized atom type: Pb3+3 (4)
[15:46:23]

****
Pre-condition Violation
bad params pointer
Violation occurred on line 21 in file ForceField/UFF/BondStretch.cpp
Failed Expression: end1Params
****

If there isn't an easy fix, can you suggest a strategy for preventing RDKit from terminating when encountering these hybridization errors and just moving to the next molecule, while making a note of the molecules name to be
logged as an error?

Sure, just put the embedding step in a try/except block and catch the failure.

For the Ni and Cu additions to AtomTyper.cpp, you told me to come up with some test cases in $RDBASE/Code/GraphMol/ForceFieldHelpers/ testHelpers.cpp Do you want me to follow the examples in that file and also submit a bug to
sourceforge.net to connect the test case to?


Please. That would be very helpful.

-greg


Reply via email to