1
subroutine smd_coords_init_system()
10
character*32 sp_coords,sp_atom
11
character*32 tag,pname
14
pname = "smd_coords_init_system"
17
call smd_system_get_component(sp_atom,tag,result)
20
> pname//'no component '//tag,0,0)
23
call smd_system_get_component(sp_coords,tag,result)
26
> pname//'no component '//tag,0,0)
28
call smd_coords_init(sp_coords)
30
call smd_coords_read(sp_coords)
35
subroutine smd_coords_init(sp_coords)
39
#include "mafdecls.fh"
44
character*(*) sp_coords
49
pname = "smd_coords_init"
51
c write(*,*) "in "//pname
53
c get total number of atoms
54
c -------------------------
55
call smd_atom_ntot(na)
58
> pname//'no atoms ',0, RTDB_ERR)
60
c create coords data structures
61
c ---------------------------
62
call smd_namespace_create(sp_coords)
63
call smd_data_create(sp_coords,"coords",3*na,MT_DBL)
68
subroutine smd_coords_read(sp_coords)
72
#include "mafdecls.fh"
77
character*(*) sp_coords
86
pname = "smd_coords_read"
88
c write(*,*) "in "//pname
90
c fill in coordinates from pdb file if any
91
c ----------------------------------------
93
call smd_get_ind_size(tag,i_c,na,result)
96
> pname//'error getting index for '//tag,0, RTDB_ERR)
101
call smd_coordfile_read_coords(na,
108
subroutine smd_coords_rebox()
110
#include "errquit.fh"
112
#include "mafdecls.fh"
117
character*32 sp_coords
122
integer i_c,i_lrc,i_lc
125
pname = "smd_coords_rebox"
128
c get atomic coordinates
129
c ----------------------
131
call smd_get_ind_size(tag,i_c,na,result)
134
> pname//'error getting index for '//tag,0, RTDB_ERR)
137
call smd_lat_rebox(na,
143
subroutine smd_coords_print(un)
145
#include "errquit.fh"
147
#include "mafdecls.fh"
153
character*32 sp_coords
158
integer i_c,i_lrc,i_lc
161
pname = "smd_coords_print"
164
c get atomic coordinates
165
c ----------------------
167
call smd_get_ind(tag,i_c,na,result)
170
> pname//'error getting index for '//tag,0, RTDB_ERR)
173
write(un,*) "printing coord"
174
call smd_util_print_force_array(un,na,
180
subroutine smd_coords_update()
182
#include "errquit.fh"
184
#include "mafdecls.fh"
187
#include "smd_system.fh"
188
#include "smd_const_data.fh"
191
character*72 sp_coords
193
character*72 sp_force
194
character*72 sp_shakelist
202
double precision ekin, tstep
204
integer i_is1,i_is2,i_ds,ns
208
integer h_nrij,i_nrij
209
integer h_orij,i_orij
211
pname = "smd_coords_update"
213
c write(*,*) "in "//pname
215
call smd_rtdb_get_handle(rtdb)
220
call smd_get_ind_size(tag,i_v,na,result)
223
> pname//'error getting index for'//tag,0, 0)
230
call smd_get_ind(tag,i_m,result)
233
> pname//'error getting index for'//tag,0, 0)
238
call smd_get_ind(tag,i_f,result)
241
> pname//'error getting index for'//tag,0, 0)
247
call smd_get_ind(tag,i_c,result)
250
> pname//'error getting index for'//tag,0, 0)
256
if (.not.rtdb_get(rtdb,tag,mt_dbl,1,tstep))
257
> call errquit(pname//'failed to store'//tag,0,
261
oshake = smd_system_shake()
266
call smd_get_ind(tag,i_is1,result)
269
> pname//'error getting index for '//tag,0, 0)
272
call smd_get_ind(tag,i_is2,result)
275
> pname//'error getting index for '//tag,0, 0)
277
tag = "shake:distance"
278
call smd_get_ind_size(tag,i_ds,ns,result)
281
> pname//'error getting index for '//tag,0, 0)
283
if(.not.ma_push_get(mt_dbl,na*3,'i_ncc',h_ncc,i_ncc))
284
+ call errquit(pname//'Failed to allocate memory',
287
if(.not.ma_push_get(mt_dbl,na*3,'i_nvv',h_nvv,i_nvv))
288
+ call errquit(pname//'Failed to allocate memory',
291
if(.not.ma_push_get(mt_dbl,na*3,'i_dcc',h_dcc,i_dcc))
292
+ call errquit(pname//'Failed to allocate memory',
295
if(.not.ma_push_get(mt_dbl,ns*3,'i_nrij',h_nrij,i_nrij))
296
+ call errquit(pname//'Failed to allocate memory',
299
if(.not.ma_push_get(mt_dbl,ns*3,'i_orij',h_orij,i_orij))
300
+ call errquit(pname//'Failed to allocate memory',
305
call smd_leapf_shake(na,
334
call smd_energy_set_component("kinetic",ekin/convfct2)
335
call smd_coords_rebox()
340
if(.not.ma_pop_stack(h_orij))
341
& call errquit(pname//'Failed to deallocate stack h_orij',0,
344
if(.not.ma_pop_stack(h_nrij))
345
& call errquit(pname//'Failed to deallocate stack h_nrij',0,
348
if(.not.ma_pop_stack(h_dcc))
349
& call errquit(pname//'Failed to deallocate stack h_dcc',0,
352
if(.not.ma_pop_stack(h_nvv))
353
& call errquit(pname//'Failed to deallocate stack h_nvv',0,
357
if(.not.ma_pop_stack(h_ncc))
358
& call errquit(pname//'Failed to deallocate stack h_ncc',0,
366
subroutine smd_coords_print_pdb(fname)
368
#include "errquit.fh"
370
#include "mafdecls.fh"
374
#include "smd_const_data.fh"
378
character*32 sp_coords
384
integer i_c,i_ta,i_tr,i_ir
387
pname = "smd_coords_print"
389
if(.not.util_get_io_unit(un))
390
> call errquit("cannot get file number",0,0)
391
open(unit=un,status="unknown",form="formatted",file=fname)
393
c get atomic coordinates
394
c ----------------------
396
call smd_get_ind_size(tag,i_c,na,result)
399
> pname//'error getting index for '//tag,0, RTDB_ERR)
403
call smd_get_ind(tag,i_ta,result)
406
> pname//'error getting index for '//tag,0, RTDB_ERR)
409
call smd_get_ind(tag,i_ir,result)
412
> pname//'error getting index for '//tag,0, RTDB_ERR)
415
call smd_get_ind(tag,i_tr,result)
418
> pname//'error getting index for '//tag,0, RTDB_ERR)
422
i0=smd_string_size*(i-1)
425
> (byte_mb(i_ta+i0+j-1),j=1,4),
426
> (byte_mb(i_tr+i0+j-1),j=1,3),
429
> dbl_mb(i_c+(i-1)+na),
430
> dbl_mb(i_c+(i-1)+2*na)
434
9000 FORMAT("ATOM",T7,I5,T13,4A,T18,3A,T23,
435
> I4,T31,F8.3,T39,F8.3,T47,F8.3)
440
subroutine smd_coords_print_pdb1(fname,c)
442
#include "errquit.fh"
444
#include "mafdecls.fh"
448
#include "smd_const_data.fh"
450
double precision c(*)
453
character*32 sp_coords
459
integer i_c,i_ta,i_tr,i_ir
462
pname = "smd_coords_print"
464
if(.not.util_get_io_unit(un))
465
> call errquit("cannot get file number",0,0)
466
open(unit=un,status="unknown",form="formatted",file=fname)
468
c get atomic coordinates
469
c ----------------------
471
call smd_get_ind_size(tag,i_c,na,result)
474
> pname//'error getting index for '//tag,0, RTDB_ERR)
478
call smd_get_ind(tag,i_ta,result)
481
> pname//'error getting index for '//tag,0, RTDB_ERR)
484
call smd_get_ind(tag,i_ir,result)
487
> pname//'error getting index for '//tag,0, RTDB_ERR)
490
call smd_get_ind(tag,i_tr,result)
493
> pname//'error getting index for '//tag,0, RTDB_ERR)
497
i0=smd_string_size*(i-1)
500
> (byte_mb(i_ta+i0+j-1),j=1,4),
501
> (byte_mb(i_tr+i0+j-1),j=1,3),
509
9000 FORMAT("ATOM",T7,I5,T13,4A,T18,3A,T23,
510
> I4,T31,F8.3,T39,F8.3,T47,F8.3)