forked from TinkerTools/tinker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbonds.f
66 lines (66 loc) · 1.92 KB
/
bonds.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
c
c
c ###################################################
c ## COPYRIGHT (C) 1990 by Jay William Ponder ##
c ## All Rights Reserved ##
c ###################################################
c
c #############################################################
c ## ##
c ## subroutine bonds -- locate and store covalent bonds ##
c ## ##
c #############################################################
c
c
c "bonds" finds the total number of covalent bonds and
c stores the atom numbers of the atoms defining each bond
c
c
subroutine bonds
use atmlst
use atoms
use bndstr
use couple
use iounit
implicit none
integer i,j,k,m
integer maxbnd
c
c
c perform dynamic allocation of some global arrays
c
maxbnd = 4 * n
if (allocated(ibnd)) deallocate (ibnd)
if (allocated(bndlist)) deallocate (bndlist)
allocate (ibnd(2,maxbnd))
allocate (bndlist(maxval,n))
c
c loop over all atoms, storing the atoms in each bond
c
nbond = 0
do i = 1, n
do j = 1, n12(i)
k = i12(j,i)
if (i .lt. k) then
nbond = nbond + 1
if (nbond .gt. maxbnd) then
write (iout,10)
10 format (/,' BONDS -- Too many Bonds; Increase',
& ' MAXBND')
call fatal
end if
ibnd(1,nbond) = i
ibnd(2,nbond) = k
bndlist(j,i) = nbond
do m = 1, n12(k)
if (i .eq. i12(m,k)) then
bndlist(m,k) = nbond
goto 20
end if
end do
20 continue
end if
end do
end do
return
end