1 logical function pre_frgsiz(lfn,fil,lfnout, 2 + natm,nbnd,nzmat,nparms,ipardef) 3c 4c $Id$ 5c 6c function to read dimensions from a frg file 7c 8c in : lfn = frg file logical file number 9c fil = frg file name 10c lfnout = output file logical file number 11c 12c out : natm = number of atoms 13c nbnd = number of bonds 14c 15 implicit none 16c 17#include "util.fh" 18c 19 integer lfn,lfnout,natm,nbnd,nzmat 20 character*255 fil 21c 22 character*80 card 23 integer i,icon(16),length 24c 25 integer nparms,ipardef 26c 27 natm=0 28 nbnd=0 29 nzmat=0 30c 31 length=index(fil,' ')-1 32c 33 if(util_print('where',print_debug)) then 34 write(lfnout,2000) fil(1:length) 35 2000 format(/,'pre_frgsiz ',a) 36 endif 37c 38 open(unit=lfn,file=fil(1:length),form='formatted', 39 + status='old',err=9999) 40c 41 if(util_print('where',print_debug)) then 42 write(lfnout,2001) fil(1:length) 43 2001 format('FRG OPEN ',a) 44 endif 45c 46 1 continue 47c 48 read(lfn,1000,end=9999,err=9999) card 49 1000 format(a) 50c 51 if(card(1:1).eq.'#'.or.card(1:1).eq.'$') goto 1 52c 53 read(card,1001) natm,nparms,ipardef,nzmat 54 1001 format(4i5) 55c 56 do 2 i=1,nparms*(natm+1) 57 read(lfn,1000,end=9999,err=9999) card 58 2 continue 59c 60 3 continue 61 read(lfn,1002,end=9,err=9999) icon 62 1002 format(16i5) 63c 64 if(icon(1).ne.0) then 65 do 4 i=2,16 66 if(icon(i).ne.0) nbnd=nbnd+1 67 4 continue 68 goto 3 69 endif 70c 71 read(lfn,1000,end=9,err=9999) card 72 if(card(1:8).eq.'z-matrix') then 73 5 continue 74 read(lfn,1003) i 75 1003 format(i5) 76 if(i.gt.0) then 77 nzmat=nzmat+1 78 goto 5 79 endif 80 endif 81c 82 9 continue 83c 84 close(lfn) 85c 86 if(util_print('where',print_debug)) then 87 write(lfnout,2002) natm,nbnd,fil(1:length) 88 2002 format(i20,' atoms',/,i20,' bonds',//, 89 + 'FRG CLOSE ',a) 90 endif 91c 92 pre_frgsiz=.true. 93 return 94c 95 9999 continue 96c 97 if(util_print('where',print_none)) then 98 write(lfnout,2003) fil(1:length) 99 2003 format('FRG ERROR ',a) 100 endif 101c 102 pre_frgsiz=.false. 103 return 104 end 105