dt_Handle molecule, container, atom1, atomX;
dt_String csmi, asmi, symbol;
dt_Integer clen, alen, number, slen, charge;
/* Read SMILES in. */
molecule = dt_smilin(10, "[OH-].[H+]");
/* Write canonical form. */
csmi = dt_cansmiles(&clen, molecule, 0);
/* Write abitrary form. */
asmi = dt_arbsmiles(&alen, molecule, 0);
printf("Canonical form is %.*s and arbitrary form is %.*s.\n",
clen, csmi, alen, asmi);
container = dt_stream(molecule, TYP_ATOM);
atom1 = dt_next(container);
number = dt_number(atom1);
symbol = dt_symbol(&slen, atom1);
charge = dt_charge(atom1);
printf("The atom number is %d, the symbol is \"%.*s\", "
"and the charge is %d.\n", number, slen, symbol, charge);
atomX = dt_next(container);
number = dt_number(atomX);
symbol = dt_symbol(&slen, atomX);
charge = dt_charge(atomX);
printf("The atom number is %d, the symbol is \"%.*s\", "
"and the charge is %d.\n", number, slen, symbol, charge);
atomX = dt_next(container);
if (NULL_OB == atomX)
printf("The NULL object is next.\n");
dt_reset(container);
atomX = dt_next(container);
if (atomX == atom1)
printf("Reset is like rewind.\n");
if (dt_parent(atomX) == molecule);
printf("You can access the molecule through the atom\n");
Canonical form is [H+].[OH-] and arbitrary form is [OH-].[H+].
The atom number is 8, the symbol is "O", and the charge is -1.
The atom number is 1, the symbol is "H", and the charge is 1.
The NULL object is next.
Reset is like rewind.
You can access the molecule through the atom.
|