User 870ab5b546
07-03-2010 19:21:14
The code:
for (MEFlow eFlow : eFlows) {
debugPrint("Processing Flow # ", ++flowNum, ": ");
final Object source = eFlow.getMolObject(MEFlow.E_SOURCE);
final Object sink = eFlow.getMolObject(MEFlow.E_SINK);
if (source instanceof MolAtom) {
debugPrint("Source is MolAtom.");
...
} else if (source instanceof MolBond) {
debugPrint("Source is MolBond.");
...
} else {
debugPrint("Source is unknown type.");
} // end source
// calculate bond orders and unshared electron counts for sinks
if (sink instanceof MolAtom[] // incipient bond
// *** or 2e arrow atom to atom = incipient bond ***
|| (source instanceof MolAtom
&& sink instanceof MolAtom
&& eFlow.getNumElectrons() == 2)) {
debugPrint("Sink is MolAtom[].");
...
} else if (sink instanceof MolAtom) {
debugPrint("Sink is MolAtom.");
...
} else if (sink instanceof MolBond) {
debugPrint("Sink is MolBond.");
...
} else {
debugPrint("Sink is unknown.");
} // end sink
doc.removeObject(eFlow);
} // next EFlow arrow flowNum
The input MRV:
<?xml version="1.0" ?>
<cml>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1 a2 a3 a4 a5 a6 a7 a8"
elementType="C C C C Br O C C"
formalCharge="0 0 0 0 0 -1 0 0"
x2="17.475572892575848 18.80925201440388 20.14293113623192 20.177234724002336 21.510913845830373 17.475572892575848 18.039252014403882 19.579252014403885"
y2="-5.895710214222811 -6.665710214222813 -5.895710214222811 -4.115085128392124 -3.345085128392123 -4.355710214222812 -7.999389336050847 -7.999389336050847"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a2 a7" order="1" />
<bond atomRefs2="a2 a8" order="1" />
</bondArray>
</molecule>
</MChemicalStruct>
<MEFlow id="o2" arcAngle="150.0" headSkip="0.15" headLength="0.5"
headWidth="0.4" tailSkip="0.25">
<MEFlowBasePoint atomRef="m1.a6" />
<MAtomSetPoint atomRefs="m1.a6 m1.a4" weights="0.25 0.75" />
</MEFlow>
<MEFlow id="o3" arcAngle="-254.995522631729" headSkip="0.25"
headLength="0.5" headWidth="0.4" tailSkip="0.15">
<MAtomSetPoint atomRefs="m1.a4 m1.a5" />
<MAtomSetPoint atomRefs="m1.a5" />
</MEFlow>
</MDocument>
</cml>
The output:
Processing Flow # 1:
Source is unknown type.
Sink is MolAtom[].
Sink is incipient bond:
Adding a new bond between these atoms
Processing Flow # 2:
Source is MolBond.
Source bond electron count changed from 2 to 0
Breaking single bond connecting atoms C4 with parity 3 and Br5 with parity 0; changing parities to 0.
Sink is MolAtom.
Setting bond 8 to ChemAxon type 1
Removing bond 4
How can it be possible for the source of an electron-flow arrow to be neither a MolAtom nor a MolBond???
Clearly the source of the electron-flow arrow IS a MolAtom!!! Why does JChem not recognize it???
Please fix!!!