本文整理汇总了C#中IAtomContainer.getAtomNumber方法的典型用法代码示例。如果您正苦于以下问题:C# IAtomContainer.getAtomNumber方法的具体用法?C# IAtomContainer.getAtomNumber怎么用?C# IAtomContainer.getAtomNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAtomContainer
的用法示例。
在下文中一共展示了IAtomContainer.getAtomNumber方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: getMatrix
/// <summary> Returns the adjacency matrix for the given AtomContainer.
///
/// </summary>
/// <param name="container">The AtomContainer for which the matrix is calculated
/// </param>
/// <returns> A adjacency matrix representating this AtomContainer
/// </returns>
public static int[][] getMatrix(IAtomContainer container)
{
IElectronContainer electronContainer = null;
int indexAtom1;
int indexAtom2;
int[][] conMat = new int[container.AtomCount][];
for (int i = 0; i < container.AtomCount; i++)
{
conMat[i] = new int[container.AtomCount];
}
for (int f = 0; f < container.ElectronContainerCount; f++)
{
electronContainer = container.getElectronContainerAt(f);
if (electronContainer is IBond)
{
IBond bond = (IBond)electronContainer;
indexAtom1 = container.getAtomNumber(bond.getAtomAt(0));
indexAtom2 = container.getAtomNumber(bond.getAtomAt(1));
conMat[indexAtom1][indexAtom2] = 1;
conMat[indexAtom2][indexAtom1] = 1;
}
}
return conMat;
}
示例3: 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;
}
}
示例4: getAngleRMSD
/// <summary> Return the variation of each angle value 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>
/// <returns> double: the value of the RMSD
/// </returns>
/// <exception cref="CDK">*
///
/// </exception>
public static double getAngleRMSD(IAtomContainer firstAtomContainer, IAtomContainer secondAtomContainer, System.Collections.IDictionary mappedAtoms)
{
//System.out.println("**** GT getAngleRMSD ****");
//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();
//System.out.println("mappedAtoms:"+mappedAtoms.toString());
IAtom firstAtomfirstAC = null;
IAtom centerAtomfirstAC = null;
IAtom firstAtomsecondAC = null;
IAtom secondAtomsecondAC = null;
IAtom centerAtomsecondAC = null;
double angleFirstMolecule = 0;
double angleSecondMolecule = 0;
double sum = 0;
double 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'"
int firstAtomNumber = ((System.Int32)firstAtoms.Current);
centerAtomfirstAC = firstAtomContainer.getAtomAt(firstAtomNumber);
IAtom[] connectedAtoms = firstAtomContainer.getConnectedAtoms(centerAtomfirstAC);
if (connectedAtoms.Length > 1)
{
//System.out.println("If "+centerAtomfirstAC.getSymbol()+" is the center atom :");
for (int i = 0; i < connectedAtoms.Length - 1; i++)
{
firstAtomfirstAC = connectedAtoms[i];
for (int j = i + 1; j < connectedAtoms.Length; j++)
{
angleFirstMolecule = getAngle(centerAtomfirstAC, firstAtomfirstAC, connectedAtoms[j]);
centerAtomsecondAC = secondAtomContainer.getAtomAt(((System.Int32)mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(centerAtomfirstAC)]));
firstAtomsecondAC = secondAtomContainer.getAtomAt(((System.Int32)mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(firstAtomfirstAC)]));
secondAtomsecondAC = secondAtomContainer.getAtomAt(((System.Int32)mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(connectedAtoms[j])]));
angleSecondMolecule = getAngle(centerAtomsecondAC, firstAtomsecondAC, secondAtomsecondAC);
sum = sum + System.Math.Pow(angleFirstMolecule - angleSecondMolecule, 2);
n++;
//System.out.println("Error for the "+firstAtomfirstAC.getSymbol().toLowerCase()+"-"+centerAtomfirstAC.getSymbol()+"-"+connectedAtoms[j].getSymbol().toLowerCase()+" Angle :"+deltaAngle+" degrees");
}
}
} //if
}
return System.Math.Sqrt(sum / n);
}
示例5: 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);
}
示例6: mapAtomsOfAlignedStructures
/// <summary> Returns a Map with the AtomNumbers, the first number corresponds to the first (or the largest
/// AtomContainer) atomContainer.
///
/// Only for similar and aligned molecules with coordinates!
///
/// </summary>
/// <param name="firstAtomContainer"> the (largest) first aligned AtomContainer which is the reference
/// </param>
/// <param name="secondAtomContainer"> the second aligned AtomContainer
/// </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, System.Collections.IDictionary mappedAtoms)
{
//System.out.println("**** GT MAP ATOMS ****");
//Map atoms onto each other
if (firstAtomContainer.AtomCount < 1 & secondAtomContainer.AtomCount < 1)
{
return mappedAtoms;
}
RMap map;
IAtom atom1;
IAtom atom2;
int countMappedAtoms = 0;
System.Collections.IList list;
try
{
list = UniversalIsomorphismTester.getSubgraphAtomsMap(firstAtomContainer, secondAtomContainer);
//System.out.println("ListSize:"+list.size());
for (int i = 0; i < list.Count; i++)
{
map = (RMap)list[i];
atom1 = firstAtomContainer.getAtomAt(map.Id1);
atom2 = secondAtomContainer.getAtomAt(map.Id2);
if (checkAtomMapping(firstAtomContainer, secondAtomContainer, firstAtomContainer.getAtomNumber(atom1), secondAtomContainer.getAtomNumber(atom2)))
{
mappedAtoms[(System.Int32)firstAtomContainer.getAtomNumber(atom1)] = (System.Int32)secondAtomContainer.getAtomNumber(atom2);
countMappedAtoms++;
//System.out.println("#:"+countMappedAtoms+" Atom:"+firstAtomContainer.getAtomNumber(atom1)+" is mapped to Atom:"+secondAtomContainer.getAtomNumber(atom2));
}
else
{
System.Console.Out.WriteLine("Error: Atoms are not similar !!");
}
}
}
catch (CDKException e)
{
// TODO Auto-generated catch block
System.Console.Out.WriteLine("Error in UniversalIsomorphismTester due to:");
SupportClass.WriteStackTrace(e, Console.Error);
}
return mappedAtoms;
}
示例7: 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);
}
}
示例8: 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);
}
示例9: toString
public String toString(IAtomContainer ac)
{
String s = "Path of length " + Count + ": ";
for (int f = 0; f < Count; f++)
{
s += ac.getAtomNumber((IAtom)this[f]) + " ";
}
return s;
}
示例10: makeAtomsMapOfBondsMap
/// <summary> This makes a map of matching atoms out of a map of matching bonds as produced by the get(Subgraph|Ismorphism)Map methods.
///
/// </summary>
/// <param name="l"> The list produced by the getMap method.
/// </param>
/// <param name="g1"> The first atom container.
/// </param>
/// <param name="g2"> The second one (first and second as in getMap)
/// </param>
/// <returns> The mapping found projected on g1. This is a List of RMap objects containing Ids of matching atoms.
/// </returns>
public static System.Collections.IList makeAtomsMapOfBondsMap(System.Collections.IList l, IAtomContainer g1, IAtomContainer g2)
{
if (l == null)
return (l);
IBond[] bonds1 = g1.Bonds;
IBond[] bonds2 = g2.Bonds;
System.Collections.IList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
for (int i = 0; i < l.Count; i++)
{
IBond bond1 = bonds1[((RMap)l[i]).Id1];
IBond bond2 = bonds2[((RMap)l[i]).Id2];
IAtom[] atom1 = bond1.getAtoms();
IAtom[] atom2 = bond2.getAtoms();
for (int j = 0; j < 2; j++)
{
IBond[] bondsConnectedToAtom1j = g1.getConnectedBonds(atom1[j]);
for (int k = 0; k < bondsConnectedToAtom1j.Length; k++)
{
if (bondsConnectedToAtom1j[k] != bond1)
{
IBond testBond = bondsConnectedToAtom1j[k];
for (int m = 0; m < l.Count; m++)
{
IBond testBond2;
if (((RMap)l[m]).Id1 == g1.getBondNumber(testBond))
{
testBond2 = bonds2[((RMap)l[m]).Id2];
for (int n = 0; n < 2; n++)
{
System.Collections.IList bondsToTest = g2.getConnectedBondsVector(atom2[n]);
if (bondsToTest.Contains(testBond2))
{
RMap map;
if (j == n)
{
map = new RMap(g1.getAtomNumber(atom1[0]), g2.getAtomNumber(atom2[0]));
}
else
{
map = new RMap(g1.getAtomNumber(atom1[1]), g2.getAtomNumber(atom2[0]));
}
if (!result.Contains(map))
{
result.Add(map);
}
RMap map2;
if (j == n)
{
map2 = new RMap(g1.getAtomNumber(atom1[1]), g2.getAtomNumber(atom2[1]));
}
else
{
map2 = new RMap(g1.getAtomNumber(atom1[0]), g2.getAtomNumber(atom2[1]));
}
if (!result.Contains(map2))
{
result.Add(map2);
}
}
}
}
}
}
}
}
}
return (result);
}
示例11: getShortestPath
/// <summary> Returns a list of atoms in the shortest path between two atoms.
///
/// This method uses the Djikstra algorithm to find all the atoms in the shortest
/// path between the two specified atoms. The start and end atoms are also included
/// in the path returned
///
/// </summary>
/// <param name="atomContainer">The molecule to search in
/// </param>
/// <param name="start">The starting atom
/// </param>
/// <param name="end">The ending atom
/// </param>
/// <returns> A <code>List</code> containing the atoms in the shortest path between <code>start</code> and
/// <code>end</code> inclusive
/// </returns>
public static System.Collections.IList getShortestPath(IAtomContainer atomContainer, IAtom start, IAtom end)
{
int natom = atomContainer.AtomCount;
int endNumber = atomContainer.getAtomNumber(end);
int startNumber = atomContainer.getAtomNumber(start);
int[] d = new int[natom];
int[] previous = new int[natom];
for (int i = 0; i < natom; i++)
{
d[i] = 99999999;
previous[i] = -1;
}
d[atomContainer.getAtomNumber(start)] = 0;
System.Collections.ArrayList S = new System.Collections.ArrayList();
System.Collections.ArrayList Q = new System.Collections.ArrayList();
for (int i = 0; i < natom; i++)
Q.Add((System.Int32)i);
while (true)
{
if (Q.Count == 0)
break;
// extract min
int u = 999999;
int index = 0;
for (int i = 0; i < Q.Count; i++)
{
int tmp = ((System.Int32)Q[i]);
if (d[tmp] < u)
{
u = d[tmp];
index = i;
}
}
Q.RemoveAt(index);
S.Add(atomContainer.getAtomAt(u));
if (u == endNumber)
break;
// relaxation
IAtom[] connected = atomContainer.getConnectedAtoms(atomContainer.getAtomAt(u));
for (int i = 0; i < connected.Length; i++)
{
int anum = atomContainer.getAtomNumber(connected[i]);
if (d[anum] > d[u] + 1)
{
// all edges have equals weights
d[anum] = d[u] + 1;
previous[anum] = u;
}
}
}
System.Collections.ArrayList tmp2 = new System.Collections.ArrayList();
int u2 = endNumber;
while (true)
{
tmp2.Insert(0, atomContainer.getAtomAt(u2));
u2 = previous[u2];
if (u2 == startNumber)
{
tmp2.Insert(0, atomContainer.getAtomAt(u2));
break;
}
}
return tmp2;
}
示例12: isStereo
/// <summary> Says if an atom as a center of any valid stereo configuration or not
///
/// </summary>
/// <param name="a"> The atom which is the center
/// </param>
/// <param name="container"> The atomContainer the atom is in
/// </param>
/// <returns> true=is a stereo atom, false=is not
/// </returns>
public static bool isStereo(IAtomContainer container, IAtom a)
{
IAtom[] atoms = container.getConnectedAtoms(a);
if (atoms.Length < 4 || atoms.Length > 6)
{
return (false);
}
IBond[] bonds = container.getConnectedBonds(a);
int stereo = 0;
for (int i = 0; i < bonds.Length; i++)
{
if (bonds[i].Stereo != 0)
{
stereo++;
}
}
if (stereo == 0)
{
return false;
}
int differentAtoms = 0;
for (int i = 0; i < atoms.Length; i++)
{
bool isDifferent = true;
for (int k = 0; k < i; k++)
{
if (atoms[i].Symbol.Equals(atoms[k].Symbol))
{
isDifferent = false;
break;
}
}
if (isDifferent)
{
differentAtoms++;
}
}
if (differentAtoms != atoms.Length)
{
int[] morgannumbers = MorganNumbersTools.getMorganNumbers(container);
System.Collections.ArrayList differentSymbols = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
for (int i = 0; i < atoms.Length; i++)
{
if (!differentSymbols.Contains(atoms[i].Symbol))
{
differentSymbols.Add(atoms[i].Symbol);
}
}
int[] onlyRelevantIfTwo = new int[2];
if (differentSymbols.Count == 2)
{
for (int i = 0; i < atoms.Length; i++)
{
if (differentSymbols.IndexOf(atoms[i].Symbol) == 0)
{
onlyRelevantIfTwo[0]++;
}
else
{
onlyRelevantIfTwo[1]++;
}
}
}
bool[] symbolsWithDifferentMorganNumbers = new bool[differentSymbols.Count];
System.Collections.ArrayList[] symbolsMorganNumbers = new System.Collections.ArrayList[differentSymbols.Count];
for (int i = 0; i < symbolsWithDifferentMorganNumbers.Length; i++)
{
symbolsWithDifferentMorganNumbers[i] = true;
symbolsMorganNumbers[i] = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
}
for (int k = 0; k < atoms.Length; k++)
{
int elementNumber = differentSymbols.IndexOf(atoms[k].Symbol);
if (symbolsMorganNumbers[elementNumber].Contains((System.Int32)morgannumbers[container.getAtomNumber(atoms[k])]))
{
symbolsWithDifferentMorganNumbers[elementNumber] = false;
}
else
{
symbolsMorganNumbers[elementNumber].Add((System.Int32)morgannumbers[container.getAtomNumber(atoms[k])]);
}
}
int numberOfSymbolsWithDifferentMorganNumbers = 0;
for (int i = 0; i < symbolsWithDifferentMorganNumbers.Length; i++)
{
if (symbolsWithDifferentMorganNumbers[i] == true)
{
numberOfSymbolsWithDifferentMorganNumbers++;
}
}
if (numberOfSymbolsWithDifferentMorganNumbers != differentSymbols.Count)
//.........这里部分代码省略.........