Technical Support Forum Index
Technical Support Forum
Access ChemAxon scientists and developers here. For registration and login issues contact website support.

Support Ticket System is replacing forum

This forum was converted into a searchable archive. You cannot add posts here any more. For support please use our new Ticket System.

Create your first ticket
get smallest set of smallest ring BONDS
To watch this topic for replies  Register (enables digests) or give email address:
This topic is locked: you cannot edit posts or make replies.
Display posts from previous:   
    View previous topic :: View next topic    
Author Message
Lorenz

Joined: 21 Jun 2007
Posts: 40

View user's profile

Back to top
Link to postPosted: Tue Sep 16, 2008 5:12 pmPost subject: get smallest set of smallest ring BONDS Reply with quote

It would be nice to be able to get an int[][] containing the smallest set of smallest ring bond indices (not the atom indices). I don't know if it already exsits, please tell me if so. If not here is a proposal:

lorenz

Code:

import chemaxon.struc.Molecule;
import chemaxon.util.MolHandler;

public class SSSRB {

   public static void main(String[] args) throws Exception {
      int[][] sssrb = new SSSRB().getSSSRBonds(new MolHandler("C12CC=C1CCOC2CCC").getMolecule());
      for (int i = 0; i < sssrb.length; i++) {
       for (int j = 0; j < sssrb[i].length; j++) {
          System.out.println("Ring "+i+" Bond "+sssrb[i][j]);
       }
    }
   }

   public int[][] getSSSRBonds(Molecule m) {
      int[][] sssr = m.getSSSR();
      int[][] btab = m.getBtab();
      int[][] sssrb = new int[sssr.length][0];
      //Loop through rings
      for (int i = 0; i < sssr.length; i++) {
         //bonds will contain bonds of ring i
         int[] bonds = new int[0];
         for (int j = 0; j < sssr[i].length; j++) {
            for (int k = j+1; k < sssr[i].length; k++) {
               //if atom j and k (of ring i) are connected then add bond to bonds
               int bond = btab[sssr[i][j]][sssr[i][k]];
               if(bond!=-1) {
                  bonds = addInt(bonds, bond);
               }
            }
         }
         sssrb[i] = bonds;
      }
      return sssrb;
   }
   
   private int[] addInt(int[] arr, int i) {
      int[] temp = arr;
      int size = temp.length;
      arr = new int[size+1];
      System.arraycopy(temp, 0, arr, 0, size);
      arr[size] = i;
      return arr;
   }
}

Volfi
ChemAxon personnel
Joined: 07 Jun 2004
Posts: 996

View user's profile

Back to top
Link to postPosted: Thu Sep 18, 2008 9:39 amPost subject: Reply with quote

Hi,

We can create such function.
I'll write if it is ready.
(I guess for the next release - Marvin 5.1.2 - it is going to be ready.)
Volfi
ChemAxon personnel
Joined: 07 Jun 2004
Posts: 996

View user's profile

Back to top
Link to postPosted: Mon Sep 29, 2008 9:34 amPost subject: Reply with quote

Hi,

The function is ready:
Code:
public final int[][] getSSSREdges()


Andras
Lorenz

Joined: 21 Jun 2007
Posts: 40

View user's profile

Back to top
Link to postPosted: Mon Sep 29, 2008 10:05 amPost subject: Reply with quote

volfi wrote:
Hi,

The function is ready:
Code:
public final int[][] getSSSREdges()


Andras
thanks!
This topic is locked: you cannot edit posts or make replies.
Page 1 of 1


To watch this topic for replies   Register (enables digests) or give email address  
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum