       module newmodc

       implicit none

       contains
     
       subroutine newmodel(r)

      real,intent(out):: r(57)
      integer ::  icd,k,ivar
      real :: res1(21)
      
      open(5,file='test_res1.dat',status='old')
      open(103,file='res1.dat',status='old')
      read(103,*) res1
        k=0
       do
       read(5,*,end=100) icd,r(icd),ivar
         if(ivar == 1) then
        k=k+1
        if(k > 21) stop "too many values to change"
        r(icd)=res1(k)
        endif
        end do

100     continue
       end subroutine

       end module