1program test
2
3  use FoX_wcml
4  implicit none
5
6  character(len=*), parameter :: filename = 'test.xml'
7  type(xmlf_t) :: xf
8
9  real, dimension(3,4) :: coords
10  character(len=2), dimension(4) :: elems
11
12  coords = reshape((/  0.0,    0.0, 0.0,   &
13                       0.0,  1.203, 0.0,   &
14                    -0.934, -0.579, 0.0,   &
15                     0.934, -0.579, 0.0/), &
16                   (/3,4/))
17
18  elems = (/"C ", "O ", "H ", "H "/)
19
20  call cmlBeginFile(xf, filename, unit=-1)
21  call cmlStartCml(xf)
22
23  call cmlAddMolecule(xf, coords=coords, elements=elems, title="Formaldehyde", &
24    atomIds=(/"c1", "o1", "h1", "h2"/), bondAtom1Refs=(/"c1", "c1", "c1", "c1"/), &
25    bondAtom2Refs=(/"o1", "h1", "h2", "c1"/), bondOrders=(/"D", "S", "S", "S"/))
26
27  call cmlFinishFile(xf)
28
29end program test
30