#656 atomtype macthing and configuring overwrites exact mass

cdk-1.2.x
closed
Rajarshi Guha
9
2012-11-03
2008-05-21
Rajarshi Guha
No

When I load a molecule from an SD file, the atoms have a valid (i.e., non-null) value for the exact mass field.

When I then percieve and configure atom types via AtomContainerManipulator.perceiveAndConfigureAtoms, the exact mass field of all the atoms becomes NULL.

This is because the CDKAtomTypeMatcher finds a matching atom type, the resulting IAtomType object has the exact mass field set to NULL.

So when AtomTypeManipulator.configure configures the current atom with the matching type, it overwrites the exact mass field of the original atom.

Why is the matcher returning a type with NULL for the exact mass?

More generally, what is the policy for configuring atoms. Right now, we just overwrite any previous configuration. I think a more correct approach would be for AtomTypeManipulator.configure to check whether the fields of a atom are UNSET - if so, then do the configuration. If the fields are not UNSET don't do the configuration.

This implies that AtomTypeManipulator should have a method that will 'clear' the configuratin related to atom types by setting the appropriate fields to UNSET

Discussion

  • In overthinking this, overwriting is what should happen with configure()... the idea is configure according to atom type...

    What we should add in addition to this method configureUnsetProperties()...

    Also, exactMass is not an IAtomType property, and should not be set in either case, I think...

    Rajarshi, what do you think?

     
  • Rajarshi Guha
    Rajarshi Guha
    2008-09-29

    I'd avoid another method and go for modifying perceiveAndConfigureAtoms(...) to only configure unset properties. Since I have added the helper method to UNSET all properties set in perceive...(), it's easy to completely reconfigure atoms in a molecule

    I agree that exact mass is not an IAtomType property - and it should probably be removed from the type info. However the perceiveAndConfigureAtoms(...) method does not indicate anything about atom types. If this method does not set the exact mass, then the user must call yet another function to complete the configuration.

    However, I believe this is not required, since exact mass is independent of the atom type and thus I think it really should be a property of the PeriodicTable class (using the mass of the major isotope) and the isotope handling classes.

    If exact mass is added to PeriodicTable, then it should not be in the atom typing classes/methods at all

     
  • Rajarshi Guha
    Rajarshi Guha
    2008-10-20

    Added patcch that fixes this problem - patch is for trunk, not 1.2.x