Skip to content

Parity information in 0 Dimension

If the atomic coordinates are zero then the molecule's spatial dimension is zero. The parity information is stored in the atom flag of the stereocenter.

Setting parity information in 0 Dimension (API)

The parity information of a single atom can be modified using the setParity(int i, int p)method of MoleculeGraphclass. For setting parities of all atoms in the molecule, the setParity (int[] p) method of MoleculeGraphclass can be used. It is important to mention that, this method is faster than setting parities with setParity(int i, int p)one by one.

Examples:
Setting parity of one atom

1
2
3
// setting the first atom parity to ODD 
boolean success = molecule.setParity(1, StereoConstants.PARITY_ODD); 
System.out.println("Setting parity to atom 1 was "+ ((!success) ? "not" : "") + " successful"); 

Setting parity for all atoms

int ODD =  StereoConstants.PARITY_ODD; 
int EVEN =  StereoConstants.PARITY_EVEN; 

// we have a molecule with 7 atoms 

int[] parities = new int[]{0, ODD, 0, 0, EVEN, 0, 0}; 
// setting parities 
boolean success = molecule.setParity(parities); 
System.out.println("Setting parities for the whole molecule was "+ 
    ((!success) ? "not" : "")+ " successful"); 

Getting parity information in 0 Dimension (API)

The parity information of a 0 dimensional molecule is stored in the atom flags . It can be retrieved with the getFlags() function of the MolAtom class or with the getParity(int i) method of the MoleculeGraph class.

Examples:
Using getFlags() method

1
2
3
4
MolAtom a = molecule.getAtom(1); 
int f = a.getFlags(); 
// mask flags 
int p = f & StereoConstants.PARITY_MASK;

Using getParity() method

int p = molecule.getParity(1);