00001 subroutine error_adjust_parameter(niq,pot,pot_bak,error,flag)
00002 use phys_constant, only : long
00003 use grid_parameter, only : eps
00004 implicit none
00005 real(long), intent(in) :: pot(niq), pot_bak(niq)
00006 real(long), intent(out) :: error
00007 integer, intent(out) :: flag
00008 real(long) :: error_pot = 0.0d0, small = 1.0d-14
00009 integer :: niq, ii
00010
00011 error = 0.0d0
00012 flag = 0
00013 do ii = 1, niq
00014 error_pot = 2.0d0*dabs(pot(ii) - pot_bak(ii)) &
00015 & /(dabs(pot(ii))+dabs(pot_bak(ii)) + small)
00016 if (error_pot > eps) flag = 1
00017 error = dmax1(error,error_pot)
00018 end do
00019 end subroutine error_adjust_parameter