User 870ab5b546
26-04-2013 19:04:33
I thought I would write a MolComparator that enforced the direction of coordinate bonds. I wrote the following code:
public boolean compareBonds(int queryBondNum, int targetBondNum) {
boolean match = true;
final MolBond queryBond = query.getBond(getOrigQueryBond(queryBondNum));
final MolBond targetBond =
target.getBond(getOrigTargetBond(targetBondNum));
if (queryBond.getType() == MolBond.COORDINATE
&& targetBond.getType() == MolBond.COORDINATE) {
final String SELF = "CoordBondDirnMatcher.compareBonds: ";
final MolAtom queryAtom1 = queryBond.getAtom1();
final MolAtom targetAtom1 = targetBond.getAtom1();
final int qAtom1Num = query.indexOf(queryAtom1);
final int tAtom1Num = target.indexOf(targetAtom1);
match = queryAtom1.getAtno() == targetAtom1.getAtno()
&& queryAtom1.getCharge() == targetAtom1.getCharge()
&& queryAtom1.getRadical() == targetAtom1.getRadical()
&& queryAtom1.getMassno() == targetAtom1.getMassno()
&& queryAtom1.getBondCount() == targetAtom1.getBondCount();
} // if either bond is not coordinate
return match;
} // compareBonds(int, int)
As you can see, I am using atomic number, charge, etc. as a proxy for the atoms matching, but really, I would like to see if queryAtom1 and targetAtom1 match according to the overall match in the structure. Is there a way to do it?