1!! gen1int: compute one-electron integrals using rotational London atomic-orbitals 2!! Copyright 2009-2012 Bin Gao, and Andreas Thorvaldsen 3!! 4!! gen1int is free software: you can redistribute it and/or modify 5!! it under the terms of the GNU Lesser General Public License as published by 6!! the Free Software Foundation, either version 3 of the License, or 7!! (at your option) any later version. 8!! 9!! gen1int is distributed in the hope that it will be useful, 10!! but WITHOUT ANY WARRANTY; without even the implied warranty of 11!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12!! GNU Lesser General Public License for more details. 13!! 14!! You should have received a copy of the GNU Lesser General Public License 15!! along with gen1int. If not, see <http://www.gnu.org/licenses/>. 16!! 17!! This subroutine checks the difference of two real numbers. 18!! 19!! 2012-02-07, Bin Gao 20!! * first version 21 22 !> \brief checks the difference of two real numbers 23 !> \author Bin Gao 24 !> \date 2012-02-07 25 !> \param ref_value is the referenced number 26 !> \param chk_value is the number to check 27 !> \return different indicates if these two numbers are different 28 subroutine check_difference(ref_value, chk_value, different) 29 use xkind 30 implicit none 31 real(REALK), intent(in) :: ref_value 32 real(REALK), intent(in) :: chk_value 33 logical, intent(out) :: different 34!nearly negligible number relative to 1 35#include "zero_thrsh.h" 36! threshold of error 37#include "err_thrsh.h" 38 real(REALK) ratio_value !ratio between referenced and checked numbers 39 ! referenced number ~ 0.0 40 if (abs(ref_value)<ZERO_THRSH) then 41 ! checked number ~ 0.0 42 if (abs(chk_value)<ZERO_THRSH) then 43 different = .false. 44 else 45 ratio_value = ref_value/chk_value 46 different = ratio_value<RATIO_THRSH(1) .or. ratio_value>RATIO_THRSH(2) 47 end if 48 else 49 ratio_value = chk_value/ref_value 50 different = ratio_value<RATIO_THRSH(1) .or. ratio_value>RATIO_THRSH(2) 51 end if 52 return 53 end subroutine check_difference 54