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 are %d atoms, %d bonds, and %d cycles.\n"
,
acount
,
bcount
,
ccount
);