PROGRESS  master
prg_graphsp2parser_mod.F90
Go to the documentation of this file.
1 
13 
16  use bml
17 
18  implicit none
19 
20  private
21 
22  integer, parameter :: dp = kind(1.0d0)
23 
26  type, public :: gsp2data_type
27  character(20) :: jobname
28  character(50) :: hamfile
29  integer :: verbose
30  integer :: minsp2iter
31  integer :: maxsp2iter
32  integer :: nodesperpart
33  integer :: natoms
34  integer :: partition_count
35 
39  integer :: nx, ny, nz
40 
41  real(dp) :: sp2tol
42  real(dp) :: threshold
43  real(dp) :: bndfil
44  real(dp) :: gthreshold
45  real(dp) :: errlimit
46  integer :: mdim
47  integer :: ndim
48  character :: sdim(3)
49  real(dp) :: pdim(3)
50  character(20) :: bml_type
51  character(10) :: sp2conv
52  character(10) :: graph_element
53  character(10) :: partition_type
54  character(10) :: partition_refinement
55  logical :: double_jump
56  real(dp) :: covgfact !Factor for tuning the extension of the covalency
57  real(dp) :: nlgcut !Radius cutoff for the hmiltonian (distance) based graph
58  integer :: parteach !Do the partition each PartEach mdsteps
59  real(dp) :: alpha ! exponential decay length for small subgraphs
60  logical :: small_subgraphs
61  end type gsp2data_type
62 
63  public :: prg_parse_gsp2
64 
65 contains
66 
69  subroutine prg_parse_gsp2(gsp2data,filename)
70 
71  implicit none
72  type(gsp2data_type), intent(inout) :: gsp2data
73  integer, parameter :: nkey_char = 7, nkey_int = 11, nkey_re = 8, nkey_log = 3
74  character(len=*) :: filename
75 
76  !Library of keywords with the respective defaults.
77  character(len=50), parameter :: keyvector_char(nkey_char) = [character(len=100) :: &
78  'JobName=', 'BMLType=','SP2Conv=', 'HamFile=', 'GraphElement=', &
79  'PartitionType=', 'PartitionRefinement=']
80  character(len=100) :: valvector_char(nkey_char) = [character(len=100) :: &
81  'MyJob', 'Dense','REL', 'text.mtx', 'Atom', 'Block', 'None']
82 
83  character(len=50), parameter :: keyvector_int(nkey_int) = [character(len=50) :: &
84  'Mdim=', 'MinSP2Iter=', 'MaxSP2Iter=','Ndim=', 'NodesPerPart=', 'NAtoms=', &
85  'PartitionCount=', 'PartEach=', 'PartitionCountX=','PartitionCountY=',&
86  &'PartitionCountZ=']
87  integer :: valvector_int(nkey_int) = (/ &
88  -1, 10, 100, 1, 16, 1, 1,1,0,0,0 /)
89 
90  character(len=50), parameter :: keyvector_re(nkey_re) = [character(len=50) :: &
91  'MatrixThreshold=','SP2Tol=','BndFil=', 'GraphThreshold=', 'ErrLimit=', 'CovGraphFact=', 'NLGraphCut=', &
92  'Alpha=']
93  real(dp) :: valvector_re(nkey_re) = (/&
94  0.00001, 0.00000001, 0.0, 0.00000000001, 0.0, 2.5, 2.5, 1.0 /)
95 
96  character(len=50), parameter :: keyvector_log(nkey_log) = [character(len=100) :: &
97  'DoubleJump=', 'Log2=', 'SmallSubgraphs=']
98  logical :: valvector_log(nkey_log) = (/&
99  .true., .false., .false./)
100 
101  !Start and stop characters
102  character(len=50), parameter :: startstop(2) = [character(len=50) :: &
103  'GSP2{', '}']
104 
105  call prg_parsing_kernel(keyvector_char,valvector_char&
106  ,keyvector_int,valvector_int,keyvector_re,valvector_re,&
107  keyvector_log,valvector_log,trim(filename),startstop)
108 
109  !Characters
110  gsp2data%JobName = valvector_char(1)
111 
112  if(valvector_char(2) == "Dense")then
113  gsp2data%bml_type = bml_matrix_dense
114  elseif(valvector_char(2) == "Ellpack")then
115  gsp2data%bml_type = bml_matrix_ellpack
116  elseif(valvector_char(2) == "Ellblock")then
117  gsp2data%bml_type = bml_matrix_ellblock
118  endif
119  gsp2data%sp2conv = valvector_char(3)
120  gsp2data%hamfile = valvector_char(4)
121  gsp2data%graph_element = valvector_char(5)
122 
123  gsp2data%partition_type = valvector_char(6)
124  gsp2data%partition_refinement = valvector_char(7)
125 
126  !Reals
127  gsp2data%threshold = valvector_re(1)
128  gsp2data%sp2tol = valvector_re(2)
129  gsp2data%bndFil = valvector_re(3)
130  gsp2data%gthreshold = valvector_re(4)
131  gsp2data%errlimit = valvector_re(5)
132  gsp2data%covgfact = valvector_re(6)
133  gsp2data%nlgcut = valvector_re(7)
134  gsp2data%alpha = valvector_re(8)
135 
136  !Logicals
137  gsp2data%double_jump = valvector_log(1)
138  gsp2data%small_subgraphs = valvector_log(3)
139 
140  !Integers
141  gsp2data%mdim = valvector_int(1)
142  gsp2data%minsp2iter = valvector_int(2)
143  gsp2data%maxsp2iter = valvector_int(3)
144  gsp2data%ndim = valvector_int(4)
145  gsp2data%nodesPerPart = valvector_int(5)
146  gsp2data%natoms = valvector_int(6)
147  gsp2data%partition_count= valvector_int(7)
148  gsp2data%parteach= valvector_int(8)
149  gsp2data%nx = valvector_int(9)
150  gsp2data%ny = valvector_int(10)
151  gsp2data%nz = valvector_int(11)
152 
153  end subroutine prg_parse_gsp2
154 
155 end module prg_graphsp2parser_mod
Graph partitioning SP2 parser.
subroutine, public prg_parse_gsp2(gsp2data, filename)
The parser for SP2 solver.
Some general parsing functions.
subroutine, public prg_parsing_kernel(keyvector_char, valvector_char, keyvector_int, valvector_int, keyvector_re, valvector_re, keyvector_log, valvector_log, filename, startstop)
The general parsing function. It is used to vectorize a set of "keywords" "value" pairs as included i...
Module to handle input output files for the PROGRESS lib.