1* $Log: not supported by cvs2svn $
2* Revision 1.8  2008/01/16 22:27:03  marat
3* added nearly all input statements
4*
5* Revision 1.7  2008/01/16 06:09:58  marat
6* added parsing of short range parameters
7*
8* Revision 1.6  2008/01/15 18:48:23  marat
9* smd updates
10*
11* Revision 1.5  2008/01/12 00:44:40  marat
12* updates to smd
13*
14* Revision 1.4  2008/01/04 00:00:33  marat
15* Fixed uninitialised variables problem
16*
17* Revision 1.3  2008/01/03 18:52:09  marat
18* restoring original files for now
19*
20* Revision 1.1  2007/12/28 01:11:09  bylaska
21* ...EJB
22*
23* Revision 1.3  2007/12/27 23:22:54  bylaska
24* ...EJB
25*
26* Revision 1.25  2007/11/17 22:45:48  bylaska
27* ...EJB
28
29      logical function task_smd(rtdb)
30      implicit none
31      integer rtdb
32
33#include "inp.fh"
34#include "mafdecls.fh"
35#include "rtdb.fh"
36
37      include 'p_input.inc'
38      include 'p_array.inc'
39
40      integer iseed,istep
41      integer ntype,nprnt,nstep,nequl
42      integer ncons,ntcons,consatm
43      integer nbond,ntbond,bondatm
44      integer nshel,ntshel,shelatm
45
46      real*8 ekin,ecoul,eshrt,ebond,eshel,ewald1
47      real*8 tstep,ivv,etime1,etime2
48
49      logical lveloc,lupdate
50
51      dimension ivv(mxatms,3)
52      dimension consatm(mxcons,2),bondatm(mxbond,2),shelatm(mxshel,2)
53      character*80 infile,outfile
54
55      write(*,*) "Hello from task_smd"
56
57      call smd_init(rtdb)
58      call smd_end(rtdb)
59      goto 500
60      if (.not.rtdb_cget(rtdb,'smd:inputfile',1,infile))
61     >   infile='INPUT'
62
63      if (.not.rtdb_cget(rtdb,'smd:outputfile',1,outfile))
64     >   outfile='OUTPUT'
65
66      write(*,*) "inputfile=",infile
67      write(*,*) "outputfile=",outfile
68
69      etime1=0.0
70      etime2=0.0
71      call cpu_time(etime1)
72
73      call util_flush(6)
74      open(unit=output,file=outfile)
75
76      write(*,*) "processng input file"
77      call util_flush(6)
78
79      call md_inpt(infile,
80     $    iseed,tstep,nstep,nequl,nprnt,ntype,ncons,consatm,
81     $    nbond,bondatm,nshel,shelatm,lveloc)
82
83      write(*,*) "finished processing input file"
84      call util_flush(6)
85      call util_flush(output)
86
87      call md_init(iseed,ntype,ncons,ntcons,consatm,nbond,ntbond,
88     $    bondatm,nshel,ntshel,shelatm,lveloc,ewald1)
89
90      write(*,*) "finished initialization"
91      call util_flush(6)
92      call util_flush(output)
93
94      call cpu_time(etime2)
95      write(output,'(/,a,f20.3)')'Set-up CPU time : ',(etime2-etime1)
96
97      do istep=1,nstep
98
99       call verlt_test(tstep,ivv,lupdate)
100
101       write(*,*) "finished verlt_test"
102       call util_flush(6)
103       call util_flush(output)
104
105       if(lupdate)call list_verlt()
106
107       call md_frce(ntype,ecoul,eshrt,ebond,ntbond,eshel,ntshel,ewald1)
108
109       write(*,*) "finished md_frce"
110       call util_flush(6)
111       call util_flush(output)
112
113       if(ntcons.eq.0)call inte_leapf(tstep,ekin)
114       if(ntcons.gt.0)call inte_shake(tstep,ntcons,ekin)
115
116       if(istep.le.nequl)call md_scle(ntshel)
117
118       call print_output(istep,nprnt,ekin,ecoul,eshrt,ebond,eshel)
119
120      enddo
121
122      call print_final()
123
124      call cpu_time(etime2)
125      write(output,'(/,a,f20.3)')'Total CPU time : ',(etime2-etime1)
126
127500   continue
128      write(*,*) "Goodbye from task_smd"
129      task_smd = .true.
130      return
131      END
132c $Id$
133