• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IAtomContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GenerateFragments

		public IEnumerable<IAtomContainer> GenerateFragments(IAtomContainer compound, string compoundId, CancellationToken isCancelled)
		{
			var fragmenter = new Fragmenter(spectrum.Peaks.ToList(), config);

			// This might throw an OutOfMemoryException, but I want it to be thrown not silently fail
			return fragmenter.GenerateFragmentsEfficient(compound, true, config.TreeDepth, compoundId, isCancelled);
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:7,代码来源:FragmentGenerator.cs


示例2: AddImplicitHydrogens

		public bool AddImplicitHydrogens(IAtomContainer molecule)
		{
			try
			{
				var builder = molecule.getBuilder();
				var matcher = CDKAtomTypeMatcher.getInstance(builder);

				foreach (var atom in molecule.atoms().ToWindowsEnumerable<IAtom>())
				{
					var type = matcher.findMatchingAtomType(molecule, atom);
					AtomTypeManipulator.configure(atom, type);
				}
				var hAdder = CDKHydrogenAdder.getInstance(builder);
				hAdder.addImplicitHydrogens(molecule);

				AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule);
			}
				//there is a bug in cdk?? error happens when there is a S or Ti in the molecule
			catch (IllegalArgumentException)
			{
				return false;
			}

			return true;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:25,代码来源:ImplicitHydrogenAdder.cs


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


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


示例5: translateAllPositive

        //UPGRADE_NOTE: The initialization of  '//logger' was moved to static method 'org.openscience.cdk.geometry.GeometryTools'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
        //private static LoggingTool //logger;


        /// <summary>  Adds an automatically calculated offset to the coordinates of all atoms
        /// such that all coordinates are positive and the smallest x or y coordinate
        /// is exactly zero, using an external set of coordinates.
        /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
        /// 
        /// </summary>
        /// <param name="atomCon"> AtomContainer for which all the atoms are translated to
        /// positive coordinates
        /// </param>
        /// <param name="renderingCoordinates"> The set of coordinates to use coming from RendererModel2D
        /// </param>
        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        public static void translateAllPositive(IAtomContainer atomCon, System.Collections.Hashtable renderingCoordinates)
        {
            //UPGRADE_TODO: The equivalent in .NET for field 'java.lang.Double.MAX_VALUE' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            double minX = System.Double.MaxValue;
            //UPGRADE_TODO: The equivalent in .NET for field 'java.lang.Double.MAX_VALUE' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            double minY = System.Double.MaxValue;
            IAtom[] atoms = atomCon.Atoms;
            for (int i = 0; i < atoms.Length; i++)
            {
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                if (renderingCoordinates[atoms[i]] == null && atoms[i].getPoint2d() != null)
                {
                    renderingCoordinates[atoms[i]] = new Point2d(atoms[i].getPoint2d().x, atoms[i].getPoint2d().y);
                }
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                if (renderingCoordinates[atoms[i]] != null)
                {
                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                    if (((Point2d)renderingCoordinates[atoms[i]]).x < minX)
                    {
                        //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                        minX = ((Point2d)renderingCoordinates[atoms[i]]).x;
                    }
                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                    if (((Point2d)renderingCoordinates[atoms[i]]).y < minY)
                    {
                        //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                        minY = ((Point2d)renderingCoordinates[atoms[i]]).y;
                    }
                }
            }
            //logger.debug("Translating: minx=" + minX + ", minY=" + minY);
            translate2D(atomCon, minX * (-1), minY * (-1), renderingCoordinates);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:50,代码来源:GeometryTools.cs


示例6: rebond

 /// <summary> Rebonding using a Binary Space Partition Tree. Note, that any bonds
 /// defined will be deleted first. It assumes the unit of 3D space to
 /// be 1 &Acircle;ngstrom.
 /// </summary>
 public virtual void rebond(IAtomContainer container)
 {
     container.removeAllBonds();
     maxCovalentRadius = 0.0;
     // construct a new binary space partition tree
     bspt = new Bspt(3);
     IAtom[] atoms = container.Atoms;
     for (int i = atoms.Length; --i >= 0; )
     {
         IAtom atom = atoms[i];
         double myCovalentRadius = atom.CovalentRadius;
         if (myCovalentRadius == 0.0)
         {
             //throw new CDKException("Atom(s) does not have covalentRadius defined.");
         }
         else
         {
             if (myCovalentRadius > maxCovalentRadius)
                 maxCovalentRadius = myCovalentRadius;
             TupleAtom tupleAtom = new TupleAtom(atom);
             bspt.addTuple(tupleAtom);
         }
     }
     // rebond all atoms
     for (int i = atoms.Length; --i >= 0; )
     {
         bondAtom(container, atoms[i]);
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:33,代码来源:RebondTool.cs


示例7: isValidDoubleBondConfiguration

 /// <summary> 
 /// Tells if a certain bond is center of a valid double bond configuration.
 /// </summary>
 /// <param name="container"> The atomcontainer.
 /// </param>
 /// <param name="bond">      The bond.
 /// </param>
 /// <returns>            true=is a potential configuration, false=is not.
 /// </returns>
 public static bool isValidDoubleBondConfiguration(IAtomContainer container, IBond bond)
 {
     IAtom[] atoms = bond.getAtoms();
     IAtom[] connectedAtoms = container.getConnectedAtoms(atoms[0]);
     IAtom from = null;
     for (int i = 0; i < connectedAtoms.Length; i++)
     {
         if (connectedAtoms[i] != atoms[1])
         {
             from = connectedAtoms[i];
         }
     }
     bool[] array = new bool[container.Bonds.Length];
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = true;
     }
     if (isStartOfDoubleBond(container, atoms[0], from, array) && isEndOfDoubleBond(container, atoms[1], atoms[0], array) && !bond.getFlag(CDKConstants.ISAROMATIC))
     {
         return (true);
     }
     else
     {
         return (false);
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:35,代码来源:BondTools.cs


示例8: GetResultRow

		public ResultRow GetResultRow(IAtomContainer originalCompound, IEnumerable<IAtomContainer> fragments, string compoundId)
		{
			var assignFragmentHits = AssignHits(fragments);

			var fragsPics = assignFragmentHits.AllHits.Reverse();

			return new ResultRow(compoundId, originalCompound, fragsPics);
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:8,代码来源:HitsMatcher.cs


示例9: ResultRow

		public ResultRow(
			string id,
			IAtomContainer originalCompound,
			IEnumerable<PeakMolPair> fragmentPics)
		{
			this.id = id;
			this.fragmentPics = fragmentPics;
			bondEnergy = new BondEnergyCalculator(originalCompound).TotalBondEnergy();
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:9,代码来源:ResultRow.cs


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


示例11: GenerateFragments

		public ResultRow GenerateFragments(IAtomContainer compound, string compoundId, CancellationToken isCancelled)
		{
			if (!hydrogenAdder.AddImplicitHydrogens(compound))
			{
				return null;
			}

			var fragments = fragmentGenerator.GenerateFragments(compound, compoundId, isCancelled);
			return hitsMatcher.GetResultRow(compound, fragments, compoundId);
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:10,代码来源:FragmentationAlgorithm.cs


示例12: PeakMolPair

		public PeakMolPair(IAtomContainer ac, Peak peak, double matchedMass, string molecularFormula, double hydrogenPenalty, double bondDissociationEnergy, string neutralChange)
		{
			this.ac = ac;
			this.peak = peak;

			MatchedMass = matchedMass;
			MolecularFormula = molecularFormula;
			HydrogenPenalty = hydrogenPenalty;
			BondDissociationEnergy = bondDissociationEnergy;
			NeutralChange = neutralChange;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:11,代码来源:PeakMolPair.cs


示例13: MatchByMass

		private bool MatchByMass(IAtomContainer ac, double peak, double mzabs, double mzppm, out double matchedMass, out double hydrogenPenalty, out int hydrogensAdded)
		{
			matchedMass = 0;
			hydrogenPenalty = 0;
			hydrogensAdded = 0;
			
			double mass;
			//speed up and neutral loss matching!
			if (ac.getProperty("FragmentMass") != null && (string)ac.getProperty("FragmentMass") != "")
			{
                mass = double.Parse(ac.getProperty("FragmentMass").ToString(), CultureInfo.InvariantCulture);
			}
			else
			{
				mass = MolecularFormulaTools.GetMonoisotopicMass(GetMolecularFormula(ac));
			}

			var peakLow = peak - mzabs - PpmTool.GetPPMDeviation(peak, mzppm);
			var peakHigh = peak + mzabs + PpmTool.GetPPMDeviation(peak, mzppm);			

			//now try to add/remove neutral hydrogens ...at most the treedepth
			var treeDepth = int.Parse((String)ac.getProperty("TreeDepth"));
			for (var i = 0; i <= treeDepth; i++)
			{
				var hMass = i * hydrogenMass;

				if ((mass + hMass) >= peakLow && (mass + hMass) <= peakHigh)
				{
					matchedMass = Math.Round(mass + hMass, 4);

					//now add a bond energy equivalent to a H-C bond
					hydrogenPenalty = (i * 1000);

					hydrogensAdded = i;

					return true;
				}

				if ((mass - hMass) >= peakLow && (mass - hMass) <= peakHigh)
				{
					matchedMass = Math.Round(mass - hMass, 4);

					//now add a bond energy equivalent to a H-C bond
					hydrogenPenalty = (i * 1000);

					hydrogensAdded = -i;

					return true;
				}
			}
			return false;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:52,代码来源:FragmentPeakAssigner.cs


示例14: saturate

		/// <summary> Saturates a molecule by setting appropriate bond orders.
		/// 
		/// </summary>
		/// <cdk.keyword>             bond order, calculation </cdk.keyword>
		/// <summary> 
		/// </summary>
		/// <cdk.created>  2003-10-03 </cdk.created>
		public virtual void  saturate(IAtomContainer atomContainer)
		{
			//logger.info("Saturating atomContainer by adjusting bond orders...");
			bool allSaturated = this.allSaturated(atomContainer);
			if (!allSaturated)
			{
				//logger.info("Saturating bond orders is needed...");
				bool succeeded = saturate(atomContainer.Bonds, atomContainer);
				if (!succeeded)
				{
					throw new CDKException("Could not saturate this atomContainer!");
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:21,代码来源:ValencyHybridChecker.cs


示例15: processFormula

        /// <summary> Processes the content from the formula field of the INChI.
        /// Typical values look like C6H6, from INChI=1.12Beta/C6H6/c1-2-4-6-5-3-1/h1-6H.
        /// </summary>
        public virtual IAtomContainer processFormula(IAtomContainer parsedContent, System.String atomsEncoding)
        {
            //logger.debug("Parsing atom data: ", atomsEncoding);

            Regex pattern = new Regex("([A-Z][a-z]?)(\\d+)?(.*)");
            //Pattern pattern = Pattern.compile("([A-Z][a-z]?)(\\d+)?(.*)");
            System.String remainder = atomsEncoding;
            while (remainder.Length > 0)
            {
                //logger.debug("Remaining: ", remainder);
                Match matcher = pattern.Match(remainder);
                //Matcher matcher = pattern.matcher(remainder);
                //if (matcher.matches())
                if (matcher != null && matcher.Success)
                {
                    System.String symbol = matcher.Groups[1].Value;
                    //logger.debug("Atom symbol: ", symbol);
                    if (symbol.Equals("H"))
                    {
                        // don't add explicit hydrogens
                    }
                    else
                    {
                        System.String occurenceStr = matcher.Groups[2].Value;
                        int occurence = 1;
                        if (occurenceStr != null)
                        {
                            occurence = System.Int32.Parse(occurenceStr);
                        }
                        //logger.debug("  occurence: ", occurence);
                        for (int i = 1; i <= occurence; i++)
                        {
                            parsedContent.addAtom(parsedContent.Builder.newAtom(symbol));
                        }
                    }
                    remainder = matcher.Groups[3].Value;
                    if (remainder == null)
                        remainder = "";
                    //logger.debug("  Remaining: ", remainder);
                }
                else
                {
                    //logger.error("No match found!");
                    remainder = "";
                }
                //logger.debug("NO atoms: ", parsedContent.AtomCount);
            }
            return parsedContent;
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:52,代码来源:INChIContentProcessorTool.cs


示例16: preprocessMolecule

		private bool preprocessMolecule(IAtomContainer original)
		{
			//prepare atom weights
			var atomWeightCanBeCalculated = prepareAtomWeights(original);
			// If the SDF contains an "R" or something, we don't know its mass, so this whole endevour is fruitless
			// (since we won't be able to match the fragment masses to the peaks).
			if (!atomWeightCanBeCalculated)
			{
				return false;
			}

			//mark all the bonds and atoms with numbers --> identify them later on        
			originalMolecule = markAllBonds(original);

			//do ring detection with the original molecule
			var allRingsFinder = new AllRingsFinder();

			// Steve: Set a really large timeout, because we don't want to crash just because it took a long time.
			// The size limit of 7 below should stop it looping forever.
			allRingsFinder.setTimeout(int.MaxValue);
			// TODO: Steve: The 7 is a max ring size - I added this to prevent it getting in to infinite loops (7 comes from MetFrag
			// where it is used in some other random class). Don't know if we need to change this??
			allRings = allRingsFinder.findAllRings(originalMolecule, Integer.valueOf(7));
			aromaticBonds = new List<IBond>();

			CDKHueckelAromaticityDetector.detectAromaticity(originalMolecule);

			foreach (var bond in originalMolecule.bonds().ToWindowsEnumerable<IBond>())
			{
				//lets see if it is a ring and aromatic
				var rings = allRings.getRings(bond);
				//don't split up aromatic rings...see constructor for option
				for (var i = 0; i < rings.getAtomContainerCount(); i++)
				{
					var aromatic = AromaticityCalculator.isAromatic((IRing)rings.getAtomContainer(i), originalMolecule);
					if (aromatic)
					{
						aromaticBonds.Add(bond);
						break;
					}
				}
			}
			return true;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:44,代码来源:Fragmenter.cs


示例17: findAllRings

 /// <summary>  Returns a ringset containing all rings in the given AtomContainer
 /// 
 /// </summary>
 /// <param name="atomContainer">    The AtomContainer to be searched for rings
 /// </param>
 /// <returns>                   A RingSet with all rings in the AtomContainer
 /// </returns>
 /// <exception cref="CDKException"> An exception thrown if something goes wrong or if the timeout limit is reached
 /// </exception>
 public virtual IRingSet findAllRings(IAtomContainer atomContainer)
 {
     startTime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
     SpanningTree spanningTree;
     try
     {
         spanningTree = new SpanningTree((IAtomContainer)atomContainer.Clone());
     }
     //UPGRADE_NOTE: Exception 'java.lang.CloneNotSupportedException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
     catch (System.Exception e)
     {
         throw new CDKException("Could not clone IAtomContainer!", e);
     }
     spanningTree.identifyBonds();
     if (spanningTree.BondsCyclicCount < 37)
     {
         findAllRings(atomContainer, false);
     }
     return findAllRings(atomContainer, true);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:AllRingsFinder.cs


示例18: getMoleculeGraph

        /// <summary>
        /// Creates a molecule graph for use with jgrapht.
        /// Bond orders are not respected.
        /// </summary>
        /// <param name="molecule">the specified molecule</param>
        /// <returns>a graph representing the molecule</returns>
	    static public SimpleGraph getMoleculeGraph(IAtomContainer molecule) {
		    SimpleGraph graph = new SimpleGraph();
		    for (int i=0; i<molecule.AtomCount; i++	) {
			    IAtom atom = molecule.Atoms[i];
			    graph.addVertex(atom);
		    }
    		
		    for (int i=0; i<molecule.getBondCount(); i++	) {
			    IBond bond = molecule.Bonds[i];
    			
			    /*
			    int order = (int) bond.getOrder();
			    for (int j=0; j<order; j++) {
				    graph.addEdge(bond.getAtoms()[0], bond.getAtoms()[1]);
			    }
			    */
			    graph.addEdge(bond.getAtoms()[0], bond.getAtoms()[1]);
		    }
		    return graph;
	    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:26,代码来源:MoleculeGraphs.cs


示例19: replaceAtomByAtom

 public static bool replaceAtomByAtom(IAtomContainer container, IAtom atom, IAtom newAtom)
 {
     if (!container.contains(atom))
     {
         // it should complain
         return false;
     }
     else
     {
         container.setAtomAt(container.getAtomNumber(atom), newAtom);
         IElectronContainer[] electronContainers = container.ElectronContainers;
         for (int i = 0; i < electronContainers.Length; i++)
         {
             if (electronContainers[i] is IBond)
             {
                 IBond bond = (IBond)electronContainers[i];
                 if (bond.contains(atom))
                 {
                     for (int j = 0; j < bond.AtomCount; j++)
                     {
                         if (atom.Equals(bond.getAtomAt(j)))
                         {
                             bond.setAtomAt(newAtom, j);
                         }
                     }
                 }
             }
             else if (electronContainers[i] is ILonePair)
             {
                 ILonePair lonePair = (ILonePair)electronContainers[i];
                 if (atom.Equals(lonePair.Atom))
                 {
                     lonePair.Atom = newAtom;
                 }
             }
         }
         return true;
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:39,代码来源:AtomContainerManipulator.cs


示例20: createIDs

        /// <summary> Labels the Atom's and Bond's in the AtomContainer using the a1, a2, b1, b2
        /// scheme often used in CML.
        /// 
        /// </summary>
        /// <seealso cref="createIDs(ISetOfAtomContainers)">
        /// </seealso>
        public virtual void createIDs(IAtomContainer container)
        {
            if (tabuList == null)
                tabuList = AtomContainerManipulator.getAllIDs(container);

            if (container.ID == null)
            {
                moleculeCount++;
                while (tabuList.Contains("m" + moleculeCount))
                    moleculeCount++;
                container.ID = "m" + moleculeCount;
            }

            IAtom[] atoms = container.Atoms;
            for (int i = 0; i < atoms.Length; i++)
            {
                IAtom atom = atoms[i];
                if (atom.ID == null)
                {
                    atomCount++;
                    while (tabuList.Contains("a" + atomCount))
                        atomCount++;
                    atoms[i].ID = "a" + atomCount;
                }
            }
            IBond[] bonds = container.Bonds;
            for (int i = 0; i < bonds.Length; i++)
            {
                IBond bond = bonds[i];
                if (bond.ID == null)
                {
                    bondCount++;
                    while (tabuList.Contains("b" + bondCount))
                        bondCount++;
                    bonds[i].ID = "b" + bondCount;
                }
            }
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:44,代码来源:IDCreator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IAttribute类代码示例发布时间:2022-05-24
下一篇:
C# IAsynchronousOperationListener类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap