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