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"
34c
35      character*(*) namespace
36c
37      character*32 pname
38      character*80 tag
39      character*255 filename
40      integer na
41      integer i_ta,i_tt,i_tr,i_q,i_m
42      logical result
43c
44      pname = "smd_param_init"
45c
46c      write(*,*) "in "//pname
47c
48c
49c     get total number of atoms in parameter file
50c     -------------------------------------------
51      call smd_paramfile_natoms(na)
52      write(*,*) "number of atoms in parameter space",na
53      if(na.le.0)
54     >  call errquit(
55     >       pname//'no parameters fond',0, 0)
56
57c
58      call smd_namespace_create(namespace)
59c
60c     create parameter data structures
61c     ---------------------------
62      call smd_data_create(namespace,"param:atomname",16*na,MT_BYTE)
63      call smd_data_create(namespace,"param:typename",16*na,MT_BYTE)
64      call smd_data_create(namespace,"param:charge",na,MT_DBL)
65      call smd_data_create(namespace,"param:mass",na,MT_DBL)
66      call smd_data_create(namespace,"param:resname",16*na,MT_BYTE)
67
68c
69c     fill in names and coordinates from parameter file
70c     -------------------------------------------------
71      tag = "param:atomname"
72      call smd_data_get_index(namespace,tag,i_ta,result)
73      if(.not. result)
74     >  call errquit(
75     >       pname//'error getting index for '//tag,0, 0)
76
77      tag = "param:typename"
78      call smd_data_get_index(namespace,tag,i_tt,result)
79      if(.not. result)
80     >  call errquit(
81     >       pname//'error getting index for'//tag,0, 0)
82
83      tag = "param:resname"
84      call smd_data_get_index(namespace,tag,i_tr,result)
85      if(.not. result)
86     >  call errquit(
87     >       pname//'error getting index for'//tag,0, 0)
88
89      tag = "param:mass"
90      call smd_data_get_index(namespace,tag,i_m,result)
91      if(.not. result)
92     >  call errquit(
93     >       pname//'error getting index for'//tag,0, 0)
94
95      tag = "param:charge"
96      call smd_data_get_index(namespace,tag,i_q,result)
97      if(.not. result)
98     >  call errquit(
99     >       pname//'error getting index for'//tag,0, 0)
100
101
102      call smd_paramfile_read_atom(na,
103     +                         byte_mb(i_ta),
104     +                         byte_mb(i_tt),
105     +                         byte_mb(i_tr),
106     +                         dbl_mb(i_m),
107     +                         dbl_mb(i_q))
108
109      return
110      end
111
112      subroutine smd_param_ntot(namespace,ntot)
113      implicit none
114#include "errquit.fh"
115#include "inp.fh"
116#include "mafdecls.fh"
117#include "util.fh"
118#include "global.fh"
119c
120      character*(*) namespace
121      integer ntot
122c
123      character*72 tag
124      character*30 pname
125      logical result
126
127      pname = "smd_param_ntot"
128      tag = "param:charge"
129      call smd_data_get_size(namespace,tag,ntot,result)
130      if(.not. result)
131     >  call errquit(
132     >       pname//'error getting size for '//tag,0, 0)
133      ntot = ntot
134
135      return
136      end
137
138c $Id$
139