示例#1
0
void setReactantAtomPropertiesToProduct(
    Atom *productAtom, const Atom& reactantAtom,
    bool setImplicitProperties)
{
    // which properties need to be set from the reactant?
    if(productAtom->getAtomicNum()<=0) {
        productAtom->setAtomicNum(reactantAtom.getAtomicNum());
        productAtom->setIsAromatic(reactantAtom.getIsAromatic());
        // don't copy isotope information over from dummy atoms
        productAtom->setIsotope(reactantAtom.getIsotope());

        // remove dummy labels (if present)
        if(productAtom->hasProp(common_properties::dummyLabel)) productAtom->clearProp(common_properties::dummyLabel);
        if(productAtom->hasProp(common_properties::_MolFileRLabel)) productAtom->clearProp(common_properties::_MolFileRLabel);
    }
    if(setImplicitProperties) {
        updateImplicitAtomProperties(productAtom,&reactantAtom);
    }
    // One might be tempted to copy over the reactant atom's chirality into the
    // product atom if chirality is not specified on the product. This would be a
    // very bad idea because the order of bonds will almost certainly change on the
    // atom and the chirality is referenced to bond order.

    // --------- --------- --------- --------- --------- ---------
    // While we're here, set the stereochemistry
    // FIX: this should be free-standing, not in this function.
    if(reactantAtom.getChiralTag()!=Atom::CHI_UNSPECIFIED &&
            reactantAtom.getChiralTag()!=Atom::CHI_OTHER &&
            productAtom->hasProp(common_properties::molInversionFlag)) {
        checkProductChirality(reactantAtom.getChiralTag(), productAtom);
    }
}
示例#2
0
void setReactantAtomPropertiesToProduct(Atom *productAtom,
                                        const Atom &reactantAtom,
                                        bool setImplicitProperties) {
  // which properties need to be set from the reactant?
  if (productAtom->getAtomicNum() <= 0 ||
      productAtom->hasProp(common_properties::_MolFileAtomQuery)) {
    productAtom->setAtomicNum(reactantAtom.getAtomicNum());
    productAtom->setIsAromatic(reactantAtom.getIsAromatic());
    // don't copy isotope information over from dummy atoms
    // (part of github #243) unless we're setting implicit properties,
    // in which case we do need to copy them in (github #1269)
    if (!setImplicitProperties) {
      productAtom->setIsotope(reactantAtom.getIsotope());
    }
    // remove dummy labels (if present)
    if (productAtom->hasProp(common_properties::dummyLabel)) {
      productAtom->clearProp(common_properties::dummyLabel);
    }
    if (productAtom->hasProp(common_properties::_MolFileRLabel)) {
      productAtom->clearProp(common_properties::_MolFileRLabel);
    }
    productAtom->setProp<unsigned int>(common_properties::reactantAtomIdx,
                                       reactantAtom.getIdx());
    productAtom->setProp(WAS_DUMMY, true);
  } else {
    // remove bookkeeping labels (if present)
    if (productAtom->hasProp(WAS_DUMMY)) productAtom->clearProp(WAS_DUMMY);
  }
  productAtom->setProp<unsigned int>(common_properties::reactantAtomIdx,
                                     reactantAtom.getIdx());
  if (setImplicitProperties) {
    updateImplicitAtomProperties(productAtom, &reactantAtom);
  }
  // One might be tempted to copy over the reactant atom's chirality into the
  // product atom if chirality is not specified on the product. This would be a
  // very bad idea because the order of bonds will almost certainly change on
  // the atom and the chirality is referenced to bond order.

  // --------- --------- --------- --------- --------- ---------
  // While we're here, set the stereochemistry
  // FIX: this should be free-standing, not in this function.
  if (reactantAtom.getChiralTag() != Atom::CHI_UNSPECIFIED &&
      reactantAtom.getChiralTag() != Atom::CHI_OTHER &&
      productAtom->hasProp(common_properties::molInversionFlag)) {
    checkProductChirality(reactantAtom.getChiralTag(), productAtom);
  }

  // copy over residue information if it's there. This was github #1632
  if (reactantAtom.getMonomerInfo()) {
    productAtom->setMonomerInfo(reactantAtom.getMonomerInfo()->copy());
  }
}