Class SingleStructureRandomGenerator

java.lang.Object
org.openscience.cdk.structgen.SingleStructureRandomGenerator

public class SingleStructureRandomGenerator extends Object
Randomly generates a single, connected, correctly bonded structure for a given molecular formula. To see it working run the graphical test org.openscience.cdk.test.SingleStructureRandomGeneratorTest and add more structures to the panel using the "More" button. In order to use this class, use MFAnalyser to get an AtomContainer from a molecular formula string.

Assign hydrogen counts to each heavy atom. The hydrogens should not be in the atom pool but should be assigned implicitly to the heavy atoms in order to reduce computational cost. Assign this AtomContainer to the SingleStructureRandomGenerator and retrieve a randomly generated, but correctly bonded structure by using the generate() method. You can then repeatedly call the generate() method in order to retrieve further structures.

Agenda:

  • add a method for randomly adding hydrogens to the atoms
  • add a seed for random generator for reproducability
Author:
steinbeck
Source code:
main
Belongs to CDK module:
structgen
Created on:
2001-09-04
  • Constructor Details

    • SingleStructureRandomGenerator

      public SingleStructureRandomGenerator(long seed) throws Exception
      Constructor for the SingleStructureRandomGenerator object.
      Throws:
      Exception
    • SingleStructureRandomGenerator

      public SingleStructureRandomGenerator() throws Exception
      Constructor for the SingleStructureRandomGenerator object.
      Throws:
      Exception
  • Method Details

    • setAtomContainer

      public void setAtomContainer(IAtomContainer ac)
      Sets the AtomContainer attribute of the SingleStructureRandomGenerator object.
      Parameters:
      ac - The new AtomContainer value
    • generate

      public IAtomContainer generate() throws CDKException
      Generates a random structure based on the atoms in the given IAtomContainer.
      Throws:
      CDKException