ring size

User 870ab5b546

16-08-2006 00:08:06

Hello,





Do you have a method that, when I ask for the ring size of benzocyclobutene, will return 8? TopologyAnalyser.largestRingSize() returns 6.





-- Bob

ChemAxon d76e6e95eb

16-08-2006 07:46:44

TopologyAnalyser ring functions are based on the "smallest set of smallest rings" (SSSR). Do you need an API function or a plugin function? What purpose would you like to use it for?

User 870ab5b546

16-08-2006 11:38:48

I have a method that determines whether a reaction is pericyclic. It creates a new Molecule that consist only of the atoms atoms and bonds in the original Molecule that are involved in electron-flow, and it creates bonds where the "incipient bonds" in the original Molecule are pointing. It then creates bonds between atoms in the new Molecule that are adjacent in the original Molecule, because these atoms would interact with one another in the pericyclic TS. (Here is a page that uses the method. Note that you need to draw two rectangles connected by a graphical arrow, putting your mechanism in box 1 and anything at all in box 2.)





The number of atoms in the pericyclic TS is equal to the number of atoms in the largest ring in the new Molecule. Although your SSSR methods are exactly what I need most of the time, in this case, I want the largest ring in the Molecule regardless of whether it contains two smaller rings in it. Right now I am simply counting the number of ring atoms in the new molecule, but I worry that this technique will give me an incorrect result in one or another case.





One problem I had when I wrote this method: When I had buggy code, such as trying to create a MolBond between atoms in two different Molecules or trying to create a new MolBond between atoms that were already connected, my program hung, and no error messages were generated. In fact, even the log output was aborted before it reached the buggy code. So it ended up taking me a VERY long time to figure out what was wrong in my code. You may want to look at generating an Exception in those cases.

ChemAxon d76e6e95eb

18-08-2006 22:16:57

I understand. I would like to keep the many ring functions in Topology Analyser operating on SSSR only. However, we can provide you an API method finding all rings in a structure, and sample code to get the largest one. Will it do for you?

User 870ab5b546

18-08-2006 23:26:23

Yes, that would be fine.

ChemAxon 25dcd765a3

19-08-2006 09:15:48

You can use the MoleculeGraph


Code:



 public int[][][] getAromaticAndAliphaticRings(int aromatizationType,


          boolean onlyAromrings,


          boolean aromatize, int maxRingSize, int ringsLimit)


method to find all rings in the molecule.


It returns the aromatic and aliphatic ring atom indexes.


Aromatic rings at the [0] position.


Aliphatic rings at the [1] position.





So all you need is to locate the largest one from these rings.





I would like to warn you that this method can be extremly slow for molecules which has quite a lot rings (like buckyball).

User 870ab5b546

19-08-2006 13:04:15

Could you give me an example of some code? I don't think I know how to handle triple arrays....

ChemAxon 25dcd765a3

20-08-2006 07:10:44

Sure.


Code:



int maxRingLength = 0;           // the largest ring length


int[] maxRingIndexes = null;     // the largest ring atom indexes





// get all rings


int[][][] rings = m.getAromaticAndAliphaticRings(0, false, false, 0, 0);


for (int i = 0; i < 2; i++){        // we have aliphatic and aromatic rings


    int l = rings[i].length;        // number of rings


    for (int j = 0; j < l; j++){    // run through the rings


        int[] r = rings[i][j];      // the ring atom indexes


        if (r.length > maxRingLength){


            maxRingIndexes = r;


            maxRingLength = r.length;


        }


    }


}


User 870ab5b546

20-08-2006 15:41:07

Thanks!