Page 375 - Handbook Of Multiphase Flow Assurance
P. 375

374                          10.  Research methods in flow assurance

                 C
                 C-------------------------------------------------------------------
                 C
                      SUBROUTINE READMSI
                      implicit real*8 (a-h,o-z)
                      character*80 cc
                      character*20 f1,f2,f3
                      character*1 aaa
                      character*12 fname2
                      character*8 fname
                      COMMON /fname / fname
                      COMMON /raw  / irawbond(1000,2),irawatom(1000)
                      COMMON /types / iatomtype(1000,2),nbondfound,natom,ngroups,ncall
                      COMMON /atoms / atomdata(1000,4),atomdata2(1000,4)

                      print *,'Enter the name of the .MSI file without extension:'
                      read(*,'(A8)')fname
                      print *,'input was', fname
                      fname2 = fname(1:index(fname,' ')-1)//'.msi'
                      open(unit=1,file=fname2,status='unknown')
                      open(unit=2,file='atoms.dat',status='unknown')
                      open(unit=3,file='bonds.dat',status='unknown')

                      nbondfound=0
                      natom=0
                 C     read a line
                  10   read (1,'(80A)')cc
                 C     check for end of file attribute: ) in position 1
                      if(cc(1:1).eq.')') goto 100
                 C     scan the line for Bond statements
                      nfound=0
                      do i=80,1,-1
                      ncc=i
                      if(cc(i:i).ne.' ') goto 11
                      end do
                  11   if(ncc.gt.4) then
                      if(cc(ncc-3:ncc).eq.'Bond')then
                        nbondfound=nbondfound+1
                  12       read (1,'(80A)')cc
                 C             check for end of file attribute: ) in position 1
                            if(cc(1:1).eq.')') goto 100
                          do i3=1,77
                          if(cc(i3:i3+3).ne.'Atom') goto 15
                          n1=index(cc,'Atom') +6
                          n2=index(cc,')') -1
                          nn=0
   370   371   372   373   374   375   376   377   378   379   380