66 integer,
parameter :: max_lines = 20
67 character(len=256),
dimension(max_lines),
public :: message
68 character(len=68),
parameter,
public :: hyphens = &
69 '--------------------------------------------------------------------'
70 character(len=69),
parameter,
public :: shyphens =
'*'//hyphens
72 character(len=512),
private :: msg
74 character(len=64),
private :: oct_status =
'undefined'
76 type(sihash_t),
private :: namespace_unit
77 type(sphash_t),
private :: namespace_mpi_grp
78 character(len=256),
private :: msg_dir =
'exec'
110 integer :: experimentals
111 integer :: current_line
117 integer,
intent(in) :: signum
118 character(len=*),
intent(out) :: signame
131 character(len=*),
intent(in),
optional :: output_dir
133 logical :: trap_signals
135 if (
present(output_dir))
then
136 msg_dir = trim(output_dir)
185 type(sihash_iterator_t) :: it
190 if (experimentals > 0 .or. warnings > 0)
then
196 if (warnings > 0)
then
199 if (warnings > 1)
then
207 if (experimentals > 0)
then
211 if (experimentals > 1)
then
218 call messages_write(
' Since you used one or more experimental features, results are likely')
220 call messages_write(
' wrong and should not be considered as valid scientific data. Check')
223 call messages_write(
' https://www.octopus-code.org/documentation/main/variables/execution/debug/experimentalfeatures')
226 call messages_write(
' or contact the octopus developers for details.')
231 open(unit =
iunit_out, file = trim(msg_dir) //
'/messages', action =
'write')
232 write(
iunit_out,
'(a, i9)')
"warnings = ", warnings
233 write(
iunit_out,
'(a, i9)')
"experimental = ", experimentals
238 call it%start(namespace_unit)
239 do while(it%has_next())
241 if (iu /= stderr .and. iu /= stdout)
call io_close(iu)
251 type(
namespace_t),
optional,
intent(in) :: namespace
255 if (
present(namespace))
then
257 if (namespace%get()==
"")
then
262 iunit =
sihash_lookup( namespace_unit, namespace%get(), found)
264 if (.not. found)
then
266 iunit =
io_open(
"log", namespace=namespace, action=
"write")
279 type(
mpi_grp_t),
target,
intent(in) :: mpigrp
282 assert(namespace_mpi_grp%is_associated())
289 type(
namespace_t),
optional,
intent(in) :: namespace
292 class(*),
pointer :: value
295 if (
present(namespace))
then
297 assert(namespace_mpi_grp%is_associated())
299 value =>
sphash_lookup(namespace_mpi_grp, trim(namespace%get()), found)
310 write(message(1),*)
"Cannot get mpi_grp for namespace ",namespace%get()
321 integer,
optional,
intent(in) :: no_lines
322 logical,
optional,
intent(in) :: only_root_writes
323 type(
namespace_t),
optional,
intent(in) :: namespace
326 integer :: ii, no_lines_
327 logical :: only_root_writes_, should_write
328 integer,
allocatable :: recv_buf(:)
329 type(mpi_request),
allocatable :: recv_req(:)
331 integer,
parameter :: fatal_tag = 32767
333 type(mpi_request) :: send_req
336 no_lines_ = current_line
337 if (
present(no_lines)) no_lines_ = no_lines
341 if (
present(only_root_writes))
then
342 should_write =
mpi_grp_is_root(msg_mpi_grp) .or. (.not. only_root_writes)
343 only_root_writes_ = only_root_writes
345 should_write = .
true.
346 only_root_writes_ = .false.
355 if (.not. only_root_writes_)
then
356 if (msg_mpi_grp%rank == 0)
then
362 call mpi_recv_init(recv_buf(ii), 1, mpi_integer, ii, fatal_tag, msg_mpi_grp%comm, recv_req(ii),
mpi_err)
371 call mpi_send_init(1, 1, mpi_integer, 0, fatal_tag, msg_mpi_grp%comm, send_req,
mpi_err)
376 call mpi_test(send_req, received, mpi_status_ignore,
mpi_err)
378 should_write = .false.
392 write(msg,
'(a)')
'*** Fatal Error (description follows)'
395 if (
present(namespace))
then
396 if (len_trim(namespace%get()) > 0)
then
397 write(msg,
'(3a)')
'* In namespace ', trim(namespace%get()),
':'
403 if (.not. only_root_writes_ .or. .not.
mpi_grp_is_root(msg_mpi_grp))
then
405 write(msg,
'(a,i4)')
"* From node = ", msg_mpi_grp%rank
411 write(msg,
'(a,1x,a)')
'*', trim(message(ii))
418 if (
debug%trace)
then
421 write(msg,
'(a)')
'* Stack: '
424 write(msg,
'(a,a)')
' > ', trim(
sub_stack(ii))
430 if (should_write)
then
444 integer,
optional,
intent(in) :: no_lines
445 logical,
optional,
intent(in) :: all_nodes
446 type(
namespace_t),
optional,
intent(in) :: namespace
448 integer :: il, no_lines_
449 integer :: iunit_namespace
450 logical :: have_to_write, all_nodes_
453 no_lines_ = current_line
454 if (
present(no_lines)) no_lines_ = no_lines
456 warnings = warnings + 1
464 if (
present(all_nodes))
then
465 have_to_write = have_to_write .or. all_nodes
466 all_nodes_ = all_nodes
469 if (have_to_write)
then
472 if (iunit_namespace /= stdout)
then
475 write(msg,
'(a)')
'** Warning:'
477 if (iunit_namespace /= stdout)
then
481 if (
present(namespace))
then
482 if (len_trim(namespace%get()) > 0)
then
483 write(msg,
'(3a)')
'** In namespace ', trim(namespace%get()),
':'
490 write(msg ,
'(a,i4)')
'** From node = ',
mpi_world%rank
492 if (iunit_namespace /= stdout)
then
499 write(msg ,
'(a,3x,a)')
'**', trim(message(il))
501 if (iunit_namespace /= stdout)
then
506 if (iunit_namespace /= stdout)
then
511 if (iunit_namespace /= stdout)
then
512 flush(iunit_namespace)
522 subroutine messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
523 integer,
optional,
intent(in) :: no_lines
524 integer,
optional,
intent(in) :: iunit
525 logical,
optional,
intent(in) :: debug_only
526 logical,
optional,
intent(in) :: stress
527 logical,
optional,
intent(in) :: all_nodes
528 type(
namespace_t),
optional,
intent(in) :: namespace
530 integer :: il, no_lines_
534 assert(.not. (
present(iunit) .and.
present(namespace)))
536 if (
present(iunit))
then
548 no_lines_ = current_line
549 if (
present(no_lines)) no_lines_ = no_lines
551 if (
present(stress))
then
557 write(msg,
'(a)') trim(message(il))
561 if (
present(stress))
then
574 character(len=*),
intent(in) :: status
580 call loct_rm(trim(msg_dir) //
'/oct-status-running')
581 call loct_rm(trim(msg_dir) //
'/oct-status-finished')
582 call loct_rm(trim(msg_dir) //
'/oct-status-aborted')
583 if (oct_status /=
'walltimer-aborted')
then
584 call loct_rm(trim(msg_dir) //
'/oct-status-walltimer-aborted')
590 open(unit=
iunit_err, file=trim(msg_dir) //
'/oct-status-'//trim(status), &
591 action=
'write', status=
'unknown')
598 integer(int64),
intent(in) :: size
599 character(len=*),
intent(in) :: file
600 integer,
intent(in) :: line
602 write(message(1),
'(a,i18,3a,i5)')
"Failed to allocate ",
size,
" words in file '", trim(file),
"' line ", line
609 integer(int64),
intent(in) :: size
610 character(len=*),
intent(in) :: file
611 integer,
intent(in) :: line
613 write(message(1),
'(a,i18,3a,i5)')
"Failed to deallocate array of ",
size,
" words in file '", trim(file),
"' line ", line
621 character(len=*),
intent(in) :: var
622 character(len=*),
optional,
intent(in) :: details
623 integer,
optional,
intent(in) :: row
624 integer,
optional,
intent(in) :: column
626 character(len=10) :: row_str, column_str
628 call messages_write(
'Input error in the input variable '// trim(var))
630 if (
present(row))
then
634 write(row_str,
'(I10)') row + 1
636 if (
present(column))
then
637 write(column_str,
'(I10)') column + 1
641 if (
present(details))
then
650 call messages_write(
'You can get the documentation of the variable with the command:', new_line = .
true.)
658 character(len=*),
intent(in) :: var
659 integer,
intent(in) :: val
660 integer,
optional,
intent(in) :: iunit
661 type(
namespace_t),
optional,
intent(in) :: namespace
663 character(len=10) :: intstring
665 assert(.not. (
present(iunit) .and.
present(namespace)))
667 write(intstring,
'(i10)') val
668 message(1) =
'Input: ['//trim(var)//
' = '//trim(adjustl(intstring))//
']'
675 character(len=*),
intent(in) :: var
676 character(len=*),
intent(in) :: val
677 integer,
optional,
intent(in) :: iunit
678 type(
namespace_t),
optional,
intent(in) :: namespace
680 assert(.not. (
present(iunit) .and.
present(namespace)))
682 message(1) =
'Input: ['//trim(var)//
' = '//trim(val)//
']'
689 character(len=*),
intent(in) :: var
690 real(real64),
intent(in) :: val
691 type(
unit_t),
optional,
intent(in) :: unit
692 integer,
optional,
intent(in) :: iunit
693 type(
namespace_t),
optional,
intent(in) :: namespace
695 character(len=11) :: floatstring
697 assert(.not. (
present(iunit) .and.
present(namespace)))
699 if (.not.
present(unit))
then
700 write(floatstring,
'(g11.4)') val
701 message(1) =
'Input: ['//trim(var)//
' = '//trim(adjustl(floatstring))//
']'
704 message(1) =
'Input: ['//trim(var)//
' = '//trim(adjustl(floatstring))//
' '//trim(
units_abbrev(unit))//
']'
712 character(len=*),
intent(in) :: var
713 logical,
intent(in) :: val
714 integer,
optional,
intent(in) :: iunit
715 type(
namespace_t),
optional,
intent(in) :: namespace
717 character(len=3) :: lstring
719 assert(.not. (
present(iunit) .and.
present(namespace)))
726 message(1) =
'Input: ['//trim(var)//
' = '//trim(lstring)//
']'
733 character(len=*),
intent(in) :: var
734 real(real64),
intent(in) :: val(:)
735 type(
unit_t),
optional,
intent(in) :: unit
736 integer,
optional,
intent(in) :: iunit
737 type(
namespace_t),
optional,
intent(in) :: namespace
740 character(len=11) :: floatstring
742 assert(.not. (
present(iunit) .and.
present(namespace)))
746 write(floatstring,
'(g11.4)') val(ii)
751 if (
present(unit))
then
762 character(len=*),
intent(in) :: var
763 integer,
optional,
intent(in) :: iunit
764 type(
namespace_t),
optional,
intent(in) :: namespace
769 assert(.not. (
present(iunit) .and.
present(namespace)))
775 if (
present(iunit))
then
786 character(len=*),
intent(in) :: var
787 integer(int64),
intent(in) :: option
788 character(len=*),
optional,
intent(in) :: pre
789 integer,
optional,
intent(in) :: iunit
790 type(
namespace_t),
optional,
intent(in) :: namespace
792 integer :: option4, iunit_
795 assert(.not. (
present(iunit) .and.
present(namespace)))
800 option4 = int(option, int32)
802 if (
present(iunit))
then
813 character(len=*),
intent(in) :: var
814 integer(int32),
intent(in) :: option
815 character(len=*),
optional,
intent(in) :: pre
816 integer,
optional,
intent(in) :: iunit
817 type(
namespace_t),
optional,
intent(in) :: namespace
819 assert(.not. (
present(iunit) .and.
present(namespace)))
827 character(len=*),
optional,
intent(in) :: msg
828 integer,
optional,
intent(in) :: iunit
829 type(
namespace_t),
optional,
intent(in) :: namespace
831 integer,
parameter :: max_len = 70
833 integer :: ii, jj, length
835 character(len=70) :: str
836 character(len=max_len) :: msg_combined
839 if (
present(iunit))
then
848 if (
present(msg))
then
850 if (len_trim(msg) > max_len)
then
851 msg_combined = trim(msg(1:max_len))
853 msg_combined = trim(msg)
855 length = len_trim(msg_combined)
860 do ii = 1, (max_len - (length + 2))/2
869 str(jj:jj) = msg_combined(ii:ii)
897 character(len = *),
intent(in) :: str
898 integer,
intent(in) :: iunit
899 character(len = *),
optional,
intent(in) :: adv
901 character(len = 20) :: adv_
904 if (
present(adv)) adv_ = trim(adv)
906 write(iunit,
'(a)', advance=adv_) trim(str)
912 character(len = *),
intent(in) :: str
916 call date_and_time(
values=val)
918 write(message(3),
'(a,i4,a1,i2.2,a1,i2.2,a,i2.2,a1,i2.2,a1,i2.2)') &
919 str , val(1),
"/", val(2),
"/", val(3), &
920 " at ", val(5),
":", val(6),
":", val(7)
930 subroutine time_sum(sec1, usec1, sec2, usec2)
931 integer,
intent(in) :: sec1
932 integer,
intent(in) :: usec1
933 integer,
intent(inout) :: sec2
934 integer,
intent(inout) :: usec2
939 usec2 = usec1 + usec2
942 if (usec2 >= 1000000)
then
944 usec2 = usec2 - 1000000
953 character(len=*),
intent(in) :: name
954 character(len=*),
optional,
intent(in) :: rep
958 write(message(1),
'(a)')
'Input variable '//trim(name)//
' is obsolete.'
960 if (
present(rep))
then
961 write(message(2),
'(a)')
' '
962 write(message(3),
'(a)')
'Equivalent functionality can be obtained with the '//trim(rep)
963 write(message(4),
'(a)')
'variable. Check the documentation for details.'
964 write(message(5),
'(a)')
'(You can use the `oct-help -p '//trim(rep)//
'` command).'
977 character(len=*),
intent(in) :: name
981 write(message(1),
'(a)')
'Input variable `'//trim(name)//
'` must be defined as a block.'
982 write(message(2),
'(a)')
'Please check the documentation for details.'
983 write(message(3),
'(a)')
'(You can use the `oct-help -p '//trim(name)//
'` command).'
992 character(len=*),
intent(in) :: name
993 type(
namespace_t),
optional,
intent(in) :: namespace
995 experimentals = experimentals + 1
997 if (.not.
conf%devel_version)
then
1001 call messages_write(
'If you still want to use this feature (at your own risk), check:')
1004 call messages_write(
'https://www.octopus-code.org/documentation/main/variables/execution/debug/experimentalfeatures')
1008 write(message(1),
'(a)') trim(name)//
' is under development.'
1009 write(message(2),
'(a)')
'It might not work or produce wrong results.'
1013 warnings = warnings - 1
1020 character(len=*),
intent(in) :: feature
1021 type(
namespace_t),
optional,
intent(in) :: namespace
1025 message(1) = trim(feature)//
" not implemented."
1042 current_line = current_line + 1
1043 message(current_line) =
''
1045 if (current_line > max_lines) stop
'Too many message lines.'
1051 real(real64),
intent(in) :: val
1052 character(len=*),
optional,
intent(in) :: fmt
1053 logical,
optional,
intent(in) :: new_line
1054 type(
unit_t),
optional,
intent(in) :: units
1055 logical,
optional,
intent(in) :: align_left
1056 logical,
optional,
intent(in) :: print_units
1058 character(len=30) :: number
1059 real(real64) :: tval
1064 if (
present(fmt))
then
1065 write(number,
'('//trim(fmt)//
')') tval
1067 write(number,
'(f12.6)') tval
1071 number = adjustl(number)
1072 number(1:len(number)) =
' '//number(1:len(number)-1)
1075 write(message(current_line),
'(a, a)') trim(message(current_line)), trim(number)
1078 write(message(current_line),
'(a, a, a)') trim(message(current_line)),
' ', trim(
units_abbrev(units))
1087 integer(int64),
intent(in) :: val
1088 character(len=*),
optional,
intent(in) :: fmt
1089 logical,
optional,
intent(in) :: new_line
1090 type(
unit_t),
optional,
intent(in) :: units
1091 logical,
optional,
intent(in) :: print_units
1093 character(len=20) :: number
1094 real(real64) :: val_conv_float
1096 if (
present(units))
then
1099 if (
present(fmt))
then
1100 write(message(current_line),
'(a, '//trim(fmt)//
')') trim(message(current_line)), val_conv_float
1102 write(number,
'(f15.3)') val_conv_float
1103 write(message(current_line),
'(3a)') trim(message(current_line)),
' ', trim(adjustl(number))
1108 if (
present(fmt))
then
1109 write(message(current_line),
'(a, '//trim(fmt)//
')') trim(message(current_line)), val
1111 write(number,
'(i12)') val
1112 write(message(current_line),
'(3a)') trim(message(current_line)),
' ', trim(adjustl(number))
1119 write(message(current_line),
'(a, a, a)') trim(message(current_line)),
' ', trim(adjustl(
units_abbrev(units)))
1122 if (
present(new_line))
then
1130 integer(int32),
intent(in) :: val
1131 character(len=*),
optional,
intent(in) :: fmt
1132 logical,
optional,
intent(in) :: new_line
1134 logical,
optional,
intent(in) :: print_units
1142 character(len=*),
intent(in) :: val
1143 character(len=*),
optional,
intent(in) :: fmt
1144 logical,
optional,
intent(in) :: new_line
1146 character(len=100) :: fmt_
1148 if (len(trim(message(current_line))) + len(trim(val)) > len(message(current_line)))
then
1151 write(0, *)
"Exceeded message line length limit, to write string:", trim(val)
1154 write(message(current_line),
'(a, '//trim(fmt_)//
')') trim(message(current_line)), trim(val)
1157 if (
present(new_line))
then
1165 logical,
intent(in) :: val
1166 logical,
optional,
intent(in) :: new_line
1168 character(len=3) :: text
1176 if (len(trim(message(current_line))) + len(trim(text)) > len(message(current_line)))
then
1177 write(message(current_line + 1),
'(3a)')
"Exceeded message line length limit, to write logical value '", trim(text),
"'"
1181 write(message(current_line),
'(a,1x,a)') trim(message(current_line)), trim(text)
1183 if (
present(new_line))
then
1191 integer,
intent(in) :: isignal
1194 character(len=300) :: description
1198 write(msg,
'(a,i2)')
''
1200 write(msg,
'(a,i2)')
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
1202 write(msg,
'(a,i2)')
''
1204 write(msg,
'(a,i2,2a)')
' Octopus was killed by signal ', isignal,
': ', trim(description)
1206 write(msg,
'(a,i2)')
''
1208 write(msg,
'(a)')
' Note: Octopus is currently trapping signals. This might prevent the'
1210 write(msg,
'(a)')
' use of debuggers or the generation of core dumps. To change this'
1212 write(msg,
'(a)')
' behavior, use the DebugTrapSignals input option.'
1214 write(msg,
'(a,i2)')
''
1216 write(msg,
'(a,i2)')
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
1219 if (
debug%trace)
then
1222 write(msg,
'(a)')
'Octopus debug trace: '
1225 write(msg,
'(a,a)')
' > ', trim(
sub_stack(ii))
1230 write(msg,
'(a)')
" Octopus debug trace not available. You can enable it with 'Debug = trace'."
1249 character(len=*),
intent(in) :: s, f
1250 integer,
intent(in) :: l
1265 call messages_write(
'This should not happen and is likely a bug in the code.')
1267 call messages_write(
'Please contact the developers and report how this occurred.')
1269 call messages_write(
'You can open an issue on gitlab as described in Contributing.md.')
1283 integer(c_int),
intent(in) :: isignal
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
subroutine handle_segv(isignal)
subroutine assert_die(s, f, l)
This subroutine is called by the assert macro, it is not in a module so it can be called from any fil...
character(len=max_path_len) function, public debug_clean_path(filename)
Prune a filename path to only include subdirectories of the "src" directory.
type(debug_t), save, public debug
subroutine, public debug_init(this, namespace)
integer, public no_sub_stack
character(len=80), dimension(50), public sub_stack
The stack.
type(conf_t), public conf
Global instance of Octopus configuration.
subroutine, public io_close(iunit, grp)
subroutine, public io_mkdir(fname, namespace, parents)
integer, parameter, public iunit_out
integer, parameter, public iunit_err
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public alloc_error(size, file, line)
subroutine, public messages_end()
subroutine messages_write_integer8(val, fmt, new_line, units, print_units)
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public messages_init(output_dir)
subroutine messages_print_var_option_8(var, option, pre, iunit, namespace)
subroutine messages_print_var_valuear(var, val, unit, iunit, namespace)
subroutine, public messages_variable_is_block(namespace, name)
subroutine, public messages_warning(no_lines, all_nodes, namespace)
subroutine messages_write_integer(val, fmt, new_line, units, print_units)
subroutine, public time_sum(sec1, usec1, sec2, usec2)
Computes t2 <- t1+t2. Parameters as in time_diff Assert: t1,2 <= 0.
subroutine messages_print_var_option_4(var, option, pre, iunit, namespace)
subroutine, public messages_obsolete_variable(namespace, name, rep)
subroutine, public messages_switch_status(status)
create status file for asynchronous communication
subroutine, public print_date(str)
subroutine flush_msg(str, iunit, adv)
subroutine, public messages_print_var_info(var, iunit, namespace)
subroutine, public messages_update_mpi_grp(namespace, mpigrp)
subroutine, public messages_new_line()
subroutine, public dealloc_error(size, file, line)
subroutine messages_print_var_values(var, val, iunit, namespace)
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine messages_print_var_valuei(var, val, iunit, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine messages_print_var_valuer(var, val, unit, iunit, namespace)
integer, parameter, private sleepytime_nonwriters
seconds
subroutine, public messages_experimental(name, namespace)
subroutine messages_print_var_valuel(var, val, iunit, namespace)
subroutine messages_write_logical(val, new_line)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
subroutine messages_write_str(val, fmt, new_line)
type(mpi_grp_t) function messages_get_mpi_grp(namespace)
subroutine, public messages_dump_stack(isignal)
integer function messages_get_unit(namespace)
subroutine messages_write_float(val, fmt, new_line, units, align_left, print_units)
subroutine messages_reset_lines()
logical function mpi_grp_is_root(grp)
Is the current MPI process of grpcomm, root.
type(mpi_grp_t), public mpi_world
integer, public mpi_err
used to store return values of mpi calls
type(namespace_t), public global_namespace
logical function, public parse_is_defined(namespace, name)
This module implements a simple hash table for string valued keys and integer values using the C++ ST...
subroutine, public sihash_insert(h, key, val)
Insert a (key, val) pair into the hash table h.
subroutine, public sihash_init(h)
Initialize a hash table h with size entries. Since we use separate chaining, the number of entries in...
integer function, public sihash_lookup(h, key, found)
Look up a value in the hash table h. If found is present, it indicates if key could be found in the t...
subroutine, public sihash_end(h)
Free a hash table.
This module implements a simple hash table for string valued keys and integer values using the C++ ST...
subroutine, public sphash_init(h)
Initialize a hash table h with size entries. Since we use separate chaining, the number of entries in...
subroutine, public sphash_insert(h, key, val, clone)
Insert a (key, val) pair into the hash table h. If clone=.true., the object will be copied.
subroutine, public sphash_end(h)
Free a hash table.
class(*) function, pointer, public sphash_lookup(h, key, found)
Look up a value in the hash table h. If found is present, it indicates if key could be found in the t...
character(len=80) function, public str_center(s_in, l_in)
puts space around string, so that it is centered
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
character(len=20) pure function, public units_abbrev(this)
subroutine, public varinfo_print_option(iunit, var, option, pre)
subroutine, public varinfo_print(iunit, var, ierr)
This is defined even when running serial.
real(real64) function values(xx)