dt_Handle molecule, atom;
  dt_Integer acount, bcount, ccount;

  /* allocate a molecule */
  molecule = dt_alloc_mol();
  /* add an oxygen atom */
  dt_mod_on(molecule);
  atom = dt_addatom(molecule, 8, 2);
  dt_mod_off(molecule);
  /* water has been created */

  /* count atoms, bonds, and cycles */
  acount = dt_count(molecule, TYP_ATOM);
  bcount = dt_count(molecule, TYP_BOND);
  ccount = dt_count(molecule, TYP_CYCLE);
  printf("There is %d atom, %d bonds, and %d cycles.\n",
         acount, bcount, ccount);

  /* The atom refers to the molecule as its parent. */
  if (dt_parent(atom) == molecule)
    printf("The parent of atom is the molecule.\n");
  /* Deallocation of the atom changes
    the molecules' atom count to 0. */

 
dt_mod_on(molecule);
 
dt_dealloc(atom);
 
dt_mod_off(molecule);
 
acount = dt_count(molecule, TYP_ATOM);
 
printf("There are %d atoms.\n", acount);

There is 1 atom, 0 bonds, and 0 cycles.
The parent of atom is the molecule.
There are 0 atoms.