// ############################## START FUNC ############################################ // Here atom from_atom is compared with atom to_atom. If both are aromatic, and located // in the same ring, without "#" between, and the path includes a mark, "complex", then // false is returned, else true. function check_arom(from_atom, to_atom, arred_atoms, path, atom_sorts) { if(path.indexOf("complex")==-1) return false; if(atom_sorts[from_atom]-(-atom_sorts[to_atom])==8 && atom_sorts[from_atom]*atom_sorts[to_atom]==7) return false; // Above, the step N->H and H->N is included in complex for later detection in recognize_patterns. var i=arred_atoms.indexOf(" "+from_atom+" "); var j=arred_atoms.indexOf(" "+to_atom+" "); if(i==-1) return true; if(j==-1) return true; // The atoms which are first in the string must be indexed as i2, not j2 var j2=Math.max(i,j); var i2=Math.min(i,j); if(arred_atoms.indexOf("#",i2) < j2 && arred_atoms.indexOf("#",i2)!=-1) return true; return false; } // ############################### end func ############################################