1      subroutine smd_param_init()
2      implicit none
3#include "errquit.fh"
4#include "inp.fh"
5#include "mafdecls.fh"
6#include "util.fh"
7#include "global.fh"
8#include "smd_data.fh"
9#include "stdio.fh"
10#include "msgids.fh"
11c
12      character*32 pname
13      character*80 tag
14      character*255 filename
15      integer na
16      integer i_ta,i_tt,i_tr,i_q,i_m
17      logical result
18      integer db, master
19c
20c
21      master = 0
22      pname = "smd_param_init"
23#ifdef SMD_DEBUG
24       write(*,*) "in "//pname
25#endif
26
27c
28      call smd_srtdb_get_handle(db)
29c
30c     get total number of atoms in parameter file
31c     -------------------------------------------
32      call smd_paramfile_natoms(na)
33#ifdef SMD_DEBUG
34      write(*,*) "number of atoms in parameter space",na
35#endif
36      if(na.le.0)
37     >  call errquit(
38     >       pname//'no parameters fond',0, 0)
39c
40c     create parameter data structures
41c     ---------------------------
42      tag = "param:atomname"
43      if(.not.smd_data_create_get(db,tag,16*na,MT_BYTE,i_ta)) then
44        call smd_message_flush(luout)
45        call errquit(" ",0,0)
46      end if
47      tag = "param:typename"
48      if(.not.smd_data_create_get(db,tag,16*na,MT_BYTE,i_tt)) then
49        call smd_message_flush(luout)
50        call errquit(" ",0,0)
51      end if
52      tag = "param:charge"
53      if(.not.smd_data_create_get(db,tag,na,MT_DBL,i_q)) then
54        call smd_message_flush(luout)
55        call errquit(" ",0,0)
56      end if
57      tag = "param:mass"
58      if(.not.smd_data_create_get(db,tag,na,MT_DBL,i_m)) then
59        call smd_message_flush(luout)
60        call errquit(" ",0,0)
61      end if
62      tag = "param:resname"
63      if(.not.smd_data_create_get(db,tag,16*na,MT_BYTE,i_tr)) then
64        call smd_message_flush(luout)
65        call errquit(" ",0,0)
66      end if
67
68      return
69      if(ga_nodeid().eq.master) then
70      call smd_paramfile_read_atom(na,
71     +                         byte_mb(i_ta),
72     +                         byte_mb(i_tt),
73     +                         byte_mb(i_tr),
74     +                         dbl_mb(i_m),
75     +                         dbl_mb(i_q))
76
77      end if
78
79      call ga_brdcst(msg_smd,byte_mb(i_ta),
80     >      16*na,master)
81      call ga_brdcst(msg_smd,byte_mb(i_tt),
82     >      16*na,master)
83      call ga_brdcst(msg_smd,byte_mb(i_tr),
84     >      16*na,master)
85      call ga_brdcst(msg_smd,dbl_mb(i_m),
86     >      na*ma_sizeof(mt_dbl,1,mt_byte),master)
87      call ga_brdcst(msg_smd,dbl_mb(i_q),
88     >      na*ma_sizeof(mt_dbl,1,mt_byte),master)
89
90      call ga_sync()
91
92#ifdef SMD_DEBUG
93       write(*,*) "out "//pname
94#endif
95
96      return
97      end
98
99c      subroutine smd_param_ntot(namespace,ntot)
100c      implicit none
101c#include "errquit.fh"
102c#include "inp.fh"
103c#include "mafdecls.fh"
104c#include "util.fh"
105c#include "global.fh"
106cc
107c      character*(*) namespace
108c      integer ntot
109cc
110c      character*72 tag
111c      character*30 pname
112c      logical result
113c
114c      pname = "smd_param_ntot"
115c      tag = "param:charge"
116c      call smd_data_get_size(namespace,tag,ntot,result)
117c      if(.not. result)
118c     >  call errquit(
119c     >       pname//'error getting size for '//tag,0, 0)
120c      ntot = ntot
121c
122c      return
123c      end
124c
125c $Id$
126