TABLE OF CONTENTS


ABINIT/linmin [ Functions ]

[ Top ] [ Functions ]

NAME

 linmin

FUNCTION

 minimizes a function along a gradient line:
 first bracket the minimum then perform the minimization

COPYRIGHT

 Copyright (C) 1998-2018 ABINIT group (DCA, XG, MT)
 This file is distributed under the terms of the
 GNU General Public License, see ~ABINIT/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributors, see ~ABINIT/Infos/contributors .

INPUTS

 dp_dum_vdp: function  to be minimized (return a dp from a vector of dp)
 vdp_dum_vdp: derivative of f

OUTPUT

 fmin: minimun value reached for dp_dum_vdp

SIDE EFFECTS

 grad: the gradient line along which the minimization is performed (not changed)
 v: the starting and then ending point of the minimization

PARENTS

      cgpr

CHILDREN

      bracketing

SOURCE

36 #if defined HAVE_CONFIG_H
37 #include "config.h"
38 #endif
39 
40 #include "abi_common.h"
41 
42 
43 subroutine linmin(nv1,nv2,dp_dum_v2dp,v2dp_dum_v2dp,sub_dum_dp_v2dp_v2dp,v,grad,fmin)
44 
45  use defs_basis
46  use m_profiling_abi
47 
48 !This section has been created automatically by the script Abilint (TD).
49 !Do not modify the following lines by hand.
50 #undef ABI_FUNC
51 #define ABI_FUNC 'linmin'
52  use interfaces_62_cg_noabirule, except_this_one => linmin
53 !End of the abilint section
54 
55  implicit none
56 
57 !Arguments ------------------------------------
58  include "dummy_functions.inc"
59 !scalars
60  integer,intent(in) :: nv1,nv2
61  real(dp),intent(out) :: fmin
62 !arrays
63  real(dp),intent(inout) :: grad(nv1,nv2),v(nv1,nv2)
64 
65 !Local variables-------------------------------
66 !scalars
67  real(dp),parameter :: maglimit=10000.0_dp,tol=tol8*tol8*tol8
68  real(dp) :: a,b,fa,fb,fx,x,xmin
69 !no_abirules
70 
71 !************************************************************************
72  a=zero
73  x=ninth*real(1e-4,dp)
74  call bracketing (nv1,nv2,dp_dum_v2dp,v,grad,a,x,b,fa,fx,fb)
75 !DEBUG
76 !write(std_out,*) 'linmin (01cg) : linmin after bracketing'
77 !write(std_out,*) 'linmin (01cg) : point',a,x,b,'value',fa,fx,fb
78 !ENDDEBUG
79  fmin =brent(nv1,nv2,dp_dum_v2dp,v2dp_dum_v2dp,sub_dum_dp_v2dp_v2dp,6,v,grad,a,x,b,tol,xmin)
80 
81  end subroutine linmin