/// <summary> Determines if the atom can be of type AtomType. That is, it sees if this
        /// AtomType only differs in bond orders, or implicit hydrogen count.
        /// </summary>
        public virtual bool couldMatchAtomType(IAtom atom, double bondOrderSum, double maxBondOrder, IAtomType type)
        {
            //logger.debug("couldMatchAtomType:   ... matching atom ", atom, " vs ", type);
            int hcount = atom.getHydrogenCount();
            int charge = atom.getFormalCharge();

            if (charge == type.getFormalCharge())
            {
                //logger.debug("couldMatchAtomType:     formal charge matches...");
                if (atom.Hybridization == type.Hybridization)
                {
                    //logger.debug("couldMatchAtomType:     hybridization is OK...");
                    if (bondOrderSum + hcount <= type.BondOrderSum)
                    {
                        //logger.debug("couldMatchAtomType:     bond order sum is OK...");
                        if (maxBondOrder <= type.MaxBondOrder)
                        {
                            //logger.debug("couldMatchAtomType:     max bond order is OK... We have a match!");
                            return(true);
                        }
                    }
                    else
                    {
                        //logger.debug("couldMatchAtomType:      no match", "" + (bondOrderSum + hcount), " > ", "" + type.BondOrderSum);
                    }
                }
            }
            else
            {
                //logger.debug("couldMatchAtomType:     formal charge does NOT match...");
            }
            //logger.debug("couldMatchAtomType:    No Match");
            return(false);
        }
        /// <summary> Method that assign properties to an atom given a particular atomType.
        /// 
        /// </summary>
        /// <param name="atom"> Atom to configure
        /// </param>
        /// <param name="atomType">   AtomType
        /// </param>
        public static void configure(IAtom atom, IAtomType atomType)
        {
            atom.AtomTypeName = atomType.AtomTypeName;
            atom.MaxBondOrder = atomType.MaxBondOrder;
            atom.BondOrderSum = atomType.BondOrderSum;
            atom.VanderwaalsRadius = atomType.VanderwaalsRadius;
            atom.CovalentRadius = atomType.CovalentRadius;
            atom.Valency = atomType.Valency;
            atom.setFormalCharge(atomType.getFormalCharge());
            atom.Hybridization = atomType.Hybridization;
            atom.FormalNeighbourCount = atomType.FormalNeighbourCount;
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR));
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_DONOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_DONOR));
            System.Object constant = atomType.getProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT);
            if (constant != null)
            {
                atom.setProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT, constant);
            }
            atom.setFlag(CDKConstants.ISAROMATIC, atomType.getFlag(CDKConstants.ISAROMATIC));

            System.Object color = atomType.getProperty("org.openscience.cdk.renderer.color");
            if (color != null)
            {
                atom.setProperty("org.openscience.cdk.renderer.color", color);
            }
            if (atomType.AtomicNumber != 0)
            {
                atom.AtomicNumber = atomType.AtomicNumber;
            }
            if (atomType.getExactMass() > 0.0)
            {
                atom.setExactMass(atomType.getExactMass());
            }
        }
Exemple #3
0
        /// <summary> Method that assign properties to an atom given a particular atomType.
        ///
        /// </summary>
        /// <param name="atom"> Atom to configure
        /// </param>
        /// <param name="atomType">   AtomType
        /// </param>
        public static void configure(IAtom atom, IAtomType atomType)
        {
            atom.AtomTypeName      = atomType.AtomTypeName;
            atom.MaxBondOrder      = atomType.MaxBondOrder;
            atom.BondOrderSum      = atomType.BondOrderSum;
            atom.VanderwaalsRadius = atomType.VanderwaalsRadius;
            atom.CovalentRadius    = atomType.CovalentRadius;
            atom.Valency           = atomType.Valency;
            atom.setFormalCharge(atomType.getFormalCharge());
            atom.Hybridization        = atomType.Hybridization;
            atom.FormalNeighbourCount = atomType.FormalNeighbourCount;
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR));
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_DONOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_DONOR));
            System.Object constant = atomType.getProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT);
            if (constant != null)
            {
                atom.setProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT, constant);
            }
            atom.setFlag(CDKConstants.ISAROMATIC, atomType.getFlag(CDKConstants.ISAROMATIC));

            System.Object color = atomType.getProperty("org.openscience.cdk.renderer.color");
            if (color != null)
            {
                atom.setProperty("org.openscience.cdk.renderer.color", color);
            }
            if (atomType.AtomicNumber != 0)
            {
                atom.AtomicNumber = atomType.AtomicNumber;
            }
            if (atomType.getExactMass() > 0.0)
            {
                atom.setExactMass(atomType.getExactMass());
            }
        }
Exemple #4
0
        /// <summary> Determines if the atom can be of type AtomType.</summary>
        public virtual bool couldMatchAtomType(IAtom atom, double bondOrderSum, double maxBondOrder, IAtomType type)
        {
            //logger.debug("   ... matching atom ", atom.Symbol, " vs ", type);
            int hcount = atom.getHydrogenCount();
            int charge = atom.getFormalCharge();

            if (charge == type.getFormalCharge())
            {
                if (bondOrderSum + hcount <= type.BondOrderSum && maxBondOrder <= type.MaxBondOrder)
                {
                    //logger.debug("    We have a match!");
                    return(true);
                }
            }
            //logger.debug("    No Match");
            return(false);
        }
		/// <summary> Determines if the atom can be of type AtomType. That is, it sees if this
		/// AtomType only differs in bond orders, or implicit hydrogen count.
		/// </summary>
		public virtual bool couldMatchAtomType(IAtom atom, double bondOrderSum, double maxBondOrder, IAtomType type)
		{
			//logger.debug("couldMatchAtomType:   ... matching atom ", atom, " vs ", type);
			int hcount = atom.getHydrogenCount();
			int charge = atom.getFormalCharge();
			if (charge == type.getFormalCharge())
			{
				//logger.debug("couldMatchAtomType:     formal charge matches...");
				if (atom.Hybridization == type.Hybridization)
				{
					//logger.debug("couldMatchAtomType:     hybridization is OK...");
					if (bondOrderSum + hcount <= type.BondOrderSum)
					{
						//logger.debug("couldMatchAtomType:     bond order sum is OK...");
						if (maxBondOrder <= type.MaxBondOrder)
						{
							//logger.debug("couldMatchAtomType:     max bond order is OK... We have a match!");
							return true;
						}
					}
					else
					{
						//logger.debug("couldMatchAtomType:      no match", "" + (bondOrderSum + hcount), " > ", "" + type.BondOrderSum);
					}
				}
			}
			else
			{
				//logger.debug("couldMatchAtomType:     formal charge does NOT match...");
			}
			//logger.debug("couldMatchAtomType:    No Match");
			return false;
		}
		/// <summary> Determines if the atom can be of type AtomType.</summary>
		public virtual bool couldMatchAtomType(IAtom atom, double bondOrderSum, double maxBondOrder, IAtomType type)
		{
			//logger.debug("   ... matching atom ", atom.Symbol, " vs ", type);
			int hcount = atom.getHydrogenCount();
			int charge = atom.getFormalCharge();
			if (charge == type.getFormalCharge())
			{
				if (bondOrderSum + hcount <= type.BondOrderSum && maxBondOrder <= type.MaxBondOrder)
				{
					//logger.debug("    We have a match!");
					return true;
				}
			}
			//logger.debug("    No Match");
			return false;
		}