当前位置: 首页>>代码示例>>C#>>正文


C# IAtomContainer.getBond方法代码示例

本文整理汇总了C#中IAtomContainer.getBond方法的典型用法代码示例。如果您正苦于以下问题:C# IAtomContainer.getBond方法的具体用法?C# IAtomContainer.getBond怎么用?C# IAtomContainer.getBond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAtomContainer的用法示例。


在下文中一共展示了IAtomContainer.getBond方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: bondAtom

 /// <summary>
 /// Rebonds one atom by looking up nearby atom using the binary space partition tree.
 /// </summary>
 private void bondAtom(IAtomContainer container, IAtom atom)
 {
     double myCovalentRadius = atom.CovalentRadius;
     double searchRadius = myCovalentRadius + maxCovalentRadius + bondTolerance;
     Point tupleAtom = new Point(atom.X3d, atom.Y3d, atom.Z3d);
     Bspt.EnumerateSphere e = bspt.enumHemiSphere(tupleAtom, searchRadius);
     while (e.MoveNext())
     {
         IAtom atomNear = ((TupleAtom)e.Current).Atom;
         if (atomNear != atom && container.getBond(atom, atomNear) == null)
         {
             bool isBonded_ = isBonded(myCovalentRadius, atomNear.CovalentRadius, e.foundDistance2());
             if (isBonded_)
             {
                 IBond bond = atom.Builder.newBond(atom, atomNear, 1.0);
                 container.addBond(bond);
             }
         }
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:23,代码来源:RebondTool.cs

示例2: isStartOfDoubleBond

 /// <summary>  Says if an atom is the start of a double bond configuration
 /// 
 /// </summary>
 /// <param name="a">                       The atom which is the start of configuration
 /// </param>
 /// <param name="container">               The atomContainer the atom is in
 /// </param>
 /// <param name="parent">                  The atom we came from
 /// </param>
 /// <param name="doubleBondConfiguration"> The array indicating where double bond
 /// configurations are specified (this method ensures that there is
 /// actually the possibility of a double bond configuration)
 /// </param>
 /// <returns>                          false=is not start of configuration, true=is
 /// </returns>
 private bool isStartOfDoubleBond(IAtomContainer container, IAtom a, IAtom parent, bool[] doubleBondConfiguration)
 {
     int lengthAtom = container.getConnectedAtoms(a).Length + a.getHydrogenCount();
     if (lengthAtom != 3 && (lengthAtom != 2 && (System.Object)a.Symbol != (System.Object)("N")))
     {
         return (false);
     }
     IAtom[] atoms = container.getConnectedAtoms(a);
     IAtom one = null;
     IAtom two = null;
     bool doubleBond = false;
     IAtom nextAtom = null;
     for (int i = 0; i < atoms.Length; i++)
     {
         if (atoms[i] != parent && container.getBond(atoms[i], a).Order == CDKConstants.BONDORDER_DOUBLE && isEndOfDoubleBond(container, atoms[i], a, doubleBondConfiguration))
         {
             doubleBond = true;
             nextAtom = atoms[i];
         }
         if (atoms[i] != nextAtom && one == null)
         {
             one = atoms[i];
         }
         else if (atoms[i] != nextAtom && one != null)
         {
             two = atoms[i];
         }
     }
     System.String[] morgannumbers = MorganNumbersTools.getMorganNumbersWithElementSymbol(container);
     if (one != null && ((!a.Symbol.Equals("N") && two != null && !morgannumbers[container.getAtomNumber(one)].Equals(morgannumbers[container.getAtomNumber(two)]) && doubleBond && doubleBondConfiguration[container.getBondNumber(a, nextAtom)]) || (doubleBond && a.Symbol.Equals("N") && System.Math.Abs(BondTools.giveAngleBothMethods(nextAtom, a, parent, true)) > System.Math.PI / 10)))
     {
         return (true);
     }
     else
     {
         return (false);
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:53,代码来源:SmilesGenerator.cs

示例3: parseChain

        /// <summary>  Parse a branch
        /// 
        /// </summary>
        /// <param name="v">                       Description of Parameter
        /// </param>
        /// <param name="buffer">                  Description of Parameter
        /// </param>
        /// <param name="container">               Description of Parameter
        /// </param>
        /// <param name="parent">                  Description of Parameter
        /// </param>
        /// <param name="chiral">                  Description of Parameter
        /// </param>
        /// <param name="doubleBondConfiguration"> Description of Parameter
        /// </param>
        /// <param name="atomsInOrderOfSmiles">    Description of Parameter
        /// </param>
        private void parseChain(System.Collections.ArrayList v, System.Text.StringBuilder buffer, IAtomContainer container, IAtom parent, bool chiral, bool[] doubleBondConfiguration, System.Collections.ArrayList atomsInOrderOfSmiles)
        {
            int positionInVector = 0;
            IAtom atom;
            //System.out.println("in parse chain. Size of tree: " + v.size());
            for (int h = 0; h < v.Count; h++)
            {
                System.Object o = v[h];
                if (o is IAtom)
                {
                    atom = (IAtom)o;
                    if (parent != null)
                    {
                        parseBond(buffer, atom, parent, container);
                    }
                    else
                    {
                        if (chiral && BondTools.isStereo(container, atom))
                        {
                            parent = (IAtom)((System.Collections.ArrayList)v[1])[0];
                        }
                    }
                    parseAtom(atom, buffer, container, chiral, doubleBondConfiguration, parent, atomsInOrderOfSmiles, v);
                    //System.out.println("in parseChain after parseAtom()");
                    /*
                    *  The principle of making chiral smiles is quite simple, although the code is
                    *  pretty uggly. The Atoms connected to the chiral center are put in sorted[] in the
                    *  order they have to appear in the smiles. Then the Vector v is rearranged according
                    *  to sorted[]
                    */
                    if (chiral && BondTools.isStereo(container, atom) && container.getBond(parent, atom) != null)
                    {
                        //System.out.println("in parseChain in isChiral");
                        IAtom[] sorted = null;
                        System.Collections.IList chiralNeighbours = container.getConnectedAtomsVector(atom);
                        if (BondTools.isTetrahedral(container, atom, false) > 0)
                        {
                            sorted = new IAtom[3];
                        }
                        if (BondTools.isTetrahedral(container, atom, false) == 1)
                        {
                            if (container.getBond(parent, atom).Stereo == CDKConstants.STEREO_BOND_DOWN)
                            {
                                for (int i = 0; i < chiralNeighbours.Count; i++)
                                {
                                    if (chiralNeighbours[i] != parent)
                                    {
                                        if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
                                        {
                                            sorted[2] = (IAtom)chiralNeighbours[i];
                                        }
                                        if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && !BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
                                        {
                                            sorted[1] = (IAtom)chiralNeighbours[i];
                                        }
                                        if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == CDKConstants.STEREO_BOND_UP && !isBondBroken((IAtom)chiralNeighbours[i], atom))
                                        {
                                            sorted[0] = (IAtom)chiralNeighbours[i];
                                        }
                                    }
                                }
                            }
                            if (container.getBond(parent, atom).Stereo == CDKConstants.STEREO_BOND_UP)
                            {
                                for (int i = 0; i < chiralNeighbours.Count; i++)
                                {
                                    if (chiralNeighbours[i] != parent)
                                    {
                                        if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
                                        {
                                            sorted[1] = (IAtom)chiralNeighbours[i];
                                        }
                                        if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == 0 && !BondTools.isLeft(((IAtom)chiralNeighbours[i]), parent, atom) && !isBondBroken((IAtom)chiralNeighbours[i], atom))
                                        {
                                            sorted[2] = (IAtom)chiralNeighbours[i];
                                        }
                                        if (container.getBond((IAtom)chiralNeighbours[i], atom).Stereo == CDKConstants.STEREO_BOND_DOWN && !isBondBroken((IAtom)chiralNeighbours[i], atom))
                                        {
                                            sorted[0] = (IAtom)chiralNeighbours[i];
                                        }
                                    }
                                }
                            }
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:SmilesGenerator.cs

示例4: hasWedges

 /// <summary>  Description of the Method
 /// 
 /// </summary>
 /// <param name="ac"> Description of the Parameter
 /// </param>
 /// <param name="a">  Description of the Parameter
 /// </param>
 /// <returns>     Description of the Return Value
 /// </returns>
 private IAtom hasWedges(IAtomContainer ac, IAtom a)
 {
     IAtom[] atoms = ac.getConnectedAtoms(a);
     for (int i = 0; i < atoms.Length; i++)
     {
         if (ac.getBond(a, atoms[i]).Stereo != CDKConstants.STEREO_BOND_NONE && !atoms[i].Symbol.Equals("H"))
         {
             return (atoms[i]);
         }
     }
     for (int i = 0; i < atoms.Length; i++)
     {
         if (ac.getBond(a, atoms[i]).Stereo != CDKConstants.STEREO_BOND_NONE)
         {
             return (atoms[i]);
         }
     }
     return (null);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:28,代码来源:SmilesGenerator.cs

示例5: isEndOfDoubleBond

 /// <summary>  Says if an atom is the end of a double bond configuration
 /// 
 /// </summary>
 /// <param name="atom">                    The atom which is the end of configuration
 /// </param>
 /// <param name="container">               The atomContainer the atom is in
 /// </param>
 /// <param name="parent">                  The atom we came from
 /// </param>
 /// <param name="doubleBondConfiguration"> The array indicating where double bond
 /// configurations are specified (this method ensures that there is
 /// actually the possibility of a double bond configuration)
 /// </param>
 /// <returns>                          false=is not end of configuration, true=is
 /// </returns>
 private bool isEndOfDoubleBond(IAtomContainer container, IAtom atom, IAtom parent, bool[] doubleBondConfiguration)
 {
     if (container.getBondNumber(atom, parent) == -1 || doubleBondConfiguration.Length <= container.getBondNumber(atom, parent) || !doubleBondConfiguration[container.getBondNumber(atom, parent)])
     {
         return false;
     }
     int lengthAtom = container.getConnectedAtoms(atom).Length + atom.getHydrogenCount();
     int lengthParent = container.getConnectedAtoms(parent).Length + parent.getHydrogenCount();
     if (container.getBond(atom, parent) != null)
     {
         if (container.getBond(atom, parent).Order == CDKConstants.BONDORDER_DOUBLE && (lengthAtom == 3 || (lengthAtom == 2 && atom.Symbol.Equals("N"))) && (lengthParent == 3 || (lengthParent == 2 && parent.Symbol.Equals("N"))))
         {
             IAtom[] atoms = container.getConnectedAtoms(atom);
             IAtom one = null;
             IAtom two = null;
             for (int i = 0; i < atoms.Length; i++)
             {
                 if (atoms[i] != parent && one == null)
                 {
                     one = atoms[i];
                 }
                 else if (atoms[i] != parent && one != null)
                 {
                     two = atoms[i];
                 }
             }
             System.String[] morgannumbers = MorganNumbersTools.getMorganNumbersWithElementSymbol(container);
             if ((one != null && two == null && atom.Symbol.Equals("N") && System.Math.Abs(BondTools.giveAngleBothMethods(parent, atom, one, true)) > System.Math.PI / 10) || (!atom.Symbol.Equals("N") && one != null && two != null && !morgannumbers[container.getAtomNumber(one)].Equals(morgannumbers[container.getAtomNumber(two)])))
             {
                 return (true);
             }
             else
             {
                 return (false);
             }
         }
     }
     return (false);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:54,代码来源:SmilesGenerator.cs

示例6: parseBond

 /// <summary>  Append the symbol for the bond order between <code>a1</code> and <code>a2</code>
 /// to the <code>line</code>.
 /// 
 /// </summary>
 /// <param name="line">          the StringBuffer that the bond symbol is appended to.
 /// </param>
 /// <param name="a1">            Atom participating in the bond.
 /// </param>
 /// <param name="a2">            Atom participating in the bond.
 /// </param>
 /// <param name="atomContainer"> the AtomContainer that the SMILES string is generated
 /// for.
 /// </param>
 private void parseBond(System.Text.StringBuilder line, IAtom a1, IAtom a2, IAtomContainer atomContainer)
 {
     //System.out.println("in parseBond()");
     if (a1.getFlag(CDKConstants.ISAROMATIC) && a1.getFlag(CDKConstants.ISAROMATIC))
     {
         return;
     }
     if (atomContainer.getBond(a1, a2) == null)
     {
         return;
     }
     int type = 0;
     //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
     type = (int)atomContainer.getBond(a1, a2).Order;
     if (type == 1)
     {
     }
     else if (type == 2)
     {
         line.Append("=");
     }
     else if (type == 3)
     {
         line.Append("#");
     }
     else
     {
         // //System.out.println("Unknown bond type");
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:43,代码来源:SmilesGenerator.cs

示例7: parseAtom


//.........这里部分代码省略.........
                //chiral
                //hcount
                buffer.Append(charge);
                if (brackets)
                {
                    buffer.Append(']');
                }
            }
            //System.out.println("in parseAtom() after dealing with Pseudoatom or not");
            //Deal with the end of a double bond configuration
            if (isEndOfDoubleBond(container, a, parent, doubleBondConfiguration))
            {
                IAtom viewFrom = null;
                for (int i = 0; i < currentChain.Count; i++)
                {
                    if (currentChain[i] == parent)
                    {
                        int k = i - 1;
                        while (k > -1)
                        {
                            if (currentChain[k] is IAtom)
                            {
                                viewFrom = (IAtom)currentChain[k];
                                break;
                            }
                            k--;
                        }
                    }
                }
                if (viewFrom == null)
                {
                    for (int i = 0; i < atomsInOrderOfSmiles.Count; i++)
                    {
                        if (atomsInOrderOfSmiles[i] == parent)
                        {
                            viewFrom = (IAtom)atomsInOrderOfSmiles[i - 1];
                        }
                    }
                }
                bool afterThisAtom = false;
                IAtom viewTo = null;
                for (int i = 0; i < currentChain.Count; i++)
                {
                    if (afterThisAtom && currentChain[i] is IAtom)
                    {
                        viewTo = (IAtom)currentChain[i];
                        break;
                    }
                    if (afterThisAtom && currentChain[i] is System.Collections.ArrayList)
                    {
                        viewTo = (IAtom)((System.Collections.ArrayList)currentChain[i])[0];
                        break;
                    }
                    if (a == currentChain[i])
                    {
                        afterThisAtom = true;
                    }
                }
                try
                {
                    if (BondTools.isCisTrans(viewFrom, a, parent, viewTo, container))
                    {
                        buffer.Append('\\');
                    }
                    else
                    {
                        buffer.Append('/');
                    }
                }
                catch (CDKException ex)
                {
                    //If the user wants a double bond configuration, where there is none, we ignore this.
                }
            }
            System.Collections.ArrayList v = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            System.Collections.IEnumerator it = getRingOpenings(a, v).GetEnumerator();
            System.Collections.IEnumerator it2 = v.GetEnumerator();
            //System.out.println("in parseAtom() after checking for Ring openings");
            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            while (it.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                System.Int32 integer = (System.Int32)it.Current;
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                IBond b = container.getBond((IAtom)it2.Current, a);
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                int type = (int)b.Order;
                if (type == 2 && !b.getFlag(CDKConstants.ISAROMATIC))
                {
                    buffer.Append("=");
                }
                else if (type == 3 && !b.getFlag(CDKConstants.ISAROMATIC))
                {
                    buffer.Append("#");
                }
                buffer.Append(integer);
            }
            atomsInOrderOfSmiles.Add(a);
            //System.out.println("End of parseAtom()");
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:SmilesGenerator.cs

示例8: saturate

		/// <summary> The method is known to fail for certain compounds. For more information, see
		/// cdk.test.limitations package.
		/// 
		/// </summary>
		public virtual void  saturate(IAtomContainer atomContainer)
		{
			/* newSaturate(atomContainer);
			}
			public void oldSaturate(AtomContainer atomContainer) throws CDKException { */
			IAtom partner = null;
			IAtom atom = null;
			IAtom[] partners = null;
			IAtomType[] atomTypes1 = null;
			IAtomType[] atomTypes2 = null;
			IBond bond = null;
			for (int i = 1; i < 4; i++)
			{
				// handle atoms with degree 1 first and then proceed to higher order
				for (int f = 0; f < atomContainer.AtomCount; f++)
				{
					atom = atomContainer.getAtomAt(f);
					//logger.debug("symbol: ", atom.Symbol);
					atomTypes1 = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
					if (atomTypes1.Length > 0)
					{
						//logger.debug("first atom type: ", atomTypes1[0]);
						if (atomContainer.getBondCount(atom) == i)
						{
							if (atom.getFlag(CDKConstants.ISAROMATIC) && atomContainer.getBondOrderSum(atom) < atomTypes1[0].BondOrderSum - atom.getHydrogenCount())
							{
								partners = atomContainer.getConnectedAtoms(atom);
								for (int g = 0; g < partners.Length; g++)
								{
									partner = partners[g];
									//logger.debug("Atom has " + partners.Length + " partners");
									atomTypes2 = getAtomTypeFactory(atom.Builder).getAtomTypes(partner.Symbol);
									if (atomTypes2.Length == 0)
										return ;
									if (atomContainer.getBond(partner, atom).getFlag(CDKConstants.ISAROMATIC) && atomContainer.getBondOrderSum(partner) < atomTypes2[0].BondOrderSum - partner.getHydrogenCount())
									{
										//logger.debug("Partner has " + atomContainer.getBondOrderSum(partner) + ", may have: " + atomTypes2[0].BondOrderSum);
										bond = atomContainer.getBond(atom, partner);
										//logger.debug("Bond order was " + bond.Order);
										bond.Order = bond.Order + 1;
										//logger.debug("Bond order now " + bond.Order);
										break;
									}
								}
							}
							if (atomContainer.getBondOrderSum(atom) < atomTypes1[0].BondOrderSum - atom.getHydrogenCount())
							{
								//logger.debug("Atom has " + atomContainer.getBondOrderSum(atom) + ", may have: " + atomTypes1[0].BondOrderSum);
								partners = atomContainer.getConnectedAtoms(atom);
								for (int g = 0; g < partners.Length; g++)
								{
									partner = partners[g];
									//logger.debug("Atom has " + partners.Length + " partners");
									atomTypes2 = getAtomTypeFactory(atom.Builder).getAtomTypes(partner.Symbol);
									if (atomTypes2.Length == 0)
										return ;
									if (atomContainer.getBondOrderSum(partner) < atomTypes2[0].BondOrderSum - partner.getHydrogenCount())
									{
										//logger.debug("Partner has " + atomContainer.getBondOrderSum(partner) + ", may have: " + atomTypes2[0].BondOrderSum);
										bond = atomContainer.getBond(atom, partner);
										//logger.debug("Bond order was " + bond.Order);
										bond.Order = bond.Order + 1;
										//logger.debug("Bond order now " + bond.Order);
										break;
									}
								}
							}
						}
					}
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:76,代码来源:SaturationChecker.cs

示例9: toRingSet

        private static IRingSet toRingSet(IAtomContainer ac, System.Collections.ICollection cycles)
        {

            IRingSet ringSet = ac.Builder.newRingSet();

            System.Collections.IEnumerator cycleIterator = cycles.GetEnumerator();

            while (cycleIterator.MoveNext())
            {
                SimpleCycle cycle = (SimpleCycle)cycleIterator.Current;

                IRing ring = ac.Builder.newRing();

                System.Collections.IList vertices = cycle.vertexList();

                IAtom[] atoms = new IAtom[vertices.Count];
                atoms[0] = (IAtom)vertices[0];
                for (int i = 1; i < vertices.Count; i++)
                {
                    atoms[i] = (IAtom)vertices[i];
                    ring.addElectronContainer(ac.getBond(atoms[i - 1], atoms[i]));
                }
                ring.addElectronContainer(ac.getBond(atoms[vertices.Count - 1], atoms[0]));
                ring.Atoms = atoms;

                ringSet.addAtomContainer(ring);
            }

            return ringSet;
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:30,代码来源:SSSRFinder.cs

示例10: makeUpDownBonds

 public static void makeUpDownBonds(IAtomContainer container)
 {
     for (int i = 0; i < container.AtomCount; i++)
     {
         IAtom a = container.getAtomAt(i);
         if (container.getConnectedAtoms(a).Length == 4)
         {
             int up = 0;
             int down = 0;
             int hs = 0;
             IAtom h = null;
             for (int k = 0; k < 4; k++)
             {
                 if (container.getBond(a, container.getConnectedAtoms(a)[k]).Stereo == CDKConstants.STEREO_BOND_UP)
                 {
                     up++;
                 }
                 if (container.getBond(a, container.getConnectedAtoms(a)[k]).Stereo == CDKConstants.STEREO_BOND_DOWN)
                 {
                     down++;
                 }
                 if (container.getBond(a, container.getConnectedAtoms(a)[k]).Stereo == CDKConstants.STEREO_BOND_NONE && container.getConnectedAtoms(a)[k].Symbol.Equals("H"))
                 {
                     h = container.getConnectedAtoms(a)[k];
                     hs++;
                 }
             }
             if (up == 0 && down == 1 && h != null && hs == 1)
             {
                 container.getBond(a, h).Stereo = CDKConstants.STEREO_BOND_UP;
             }
             if (up == 1 && down == 0 && h != null && hs == 1)
             {
                 container.getBond(a, h).Stereo = CDKConstants.STEREO_BOND_DOWN;
             }
         }
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:38,代码来源:BondTools.cs

示例11: stereosAreOpposite

 /// <summary>  Says if of four atoms connected two one atom the up and down bonds are
 /// opposite or not, i. e.if it's tetrehedral or square planar. The method
 /// doesnot check if there are four atoms and if two or up and two are down
 /// 
 /// </summary>
 /// <param name="a">         The atom which is the center
 /// </param>
 /// <param name="container"> The atomContainer the atom is in
 /// </param>
 /// <returns>            true=are opposite, false=are not
 /// </returns>
 public static bool stereosAreOpposite(IAtomContainer container, IAtom a)
 {
     System.Collections.IList atoms = container.getConnectedAtomsVector(a);
     //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.TreeMap' and 'System.Collections.SortedList' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
     //UPGRADE_TODO: Constructor 'java.util.TreeMap.TreeMap' was converted to 'System.Collections.SortedList' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilTreeMapTreeMap'"
     System.Collections.SortedList hm = new System.Collections.SortedList();
     for (int i = 1; i < atoms.Count; i++)
     {
         hm[(double)giveAngle(a, (IAtom)atoms[0], ((IAtom)atoms[i]))] = (System.Int32)i;
     }
     //UPGRADE_TODO: Method 'java.util.TreeMap.values' was converted to 'System.Collections.SortedList.Values' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilTreeMapvalues'"
     System.Object[] ohere = SupportClass.ICollectionSupport.ToArray(hm.Values);
     int stereoOne = container.getBond(a, (IAtom)atoms[0]).Stereo;
     int stereoOpposite = container.getBond(a, (IAtom)atoms[(((System.Int32)ohere[1]))]).Stereo;
     if (stereoOpposite == stereoOne)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:34,代码来源:BondTools.cs

示例12: isCisTrans

 /// <summary>  Says if two atoms are in cis or trans position around a double bond.
 /// The atoms have to be given to the method like this:  firstOuterAtom - firstInnerAtom = secondInnterAtom - secondOuterAtom
 /// 
 /// </summary>
 /// <param name="firstOuterAtom">   See above.
 /// </param>
 /// <param name="firstInnerAtom">   See above.
 /// </param>
 /// <param name="secondInnerAtom">  See above.
 /// </param>
 /// <param name="secondOuterAtom">  See above.
 /// </param>
 /// <param name="ac">               The atom container the atoms are in.
 /// </param>
 /// <returns>                   true=trans, false=cis.
 /// </returns>
 /// <exception cref="CDKException"> The atoms are not in a double bond configuration (no double bond in the middle, same atoms on one side)
 /// </exception>
 public static bool isCisTrans(IAtom firstOuterAtom, IAtom firstInnerAtom, IAtom secondInnerAtom, IAtom secondOuterAtom, IAtomContainer ac)
 {
     if (!isValidDoubleBondConfiguration(ac, ac.getBond(firstInnerAtom, secondInnerAtom)))
     {
         throw new CDKException("There is no valid double bond configuration between your inner atoms!");
     }
     bool firstDirection = isLeft(firstOuterAtom, firstInnerAtom, secondInnerAtom);
     bool secondDirection = isLeft(secondOuterAtom, secondInnerAtom, firstInnerAtom);
     if (firstDirection == secondDirection)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:35,代码来源:BondTools.cs


注:本文中的IAtomContainer.getBond方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。