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


C# IAtomContainer.getAtomAt方法代码示例

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


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

示例1: isConnected

 /// <summary> Check whether a set of atoms in an atomcontainer is connected
 /// 
 /// </summary>
 /// <param name="atomContainer"> The AtomContainer to be check for connectedness
 /// </param>
 /// <returns>                 true if the AtomContainer is connected   
 /// </returns>
 public static bool isConnected(IAtomContainer atomContainer)
 {
     IAtomContainer ac = atomContainer.Builder.newAtomContainer();
     IAtom atom = null;
     IMolecule molecule = atomContainer.Builder.newMolecule();
     System.Collections.ArrayList sphere = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     for (int f = 0; f < atomContainer.AtomCount; f++)
     {
         atom = atomContainer.getAtomAt(f);
         atomContainer.getAtomAt(f).setFlag(CDKConstants.VISITED, false);
         ac.addAtom(atomContainer.getAtomAt(f));
     }
     IBond[] bonds = atomContainer.Bonds;
     for (int f = 0; f < bonds.Length; f++)
     {
         bonds[f].setFlag(CDKConstants.VISITED, false);
         ac.addBond(bonds[f]);
     }
     atom = ac.getAtomAt(0);
     sphere.Add(atom);
     atom.setFlag(CDKConstants.VISITED, true);
     PathTools.breadthFirstSearch(ac, sphere, molecule);
     if (molecule.AtomCount == atomContainer.AtomCount)
     {
         return true;
     }
     return false;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:35,代码来源:ConectivityChecker.cs

示例2: getAtomById

 /// <summary> Returna an atom in an atomcontainer identified by id
 /// 
 /// </summary>
 /// <param name="ac">The AtomContainer to search in
 /// </param>
 /// <param name="id">The id to search for
 /// </param>
 /// <returns> An atom having id id
 /// </returns>
 /// <throws>  CDKException There is no such atom </throws>
 public static IAtom getAtomById(IAtomContainer ac, System.String id)
 {
     for (int i = 0; i < ac.AtomCount; i++)
     {
         if (ac.getAtomAt(i).ID != null && ac.getAtomAt(i).ID.Equals(id))
             return ac.getAtomAt(i);
     }
     throw new CDKException("no suc atom");
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:19,代码来源:AtomContainerManipulator.cs

示例3: getMorganNumbers

 /// <summary>  Makes an array containing the morgan numbers of the atoms of atomContainer.
 /// 
 /// </summary>
 /// <param name="atomContainer"> The atomContainer to analyse.
 /// </param>
 /// <returns>                The morgan numbers value.
 /// </returns>
 public static int[] getMorganNumbers(IAtomContainer atomContainer)
 {
     int[] morganMatrix;
     int[] tempMorganMatrix;
     int N = atomContainer.AtomCount;
     morganMatrix = new int[N];
     tempMorganMatrix = new int[N];
     IAtom[] atoms = null;
     for (int f = 0; f < N; f++)
     {
         morganMatrix[f] = atomContainer.getBondCount(f);
         tempMorganMatrix[f] = atomContainer.getBondCount(f);
     }
     for (int e = 0; e < N; e++)
     {
         for (int f = 0; f < N; f++)
         {
             morganMatrix[f] = 0;
             atoms = atomContainer.getConnectedAtoms(atomContainer.getAtomAt(f));
             for (int g = 0; g < atoms.Length; g++)
             {
                 morganMatrix[f] += tempMorganMatrix[atomContainer.getAtomNumber(atoms[g])];
             }
         }
         Array.Copy(morganMatrix, 0, tempMorganMatrix, 0, N);
     }
     return tempMorganMatrix;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:35,代码来源:MorganNumbersTools.cs

示例4: getClosestAtom

 /// <summary>  Returns the atom of the given molecule that is closest to the given
 /// coordinates.
 /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
 /// 
 /// </summary>
 /// <param name="xPosition"> The x coordinate
 /// </param>
 /// <param name="yPosition"> The y coordinate
 /// </param>
 /// <param name="atomCon">   The molecule that is searched for the closest atom
 /// </param>
 /// <returns>            The atom that is closest to the given coordinates
 /// </returns>
 public static IAtom getClosestAtom(int xPosition, int yPosition, IAtomContainer atomCon)
 {
     IAtom closestAtom = null;
     IAtom currentAtom;
     double smallestMouseDistance = -1;
     double mouseDistance;
     double atomX;
     double atomY;
     for (int i = 0; i < atomCon.AtomCount; i++)
     {
         currentAtom = atomCon.getAtomAt(i);
         atomX = currentAtom.X2d;
         atomY = currentAtom.Y2d;
         mouseDistance = System.Math.Sqrt(System.Math.Pow(atomX - xPosition, 2) + System.Math.Pow(atomY - yPosition, 2));
         if (mouseDistance < smallestMouseDistance || smallestMouseDistance == -1)
         {
             smallestMouseDistance = mouseDistance;
             closestAtom = currentAtom;
         }
     }
     return closestAtom;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:35,代码来源:GeometryTools.cs

示例5: mapAtomsOfAlignedStructures

        /// <summary>  Returns a Map with the AtomNumbers, the first number corresponds to the first (or the largest
        /// AtomContainer) atomcontainer. It is recommend to sort the atomContainer due to their number of atoms before
        /// calling this function.
        /// 
        /// The molecules needs to be aligned before! (coordinates are needed)
        /// 
        /// </summary>
        /// <param name="firstAtomContainer">               the (largest) first aligned AtomContainer which is the reference
        /// </param>
        /// <param name="secondAtomContainer">              the second aligned AtomContainer
        /// </param>
        /// <param name="searchRadius">              		the radius of space search from each atom
        /// </param>
        /// <returns>                   				a Map of the mapped atoms
        /// </returns>
        /// <exception cref="CDKException"> Description of the Exception
        /// </exception>
        public static System.Collections.IDictionary mapAtomsOfAlignedStructures(IAtomContainer firstAtomContainer, IAtomContainer secondAtomContainer, double searchRadius, System.Collections.IDictionary mappedAtoms)
        {
            //to return the mapping setProperty("MappedAtom",AtomNumber)
            //System.out.println("**** MAP ATOMS ****");
            getLargestAtomContainer(firstAtomContainer, secondAtomContainer);
            double[][] distanceMatrix = new double[firstAtomContainer.AtomCount][];
            for (int i = 0; i < firstAtomContainer.AtomCount; i++)
            {
                distanceMatrix[i] = new double[secondAtomContainer.AtomCount];
            }
            for (int i = 0; i < firstAtomContainer.AtomCount; i++)
            {
                Point3d firstAtomPoint = firstAtomContainer.getAtomAt(i).getPoint3d();
                //System.out.println("Closest atoms of "+firstAtomContainer.getAtoms()[i].getSymbol()+" :");
                for (int j = 0; j < secondAtomContainer.AtomCount; j++)
                {
                    distanceMatrix[i][j] = firstAtomPoint.distance(secondAtomContainer.getAtomAt(j).getPoint3d());
                    //System.out.println("Distance "+i+" "+j+":"+distanceMatrix[i][j]);
                }
                //System.out.println(" Atoms from the secondAtomContainer");
            }

            //System.out.println();
            //System.out.print("\t");
            //for (int j=0;j<secondAtomContainer.getAtomCount();j++){
            //System.out.print(j+" "+secondAtomContainer.getAtomAt(j).getSymbol()+"\t");
            //}
            double tmp = 0;
            for (int i = 0; i < firstAtomContainer.AtomCount; i++)
            {
                //System.out.print(i+" "+firstAtomContainer.getAtomAt(i).getSymbol()+"\t");
                for (int j = 0; j < secondAtomContainer.AtomCount; j++)
                {
                    tmp = System.Math.Floor(distanceMatrix[i][j] * 10);
                    //System.out.println(tmp/10+"\t");
                }
            }

            double minimumDistance = searchRadius;
            int countMappedAtoms = 0;
            for (int i = 0; i < firstAtomContainer.AtomCount; i++)
            {
                minimumDistance = searchRadius;
                for (int j = 0; j < secondAtomContainer.AtomCount; j++)
                {
                    if (distanceMatrix[i][j] < searchRadius && distanceMatrix[i][j] < minimumDistance)
                    {
                        //System.out.println("Distance OK "+i+" "+j+":"+distanceMatrix[i][j]+" AtomCheck:"+checkAtomMapping(firstAtomContainer,secondAtomContainer, i, j));
                        //check atom properties
                        if (checkAtomMapping(firstAtomContainer, secondAtomContainer, i, j))
                        {
                            minimumDistance = distanceMatrix[i][j];
                            mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(firstAtomContainer.getAtomAt(i))] = (System.Int32)secondAtomContainer.getAtomNumber(secondAtomContainer.getAtomAt(j));
                            //firstAtomContainer.getAtomAt(i).setProperty("MappedAtom",new Integer(secondAtomContainer.getAtomNumber(secondAtomContainer.getAtomAt(j))));
                            countMappedAtoms++;
                            //System.out.println("#:"+countMappedAtoms+" Atom:"+i+" is mapped to Atom"+j);
                            //System.out.println(firstAtomContainer.getConnectedAtoms(firstAtomContainer.getAtomAt(i)).length);
                        }
                    }
                }
            }
            return mappedAtoms;
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:80,代码来源:GeometryTools.cs

示例6: readBondBlock

        /// <summary> Reads the bond atoms, order and stereo configuration.</summary>
        public virtual void readBondBlock(IAtomContainer readData)
        {
            bool foundEND = false;
            while (Ready && !foundEND)
            {
                System.String command = readCommand();
                if ("END BOND".Equals(command))
                {
                    foundEND = true;
                }
                else
                {
                    //logger.debug("Parsing bond from: " + command);
                    SupportClass.Tokenizer tokenizer = new SupportClass.Tokenizer(command);
                    IBond bond = readData.Builder.newBond();
                    // parse the index
                    try
                    {
                        System.String indexString = tokenizer.NextToken();
                        bond.ID = indexString;
                    }
                    catch (System.Exception exception)
                    {
                        System.String error = "Error while parsing bond index";
                        //logger.error(error);
                        //logger.debug(exception);
                        throw new CDKException(error, exception);
                    }
                    // parse the order
                    try
                    {
                        System.String orderString = tokenizer.NextToken();
                        int order = System.Int32.Parse(orderString);
                        if (order >= 4)
                        {
                            //logger.warn("Query order types are not supported (yet). File a bug if you need it");
                        }
                        else
                        {
                            bond.Order = (double)order;
                        }
                    }
                    catch (System.Exception exception)
                    {
                        System.String error = "Error while parsing bond index";
                        //logger.error(error);
                        //logger.debug(exception);
                        throw new CDKException(error, exception);
                    }
                    // parse index atom 1
                    try
                    {
                        System.String indexAtom1String = tokenizer.NextToken();
                        int indexAtom1 = System.Int32.Parse(indexAtom1String);
                        IAtom atom1 = readData.getAtomAt(indexAtom1 - 1);
                        bond.setAtomAt(atom1, 0);
                    }
                    catch (System.Exception exception)
                    {
                        System.String error = "Error while parsing index atom 1 in bond";
                        //logger.error(error);
                        //logger.debug(exception);
                        throw new CDKException(error, exception);
                    }
                    // parse index atom 2
                    try
                    {
                        System.String indexAtom2String = tokenizer.NextToken();
                        int indexAtom2 = System.Int32.Parse(indexAtom2String);
                        IAtom atom2 = readData.getAtomAt(indexAtom2 - 1);
                        bond.setAtomAt(atom2, 1);
                    }
                    catch (System.Exception exception)
                    {
                        System.String error = "Error while parsing index atom 2 in bond";
                        //logger.error(error);
                        //logger.debug(exception);
                        throw new CDKException(error, exception);
                    }
                    // the rest are key=value fields
                    if (command.IndexOf("=") != -1)
                    {
                        System.Collections.Hashtable options = parseOptions(exhaustStringTokenizer(tokenizer));
                        System.Collections.IEnumerator keys = options.Keys.GetEnumerator();
                        //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' 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_javautilEnumerationhasMoreElements'"
                        while (keys.MoveNext())
                        {
                            //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' 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_javautilEnumerationnextElement'"
                            System.String key = (System.String)keys.Current;
                            System.String value_Renamed = (System.String)options[key];
                            try
                            {
                                if (key.Equals("CFG"))
                                {
                                    int configuration = System.Int32.Parse(value_Renamed);
                                    if (configuration == 0)
                                    {
                                        bond.Stereo = CDKConstants.STEREO_BOND_NONE;
                                    }
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:MDLV3000Reader.cs

示例7: isSubgraph

 /// <summary>  Tests if g2 a subgraph of g1
 /// 
 /// </summary>
 /// <param name="g1"> first molecule
 /// </param>
 /// <param name="g2"> second molecule
 /// </param>
 /// <returns>     true if g2 a subgraph on g1
 /// </returns>
 public static bool isSubgraph(IAtomContainer g1, IAtomContainer g2)
 {
     if (g2.AtomCount > g1.AtomCount)
         return false;
     // test for single atom case
     if (g2.AtomCount == 1)
     {
         IAtom atom = g2.getAtomAt(0);
         for (int i = 0; i < g1.AtomCount; i++)
         {
             IAtom atom2 = g1.getAtomAt(i);
             if (atom is IQueryAtom)
             {
                 IQueryAtom qAtom = (IQueryAtom)atom;
                 if (qAtom.matches(atom2))
                     return true;
             }
             else if (atom2 is IQueryAtom)
             {
                 IQueryAtom qAtom = (IQueryAtom)atom2;
                 if (qAtom.matches(atom))
                     return true;
             }
             else
             {
                 if (atom2.Symbol.Equals(atom.Symbol))
                     return true;
             }
         }
         return false;
     }
     if (!testSubgraphHeuristics(g1, g2))
         return false;
     return (getSubgraphMap(g1, g2) != null);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:44,代码来源:UniversalIsomorphismTester.cs

示例8: getBondLengthRMSD

 /// <summary>  Return the RMSD of bonds length between the 2 aligned molecules.
 /// 
 /// </summary>
 /// <param name="firstAtomContainer">               the (largest) first aligned AtomContainer which is the reference
 /// </param>
 /// <param name="secondAtomContainer">              the second aligned AtomContainer
 /// </param>
 /// <param name="mappedAtoms">            			Map: a Map of the mapped atoms
 /// </param>
 /// <param name="Coords3d">           			    boolean: true if moecules has 3D coords, false if molecules has 2D coords
 /// </param>
 /// <returns>                   				double: all the RMSD of bonds length
 /// </returns>
 /// <exception cref="CDK">*
 /// 
 /// </exception>
 public static double getBondLengthRMSD(IAtomContainer firstAtomContainer, IAtomContainer secondAtomContainer, System.Collections.IDictionary mappedAtoms, bool Coords3d)
 {
     //System.out.println("**** GT getBondLengthRMSD ****");
     //UPGRADE_TODO: Method 'java.util.Map.keySet' was converted to 'CSGraphT.SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilMapkeySet'"
     System.Collections.IEnumerator firstAtoms = new CSGraphT.SupportClass.HashSetSupport(mappedAtoms.Keys).GetEnumerator();
     IAtom centerAtomFirstMolecule = null;
     IAtom centerAtomSecondMolecule = null;
     IAtom[] connectedAtoms = null;
     double sum = 0;
     double n = 0;
     double distance1 = 0;
     double distance2 = 0;
     setVisitedFlagsToFalse(firstAtomContainer);
     setVisitedFlagsToFalse(secondAtomContainer);
     //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 (firstAtoms.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'"
         centerAtomFirstMolecule = firstAtomContainer.getAtomAt(((System.Int32)firstAtoms.Current));
         centerAtomFirstMolecule.setFlag(CDKConstants.VISITED, true);
         centerAtomSecondMolecule = secondAtomContainer.getAtomAt(((System.Int32)mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(centerAtomFirstMolecule)]));
         connectedAtoms = firstAtomContainer.getConnectedAtoms(centerAtomFirstMolecule);
         for (int i = 0; i < connectedAtoms.Length; i++)
         {
             //this step is built to know if the program has already calculate a bond length (so as not to have duplicate values)
             if (!connectedAtoms[i].getFlag(CDKConstants.VISITED))
             {
                 if (Coords3d)
                 {
                     distance1 = ((Point3d)centerAtomFirstMolecule.getPoint3d()).distance(connectedAtoms[i].getPoint3d());
                     distance2 = ((Point3d)centerAtomSecondMolecule.getPoint3d()).distance(secondAtomContainer.getAtomAt(((System.Int32)mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(connectedAtoms[i])])).getPoint3d());
                     sum = sum + System.Math.Pow((distance1 - distance2), 2);
                     n++;
                 }
                 else
                 {
                     distance1 = ((Point2d)centerAtomFirstMolecule.getPoint2d()).distance(connectedAtoms[i].getPoint2d());
                     distance2 = ((Point2d)centerAtomSecondMolecule.getPoint2d()).distance(secondAtomContainer.getAtomAt(((System.Int32)mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(connectedAtoms[i])])).getPoint2d());
                     sum = sum + System.Math.Pow((distance1 - distance2), 2);
                     n++;
                 }
             }
         }
     }
     setVisitedFlagsToFalse(firstAtomContainer);
     setVisitedFlagsToFalse(secondAtomContainer);
     return System.Math.Sqrt(sum / n);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:64,代码来源:GeometryTools.cs

示例9: getHeavyAtomRMSD

 /// <summary>  Return the RMSD of the heavy atoms between the 2 aligned molecules.
 /// 
 /// </summary>
 /// <param name="firstAtomContainer">               the (largest) first aligned AtomContainer which is the reference
 /// </param>
 /// <param name="secondAtomContainer">              the second aligned AtomContainer
 /// </param>
 /// <param name="mappedAtoms">            			Map: a Map of the mapped atoms
 /// </param>
 /// <param name="Coords3d">           			    boolean: true if moecules has 3D coords, false if molecules has 2D coords
 /// </param>
 /// <returns>                   				double: the value of the RMSD 
 /// </returns>
 /// <exception cref="CDK">*
 /// 
 /// </exception>
 public static double getHeavyAtomRMSD(IAtomContainer firstAtomContainer, IAtomContainer secondAtomContainer, System.Collections.IDictionary mappedAtoms, bool Coords3d)
 {
     //System.out.println("**** GT getAllAtomRMSD ****");
     double sum = 0;
     double RMSD = 0;
     //UPGRADE_TODO: Method 'java.util.Map.keySet' was converted to 'CSGraphT.SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilMapkeySet'"
     System.Collections.IEnumerator firstAtoms = new CSGraphT.SupportClass.HashSetSupport(mappedAtoms.Keys).GetEnumerator();
     int firstAtomNumber = 0;
     int secondAtomNumber = 0;
     int n = 0;
     //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 (firstAtoms.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'"
         firstAtomNumber = ((System.Int32)firstAtoms.Current);
         try
         {
             secondAtomNumber = ((System.Int32)mappedAtoms[(System.Int32)firstAtomNumber]);
             IAtom firstAtom = firstAtomContainer.getAtomAt(firstAtomNumber);
             if (!firstAtom.Symbol.Equals("H"))
             {
                 if (Coords3d)
                 {
                     sum = sum + System.Math.Pow(((Point3d)firstAtom.getPoint3d()).distance(secondAtomContainer.getAtomAt(secondAtomNumber).getPoint3d()), 2);
                     n++;
                 }
                 else
                 {
                     sum = sum + System.Math.Pow(((Point2d)firstAtom.getPoint2d()).distance(secondAtomContainer.getAtomAt(secondAtomNumber).getPoint2d()), 2);
                     n++;
                 }
             }
         }
         catch (System.Exception ex)
         {
         }
     }
     RMSD = System.Math.Sqrt(sum / n);
     return RMSD;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:56,代码来源:GeometryTools.cs

示例10: resetFlags

 public static void resetFlags(IAtomContainer ac)
 {
     for (int f = 0; f < ac.AtomCount; f++)
     {
         ac.getAtomAt(f).setFlag(CDKConstants.VISITED, false);
     }
     for (int f = 0; f < ac.ElectronContainerCount; f++)
     {
         ac.getElectronContainerAt(f).setFlag(CDKConstants.VISITED, false);
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:SpanningTree.cs

示例11: checkAtomMapping

 private static bool checkAtomMapping(IAtomContainer firstAC, IAtomContainer secondAC, int posFirstAtom, int posSecondAtom)
 {
     IAtom firstAtom = firstAC.getAtomAt(posFirstAtom);
     IAtom secondAtom = secondAC.getAtomAt(posSecondAtom);
     if (firstAtom.Symbol.Equals(secondAtom.Symbol) && firstAC.getConnectedAtoms(firstAtom).Length == secondAC.getConnectedAtoms(secondAtom).Length && firstAtom.BondOrderSum == secondAtom.BondOrderSum && firstAtom.MaxBondOrder == secondAtom.MaxBondOrder)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:13,代码来源:GeometryTools.cs

示例12: allSaturated

		public virtual bool allSaturated(IAtomContainer ac)
		{
			//logger.debug("Are all atoms saturated?");
			for (int f = 0; f < ac.AtomCount; f++)
			{
				if (!isSaturated(ac.getAtomAt(f), ac))
				{
					return false;
				}
			}
			return true;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:ValencyHybridChecker.cs

示例13: buildSpanningTree

        /// <summary> Kruskal algorithm</summary>
        /// <param name="atomContainer">
        /// </param>
        public virtual void buildSpanningTree(IAtomContainer atomContainer)
        {
            disconnected = false;
            molecule = atomContainer;

            V = atomContainer.AtomCount;
            E = atomContainer.getBondCount();

            sptSize = 0; edrSize = 0;
            fastFindInit(V);
            for (int i = 0; i < V; i++)
            {
                (atomContainer.getAtomAt(i)).setProperty("ST_ATOMNO", System.Convert.ToString(i + 1));
            }
            IBond bond;
            int v1, v2;
            bondsInTree = new bool[E];

            for (int b = 0; b < E; b++)
            {
                bondsInTree[b] = false;
                bond = atomContainer.getBondAt(b);
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                v1 = System.Int32.Parse((bond.getAtomAt(0)).getProperty("ST_ATOMNO").ToString());
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                v2 = System.Int32.Parse((bond.getAtomAt(1)).getProperty("ST_ATOMNO").ToString());
                //this below is a little bit  slower
                //v1 = atomContainer.getAtomNumber(bond.getAtomAt(0))+1; 
                //v2 = atomContainer.getAtomNumber(bond.getAtomAt(1))+1;
                if (fastfind(v1, v2, true))
                {
                    bondsInTree[b] = true;
                    sptSize++;
                    //System.out.println("ST : includes bond between atoms "+v1+","+v2);
                }
                if (sptSize >= (V - 1))
                    break;
            }
            // if atomcontainer is connected then the number of bonds in the spanning tree = (No atoms-1)
            //i.e.  edgesRings = new Bond[E-V+1];
            //but to hold all bonds if atomContainer was disconnected then  edgesRings = new Bond[E-sptSize]; 
            if (sptSize != (V - 1))
                disconnected = true;
            for (int b = 0; b < E; b++)
                if (!bondsInTree[b])
                {
                    //			edgesRings[edrSize] = atomContainer.getBondAt(b);
                    edrSize++;
                }
            cb = new int[edrSize][];
            for (int i2 = 0; i2 < edrSize; i2++)
            {
                cb[i2] = new int[E];
            }
            for (int i = 0; i < edrSize; i++)
                for (int a = 0; a < E; a++)
                    cb[i][a] = 0;
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:61,代码来源:SpanningTree.cs

示例14: configureAtoms

 /// <summary>  Configures atoms in an AtomContainer to 
 /// carry all the correct data according to their element type.
 /// 
 /// </summary>
 /// <param name="container"> The AtomContainer to be configured
 /// </param>
 public virtual void configureAtoms(IAtomContainer container)
 {
     for (int f = 0; f < container.AtomCount; f++)
     {
         configure(container.getAtomAt(f));
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:13,代码来源:IsotopeFactory.cs

示例15: 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


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