TABLE OF CONTENTS


ABINIT/m_ga [ Modules ]

[ Top ] [ Modules ]

NAME

  m_ga

FUNCTION

  This module provides several routines and datatypes for the
  Genetic algorithm stochastic search implementation.

COPYRIGHT

 Copyright (C) 2012-2024 ABINIT group (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 .

SOURCE

17 #if defined HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include "abi_common.h"
22 
23 MODULE m_ga
24 
25  use defs_basis
26  use m_errors
27  use m_abicore
28  use m_dtset
29 
30  implicit none
31 
32  private
33 
34 !public procedures
35  public :: ga_init
36  public :: ga_destroy
37  public :: ga_nullify

m_ga/ga_destroy [ Functions ]

[ Top ] [ m_ga ] [ Functions ]

NAME

  ga_destroy

FUNCTION

  Destroy the content of a datastructure of type ga_type.

INPUTS

OUTPUT

SIDE EFFECTS

  ga_param=datastructure of type ga_type.
            parameters for Genetic algorithm search.

SOURCE

126 subroutine ga_destroy(ga_param)
127 
128 !Arguments ------------------------------------
129 !scalars
130  type(ga_type),intent(inout) :: ga_param
131 
132 !************************************************************************
133 
134  if(allocated(ga_param%ga_iatfix))then
135    ABI_FREE(ga_param%ga_iatfix)
136  endif
137  call ga_nullify(ga_param)
138 
139 end subroutine ga_destroy

m_ga/ga_init [ Functions ]

[ Top ] [ m_ga ] [ Functions ]

NAME

  ga_init

FUNCTION

  Initialize a datastructure of type ga_type.

INPUTS

  dtset <type(dataset_type)>=all input variables in current dataset

OUTPUT

SIDE EFFECTS

  ga_param=datastructure of type ga_type.
            several parameters for Genetic Algorithm random search.

SOURCE

 85 subroutine ga_init(dtset,ga_param)
 86 
 87 !Arguments ------------------------------------
 88 !scalars
 89  type(dataset_type),target,intent(in) :: dtset
 90  type(ga_type),intent(inout) :: ga_param
 91 
 92 !************************************************************************
 93 
 94  if(dtset%imgmov==4)then
 95    ga_param%ga_n_rules           = dtset%ga_n_rules
 96    ga_param%ga_rules(:)          = dtset%ga_rules
 97    ga_param%ga_fitness           = dtset%ga_fitness
 98    ga_param%ga_opt_percent       = dtset%ga_opt_percent
 99    ga_param%ga_algor             = dtset%ga_algor
100    ABI_MALLOC(ga_param%ga_iatfix,(3,dtset%natom))
101    ga_param%ga_iatfix            = dtset%iatfix
102  end if
103 
104 end subroutine ga_init

m_ga/ga_nullify [ Functions ]

[ Top ] [ m_ga ] [ Functions ]

NAME

  ga_nullify

FUNCTION

  Nullify the content of a datastructure of type ga_type.

INPUTS

OUTPUT

SIDE EFFECTS

  ga_param=datastructure of type ga_type.
            several parameters for Genetic algorithm search.

SOURCE

161 subroutine ga_nullify(ga_param)
162 
163 !Arguments ------------------------------------
164 !scalars
165  type(ga_type),intent(inout) :: ga_param
166 
167 !************************************************************************
168 
169  ga_param%ga_start  = -1
170  ga_param%ga_n_rules   = -1
171 ! ga_param%ga_algor     = -1
172  ga_param%ga_opt_percent  = zero
173  ga_param%ga_rules(:) = -1
174 
175 end subroutine ga_nullify

m_ga/ga_type [ Types ]

[ Top ] [ m_ga ] [ Types ]

NAME

 ga_type

FUNCTION

 Datatype with the variables required to perform GA random search

NOTES

SOURCE

51  type,public :: ga_type
52 ! Scalars
53   integer  :: ga_start     ! Starting iteration for the Genetic algorithm
54   integer  :: ga_n_rules   ! Number of genetic rules chosen by the user
55   integer  :: ga_fitness   ! Fitness function chosen by the user
56   integer  :: ga_algor     ! Genetic algorithm
57   real(dp) :: ga_opt_percent   ! Percentage of the population that passes from one iteration to the next
58 ! Arrays same dimension as defined for the whole data input data structure
59   integer  :: ga_rules(30)         ! Genetic rules chosen by the user
60   integer,allocatable  :: ga_iatfix(:,:)  ! defined fixed atoms and directions
61  end type ga_type