program volgrad2 c c second scheme: subtractions from the working volume c c calculate volume steps for changing from 0% B to 100% B c with a working volume of X in Y steps c volgrad X Y c e.g. "volgrad 200 10 >file" will print steps for changing to 100% B c in 10 steps with a working volume of 200 (ul or whatever) c c integer n_arg, iargc integer nsteps, step, tempi, i real workvol, remvol, tempvol, conc, prev_conc character*80 line c data workvol, nsteps, volume / 100.0, 10, 0.0 / c c c look for command line arguments n_arg = iargc() if (n_arg .NE. 0) then c recover volume call getarg(1, line) read(line, *, end=666, err=666) tempvol workvol = tempvol if (n_arg .gt. 1) then c recover # steps call getarg(2, line) read(line, *, end=666, err=666) tempi nsteps = tempi endif endif if (nsteps .lt. 0 .or. volume .lt. 0.0) then write(6,*) ' volume= ', workvol, ' number of steps= ', nsteps stop ' VOLGRAD> bad input' endif c write out header write(6,'(A)') ' Switching from 0% B to 100% B' write(6,101) workvol, nsteps 101 format(' with a working volume of ',F6.1,' in ',I4,' steps') write(6,*) ' subtraction scheme' write(6,*) write(6,*) ' Starting volume:', workvol conc = 0.0 prev_conc = 0.0 rem_vol = 0.0 do i = 1, nsteps write(6,*) write(6,*) ' STEP ', i prev_conc = conc conc = ( real(i) / real(nsteps) ) * 100 remvol = ( workvol* (conc - prev_conc) ) / ( 100.0 - prev_conc ) write(6,*) ' remove ', remvol write(6,102) conc 102 format( ' new target concentration: ',F5.1,'%') write(6,*) ' add ', remvol, ' of 100% B' end do !nsteps goto 669 666 continue stop 'VOLGRAD> bad command line argument' c 669 continue c successful completion, terminate end