本文整理汇总了C#中IAtomContainer.removeAtomAndConnectedElectronContainers方法的典型用法代码示例。如果您正苦于以下问题:C# IAtomContainer.removeAtomAndConnectedElectronContainers方法的具体用法?C# IAtomContainer.removeAtomAndConnectedElectronContainers怎么用?C# IAtomContainer.removeAtomAndConnectedElectronContainers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAtomContainer
的用法示例。
在下文中一共展示了IAtomContainer.removeAtomAndConnectedElectronContainers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: remove
/// <summary> Removes an atom from the AtomContainer under certain conditions.
/// See {@cdk.cite HAN96} for details
///
///
/// </summary>
/// <param name="atom"> The atom to be removed
/// </param>
/// <param name="ac"> The AtomContainer to work on
/// </param>
/// <param name="pathes"> The pathes to manipulate
/// </param>
/// <param name="rings"> The ringset to be extended
/// </param>
/// <exception cref="CDKException"> Thrown if something goes wrong or if the timeout is exceeded
/// </exception>
private void remove(IAtom atom, IAtomContainer ac, System.Collections.ArrayList pathes, IRingSet rings)
{
Path path1 = null;
Path path2 = null;
Path union = null;
int intersectionSize = 0;
newPathes.Clear();
removePathes.Clear();
potentialRings.Clear();
if (debug)
{
System.Console.Out.WriteLine("*** Removing atom " + originalAc.getAtomNumber(atom) + " ***");
}
for (int i = 0; i < pathes.Count; i++)
{
path1 = (Path)pathes[i];
if (path1[0] == atom || path1[path1.Count - 1] == atom)
{
for (int j = i + 1; j < pathes.Count; j++)
{
//System.out.print(".");
path2 = (Path)pathes[j];
if (path2[0] == atom || path2[path2.Count - 1] == atom)
{
intersectionSize = path1.getIntersectionSize(path2);
if (intersectionSize < 3)
{
//if (debug) System.out.println("Joining " + path1.toString(originalAc) + " and " + path2.toString(originalAc));
union = Path.join(path1, path2, atom);
if (intersectionSize == 1)
{
newPathes.Add(union);
}
else
{
potentialRings.Add(union);
}
//if (debug) System.out.println("Intersection Size: " + intersectionSize);
//if (debug) System.out.println("Union: " + union.toString(originalAc));
/*
* Now we know that path1 and
* path2 share the Atom atom.
*/
removePathes.Add(path1);
removePathes.Add(path2);
}
}
checkTimeout();
}
}
}
for (int f = 0; f < removePathes.Count; f++)
{
pathes.Remove(removePathes[f]);
}
for (int f = 0; f < newPathes.Count; f++)
{
pathes.Add(newPathes[f]);
}
detectRings(potentialRings, rings, originalAc);
ac.removeAtomAndConnectedElectronContainers(atom);
if (debug)
{
System.Console.Out.WriteLine("\n" + pathes.Count + " pathes and " + ac.AtomCount + " atoms left.");
}
}
示例2: removeAliphatic
/// <summary> Removes all external aliphatic chains by chopping them off from the
/// ends
///
/// </summary>
/// <param name="ac"> The AtomContainer to work with
/// </param>
/// <exception cref="CDKException"> An exception thrown if something goes wrong or if the timeout limit is reached
/// </exception>
private void removeAliphatic(IAtomContainer ac)
{
bool removedSomething;
IAtom atom = null;
do
{
removedSomething = false;
//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'"
for (System.Collections.IEnumerator e = ac.atoms(); e.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'"
atom = (IAtom)e.Current;
if (ac.getBondCount(atom) == 1)
{
ac.removeAtomAndConnectedElectronContainers(atom);
removedSomething = true;
}
}
}
while (removedSomething);
}