Toolkit Tutorial: Programming
dt_Handle
container2
,
container3
,
container4
;
dt_Handle
reaction
,
atom
;
dt_Integer
slen
,
tmap
;
dt_String
str
;
int
i
,
j
,
k
;
container2
=
dt_transform
(
transform
,
container
,
DX_FORWARD
,
0
);
i
=
0
;
while
(
NULL_OB
!=
(
reaction
=
dt_next
(
container2
)))
{
i
++
;
str
=
dt_arbsmiles
(
&
slen
,
reaction
,
0
);
printf
(
"Transformation reaction %d is %.*s.\n"
,
i
,
slen
,
str
);
str
=
dt_arbsmiles
(
&
slen
,
reaction
,
1
);
printf
(
"Transformation mappings %d is %.*s.\n"
,
i
,
slen
,
str
);
j
=
0
;
container3
=
dt_stream
(
reaction
,
TYP_MOLECULE
);
while
(
NULL_OB
!=
(
molecule
=
dt_next
(
container3
)))
{
j
++
;
k
=
0
;
container4
=
dt_stream
(
molecule
,
TYP_ATOM
);
while
(
NULL_OB
!=
(
atom
=
dt_next
(
container4
)))
{
k
++
;
str
=
dt_symbol
(
&
slen
,
atom
);
tmap
=
dt_integer
(
atom
,
4
,
"tmap"
);
if
(
0
<
tmap
)
printf
(
"Molecule %d atom %.*s%d is map class number %d.\n"
,
j
,
slen
,
str
,
k
,
tmap
);
}
}
}
(
selected
output
)
Transformation
mappings
1
is
[
OH
:
1
][
H
:
10
].[
OH
:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
OH
:
7
]
>>
[
OH
-:
1
].[
OH
:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
OH
:
7
].[
H
+:
10
].
Transformation
reaction
1
is
O
.
Oc1ccc
(
cc1
)
O
>>
[
OH
-
].
Oc1ccc
(
cc1
)
O
.[
H
+
].
Molecule
1
atom
O1
is
map
class
number
1.
Molecule
1
atom
H10
is
map
class
number
2.
Molecule
2
atom
O1
is
map
class
number
1.
Molecule
2
atom
H10
is
map
class
number
2.
Transformation
mappings
2
is
[
OH
:
1
][
H
:
10
].[
OH
:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
OH
:
7
]
>>
[
OH
-:
1
].[
OH
:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
OH
:
7
].[
H
+:
10
].
Transformation
reaction
2
is
O
.
Oc1ccc
(
cc1
)
O
>>
[
OH
-
].
Oc1ccc
(
cc1
)
O
.[
H
+
].
Molecule
1
atom
O1
is
map
class
number
1.
Molecule
1
atom
H10
is
map
class
number
2.
Molecule
2
atom
O1
is
map
class
number
1.
Molecule
2
atom
H10
is
map
class
number
2.
Transformation
mappings
3
is
[
OH2
:
1
].[
O
:
2
]([
H
:
10
])[
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
OH
:
7
]
>>
[
OH2
:
1
].[
O
-:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
OH
:
7
].[
H
+:
10
].
Transformation
reaction
3
is
O
.
Oc1ccc
(
cc1
)
O
>>
O
.[
O
-
]
c1ccc
(
cc1
)
O
.[
H
+
].
Molecule
1
atom
O2
is
map
class
number
1.
Molecule
1
atom
H10
is
map
class
number
2.
Molecule
2
atom
O2
is
map
class
number
1.
Molecule
2
atom
H10
is
map
class
number
2.
Transformation
mappings
4
is
[
OH2
:
1
].[
OH
:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
O
:
7
][
H
:
10
]
>>
[
OH2
:
1
].[
OH
:
2
][
c
:
3
]
1
[
cH
:
9
][
cH
:
8
][
c
:
6
]([
cH
:
5
][
cH
:
4
]
1
)[
O
-:
7
].[
H
+:
10
].
Transformation
reaction
4
is
O
.
Oc1ccc
(
cc1
)
O
>>
O
.
Oc1ccc
(
cc1
)[
O
-
].[
H
+
].
Molecule
1
atom
O7
is
map
class
number
1.
Molecule
1
atom
H10
is
map
class
number
2.
Molecule
2
atom
O7
is
map
class
number
1.
Molecule
2
atom
H10
is
map
class
number
2.