1
subroutine smd_vlist_init_system()
10
character*32 sp_vlist,sp_exlist,sp_coords
11
character*32 tag,pname
15
pname = "smd_vlist_init_system"
18
call smd_system_get_component(sp_coords,tag,result)
21
> pname//'no component '//tag,0,0)
25
call smd_system_get_component(sp_exlist,tag,result)
26
if(.not.result) oexlist = .false.
29
call smd_system_get_component(sp_vlist,tag,result)
32
> pname//'no component '//tag,0,0)
35
call smd_vlist_init(oexlist,sp_vlist,sp_exlist,sp_coords)
40
subroutine smd_vlist_init(oexlist,sp_vlist,sp_exlist,sp_coord)
44
#include "mafdecls.fh"
49
character*(*) sp_vlist
50
character*(*) sp_exlist
51
character*(*) sp_coord
59
integer i_list,i_clist
68
pname = "smd_vlist_init"
70
c write(*,*) "in "//pname
72
c get coordinate information
73
c --------------------------
75
call smd_get_ind_dim(tag,i_c,np,result)
78
> pname//'error getting index for'//tag,0, RTDB_ERR)
81
c get excluded list information
82
c -----------------------------
84
tag = "exlist:pointer"
85
call smd_get_ind(tag,i_xp,result)
88
> pname//'error getting index for'//tag,0, RTDB_ERR)
90
call smd_get_ind(tag,i_xl,result)
93
> pname//'error getting index for'//tag,0, RTDB_ERR)
97
c gestimate the size of pair list
98
c ------------------------------
99
nl = min( 7*np*200, ma_inquire_avail(MT_INT))
102
c create pointer memory
103
c ---------------------
104
call smd_namespace_create(sp_vlist)
105
tag = "vlist:pointer"
106
call smd_data_create_get(sp_vlist,"vlist:pointer",np,MT_INT,i_p)
108
c create temporary scratch array for list since
109
c we do not know the size yet
110
c ---------------------------------------------
111
if(.not.ma_push_get(mt_int,nl,'tmp l',h_l,i_l))
112
+ call errquit(pname//'Failed to allocate memory for tmp l',
115
if(.not.ma_push_get(mt_dbl,3*nl,'tmp cl',h_cl,i_cl))
116
+ call errquit(pname//'Failed to allocate memory for tmp l',
119
if(.not.ma_push_get(mt_dbl,3*np,'tmp',h_ct,i_ct))
120
+ call errquit(pname//'Failed to allocate memory for tmp l',
124
call smd_cutoff_get_rcut_verlet(rc2)
128
call smd_vlist_set(np,
142
call smd_vlist_set1(np,
156
c nl now contains the actual size
157
c we will buffer it though to allow for possible expansion
158
c --------------------------------------------------------
161
call smd_data_create_get(sp_vlist,tag,nl+nlb,MT_INT,i_list)
163
tag = "vlist:distances"
164
call smd_data_create_get(sp_vlist,tag,3*(nl+nlb),MT_DBL,i_clist)
166
tag = "vlist:displacement"
167
call smd_data_create(sp_vlist,tag,3*np,MT_DBL)
170
dbl_mb(i_clist+i-1) = dbl_mb(i_cl+i-1)
173
if(.not.ma_pop_stack(h_ct))
174
& call errquit(pname//'Failed to deallocate stack h_l',nl,
178
if(.not.ma_pop_stack(h_cl))
179
& call errquit(pname//'Failed to deallocate stack h_l',nl,
183
if(.not.ma_pop_stack(h_l))
184
& call errquit(pname//'Failed to deallocate stack h_l',nl,
191
subroutine smd_vlist_update(olist,ocoord)
193
#include "errquit.fh"
195
#include "mafdecls.fh"
203
character*32 sp_vlist
204
character*32 sp_exlist
205
character*32 sp_coord
212
integer i_list,i_clist
221
pname = "smd_vlist_update"
223
c write(*,*) "in "//pname
225
if((.not.olist).and.(.not.ocoord)) return
230
call smd_system_get_component(sp_coord,tag,result)
233
> pname//'no component '//tag,0,0)
237
call smd_system_get_component(sp_exlist,tag,result)
238
if(.not.result) oexlist =.false.
241
call smd_system_get_component(sp_vlist,tag,result)
244
> pname//'no component '//tag,0,0)
248
call smd_vlist_update_coord(sp_vlist,sp_coord)
252
c get coordinate information
253
c --------------------------
255
call smd_get_ind_dim(tag,i_c,np,result)
258
> pname//'error getting index for'//tag,0, RTDB_ERR)
261
c get excluded list information
262
c -----------------------------
264
tag = "exlist:pointer"
265
call smd_get_ind(tag,i_xp,result)
268
> pname//'error getting index for'//tag,0, RTDB_ERR)
270
call smd_get_ind(tag,i_xl,result)
273
> pname//'error getting index for'//tag,0, RTDB_ERR)
277
c get verlet list information
278
c ---------------------------
279
tag = "vlist:pointer"
280
call smd_get_ind(tag,i_p,result)
283
> pname//'error getting index for'//tag,0, RTDB_ERR)
286
call smd_get_ind_dim(tag,i_list,nl,result)
289
> pname//'error getting index for'//tag,0, RTDB_ERR)
291
tag = "vlist:distances"
292
call smd_get_ind(tag,i_clist,result)
295
> pname//'error getting index for'//tag,0, RTDB_ERR)
297
c create temporary scratch array for list
298
c ---------------------------------------------
300
if(.not.ma_push_get(mt_dbl,3*np,'tmp',h_ct,i_ct))
301
+ call errquit(pname//'Failed to allocate memory for tmp l',
305
call smd_cutoff_get_rcut_verlet(rc2)
309
call smd_vlist_set(np,
323
call smd_vlist_set1(np,
336
if(.not.ma_pop_stack(h_ct))
337
& call errquit(pname//'Failed to deallocate stack h_l',nl,
345
subroutine smd_vlist_update_coord(sp_vlist,sp_coord)
347
#include "errquit.fh"
349
#include "mafdecls.fh"
354
character*(*) sp_vlist
355
character*(*) sp_coord
361
integer i_list,i_clist
365
pname = "smd_vlist_init"
367
c write(*,*) "in "//pname
369
c get coordinate information
370
c --------------------------
372
call smd_get_ind_dim(tag,i_c,np,result)
375
> pname//'error getting index for'//tag,0, RTDB_ERR)
378
c get list information
379
c --------------------
380
tag = "vlist:pointer"
381
call smd_get_ind(tag,i_p,result)
384
> pname//'error getting index for'//tag,0, RTDB_ERR)
387
call smd_get_ind(tag,i_list,result)
390
> pname//'error getting index for'//tag,0, RTDB_ERR)
393
tag = "vlist:distances"
394
call smd_get_ind_dim(tag,i_clist,nl,result)
397
> pname//'error getting index for'//tag,0, RTDB_ERR)
400
call smd_vlist_update_coord0(np,nl,
406
call smd_lat_rebox(nl,dbl_mb(i_clist))
411
subroutine smd_vlist_update_coord0(np,nl,c,point,
414
c update coordinates in verlet pair list
415
c point(i) is an index to list() array
416
c that contains all the pairs of atom i
417
c In other words all the atoms paired with atom i
418
c are contained in list(point(i)),...,list(point(i+1)-1)
419
c np [in] number of atoms (which is also size of pointer array)
422
c point [in] verlet pointer
423
c list [in] verlet list
424
c cl [out] list of vectors (ri-rj)
426
#include "errquit.fh"
428
double precision c(np,3)
431
double precision cl(nl,3)
435
integer jnab,jbeg,jend
439
pname = "smd_vlist_update_coord0"
454
> pname//'out of bounds',0, RTDB_ERR)
456
cl(nlist,1)=c(i,1)-c(j,1)
457
cl(nlist,2)=c(i,2)-c(j,2)
458
cl(nlist,3)=c(i,3)-c(j,3)
471
subroutine smd_vlist_set(np,nl,vcutsq,c,xp,xl,point,
474
c constructs verlet pairt list
475
c point(i) is an index to list() array
476
c that contains all the pairs of atom i
477
c In other words all the atoms paired with atom i
478
c are contained in list(point(i)),...,list(point(i+1)-1)
479
c np [in] number of atoms (which is also size of pointer array)
480
c nl [inout] size of verlet list
482
c xp [in] excluded pointer
483
c xl [in] excluded list
484
c point [out] verlet pointer
485
c list [out] verlet list
486
c cl [out] list of vectors (ri-rj)
487
c result [out] status of subroutine
489
#include "errquit.fh"
492
double precision vcutsq
493
double precision c(np,3)
498
double precision cl(nl,3)
499
double precision ct(np,3)
505
double precision rij(3),rijsq,cc(1,3)
509
pname = "smd_vlist_set"
517
if(xp(i).ne.xp(i+1))eatm=xp(i)
523
ct(k,1)=c(i,1)-c(j,1)
524
ct(k,2)=c(i,2)-c(j,2)
525
ct(k,3)=c(i,3)-c(j,3)
530
call smd_lat_rebox(np,ct)
537
if((xp(i).ne.xp(i+1)).and.(xl(eatm).eq.j))then
539
eatm=min(eatm+1,(xp(i+1)-1))
547
rijsq=rij(1)*rij(1)+rij(2)*rij(2)+rij(3)*rij(3)
550
if(rijsq.lt.vcutsq)then
583
subroutine smd_vlist_set1(np,nl,vcutsq,c,point,
586
c constructs verlet pairt list
587
c point(i) is an index to list() array
588
c that contains all the pairs of atom i
589
c In other words all the atoms paired with atom i
590
c are contained in list(point(i)),...,list(point(i+1)-1)
591
c np [in] number of atoms (which is also size of pointer array)
592
c nl [inout] size of verlet list
594
c xp [in] excluded pointer
595
c xl [in] excluded list
596
c point [out] verlet pointer
597
c list [out] verlet list
598
c cl [out] list of vectors (ri-rj)
599
c result [out] status of subroutine
601
#include "errquit.fh"
604
double precision vcutsq
605
double precision c(np,3)
608
double precision cl(nl,3)
609
double precision ct(np,3)
615
double precision rij(3),rijsq,cc(1,3)
619
pname = "smd_vlist_set"
632
ct(k,1)=c(i,1)-c(j,1)
633
ct(k,2)=c(i,2)-c(j,2)
634
ct(k,3)=c(i,3)-c(j,3)
639
call smd_lat_rebox(np,ct)
651
rijsq=rij(1)*rij(1)+rij(2)*rij(2)+rij(3)*rij(3)
654
if(rijsq.lt.vcutsq)then
685
SUBROUTINE smd_vlist_test(lupdate)
687
#include "smd_system.fh"
688
#include "mafdecls.fh"
689
#include "errquit.fh"
697
character*72 sp_vlist
701
double precision vcut,rcut
703
pname = "smd_vlist_test"
708
call smd_system_get_component(sp_vel,tag,result)
711
> pname//'no component '//tag,0,0)
714
call smd_get_ind_dim(tag,i_v,na,result)
717
> pname//'error getting index for'//tag,0, 0)
722
if(.not.smd_system_tstep(t))
724
> pname//'no time step ',0,0)
727
c get verlet displacement array
728
c -----------------------------
729
tag = "vlist:displacement"
730
call smd_get_ind(tag,i_vd,result)
733
> pname//'error getting index for'//tag,0, 0)
735
call smd_cutoff_get_rcut(rcut)
736
call smd_cutoff_get_rcut_verlet(vcut)
738
call smd_vlist_test0(na,t,rcut,vcut,
739
> dbl_mb(i_vd),dbl_mb(i_v),lupdate)
741
c write(*,*) "out",pname
746
SUBROUTINE smd_vlist_test0(natms,tstep,rcut,vcut,ivv,vvv,lupdate)
751
double precision rcut,vcut
752
double precision tstep
754
double precision ivv(natms,3)
755
double precision vvv(natms,3)
759
double precision tstepsq
760
double precision dispmax,dispxsq,dispysq,dispzsq,disprsq
787
dispmax=((vcut-rcut)/2.0)**2
791
ivv(i,1)=ivv(i,1)+vvv(i,1)
792
ivv(i,2)=ivv(i,2)+vvv(i,2)
793
ivv(i,3)=ivv(i,3)+vvv(i,3)
804
disprsq=tstepsq*(dispxsq+dispysq+dispzsq)
805
if(disprsq.gt.dispmax) then
807
write(*,*) "verlet update disp",disprsq,dispmax
809
if(exceed.ge.2)lupdate=.true.