S-groups

Superatom S-group

Building of Superatom S-group

We show how to build Superatom S-groups in the example of the phenil group.
superatom sgroup

Creating of SuperatomSgroup object

First, the whole molecule should be built using the Core API methods, or imported. In this example, we import it from SMILES format. Then the SuperatomSgroup is constructed with the molecule in the argument of the its constructor.

        Molecule mol = MolImporter.importMol("C1=CC=CC=C1C");
        Cleaner.clean(mol, 2, null);

        // Create the Sgroups.
        SuperatomSgroup superSg = new SuperatomSgroup(mol);

Setting an S-group as the parent of its atoms

The atoms that are supposed to be a part of an S-group should be added to it (that is, set the S-group as the parent of the MolAtom). In our example, we add the carbon atoms of the benzene ring to the S-group, they are the first six atoms of the molecule.

        for (int i = 0; i < 6; i++) {
            mol.setSgroupParent(mol.getAtom(i), superSg, true);
        }
In the argument of the Molecule.setSgroupParent() method, MolAtom represents the atom to be added to the Superatom S-group superSg. If the boolean is true, the atom will be added to the S-group, otherwise it will be removed from there.

Set subscript of the S-group

In order to set subscript of a Superatom S-group, use the SuperatomSgroup.setSubscript(String) method:

       superSg.setSubscript("Ph"); 

Set attach atoms

One way to set S-group attachment point information on a given MolAtom object is the
	MolAtom.setAttach(int a);       
method. The integer int a defines the type of the attachment point:

Calculate the attachment points

Attachments points are put to atoms in the S-group that have bond which other end atom is outside the group. That kind of bond is called crossing bond. Currently only two attachment points are possible on each Superatom S-group:

The method SuperatomSgroup.calculateAttachmentPoints(); calculates the attachment points for the atoms having crossing bonds.

	superSg.calculateAttachmentPoints();

Expanded, contracted state

There are two states of the molecule: Note:
When Molecule.isGUIContracted() returns true and afterwards you call:
Molecule.setGUIContracted(false);
Molecule.setGUIContracted(true);
the second setGUIContracted call will restore the state before the first setGUIContracted call!

Repeating unit S-groups

Repeating unit S-groups are used to represent polymers and other repeating units.

In order to construct a repeating unit S-group object, use its constructor as

	RepeatingUnitSgroup repeatingSg = new RepeatingUnitSgroup(Molecule mol,
		String connectivity, int type); 

The parameter Molecule object will be the parent of the S-group repeatingSg. The String connectivity defines way the units connects to each other: "ht", for head-to-tail; "hh", for head-to-head, and "eu" for either/undefined polymers. The type of the S-group can be defined using the following constants:

Atoms and bonds can be added to a repeating unit S-group in a same way as to a Superatom S-group.

The bracket of this type of S-groups defines the repeating fragment of the polymer. Bonds that cross the brackets, called crossing bonds, define how the repeating units of the S-group connect.

The generateBracketCoord method of the CleanUtil class generates brackets. As parameter the S-group and the bracket type, square or round, should be added:

	CleanUtil.generateBracketCoords(repeatingSg, MBracket.T_SQUARE);

The end groups of polymers are often unknown or unspecified which are represented by star atoms (*). Star atoms are defined with the

	repeatingSg.addStarAtoms();	
method.

Full example of building of polystyrene can be found at the Code examples.

 

 

 

 

R-group structures

Table of contents

Representation of reactions

Previous chapter

 

Next chapter