Page 362 - Handbook Of Multiphase Flow Assurance
P. 362

Computer code (Makogon, 1994, 1997)              361

            termin(ttyin);                      {send input/output to tty terminal}
            termout(ttyout);
            writeln(ttyout,'Program starting');
            reset(f, 'NAME=ring.dat');
            rewrite(f2, 'NAME=ring.hst');
            write(ttyout, 'Enter the number of timesteps ? ');
            readln(ntime);
            write(ttyout, 'Enter the number of equilibration timesteps ? ');
            readln(nequil);

            read(f,i,j);
            if (i<>1234)or(j<>5678) then writeln(ttyout,'Error at start of ring.dat');
            for itime:=1 to ntime do
            begin
            writeln(ttyout,'Timestep ',itime);
            n:=0;                               {read in H bond data from a file}
            ntot:=0;                            {number of rings found}
            found:=False;
            while not eof(f) do
              begin
              read(f,i,j);
              if (i=1234)and(j=5678) then goto 3;
              n:=n+1;
              nhb[n,1]:=i;
              nhb[n,2]:=j;
              end;
            3:
            writeln(ttyout,n,' bonds read');
            if itime<=nequil then n:=0;           {if in equilibration discard bonds}

            for i:=1 to ngrand do               {Find bonds which went through PBC}
              pass[i]:=0;                       {reset pass array}
            for i:=1 to n do
              if (nhb[i,1]<0)or(nhb[i,2]<0)then {if pass flag is present in data}

                begin
                if nhb[i,1]<0 then
                  pass[i]:=1;
                if nhb[i,2]<0 then
                  begin
                  pass[i]:=2;
                  if nhb[i,1]<0 then
                   pass[i]:=3;
                  end;
                nhb[i,1]:=abs(nhb[i,1]);
   357   358   359   360   361   362   363   364   365   366   367