@@ -616,10 +616,7 @@ public double getContactOverlapScore(StructureInterface other, boolean invert) {
616616 Pair <EntityInfo > thisCompounds = new Pair <EntityInfo >(thisChains .getFirst ().getEntityInfo (), thisChains .getSecond ().getEntityInfo ());
617617 Pair <EntityInfo > otherCompounds = new Pair <EntityInfo >(otherChains .getFirst ().getEntityInfo (), otherChains .getSecond ().getEntityInfo ());
618618
619- if ( ( (thisCompounds .getFirst ().getMolId () == otherCompounds .getFirst ().getMolId ()) &&
620- (thisCompounds .getSecond ().getMolId () == otherCompounds .getSecond ().getMolId ()) ) ||
621- ( (thisCompounds .getFirst ().getMolId () == otherCompounds .getSecond ().getMolId ()) &&
622- (thisCompounds .getSecond ().getMolId () == otherCompounds .getFirst ().getMolId ()) ) ) {
619+ if (checkMolIdMatch (thisCompounds ,otherCompounds )) {
623620
624621 int common = 0 ;
625622 GroupContactSet thisContacts = getGroupContacts ();
@@ -653,6 +650,17 @@ public double getContactOverlapScore(StructureInterface other, boolean invert) {
653650 }
654651 }
655652
653+ /**
654+ * This method check if two compounds have same MolIds or not.
655+ * @param thisCompounds
656+ * @param otherCompounds
657+ * @return
658+ */
659+ private boolean checkMolIdMatch (Pair <EntityInfo > thisCompounds , Pair <EntityInfo > otherCompounds ){
660+ boolean firstMatch = thisCompounds .getFirst ().getMolId () == otherCompounds .getFirst ().getMolId () && thisCompounds .getSecond ().getMolId () == otherCompounds .getSecond ().getMolId ();
661+ boolean secondMatch = thisCompounds .getFirst ().getMolId () == otherCompounds .getSecond ().getMolId () && thisCompounds .getSecond ().getMolId () == otherCompounds .getFirst ().getMolId ();
662+ return firstMatch || secondMatch ;
663+ }
656664 public GroupContactSet getGroupContacts () {
657665 if (groupContacts ==null ) {
658666 this .groupContacts = new GroupContactSet (contacts );
0 commit comments