1*
2* $Id$
3*
4      subroutine util_set_rtdb_state(rtdb,os,oc,or)
5      implicit none
6#include "errquit.fh"
7*
8* sets the rtdb state
9*
10c:: includes
11#include "stdio.fh"
12#include "mafdecls.fh"
13#include "rtdb.fh"
14c:: passed
15      integer rtdb ! [input] rtdb handle
16      logical os   ! [input] T -> nwchem had start    directive
17      logical oc   ! [input] T -> nwchem had continue directive
18      logical or   ! [input] T -> nwchem had restart  directive
19c:: local
20      integer iset
21      integer ncond
22      parameter (ncond = 3)
23      logical ostate(ncond)
24c
25c sanity checking
26c
27      iset = 0
28      if (os) iset = iset + 1
29      if (oc) iset = iset + 1
30      if (or) iset = iset + 1
31      if (iset.ne.1) then
32        write(luout,*)' os[tart]    = ',os
33        write(luout,*)' oc[ontinue] = ',oc
34        write(luout,*)' or[estart]  = ',or
35        call errquit(' util_set_rtdb_state: fatal error',911, RTDB_ERR)
36      endif
37      ostate(1) = os
38      ostate(2) = oc
39      ostate(3) = or
40      if(.not.
41     &    rtdb_put(rtdb,'rtdb:stored:state',mt_log,ncond,ostate)) then
42        call errquit(' util_set_rtdb_state: rtdb_put failed',911,
43     &       RTDB_ERR)
44      endif
45      end
46      subroutine util_get_rtdb_state(rtdb,os,oc,or)
47      implicit none
48#include "errquit.fh"
49*
50* gets the rtdb state
51*
52c:: includes
53#include "stdio.fh"
54#include "mafdecls.fh"
55#include "rtdb.fh"
56c:: passed
57      integer rtdb ! [input] rtdb handle
58      logical os   ! [output] T -> nwchem had start    directive
59      logical oc   ! [output] T -> nwchem had continue directive
60      logical or   ! [output] T -> nwchem had restart  directive
61c:: local
62      integer iget
63      integer ncond
64      parameter (ncond = 3)
65      logical ostate(ncond)
66c
67      if(.not.
68     &    rtdb_get(rtdb,'rtdb:stored:state',mt_log,ncond,ostate)) then
69        call errquit(' util_get_rtdb_state: rtdb_put failed',911,
70     &       RTDB_ERR)
71      endif
72c
73      os = ostate(1)
74      oc = ostate(2)
75      or = ostate(3)
76c
77c sanity checking
78c
79      iget = 0
80      if (os) iget = iget + 1
81      if (oc) iget = iget + 1
82      if (or) iget = iget + 1
83      if (iget.ne.1) then
84        write(luout,*)' os[tart]    = ',os
85        write(luout,*)' oc[ontinue] = ',oc
86        write(luout,*)' or[estart]  = ',or
87        call errquit(' util_get_rtdb_state: fatal error',911, RTDB_ERR)
88      endif
89      end
90