Octopus
parser.F90
Go to the documentation of this file.
1!! Copyright (C) 2003-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
21module parser_oct_m
22 use global_oct_m
23 use iso_c_binding
24 use loct_oct_m
25 use mpi_oct_m
27 use unit_oct_m
28 use string_oct_m
30
31 implicit none
32
33 private
34 public :: &
35 block_t, &
37 parser_end, &
38 parse_init, &
39 parse_end, &
56
57 type :: block_t
58 private
59 integer, pointer :: p
60 end type block_t
61
63 character(len=27), parameter, public :: parser_varname_excluded_characters = '|!''"#$%&/\‍()=?{}+-*^.,;:<> '
64
65 interface parse_init
66 integer function oct_parse_init(file_out, mpiv_node) bind(c)
67 use iso_c_binding
68 implicit none
69 character(kind=c_char), intent(in) :: file_out(*)
70 integer, intent(in) :: mpiv_node
71 end function oct_parse_init
72 end interface parse_init
73
74 interface parse_input_file
75 integer function oct_parse_input(file_in, set_used) bind(c)
76 use iso_c_binding
77 implicit none
78 character(kind=c_char), intent(in) :: file_in(*)
79 integer, intent(in) :: set_used
80 end function oct_parse_input
81 end interface parse_input_file
82
83 interface parse_environment
84 subroutine oct_parse_environment(prefix) bind(c)
85 use iso_c_binding
86 implicit none
87 character(kind=c_char), intent(in) :: prefix(*)
88 end subroutine oct_parse_environment
89 end interface parse_environment
90
91 interface parse_end
92 subroutine oct_parse_end()
93 implicit none
94 end subroutine oct_parse_end
95 end interface parse_end
96
97 interface sym_output_table
98 subroutine oct_sym_output_table(only_unused, mpiv_node)
99 implicit none
100 integer, intent(in) :: only_unused
101 integer, intent(in) :: mpiv_node
102 end subroutine oct_sym_output_table
103 end interface sym_output_table
104
105 interface parse_isdef
106 integer pure function oct_parse_isdef(name) bind(c)
107 use iso_c_binding
108 implicit none
109 character(kind=c_char), intent(in) :: name(*)
110 end function oct_parse_isdef
111 end interface parse_isdef
112
113 interface
114 subroutine oct_parse_int(name, def, res) bind(c)
115 use iso_c_binding
116 use, intrinsic :: iso_fortran_env
117 implicit none
118 character(kind=c_char), intent(in) :: name(*)
119 integer(int64), intent(in) :: def
120 integer(int64), intent(out) :: res
121 end subroutine oct_parse_int
122
123 subroutine oct_parse_double(name, def, res) bind(c)
124 use iso_c_binding
125 use, intrinsic :: iso_fortran_env
126 implicit none
127 character(kind=c_char), intent(in) :: name(*)
128 real(real64), intent(in) :: def
129 real(real64), intent(out) :: res
130 end subroutine oct_parse_double
131
132 subroutine oct_parse_complex(name, def, res) bind(c)
133 use iso_c_binding
134 use, intrinsic :: iso_fortran_env
135 implicit none
136 character(kind=c_char), intent(in) :: name(*)
137 complex(real64), intent(in) :: def
138 complex(real64), intent(out) :: res
139 end subroutine oct_parse_complex
140
141 subroutine oct_parse_string(name, def, res, res_len) bind(c)
142 use iso_c_binding
143 implicit none
144 character(kind=c_char), intent(in) :: name(*), def(*)
145 character(kind=c_char), intent(inout) :: res(*)
146 integer(kind=c_size_t), intent(in) :: res_len ! Length of res
147 end subroutine oct_parse_string
148
149 integer function oct_parse_block(name, blk)
150 use iso_c_binding
151 import block_t
152 implicit none
153 character(kind=c_char), intent(in) :: name(*)
154 type(block_t), intent(out) :: blk
155 end function oct_parse_block
156 end interface
157
159 module procedure parse_integer
160 module procedure parse_integer8
161 module procedure parse_integer48
162 module procedure parse_integer84
163 module procedure parse_logical
164 module procedure parse_string
165 module procedure parse_cmplx
166 module procedure oct_parse_double_unit
167 end interface parse_variable
168
171 module procedure oct_parse_expression_vec1
172 end interface parse_expression
173
174 interface parse_block_end
175 subroutine oct_parse_block_end(blk)
176 import block_t
177 implicit none
178 type(block_t), intent(inout) :: blk
179 end subroutine oct_parse_block_end
180 end interface parse_block_end
181
182 interface parse_block_n
183 integer function oct_parse_block_n(blk)
184 import block_t
185 implicit none
186 type(block_t), intent(in) :: blk
187 end function oct_parse_block_n
188 end interface parse_block_n
189
190 interface parse_block_cols
191 integer function oct_parse_block_cols(blk, line)
192 import block_t
193 implicit none
194 type(block_t), intent(in) :: blk
195 integer, intent(in) :: line
196 end function oct_parse_block_cols
197 end interface parse_block_cols
198
199 interface parse_block_integer
200 subroutine oct_parse_block_int(blk, l, c, res)
201 import block_t
202 implicit none
203 type(block_t), intent(in) :: blk
204 integer, intent(in) :: l, c
205 integer, intent(out) :: res
206 end subroutine oct_parse_block_int
207
208 subroutine oct_parse_block_int8(blk, l, c, res)
209 use, intrinsic :: iso_fortran_env
210 import block_t
211 implicit none
212 type(block_t), intent(in) :: blk
213 integer, intent(in) :: l, c
214 integer(int64), intent(out) :: res
215 end subroutine oct_parse_block_int8
216 end interface parse_block_integer
217
219 subroutine oct_parse_block_double(blk, l, c, res)
220 use, intrinsic :: iso_fortran_env
221 import block_t
222 implicit none
223 type(block_t), intent(in) :: blk
224 integer, intent(in) :: l, c
225 real(real64), intent(out) :: res
226 end subroutine oct_parse_block_double
228 module procedure oct_parse_block_double_unit
229 end interface parse_block_float
230
231 interface parse_block_cmplx
232 subroutine oct_parse_block_complex(blk, l, c, res)
233 use, intrinsic :: iso_fortran_env
234 import block_t
235 implicit none
236 type(block_t), intent(in) :: blk
237 integer, intent(in) :: l, c
238 complex(real64), intent(out) :: res
239 end subroutine oct_parse_block_complex
240 end interface parse_block_cmplx
241
242contains
243
254 subroutine parser_initialize_symbol_table(log_file, dont_write)
255 character(len=*), optional, intent(in) :: log_file
256 logical, optional, intent(in) :: dont_write
257
258 integer :: ierr
259 logical :: file_exists
260 character(len=:), allocatable :: log_file_
261 character(len=MAX_PATH_LEN) :: variables
262 integer(c_int) :: dont_write_
263
264 if (present(log_file)) then
265 log_file_ = trim(log_file)
266 else
267 log_file_ = 'exec/parser.log'
268 end if
270 if (present(dont_write)) then
271 dont_write_ = merge(1_c_int, 0_c_int, dont_write)
272 else
273 dont_write_ = mpi_world%rank
274 end if
275
276 variables = trim(conf%share)//'/variables'
277 file_exists = .false.
278 inquire(file=variables, exist=file_exists)
279 if (.not. file_exists) then
280 write(stderr,'(a)') '*** Fatal Error (description follows)'
281 write(stderr,'(a)') 'Error initializing parser'
282 write(stderr,'(a)') 'Cannot open variables file: '//trim(conf%share)//'/variables'
283 call parse_fatal()
284 end if
286 ! If using default log file, make the directory
287 if (.not. present(log_file)) then
288 if (mpi_world%is_root()) call loct_mkdir('exec')
289 endif
290
291 ! Initialize the symbol table, and the log file
292 ! Note, it would make sense to expose `sym_init_table` as its own call
293 ierr = parse_init(string_f_to_c(log_file_), dont_write_)
294 if (ierr /= 0) then
295 write(stderr,'(a)') '*** Fatal Error (description follows)'
296 write(stderr,'(a)') 'Error initializing parser: cannot write to ' // log_file_
297 write(stderr,'(a)') 'Do you have write permissions in this directory?'
298 call parse_fatal()
299 end if
300
301 ! Parse option definitions, and use them to populate the symbol table keys
302 ierr = parse_input_file(string_f_to_c(variables), set_used = 1)
303 if (ierr /= 0) then
304 write(stderr,'(a)') '*** Fatal Error (description follows)'
305 write(stderr,'(a)') 'Error initializing parser'
306 write(stderr,'(a)') 'Cannot open variables file: '//trim(conf%share)//'/variables'
307 call parse_fatal()
308 end if
309
310 end subroutine parser_initialize_symbol_table
311
312
314 subroutine parser_init()
315
316 integer :: ierr
317 logical :: file_exists
318
320
321 file_exists = .false.
322 inquire(file='inp', exist=file_exists)
323 if (.not. file_exists) then
324 write(stderr,'(a)') '*** Fatal Error (description follows)'
325 write(stderr,'(a)') 'Error initializing parser'
326 write(stderr,'(a)') 'Cannot open input file!'
327 write(stderr,'(a)') 'Please provide an input file with name inp in the current workdir'
328 call parse_fatal()
329 end if
330
331 ierr = parse_input_file(string_f_to_c('inp'), set_used = 0)
332 if (ierr /= 0) then
333 write(stderr,'(a)') '*** Fatal Error (description follows)'
334 write(stderr,'(a)') 'Error initializing parser'
335 write(stderr,'(a)') 'Cannot open input file!'
336 write(stderr,'(a)') 'Please provide an input file with name inp in the current workdir'
337 call parse_fatal()
338 end if
339
340 ! parse OCT_ prefixed variables from environment
341 call parse_environment(string_f_to_c("OCT_"))
342
343 end subroutine parser_init
344
346 subroutine parser_end()
347 integer :: parser_log
348
349 ! Output the symbol table
350 call sym_output_table(only_unused = 1, mpiv_node = mpi_world%rank)
351 ! Free the symbol table and close global C file handle.
352 call parse_end()
353
354 ! Write the octopus version and git_commit hash to the parser.log.
355 ! This is done after parse_end(), to avoid conflicting with the existing open file handle
356 if(mpi_world%is_root()) then
357 open(newunit=parser_log, file='exec/parser.log', status='old', action='write', position='append')
358 write(parser_log, '(a)') '# Octopus version: '//trim(conf%version)
359 write(parser_log, '(a)') '# Octopus git_commit: '//trim(conf%git_commit)
360 close(parser_log)
361 end if
362
363 end subroutine parser_end
364
365 ! ---------------------------------------------------------
366
367 logical function parse_is_defined(namespace, name) result(isdef)
368 type(namespace_t), intent(in) :: namespace
369 character(len=*), intent(in) :: name
370
371 character(len=MAX_PATH_LEN) :: full_name
372
373 full_name = parse_get_full_name(namespace, name)
374 isdef = parse_isdef(string_f_to_c(full_name)) /= 0
375
376 end function parse_is_defined
377
378 ! ---------------------------------------------------------
379
380 integer function parse_input_string(file_contents, set_used)
381 character(len=*), intent(in) :: file_contents
382 integer, intent(in) :: set_used
383
384 interface
385 integer function oct_parse_input_string(file_contents, set_used) bind(c)
386 use iso_c_binding
387 implicit none
388 character(kind=c_char), intent(in) :: file_contents(*)
389 integer, intent(in) :: set_used
390 end function oct_parse_input_string
391 end interface
392
393 parse_input_string = oct_parse_input_string(string_f_to_c(file_contents), set_used)
394 end function parse_input_string
395
396 ! ---------------------------------------------------------
397
398 subroutine parse_integer(namespace, name, def, res)
399 type(namespace_t), intent(in) :: namespace
400 character(len=*), intent(in) :: name
401 integer, intent(in) :: def
402 integer, intent(out) :: res
403
404 integer(int64) :: res8
405 character(len=MAX_PATH_LEN) :: full_name
406
407 call parse_check_varinfo(name)
408
409 full_name = parse_get_full_name(namespace, name)
410 call oct_parse_int(string_f_to_c(full_name), int(def, int64), res8)
411
412 res = int(res8)
413
414 end subroutine parse_integer
415
416 ! ---------------------------------------------------------
417
418 subroutine parse_integer8(namespace, name, def, res)
419 type(namespace_t), intent(in) :: namespace
420 character(len=*), intent(in) :: name
421 integer(int64), intent(in) :: def
422 integer(int64), intent(out) :: res
423
424 call parse_check_varinfo(name)
425 call oct_parse_int(string_f_to_c(parse_get_full_name(namespace, name)), def, res)
426
427 end subroutine parse_integer8
428
429 ! ---------------------------------------------------------
430
431 subroutine parse_integer48(namespace, name, def, res)
432 type(namespace_t), intent(in) :: namespace
433 character(len=*), intent(in) :: name
434 integer, intent(in) :: def
435 integer(int64), intent(out) :: res
436
437 character(len=MAX_PATH_LEN) :: full_name
438
439
440 call parse_check_varinfo(name)
442 full_name = parse_get_full_name(namespace, name)
443 call oct_parse_int(string_f_to_c(full_name), int(def, int64), res)
444
445 end subroutine parse_integer48
446
447 ! ---------------------------------------------------------
448
449 subroutine parse_integer84(namespace, name, def, res)
450 type(namespace_t), intent(in) :: namespace
451 character(len=*), intent(in) :: name
452 integer(int64), intent(in) :: def
453 integer, intent(out) :: res
454
455 integer(int64) :: res8
456 character(len=MAX_PATH_LEN) :: full_name
457
458 call parse_check_varinfo(name)
459
460 full_name = parse_get_full_name(namespace, name)
461 call oct_parse_int(string_f_to_c(full_name), def, res8)
463 res = int(res8)
464
465 end subroutine parse_integer84
466
467 ! ---------------------------------------------------------
468
469 subroutine parse_string(namespace, name, def, res)
470 type(namespace_t), intent(in) :: namespace
471 character(len=*), intent(in) :: name
472 character(len=*), intent(in) :: def
473 character(len=*), intent(inout) :: res
474
475 integer(kind=c_size_t) :: res_len
476 character(len=MAX_PATH_LEN) :: full_name
477 character(kind=c_char) :: c_res(len(res)+1)
478
479 call parse_check_varinfo(name)
480
481 c_res = c_null_char
482 res_len = len(res)+1
483
484 full_name = parse_get_full_name(namespace, name)
485 call oct_parse_string(string_f_to_c(full_name), string_f_to_c(def), c_res, res_len)
486 call string_c_to_f(c_res, res)
487
488 end subroutine parse_string
489
490
491 subroutine parse_logical(namespace, name, def, res)
492 type(namespace_t), intent(in) :: namespace
493 character(len=*), intent(in) :: name
494 logical, intent(in) :: def
495 logical, intent(out) :: res
496
497 integer(int64) :: idef, ires
498 character(len=MAX_PATH_LEN) :: full_name
499
500 call parse_check_varinfo(name)
501
502 ! logical is a FORTRAN type, so we emulate the routine with integers
503 idef = 0
504 if (def) idef = 1
505
506 full_name = parse_get_full_name(namespace, name)
507 call oct_parse_int(string_f_to_c(full_name), idef, ires)
508 res = (ires /= 0)
509
510 end subroutine parse_logical
511
512 ! ---------------------------------------------------------
514 subroutine parse_cmplx(namespace, name, def, res)
515 type(namespace_t), intent(in) :: namespace
516 character(len=*), intent(in) :: name
517 complex(real64), intent(in) :: def
518 complex(real64), intent(out) :: res
519
520 call parse_check_varinfo(name)
521 call oct_parse_complex(string_f_to_c(parse_get_full_name(namespace, name)), def, res)
522
523 end subroutine parse_cmplx
524
525 ! ---------------------------------------------------------
527 integer function parse_block(namespace, name, blk, check_varinfo_)
528 type(namespace_t), intent(in) :: namespace
529 character(len=*), intent(in) :: name
530 type(block_t), intent(out) :: blk
531 logical, optional, intent(in) :: check_varinfo_
532
533 logical :: check_varinfo
534 character(len=MAX_PATH_LEN) :: full_name
535
536 check_varinfo = .true.
537 if (present(check_varinfo_)) check_varinfo = check_varinfo_
538
539 if (check_varinfo) then
540 call parse_check_varinfo(name)
541 end if
542
543 full_name = parse_get_full_name(namespace, name)
545 parse_block = oct_parse_block(string_f_to_c(full_name), blk)
546
547 end function parse_block
548
549 ! ---------------------------------------------------------
550
551 subroutine parse_block_logical(blk, l, c, res)
552 type(block_t), intent(in) :: blk
553 integer, intent(in) :: l, c
554 logical, intent(out) :: res
555
556 integer :: ires
557
558 call oct_parse_block_int(blk, l, c, ires)
559 res = (ires /= 0)
560
561 end subroutine parse_block_logical
562
563 ! ---------------------------------------------------------
565 subroutine oct_parse_double_unit(namespace, name, def, res, unit)
566 type(namespace_t), intent(in) :: namespace
567 character(len=*), intent(in) :: name
568 real(real64), intent(in) :: def
569 real(real64), intent(out) :: res
570 type(unit_t), optional, intent(in) :: unit
571
572 character(len=MAX_PATH_LEN) :: full_name
573
574 call parse_check_varinfo(name)
575
576 full_name = parse_get_full_name(namespace, name)
577
578 if (present(unit)) then
579 call oct_parse_double(string_f_to_c(full_name), units_from_atomic(unit, def), res)
580 res = units_to_atomic(unit, res)
581 else
582 call oct_parse_double(string_f_to_c(full_name), def, res)
583 end if
584
585 end subroutine oct_parse_double_unit
587 ! ---------------------------------------------------------
588
589 subroutine oct_parse_block_double_unit(blk, l, c, res, unit)
590 type(block_t), intent(in) :: blk
591 integer, intent(in) :: l, c
592 real(real64), intent(out) :: res
593 type(unit_t), intent(in) :: unit
594
595 call oct_parse_block_double(blk, l, c, res)
596 res = units_to_atomic(unit, res)
597
598 end subroutine oct_parse_block_double_unit
599
600 ! ---------------------------------------------------------
601 subroutine oct_parse_expression_vec0(re, im, ndim, x, r, t, pot)
602 real(real64), intent(out) :: re, im
603 integer, intent(in) :: ndim
604 real(real64), intent(in) :: x(:), r, t
605 character(len=*), intent(in) :: pot
606
607 call oct_parse_expression(re, im, ndim, x(1), r, t, pot)
608
610
611
612 ! ----------------------------------------------------------------------
617 subroutine parse_array(inp_string, x, arraychar)
618 character(len=*), intent(inout) :: inp_string
619 real(real64), intent(in) :: x(:, :)
620 character(len=1), intent(in) :: arraychar
621
622 integer :: i, m, n_atom, coord, string_length
623 character (LEN=100) :: v_string
624
625 string_length = len(inp_string)
626 do i = 1, string_length - 1
627 if (inp_string(i:i+1) == arraychar//"[") then
628 m = 0
629 if (inp_string(i+3:i+3) == ",") m = 1
630 if (inp_string(i+4:i+4) == ",") m = 2
631 if (m == 0) then
632 write(stderr, '(a)') "*** Fatal Error (description follows)"
633 write(stderr, '(a)') "Attempting to parse a string with array elements larger than 99"
634 call parse_fatal()
635 end if
636 read(inp_string(i+2:i+1+m),*) n_atom
637 read(inp_string(i+3+m:i+3+m),*) coord
638 write(v_string,*) x(n_atom, coord)
639 inp_string = inp_string(:i-1) // "(" // trim(v_string) // ")" // inp_string(i+5+m:)
640 end if
641 end do
642
643 end subroutine parse_array
644
645 ! ----------------------------------------------------------------------
647 subroutine parse_check_varinfo(varname)
648 character(len=*), intent(in) :: varname
649
650 if (.not. varinfo_exists(varname)) then
651 write(stderr,'(a)') "*** Fatal Internal Error (description follows)"
652 write(stderr,'(a)') 'Attempting to parse undocumented variable '//trim(varname)//'.'
653 call parse_fatal()
654 end if
655
656 end subroutine parse_check_varinfo
657
658 ! ----------------------------------------------------------------------
685 function parse_get_full_name(namespace, varname) result(name)
686 type(namespace_t), target, intent(in) :: namespace
687 character(len=*), intent(in) :: varname
688 character(len=:), allocatable :: name
689
690 logical :: found
691 integer :: is
692 type(namespace_t), pointer :: ancestor
693 character(len=MAX_NAMESPACE_LEN) :: ancestor_name, tmp
694
695 found = .false.
697 ! Loop over all ancestors, starting from the right-most
698 ancestor => namespace
699 do while (associated(ancestor) .and. .not. found)
700
701 ! Loop over all paths to this ancestor, starting from the most complete path
702 ancestor_name = ancestor%get()
703 is = -1
704 do while (len_trim(ancestor_name) > 0 .and. is /= 0 .and. .not. found)
705 ! Check if the current path is found in the input file
706 name = trim(ancestor_name) // "." // trim(varname)
707 found = parse_isdef(string_f_to_c(trim(name))) /= 0
708
709 ! Remove the left-most namespace ("is" will be zero if there is only one namespace left)
710 is = index(ancestor_name, ".")
711 tmp = ancestor_name(is+1:)
712 ancestor_name = tmp
713 end do
714 ancestor => ancestor%parent
715 end do
716
717 ! If no suitable namespace found, just return the variable name
718 if (.not. found) name = varname
719
720 end function parse_get_full_name
721
722 subroutine parse_block_string(blk, l, c, res, convert_to_c)
723 type(block_t), intent(in) :: blk
724 integer, intent(in) :: l, c
725 character(len=*), intent(inout) :: res
726 logical, optional,intent(in) :: convert_to_c
727
728 character(kind=c_char) :: c_res(len(res)+1)
729
730 interface oct_parse_block_string
731 subroutine oct_parse_block_string(blk, l, c, res)
732 use iso_c_binding
733 import block_t
734 implicit none
735 type(block_t), intent(in) :: blk
736 integer, intent(in) :: l, c
737 character(kind=c_char), intent(out) :: res(*)
738 end subroutine oct_parse_block_string
739 end interface oct_parse_block_string
740
741 c_res = c_null_char
742 call oct_parse_block_string(blk, l, c, c_res)
743 call string_c_to_f(c_res, res)
744
745 if(optional_default(convert_to_c, .false.)) then
746 call conv_to_c_string(res)
747 end if
748 end subroutine parse_block_string
749
750
751 ! ---------------------------------------------------------
762 ! ---------------------------------------------------------
763
764 subroutine oct_parse_expression(re, im, ndim, x, r, t, pot)
765 real(real64), intent(in) :: x, r, t
766 integer, intent(in) :: ndim
767 real(real64), intent(out) :: re, im
768 character(len=*), intent(in) :: pot
769
770 interface oct_parse_expression_low
771 subroutine oct_parse_expression_low(re, im, ndim, x, r, t, pot) bind(c, name='oct_parse_expression')
772 use iso_c_binding
773 use, intrinsic :: iso_fortran_env
774 implicit none
775 real(real64), intent(in) :: x, r, t
776 integer, intent(in) :: ndim
777 real(real64), intent(out) :: re, im
778 character(kind=c_char), intent(in) :: pot(*)
779 end subroutine oct_parse_expression_low
780 end interface oct_parse_expression_low
781
782 call oct_parse_expression_low(re, im, ndim, x, r, t, string_f_to_c(pot))
783 end subroutine oct_parse_expression
784
785 subroutine oct_parse_expression_vec1(re, im, c, x, string)
786 real(real64), intent(out) :: re, im
787 character(len=*), intent(in) :: c
788 real(real64), intent(in) :: x
789 character(len=*), intent(in) :: string
790
791 interface oct_parse_expression1
792 subroutine oct_parse_expression1(re, im, c, x, string) bind(c)
793 use iso_c_binding
794 use, intrinsic :: iso_fortran_env
795 implicit none
796 real(real64), intent(out) :: re, im
797 character(kind=c_char), intent(in) :: c(*)
798 real(real64), intent(in) :: x
799 character(kind=c_char), intent(in) :: string(*)
800 end subroutine oct_parse_expression1
801 end interface oct_parse_expression1
802
803 call oct_parse_expression1(re, im, string_f_to_c(c), x, string_f_to_c(string))
804
805 end subroutine oct_parse_expression_vec1
806
807
808
809 ! ----------------------------------------------------------------------
810 subroutine parse_fatal()
811
812 call mpi_world%abort()
813
814 end subroutine parse_fatal
815
816end module parser_oct_m
818!! Local Variables:
819!! mode: f90
820!! coding: utf-8
821!! End:
System information (time, memory, sysname)
Definition: loct.F90:117
character(len=:) function, allocatable, public parse_get_full_name(namespace, varname)
Given a namespace and a variable name, this function will iterate over all namespace ancestors contai...
Definition: parser.F90:781
logical function, public parse_is_defined(namespace, name)
Definition: parser.F90:463
subroutine parse_logical(namespace, name, def, res)
Definition: parser.F90:587
subroutine, public parser_initialize_symbol_table(log_file, dont_write)
Initialise the Octopus parser symbol table from file of keys.
Definition: parser.F90:350
subroutine parse_integer(namespace, name, def, res)
Definition: parser.F90:494
subroutine, public parse_block_string(blk, l, c, res, convert_to_c)
Definition: parser.F90:818
subroutine parse_fatal()
Definition: parser.F90:906
subroutine parse_integer48(namespace, name, def, res)
Definition: parser.F90:527
subroutine, public parser_init()
Initialise the Octopus parser.
Definition: parser.F90:410
subroutine, public parse_block_logical(blk, l, c, res)
Definition: parser.F90:647
subroutine oct_parse_expression(re, im, ndim, x, r, t, pot)
The public subroutine parse_expression accepts two possible interfaces, one which assumes that the va...
Definition: parser.F90:860
subroutine, public parser_end()
End the Octopus parser.
Definition: parser.F90:442
subroutine oct_parse_block_double_unit(blk, l, c, res, unit)
Definition: parser.F90:685
subroutine parse_integer84(namespace, name, def, res)
Definition: parser.F90:545
subroutine, public parse_array(inp_string, x, arraychar)
A very primitive way to "preprocess" a string that contains reference to the elements of a two-dimens...
Definition: parser.F90:713
integer function, public parse_input_string(file_contents, set_used)
Definition: parser.F90:476
subroutine parse_integer8(namespace, name, def, res)
Definition: parser.F90:514
subroutine oct_parse_double_unit(namespace, name, def, res, unit)
Definition: parser.F90:661
subroutine oct_parse_expression_vec1(re, im, c, x, string)
Definition: parser.F90:881
subroutine oct_parse_expression_vec0(re, im, ndim, x, r, t, pot)
Definition: parser.F90:697
subroutine parse_string(namespace, name, def, res)
Definition: parser.F90:565
subroutine parse_check_varinfo(varname)
Definition: parser.F90:743
subroutine parse_cmplx(namespace, name, def, res)
Definition: parser.F90:610
integer function, public parse_block(namespace, name, blk, check_varinfo_)
Definition: parser.F90:623
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
Definition: unit.F90:134
int true(void)