1499 use,
intrinsic :: iso_fortran_env
1503 use base_strings,
only : lowercase
1504 use csv_io,
only : max_filename, csv_matrix_write, &
1505 csv_file_lines_count, get_free_funit, fs_unlink
1506 use base_strings,
only : parse
1534 integer,
parameter,
public ::
s_prec_32 = selected_real_kind( 6, 37)
1535 integer,
parameter,
public ::
d_prec_64 = selected_real_kind(15, 307)
1536 integer,
parameter,
public ::
q_prec_128 = selected_real_kind(33, 4931)
1569 integer,
parameter,
public ::
long = selected_int_kind(16)
1591 character(len=*),
parameter,
private ::
modname =
"(COMMONDATA)"
1613 character(len=*),
parameter,
public :: &
1644 real(
srp),
parameter,
public ::
zero = epsilon(0.0_srp)
1691 epsilon(0.0_hrp) * 1000.0_hrp
1710 real(
srp),
parameter,
public ::
pi=4.0_srp*atan(1.0_srp)
1713 character(len=*),
parameter,
public ::
csv=
".csv"
1716 character(len=*),
parameter,
public ::
ps=
".ps"
1754 character(len=*),
parameter ::
lock_file =
"lock_simulation_running.lock"
1777 character(len=*),
parameter ::
stop_file =
"stop_simulation_running.lock"
1819 character(len=*),
parameter,
public ::
ltag_major =
"IMPORTANT: "
1822 character(len=*),
parameter,
public ::
ltag_warn =
"WARNING: "
1824 character(len=*),
parameter,
public ::
ltag_crit =
"CRITICAL: "
1842 "No automatic array allocation"
1850 "No automatic size in parameter arrays"
1856 "Cannot allocate array or object"
1859 "Lock file '" //
lock_file //
"' exists. Is another simulation running?"
1899 character (len=LONG_LABEL_LENGTH) :: cpu_time_title
1943 "AHA, single fear, body size non-genetic."
2052 character(len=:),
allocatable,
protected,
public ::
mmdd
2180 real(
srp),
parameter,
public :: &
2186 real(
srp),
parameter,
public :: &
2192 real(
srp),
parameter,
public :: &
2198 real(
srp),
parameter,
public :: &
2227 [ 0.0_srp, 0.1_srp, 0.199_srp, 0.20_srp ]
2255 [0.0_srp, 0.0_srp, 0.0_srp]
2257 [20000.0_srp, 10000.0_srp, 3000.0_srp]
2295 real(
srp),
parameter,
dimension(3),
public :: &
2297 real(
srp),
parameter,
dimension(3),
public :: &
2301 real(
srp),
parameter,
dimension(3),
public :: &
2303 real(
srp),
parameter,
dimension(3),
public :: &
2369 real(
srp),
parameter,
public :: &
2376 real(
srp),
parameter,
public :: &
2417 real(
srp),
dimension(*),
parameter,
public &
2473 real(
srp),
parameter,
public :: &
2630 [ 6, 5, 12, 12, 12, 12 ]
2653 character(len=*),
parameter,
dimension(N_CHROMOSOMES),
public :: &
2684 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2718 character(len=*),
parameter,
public ::
male=
"male",
female=
"female"
2753 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2800 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2847 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2882 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2917 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2952 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
2987 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3055 [ 0.0_srp, 0.01_srp, 0.1_srp ]
3085 [ 0.0_srp, 0.01_srp, 0.1_srp ]
3124 parameter,
public :: &
3135 parameter,
public :: &
3137 [0.0_srp, 0.6_srp, 0.9_srp, 0.98, 1.00_srp]
3172 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3207 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3244 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3281 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3394 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3420 real(
srp),
parameter,
public :: &
3426 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3452 real(
srp),
parameter,
public :: &
3458 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3484 real(
srp),
parameter,
public :: &
3490 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3516 real(
srp),
parameter,
public :: &
3522 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3548 real(
srp),
parameter,
public :: &
3554 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3580 real(
srp),
parameter,
public :: &
3586 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3612 real(
srp),
parameter,
public :: &
3633 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3659 real(
srp),
parameter,
public :: &
3665 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3691 real(
srp),
parameter,
public :: &
3697 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3723 real(
srp),
parameter,
public :: &
3729 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3755 real(
srp),
parameter,
public :: &
3761 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3787 real(
srp),
parameter,
public :: &
3797 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3823 real(
srp),
parameter,
public :: &
3829 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3855 real(
srp),
parameter,
public :: &
3862 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3888 real(
srp),
parameter,
public :: &
3895 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3921 real(
srp),
parameter,
public :: &
3928 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3954 real(
srp),
parameter,
public :: &
3961 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
3987 real(
srp),
parameter,
public :: &
3994 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4020 real(
srp),
parameter,
public :: &
4026 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4052 real(
srp),
parameter,
public :: &
4058 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4084 real(
srp),
parameter,
public :: &
4091 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4117 real(
srp),
parameter,
public :: &
4124 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4150 real(
srp),
parameter,
public :: &
4157 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4183 real(
srp),
parameter,
public :: &
4193 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4219 real(
srp),
parameter,
public :: &
4225 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4251 real(
srp),
parameter,
public :: &
4258 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4284 real(
srp),
parameter,
public :: &
4291 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4317 real(
srp),
parameter,
public :: &
4324 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4350 real(
srp),
parameter,
public :: &
4357 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4383 real(
srp),
parameter,
public :: &
4390 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4416 real(
srp),
parameter,
public :: &
4422 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4448 real(
srp),
parameter,
public :: &
4454 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4480 real(
srp),
parameter,
public :: &
4487 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4513 real(
srp),
parameter,
public :: &
4520 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4546 real(
srp),
parameter,
public :: &
4553 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4579 real(
srp),
parameter,
public :: &
4599 real(
srp),
parameter,
public :: &
4606 real(
srp),
parameter,
public :: &
4653 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4679 real(
srp),
parameter,
public :: &
4685 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
parameter,
public &
4711 real(
srp),
parameter,
public :: &
4831 real(
srp),
dimension(*),
parameter,
public :: &
4839 real(
srp),
dimension(*),
parameter,
public :: &
4849 real(
srp),
dimension(*),
parameter, &
4851 [0.0_srp, 0.2_srp, 0.60_srp, 0.80_srp, 0.90_srp, 1.0_srp, 1.1_srp]
4857 real(
srp),
dimension(*),
parameter, &
4859 [1.0_srp, 0.3_srp, 0.04_srp, 0.01_srp, 0.001_srp, 0.0_srp, 0.0_srp]
4872 real(
srp),
dimension(*),
parameter, &
4874 [ 1.0, 2.00, 5.00, 10.0, 15.0, 18.0, 20.0 ]
4881 real(
srp),
dimension(*),
parameter, &
4883 [ 1.0, 0.98, 0.80, 0.40, 0.22, 0.18, 0.17 ]
4913 real(
srp),
dimension(*),
parameter, &
4915 [0.5_srp, 1.0_srp, 2.0_srp]
4926 real(
srp),
dimension(*),
parameter, &
4928 [0.0_srp, 1.0_srp, 1.8_srp]
4938 real(
srp),
parameter,
public :: &
5003 real(
srp),
dimension(*),
parameter,
public :: &
5017 real(
srp),
dimension(*),
parameter,
public :: &
5027 real(
srp),
parameter,
public :: &
5035 real(
srp),
parameter,
public :: &
5055 real(
srp),
dimension(*),
parameter, &
5057 [ 0.00_srp, 0.10_srp, 1.00_srp, 1.50_srp ]
5070 real(
srp),
dimension(*),
parameter, &
5072 [ 0.00_srp, 0.01_srp, 0.50_srp, 1.00_srp ]
5102 real(
srp),
parameter,
public :: &
5164 = [ 1.0_srp, 10.0_srp, 25.0_srp, 50.0_srp, 100.0_srp ]
5171 real(
srp),
dimension(*),
parameter,
public :: &
5173 [ 10.0_srp, 20.0_srp, 50.0_srp, 75.0_srp, 100.0_srp ]
5428 interface operator (.feq.)
5429 procedure float_equal_srp_operator
5430 procedure float_equal_hrp_operator
5431 end interface operator (.feq.)
5453 interface operator (.approx.)
5454 procedure float_approx_srp_operator
5455 procedure float_approx_hrp_operator
5456 end interface operator (.approx.)
5470 procedure is_within_operator_r
5471 procedure is_within_operator_i
5472 end interface operator (.within.)
5483 interface operator (.cat.)
5484 procedure stack2arrays_r
5485 procedure stack2arrays_i
5486 end interface operator (.cat.)
5523 interface operator (.radd.)
5524 procedure random_add_subtract
5525 end interface operator (.radd.)
5550 elemental function cm2m_r(value_cm)
result(value_m)
5551 real(
srp),
intent(in) :: value_cm
5552 real(
srp) :: value_m
5553 real(
srp),
parameter :: conv_f = 0.01_srp
5555 value_m = value_cm * conv_f
5564 elemental function cm2m_hr(value_cm)
result(value_m)
5565 real(
hrp),
intent(in) :: value_cm
5566 real(
hrp) :: value_m
5567 real(
hrp),
parameter :: conv_f = 0.01_hrp
5569 value_m = value_cm * conv_f
5578 elemental function cm2m_i(value_cm)
result(value_m)
5579 integer,
intent(in) :: value_cm
5580 real(
srp) :: value_m
5581 real(
srp),
parameter :: conv_f = 0.01_srp
5583 value_m = real(value_cm,
srp) * conv_f
5592 elemental function m2cm_r(value_m)
result(value_cm)
5593 real(
srp),
intent(in) :: value_m
5594 real(
srp) :: value_cm
5595 real(
srp),
parameter :: conv_f = 100.0_srp
5597 value_cm = value_m * conv_f
5606 elemental function m2cm_hr(value_m)
result(value_cm)
5607 real(
hrp),
intent(in) :: value_m
5608 real(
hrp) :: value_cm
5609 real(
hrp),
parameter :: conv_f = 100.0_hrp
5611 value_cm = value_m * conv_f
5620 elemental function m2cm_i(value_m)
result(value_cm)
5621 integer,
intent(in) :: value_m
5622 real(
srp) :: value_cm
5623 real(
srp),
parameter :: conv_f = 100.0_srp
5625 value_cm = real(value_m,
srp) * conv_f
5634 elemental function mm2m_r(value_mm)
result(value_m)
5635 real(
srp),
intent(in) :: value_mm
5636 real(
srp) :: value_m
5637 real(
srp),
parameter :: conv_f = 0.001_srp
5639 value_m = value_mm * conv_f
5648 elemental function mm2m_i(value_mm)
result(value_m)
5649 integer,
intent(in) :: value_mm
5650 real(
srp) :: value_m
5651 real(
srp),
parameter :: conv_f = 0.001_srp
5653 value_m = real(value_mm,
srp) * conv_f
5664 elemental function carea(R)
result (area_circ)
5665 real(
srp),
intent(in) :: r
5666 real(
srp) :: area_circ
5668 area_circ =
pi * r * r
5682 real(
srp),
intent(in) :: body_length
5683 real(
srp) :: side_area
5685 side_area = 0.35_srp * body_length ** 1.8_srp
5707 real(
srp),
intent(in) :: value_in
5708 real(
srp),
intent(in) :: a, b, a1, b1
5709 real(
srp) :: rescaled
5718 ck = (a1-b1) / (a-b)
5719 cb = -1.0_srp * ((a1*b - a*b1) / (a-b))
5722 rescaled = value_in*ck + cb
5734 elemental function rescale_1(value_in, A1, B1)
result(rescaled)
5735 real(
srp),
intent(in) :: value_in
5736 real(
srp),
intent(in) :: a1, b1
5737 real(
srp) :: rescaled
5750 rescaled = value_in*ck + cb
5766 elemental function within_r(value_in, vmin, vmax)
result (value_out)
5767 real(
srp),
intent(in) :: value_in
5768 real(
srp),
optional,
intent(in) :: vmin
5769 real(
srp),
intent(in) :: vmax
5770 real(
srp) :: value_out
5773 real(
srp) :: vmin_here
5776 if (
present(vmin))
then
5782 value_out = min( max( value_in, vmin_here ), vmax )
5798 elemental function within_i(value_in, vmin, vmax)
result (value_out)
5799 integer,
intent(in) :: value_in
5800 integer,
optional,
intent(in) :: vmin
5801 integer,
intent(in) :: vmax
5802 integer :: value_out
5805 integer :: vmin_here
5808 if (
present(vmin))
then
5815 value_out = min( max( value_in, vmin_here ), vmax )
5832 real(
srp),
intent(in) :: x, lower, upper
5833 logical :: within_yes
5836 real(
srp) :: lower_loc, upper_loc
5840 if (lower < upper)
then
5848 if ( x >= lower_loc .and. x <= upper_loc )
then
5851 within_yes = .
false.
5869 integer,
intent(in) :: x, lower, upper
5870 logical :: within_yes
5873 integer :: lower_loc, upper_loc
5877 if (lower < upper)
then
5885 if ( x >= lower_loc .and. x <= upper_loc )
then
5888 within_yes = .
false.
5904 real(
srp),
intent(in) :: x
5907 real(
srp),
dimension(2),
intent(in) :: limits
5910 logical :: return_yesno
5914 return_yesno =
is_within_r(x, limits(1), limits(2))
5929 integer,
intent(in) :: x
5932 integer,
dimension(2),
intent(in) :: limits
5935 logical :: return_yesno
5939 return_yesno =
is_within_i(x, limits(1), limits(2))
5952 pure function average_r (array_in, missing_code, undef_ret_null) &
5956 real(
srp),
dimension(:),
intent(in) :: array_in
5960 real(
srp),
optional,
intent(in) :: missing_code
5964 logical,
optional,
intent(in) :: undef_ret_null
5967 real(
srp) :: mean_val
5970 real(
srp) :: missing_code_here
5973 integer :: count_valid
5977 real(
hrp) :: bigsum, bigmean
5983 if (
present(missing_code))
then
5984 missing_code_here = missing_code
5990 count_valid = count(array_in /= missing_code_here)
5993 if (count_valid==0)
then
5994 if (
present(undef_ret_null))
then
5995 if (undef_ret_null)
then
6006 bigsum = sum( real(array_in,
hrp), array_in /= missing_code_here )
6007 bigmean = bigsum / count_valid
6009 mean_val = real(bigmean,
srp)
6022 pure function average_i (array_in, missing_code, undef_ret_null) &
6026 integer,
dimension(:),
intent(in) :: array_in
6030 integer,
optional,
intent(in) :: missing_code
6034 logical,
optional,
intent(in) :: undef_ret_null
6037 real(
srp) :: mean_val
6040 integer :: missing_code_here
6043 integer :: count_valid
6047 integer(LONG) :: bigsum
6048 real(
hrp) :: bigmean
6054 if (
present(missing_code))
then
6055 missing_code_here = missing_code
6061 count_valid = count(array_in /= missing_code_here)
6064 if (count_valid==0)
then
6065 if (
present(undef_ret_null))
then
6066 if (undef_ret_null)
then
6077 bigsum = sum( int(array_in,
long), array_in /= missing_code_here )
6078 bigmean = real(bigsum,
hrp) / real(count_valid,
hrp)
6080 mean_val = real(bigmean,
srp)
6088 function std_dev(array_in, missing_code, undef_ret_null)
result (stddev)
6090 real(
srp),
dimension(:),
intent(in) :: array_in
6093 real(
srp),
optional,
intent(in) :: missing_code
6096 logical,
optional,
intent(in) :: undef_ret_null
6101 real(
srp) :: missing_code_here
6104 integer :: count_valid
6108 integer,
parameter :: min_n = 4
6111 real(
srp),
dimension(size(array_in)) :: dev2
6114 real(
srp) :: sample_mean
6118 if (
present(missing_code))
then
6119 missing_code_here = missing_code
6124 count_valid = count(array_in /= missing_code_here)
6127 if (count_valid < min_n)
then
6128 if (
present(undef_ret_null))
then
6129 if (undef_ret_null)
then
6140 sample_mean =
average( array_in, missing_code_here )
6142 where ( array_in /= missing_code_here )
6143 dev2 = ( array_in - sample_mean ) ** 2
6145 dev2 = missing_code_here
6148 stddev = sqrt( sum( dev2, dev2 /= missing_code_here ) / (count_valid - 1) )
6158 real(
srp),
intent(in),
dimension(:) :: a
6160 real(
srp),
intent(in),
dimension(:) :: b
6162 real(
srp),
dimension(:),
allocatable :: c
6164 allocate(c(
size(a)+
size(b)))
6166 c(
size(a)+1:
size(a)+
size(b)) = b
6177 integer,
intent(in),
dimension(:) :: a
6179 integer,
intent(in),
dimension(:) :: b
6181 integer,
dimension(:),
allocatable :: c
6183 allocate(c(
size(a)+
size(b)))
6185 c(
size(a)+1:
size(a)+
size(b)) = b
6204 real(
srp),
intent (in) :: test_number
6206 real(
srp),
intent (in),
optional :: epsilon
6210 real(kind(epsilon)) :: local_epsilon
6213 if (
present(epsilon) )
then
6214 if ( abs(epsilon) >=
tiny_srp ) local_epsilon = abs(epsilon)
6217 ret_val = abs(test_number) < local_epsilon
6234 real(
hrp),
intent (in) :: test_number
6236 real(
hrp),
intent (in),
optional :: epsilon
6240 real(kind(epsilon)) :: local_epsilon
6243 if (
present(epsilon) )
then
6244 if ( abs(epsilon) >=
tiny_hrp ) local_epsilon = abs(epsilon)
6247 ret_val = abs(test_number) < local_epsilon
6270 real(
srp),
intent(in) :: value1
6272 real(
srp),
intent(in) :: value2
6274 real(
srp),
intent (in),
optional :: epsilon
6278 real(kind(epsilon)) :: local_epsilon
6281 if (
present(epsilon) )
then
6282 if ( abs(epsilon) >=
tiny_srp ) local_epsilon = abs(epsilon)
6285 equal =
is_near_zero( abs(value1 - value2), local_epsilon )
6308 real(
hrp),
intent(in) :: value1
6310 real(
hrp),
intent(in) :: value2
6312 real(
hrp),
intent (in),
optional :: epsilon
6316 real(kind(epsilon)) :: local_epsilon
6319 if (
present(epsilon) )
then
6320 if ( abs(epsilon) >=
tiny_hrp ) local_epsilon = abs(epsilon)
6323 equal =
is_near_zero( abs(value1 - value2), local_epsilon )
6342 real(
srp),
intent(in) :: value1
6344 real(
srp),
intent(in) :: value2
6349 equal =
is_near_zero( abs(value1 - value2), epsilon_loc )
6367 real(
hrp),
intent(in) :: value1
6369 real(
hrp),
intent(in) :: value2
6374 equal =
is_near_zero( abs(value1 - value2), epsilon_loc )
6392 real(
srp),
intent(in) :: value1
6394 real(
srp),
intent(in) :: value2
6400 equal =
is_near_zero( abs(value1 - value2), epsilon_loc )
6418 real(
hrp),
intent(in) :: value1
6420 real(
hrp),
intent(in) :: value2
6426 equal =
is_near_zero( abs(value1 - value2), epsilon_loc )
6437 subroutine do_sanitise( array, lvalid, hvalid, substval, only_wrong, tnote )
6447 include
"IEEE_wrap.inc"
6449 real(SRP),
intent(inout),
dimension(:) :: array
6452 real(SRP),
intent(in),
optional :: lvalid
6455 real(SRP),
intent(in),
optional :: hvalid
6458 real(SRP),
intent(in),
optional :: substval
6462 logical,
intent(in),
optional :: only_wrong
6465 character(len=*),
optional,
intent(in) :: tnote
6468 real(SRP) :: lvalid_loc, hvalid_loc, substval_loc
6471 real(SRP) :: INFINITY_POS, INFINITY_NEG, NAN_QUIET
6474 logical :: ieee_def_mode_overflow, &
6475 ieee_def_mode_underflow, &
6476 ieee_def_mode_invalid, &
6477 ieee_def_mode_inexact
6483 logical :: fix_only_wrong
6484 character(len=:),
allocatable :: tnote_loc
6487 integer :: ieee_report_except
6489 character(len=*),
parameter :: PROCNAME =
"(do_sanitise)"
6492 call ieee_get_halting_mode(ieee_overflow, ieee_def_mode_overflow)
6493 call ieee_get_halting_mode(ieee_underflow, ieee_def_mode_underflow)
6494 call ieee_get_halting_mode(ieee_invalid, ieee_def_mode_invalid)
6495 call ieee_get_halting_mode(ieee_inexact, ieee_def_mode_inexact)
6497 call ieee_set_halting_mode(ieee_overflow, .
false.)
6498 call ieee_set_halting_mode(ieee_underflow, .
false.)
6499 call ieee_set_halting_mode(ieee_invalid, .
false.)
6500 call ieee_set_halting_mode(ieee_inexact, .
false.)
6502 if (
present(lvalid))
then
6508 if (
present(hvalid))
then
6514 if (
present(substval))
then
6515 substval_loc = substval
6520 if (
present(only_wrong))
then
6521 fix_only_wrong = only_wrong
6523 fix_only_wrong = .
false.
6526 if (
present(tnote))
then
6533 infinity_pos = ieee_value(0.0_srp, ieee_positive_inf)
6534 infinity_neg = ieee_value(0.0_srp, ieee_negative_inf)
6535 nan_quiet = ieee_value(0.0_srp, ieee_quiet_nan)
6539 if ( ieee_report_except == 0 )
then
6550 where ( ieee_is_nan(array) ) array = substval_loc
6551 where ( array == infinity_pos ) array = substval_loc
6552 where ( array == infinity_neg ) array = substval_loc
6553 if (fix_only_wrong .eqv. .
false.) &
6554 where ( array < lvalid_loc .or. array > hvalid_loc ) array = substval_loc
6557 call ieee_set_halting_mode(ieee_overflow, ieee_def_mode_overflow)
6558 call ieee_set_halting_mode(ieee_underflow, ieee_def_mode_underflow)
6559 call ieee_set_halting_mode(ieee_invalid, ieee_def_mode_invalid)
6560 call ieee_set_halting_mode(ieee_inexact, ieee_def_mode_inexact)
6593 include
"IEEE_wrap.inc"
6594 integer :: error_code
6598 logical,
optional,
intent(in) :: reset
6601 character(len=*),
optional,
intent(in) :: tnote
6604 logical :: reset_loc
6605 character(len=:),
allocatable :: tnote_loc
6607 character(len=*),
parameter ::
procname =
"(ieee_error_reporting)"
6612 integer,
parameter :: is_overflow=101, &
6617 no_support_overflow=901, &
6618 no_support_underflow=902, &
6619 no_support_invalid=903, &
6620 no_support_inexact=904, &
6621 no_support_divbyzero=905, &
6627 if (
present(reset))
then
6633 error_code = no_error_flag
6636 if (
present(tnote))
then
6643 if ( ieee_support_datatype(1.0_srp) .and. &
6644 ieee_support_halting(ieee_overflow) )
then
6645 call ieee_get_flag (ieee_overflow, ieee_get)
6647 error_code = is_overflow
6649 ": IEEE_OVERFLOW is signalled!" )
6650 if (reset_loc)
call ieee_set_flag (ieee_overflow, .
false.)
6653 error_code = no_support_overflow
6655 ": IEEE_OVERFLOW NOT supported for SRP " // tostr(
srp) )
6658 if ( ieee_support_datatype(1.0_srp) .and. &
6659 ieee_support_halting(ieee_underflow) )
then
6660 call ieee_get_flag (ieee_underflow, ieee_get)
6662 error_code = is_underflow
6664 ": IEEE_UNDERFLOW is signalled!" )
6665 if (reset_loc)
call ieee_set_flag (ieee_underflow, .
false.)
6668 error_code = no_support_underflow
6670 ": IEEE_UNDERFLOW NOT supported for SRP " // tostr(
srp) )
6673 if ( ieee_support_datatype(1.0_srp) .and. &
6674 ieee_support_halting(ieee_invalid) )
then
6675 call ieee_get_flag (ieee_invalid, ieee_get)
6677 error_code = is_invalid
6679 ": IEEE_INVALID is signalled!" )
6680 if (reset_loc)
call ieee_set_flag (ieee_invalid, .
false.)
6683 error_code = no_support_invalid
6685 ": IEEE_INVALID NOT supported for SRP " // tostr(
srp) )
6703 if ( ieee_support_datatype(1.0_srp) .and. &
6704 ieee_support_halting(ieee_divide_by_zero) )
then
6705 call ieee_get_flag (ieee_divide_by_zero, ieee_get)
6707 error_code = is_divbyzero
6709 ": IEEE_DIVIDE_BY_ZERO is signalled!" )
6710 if (reset_loc)
call ieee_set_flag (ieee_divide_by_zero, .
false.)
6713 error_code = no_support_divbyzero
6715 ": IEEE_DIVIDE_BY_ZERO NOT supported for SRP "//tostr(
srp))
6756 real(
srp),
intent(in) :: ax,bx,tol
6784 real(
srp) :: a,b,c,d,e,eps,fa,fb,fc,tol1,xm,p,q,r,s
6793 if (fa .eq.0.0_srp .or. fb .eq. 0.0_srp)
go to 20
6794 if (fa * (fb/abs(fb)) .le. 0.0_srp)
go to 20
6803 30
if (abs(fc).ge.abs(fb))
go to 40
6810 40 tol1=2.0_srp*eps*abs(b)+0.5_srp*tol
6812 if ((abs(xm).le.tol1).or.(fb.eq.0.0_srp))
go to 150
6816 if ((abs(e).ge.tol1).and.(abs(fa).gt.abs(fb)))
go to 50
6821 if (a.ne.c)
go to 60
6833 p=s*(2.0_srp*xm*q*(q-r)-(b-a)*(r-1.0_srp))
6834 q=(q-1.0_srp)*(r-1.0_srp)*(s-1.0_srp)
6835 70
if (p.le.0.0_srp)
go to 80
6841 if (((2.0_srp*p).ge.(3.0_srp*xm*q-abs(tol1*q))) .or. &
6842 (p.ge. abs(0.5d0*s*q)))
go to 100
6849 if (abs(d).le.tol1)
go to 120
6852 120
if (xm.le.0.0_srp)
go to 130
6857 if ((fb*(fc/abs(fc))).gt.0.0_srp)
go to 20
6884 integer,
intent(in) :: raw_value
6885 real(
srp) :: converted
6908 real(
srp),
intent(in) :: raw_value
6910 real(
srp) :: converted
6913 real(
srp),
parameter :: scale_factor = 10.
6921 converted = raw_value
6957 real(
srp) :: variance
6959 real(
srp),
intent(in) :: cv
6961 real(
srp),
intent(in) :: mean
6963 variance = (mean*cv)**2
7004 result(neuronal_response)
7007 real(
srp) :: neuronal_response
7013 integer,
dimension(:),
intent(in) :: gs
7019 integer,
dimension(:),
intent(in) :: gh
7023 real(
srp),
intent(in) :: signal
7029 real(
srp),
optional,
intent(in) :: erpcv
7032 real(
srp) :: perception
7038 real(
srp),
parameter :: forced_min_percept =
zero
7050 if (
present(erpcv))
then
7052 perception = max(forced_min_percept, rnorm(signal,(erpcv*signal)**2))
7054 perception = max(forced_min_percept, signal)
7057 perception = max(forced_min_percept, signal)
7064 do concurrent(i=1:
size(gs))
7067 nr = nr + d1/(1.0_hrp+d1)
7071 neuronal_response =
zero
7073 neuronal_response = real(nr,
srp)
7118 real(
srp) :: neuronal_response
7124 real(
srp),
dimension(:),
intent(in) :: gs
7130 real(
srp),
dimension(:),
intent(in) :: gh
7134 real(
srp),
intent(in) :: signal
7140 real(
srp),
optional,
intent(in) :: erpcv
7143 real(
srp) :: perception
7149 real(
srp),
parameter :: forced_min_percept =
zero
7160 if (
present(erpcv))
then
7162 perception = max(forced_min_percept, rnorm(signal,(erpcv*signal)**2))
7164 perception = max(forced_min_percept, signal)
7167 perception = max(forced_min_percept, signal)
7174 do concurrent(i=1:
size(gs))
7177 nr = nr + d1/(1.0_hrp+d1)
7181 neuronal_response =
zero
7183 neuronal_response = real(nr,
srp)
7194 result(predicted_val)
7195 real(
srp),
intent(in) :: signal
7196 real(
srp),
optional,
intent(in) :: gs, gh
7197 integer,
optional,
intent(in) :: n_acomps
7198 real(
srp) :: predicted_val
7201 real(
srp) :: gs_loc, gh_loc
7202 integer :: n_acomps_loc
7204 if (
present(gs))
then
7210 if (
present(gh))
then
7216 if (
present(n_acomps))
then
7217 n_acomps_loc = n_acomps
7222 predicted_val = n_acomps_loc * ( (signal/gh_loc)**gs_loc / &
7223 (1.0_srp+(signal/gh_loc)**gs_loc) )
7264 real(
srp),
intent(in) :: neuronal_response, gs, gh
7267 integer,
intent(in),
optional :: nc
7272 if (
present(nc))
then
7280 signal = gh * (neuronal_response / n - neuronal_response )**(1.0_srp/gs)
7302 integer,
dimension(:),
intent(inout) :: history_array
7304 integer,
intent(in) :: add_this
7307 integer :: history_size
7309 history_size =
size(history_array)
7311 history_array(1:history_size-1) = history_array(2:history_size)
7312 history_array(history_size) = add_this
7327 real(
srp),
dimension(:),
intent(inout) :: history_array
7329 real(
srp),
intent(in) :: add_this
7332 integer :: history_size
7334 history_size =
size(history_array)
7336 history_array(1:history_size-1) = history_array(2:history_size)
7337 history_array(history_size) = add_this
7351 character(*),
dimension(:),
intent(inout) :: history_array
7353 character(*),
intent(in) :: add_this
7356 integer :: history_size
7358 history_size =
size(history_array)
7360 history_array(1:history_size-1) = history_array(2:history_size)
7361 history_array(history_size) = add_this
7370 elemental function conv_l2i(flag, code_false, code_true)
result (num_out)
7371 logical,
intent(in) :: flag
7372 integer,
optional,
intent(in) :: code_false
7373 integer,
optional,
intent(in) :: code_true
7377 integer :: code_false_loc, code_true_loc
7379 integer,
parameter :: false_def=0, true_def=1
7382 if (
present(code_false))
then
7383 code_false_loc = code_false
7385 code_false_loc = false_def
7388 if (
present(code_true))
then
7389 code_true_loc = code_true
7391 code_true_loc = true_def
7395 if (flag .eqv. .
true.)
then
7396 num_out = code_true_loc
7398 num_out = code_false_loc
7420 elemental function conv_l2r(flag, code_false, code_true)
result (num_out)
7421 logical,
intent(in) :: flag
7422 real(
srp),
optional,
intent(in) :: code_false
7423 real(
srp),
optional,
intent(in) :: code_true
7424 real(
srp) :: num_out
7426 real(
srp) :: code_false_loc, code_true_loc
7428 real(
srp),
parameter :: false_def=0.0_srp, true_def=1.0_srp
7431 if (
present(code_false))
then
7432 code_false_loc = code_false
7434 code_false_loc = false_def
7437 if (
present(code_true))
then
7438 code_true_loc = code_true
7440 code_true_loc = true_def
7444 if (flag .eqv. .
true.)
then
7445 num_out = code_true_loc
7447 num_out = code_false_loc
7465 real(
srp),
intent(in) :: value
7467 real(
srp),
dimension(:),
intent(in) :: array
7469 real(
srp),
optional,
intent(in) :: tolerance
7472 real(
srp) :: tolerance_threshold
7477 if (
present(tolerance))
then
7478 if ( abs(tolerance) >=
tiny_srp ) tolerance_threshold = abs(tolerance)
7482 if (
float_equal(
value, maxval(array), tolerance_threshold ) )
then
7503 integer,
intent(in) :: value
7505 integer,
dimension(:),
intent(in) :: array
7508 if (
value == maxval(array) )
then
7530 real(
srp),
intent(in) :: value
7532 real(
srp),
dimension(:),
intent(in) :: array
7534 real(
srp),
optional,
intent(in) :: tolerance
7537 real(
srp) :: tolerance_threshold
7542 if (
present(tolerance))
then
7543 if ( abs(tolerance) >=
tiny_srp ) tolerance_threshold = abs(tolerance)
7547 if (
float_equal(
value, minval(array), tolerance_threshold ) )
then
7568 integer,
intent(in) :: value
7570 integer,
dimension(:),
intent(in) :: array
7573 if (
value == minval(array) )
then
7593 character(len=*),
optional,
intent(in) :: timer_title
7595 if (
present(timer_title))
then
7596 this%cpu_time_title = timer_title
7598 this%cpu_time_title =
"DEFAULT_TIMER"
7602 call cpu_time(this%cpu_time_start)
7614 real(
srp) :: cpu_time_elapsed
7617 real(
srp) :: cpu_time_finish
7620 call cpu_time(cpu_time_finish)
7623 cpu_time_elapsed = cpu_time_finish - this%cpu_time_start
7637 character(len=:),
allocatable :: timer_title
7639 timer_title = trim(this%cpu_time_title)
7649 character(len=:),
allocatable :: timer_string
7650 real(
srp) :: timer_value
7652 real(
srp),
parameter :: add_hours_val_exceed = 120.0_srp
7654 timer_value = this%elapsed()
7657 timer_string = trim(this%cpu_time_title) //
" took " // &
7658 tostr(timer_value) //
"s"
7661 if (timer_value > add_hours_val_exceed) timer_string = &
7662 timer_string //
" (" // tostr(timer_value/3600) //
" h)"
7664 timer_string = trim(this%cpu_time_title) // &
7665 " took ZERO TIME (seems too fast, check data!)"
7681 character(len=:),
allocatable :: timer_string
7711 is_background_task, cmd_is_success, exit_code )
7717 use iso_c_binding,
only: c_null_char
7719 character(len=*),
intent(in) :: command
7723 logical,
optional,
intent(in) :: suppress_output
7726 logical,
optional,
intent(in) :: suppress_error
7734 logical,
optional,
intent(in) :: is_background_task
7737 logical,
optional,
intent(out) :: cmd_is_success
7739 integer,
optional,
intent(out) :: exit_code
7742 logical :: wait_exec
7745 character(len=:),
allocatable :: cmd_execute
7746 character(len=LONG_LABEL_LENGTH) :: cmd_error_msg
7752 character(len=*),
parameter :: NO_STDOUT_UNIX =
" >/dev/null"
7753 character(len=*),
parameter :: NO_STDOUT_WINDOWS =
" >:NULL"
7754 character(len=*),
parameter :: NO_STDOUT_DISABLE =
""
7759 character(len=*),
parameter :: NO_STDERR_UNIX =
" 2>/dev/null"
7760 character(len=*),
parameter :: NO_STDERR_WINDOWS =
" 2>&1"
7761 character(len=*),
parameter :: NO_STDERR_DISABLE =
""
7764 character(len=:),
allocatable :: null_redirect_stdout, null_redirect_stderr
7767 integer :: status_int, status_err
7770 character(len=*),
parameter :: PROCNAME =
"(call_external)"
7773 if (
present(suppress_output))
then
7774 if (suppress_output)
then
7777 null_redirect_stdout = no_stdout_windows
7779 null_redirect_stdout = no_stdout_unix
7782 null_redirect_stdout = no_stdout_disable
7785 null_redirect_stdout = no_stdout_disable
7789 if (
present(suppress_error))
then
7790 if (suppress_error)
then
7793 null_redirect_stderr = no_stderr_windows
7795 null_redirect_stderr = no_stderr_unix
7798 null_redirect_stderr = no_stderr_disable
7801 null_redirect_stderr = no_stderr_disable
7811 if (
present(is_background_task))
then
7812 if ( is_background_task .eqv. .
false. ) wait_exec = .
true.
7817 cmd_error_msg =
"unknown"
7864 cmd_execute = command // null_redirect_stdout // null_redirect_stderr &
7866 call log_dbg(
ltag_info //
"Calling full command line " // cmd_execute // &
7867 ", with synchronous mode " // tostr(wait_exec), &
7869 call execute_command_line( command = cmd_execute, &
7871 exitstat = status_int, cmdstat = status_err, &
7872 cmdmsg = cmd_error_msg )
7878 if (
present(cmd_is_success))
then
7879 cmd_is_success = ( status_int == 0 .and. status_err == 0 )
7882 if (
present(exit_code)) exit_code = status_int
7887 ", with execution status: " // tostr(status_err) // &
7888 " and " //
"exit code: " // tostr(status_int) // &
7889 ", error message: " // trim(cmd_error_msg), &
7897 character(len=*),
intent(in) :: exec
7901 is_background_task=.
false., cmd_is_success=is_valid )
7914 character(len=*),
intent(in) :: exec
7917 logical,
optional,
intent(in) :: debug_only
7920 logical,
optional,
intent(out) :: is_valid
7923 logical :: is_valid_here
7929 character(len=*),
parameter :: PROCNAME =
"(log_check_external)"
7932 if (
present(debug_only))
then
7933 if (debug_only .and. .not.
is_debug)
return
7939 is_background_task=.
false., &
7940 cmd_is_success=is_valid_here, &
7941 exit_code=int_code )
7943 if ( .not. is_valid_here .or. int_code /= 0 ) &
7944 call log_msg(
ltag_warn // exec //
" could not be started, exit code " &
7945 // tostr(int_code) //
"." )
7947 if (
present(is_valid)) is_valid = is_valid_here
7968 real(SRP),
dimension(:),
intent(in) :: x_data
7971 logical ,
optional,
intent(in) :: delete_csv
7974 character(len=*),
optional,
intent(in) :: csv_out_file
7977 logical,
optional,
intent(in) :: enable_non_debug
7981 character(len=FILENAME_LENGTH) :: csv_file_here
7983 logical :: do_background
7986 character(len=*),
parameter :: PROCNAME =
"(debug_histogram_save)"
8009 if (
present(enable_non_debug))
then
8010 if (enable_non_debug .eqv. .
false.)
return
8025 if (
present(csv_out_file))
then
8026 csv_file_here = csv_out_file
8028 csv_file_here =
"debug_histogr_" //
mmdd // &
8033 do_background = .
true.
8034 if (
present(delete_csv))
then
8035 if (delete_csv) do_background = .
false.
8038 call log_msg(
"INFO: Saving histogram, data :" // trim(csv_file_here) )
8042 call csv_matrix_write ( x_data, trim(csv_file_here), .
true. )
8057 command =
exec_histogram //
" 1 " // trim(csv_file_here) //
" " // &
8058 trim(csv_file_here) //
ps, &
8059 suppress_output = .
true., suppress_error = .
true., &
8060 is_background_task = do_background )
8062 if (
present(delete_csv))
then
8063 if (delete_csv)
then
8098 real(SRP),
dimension(:),
intent(in) :: x_data, y_data
8101 logical ,
optional,
intent(in) :: delete_csv
8104 character(len=*),
optional,
intent(in) :: csv_out_file
8107 logical,
optional,
intent(in) :: enable_non_debug
8111 character(len=FILENAME_LENGTH) :: csv_file_here
8113 logical :: do_background
8116 character(len=*),
parameter :: PROCNAME =
"(debug_scatterplot_save)"
8139 if (
present(enable_non_debug))
then
8140 if (enable_non_debug .eqv. .
false.)
return
8155 if (
present(csv_out_file))
then
8156 csv_file_here = csv_out_file
8158 csv_file_here =
"debug_scatterplot_" //
mmdd // &
8163 do_background = .
true.
8164 if (
present(delete_csv))
then
8165 if (delete_csv) do_background = .
false.
8168 call log_msg(
"INFO: Saving scatterplot, data :" // trim(csv_file_here) )
8174 call csv_matrix_write ( reshape( &
8175 [ x_data, y_data], &
8176 [max(
size(x_data),
size(y_data)), 2], [
missing]),&
8177 trim(csv_file_here), [
"X_DATA",
"Y_DATA"] )
8192 trim(csv_file_here) //
ps, &
8193 suppress_output = .
true., suppress_error = .
true., &
8194 is_background_task = do_background )
8196 if (
present(delete_csv))
then
8197 if (delete_csv)
then
8230 algstr, output_file, enable_non_debug )
8233 real(SRP),
dimension(:),
intent(in) :: grid_xx, grid_yy
8235 real(SRP),
intent(in) :: ipol_value
8237 character(*),
intent(in) :: algstr
8239 character(len=*),
intent(in) :: output_file
8242 logical,
optional,
intent(in) :: enable_non_debug
8245 logical :: enable_non_debug_here
8248 character(len=:),
allocatable :: cmd_execute
8258 if (
present(enable_non_debug))
then
8259 enable_non_debug_here = enable_non_debug
8261 enable_non_debug_here = .
false.
8279 if (
is_debug .or. enable_non_debug_here )
then
8280 call log_msg(
"INFO: Saving interpolation plot: " // trim(output_file) )
8296 tostr(grid_yy) //
"] [" // tostr(ipol_value) //
"] [" // algstr // &
8297 "] [" // trim(output_file) //
"]"
8299 command = cmd_execute, &
8300 suppress_output = .
true., suppress_error = .
true., &
8301 is_background_task = .
false. )
8323 character(len=*),
intent(in) :: file_name
8324 logical,
optional,
intent(out) :: success
8326 integer :: file_unit, file_error_status
8327 logical :: openedq, existq
8330 character(len=*),
parameter :: PROCNAME =
"(file_delete)"
8335 call fs_unlink( file_name, file_error_status )
8336 if (file_error_status == 0 )
then
8338 //
" using POSIX call, result is success." )
8339 if (
present(success)) success = .
true.
8341 call log_msg(
ltag_error // procname //
" Could not delete file " // &
8342 file_name //
" using POSIX call (unlink)." )
8343 if (
present(success)) success = .
false.
8352 inquire(file=file_name, opened=openedq, exist=existq, &
8353 iostat=file_error_status)
8356 if ( .not. openedq .and. existq .and. file_error_status==0 )
then
8358 file_unit = get_free_funit()
8360 open (unit=file_unit, file=file_name, status=
'old', &
8361 iostat=file_error_status)
8363 close(unit=file_unit, status=
'delete', iostat= file_error_status)
8365 if (
present(success))
then
8366 success = (file_error_status == 0)
8368 //
" with success flag " // tostr(success) //
"." )
8370 call log_msg(
ltag_info // procname //
" Deleted file " // file_name &
8371 //
" , result is success." )
8373 if (
present(success)) success = .
false.
8374 call log_msg(
ltag_info // procname //
" Could not delete file " // &
8386 real(
srp),
intent(in) :: x
8388 real(
srp),
intent(in) :: y
8390 real(
srp) :: out_val
8392 if (rand_i(1,2)==1)
then
8405 use csv_io,
only : get_free_funit
8412 character(len=LABEL_LENGTH) :: debug_string
8415 logical :: check_1, check_2, check_3, check_4
8418 logical :: do_check_externals
8421 character(len=*),
parameter :: PROCNAME =
"(system_init)"
8424 logical :: lock_preexists
8427 integer :: lock_iostat
8430 integer :: ieee_check_result
8442 inquire( file=
lock_file, exist=lock_preexists )
8443 if ( lock_preexists )
then
8446 ignore_lockfile = .
true. )
8454 call random_seed_init()
8463 call get_environment_variable(name=
"AHA_DEBUG",
value=debug_string)
8464 debug_string = lowercase(debug_string)
8465 if ( trim(debug_string)==
"1" .or. &
8466 trim(debug_string)==
"yes" .or. &
8467 trim(debug_string)==
"true" )
then
8471 else if ( trim(debug_string)==
"0" .or. &
8472 trim(debug_string)==
"no" .or. &
8473 trim(debug_string)==
"false" )
then
8503 call get_command_argument(number=1,
value=debug_string)
8504 debug_string = lowercase(debug_string)
8505 if ( trim(debug_string)==
"debug" .or. &
8506 trim(debug_string)==
"debug=1" .or. &
8507 trim(debug_string)==
"debug=yes" .or. &
8508 trim(debug_string)==
"debug=true" )
then
8569 call get_environment_variable(name=
"AHA_SCREEN",
value=debug_string)
8570 debug_string = lowercase(debug_string)
8571 if ( trim(debug_string)==
"1" .or. &
8572 trim(debug_string)==
"yes" .or. &
8574 if ( trim(debug_string)==
"0" .or. &
8575 trim(debug_string)==
"no" .or. &
8595 call get_environment_variable(name=
"AHA_DEBUG_PLOTS",
value=debug_string)
8596 debug_string = lowercase(debug_string)
8597 if ( trim(debug_string)==
"1" .or. &
8598 trim(debug_string)==
"yes" .or. &
8600 if ( trim(debug_string)==
"0" .or. &
8601 trim(debug_string)==
"no" .or. &
8621 call get_environment_variable(name=
"AHA_ZIP_FILES",
value=debug_string)
8622 debug_string = lowercase(debug_string)
8623 if ( trim(debug_string)==
"1" .or. &
8624 trim(debug_string)==
"yes" .or. &
8626 if ( trim(debug_string)==
"0" .or. &
8627 trim(debug_string)==
"no" .or. &
8653 do_check_externals =.
true.
8654 call get_environment_variable(name=
"AHA_CHECK_EXTERNALS",
value=debug_string)
8655 debug_string = lowercase(debug_string)
8656 if ( trim(debug_string)==
"0" .or. &
8657 trim(debug_string)==
"no" .or. &
8658 trim(debug_string)==
"false" ) do_check_externals =.
false.
8672 call log_msg(
ltag_info //
"Starting initial checks." )
8676 call log_msg(
ltag_info //
"Checking IEEE math exception support")
8678 if ( ieee_check_result == 0 )
then
8679 call log_msg(
ltag_info //
"No IEEE exception is reported.")
8681 call log_msg(
ltag_info //
"IEEE exception is reported, error code: " &
8682 // tostr(ieee_check_result) )
8683 call log_msg(
ltag_info //
"Note that it can be processor-dependent,"// &
8684 "some exceptions (e.g. IEEE_INEXACT) can be just ignored.")
8686 if (ieee_check_result == 0)
then
8687 call log_msg(
ltag_info //
"So far all exceptions are reset to FALSE.")
8689 call log_msg(
ltag_error //
"Cannot reset IEEE exception flags," // &
8690 "something may be wrong, but is platform/CPU dependent.")
8697 if (do_check_externals)
then
8698 call log_delimiter(log_level_chapter)
8699 call log_msg (
ltag_info //
"Checking external procedures. " // &
8700 "Note: may not work on all platforms.")
8701 call log_msg (
ltag_warn //
"THIS CAN CRASH THIS PROGRAM IF INTEL FORTRAN")
8702 call log_msg (
ltag_warn //
"COMPILER IS USED FOR BUILDING.")
8703 call log_msg (
ltag_warn //
"IN SUCH A CASE SET ENVIRONMENT VARIABLE")
8704 call log_msg (
ltag_warn //
"'AHA_CHECK_EXTERNALS=FALSE' AND DISABLE")
8705 call log_msg (
ltag_warn //
"DEBUG PLOTS BY SETTING ENVIRONMENT VARIABVLE")
8706 call log_msg (
ltag_warn //
"'AHA_DEBUG_PLOTS=FALSE'.")
8707 call log_delimiter(log_level_chapter)
8718 character(len=*),
parameter :: test_file_zip =
"ztest_compression"
8719 integer :: test_file_unit
8722 test_file_unit = get_free_funit()
8723 open( unit=test_file_unit, file=test_file_zip, &
8724 iostat=lock_iostat, action=
'write', status=
'replace', &
8726 close(test_file_unit)
8727 call log_msg(
ltag_info //
"Checking if compression of data " // &
8728 "files is possible: " // &
8730 call log_msg(
ltag_warn //
"If this command hangs, disable " // &
8731 "data file compression by setting environment " // &
8732 "variable AHA_ZIP_FILES=NO." )
8739 is_valid = check_4 )
8740 call log_msg(
ltag_info //
"Command executed and not hanged.")
8743 if ( check_4 .eqv. .
false. )
then
8747 ": Compression test failed, IS_ZIP_OUTPUTS disabled")
8755 call log_msg(
ltag_info //
"Validity (is executable) codes: " // &
8756 tostr([check_1, check_2, check_3, check_4]) )
8764 if ( any([check_1,check_2,check_3] .eqv. .
false.) )
then
8765 call log_msg(
ltag_warn //
"External procedures cannot be called" // &
8766 ", generation of debug plots is DISABLED: " // &
8767 "IS_PLOTTING set to FALSE." )
8769 call log_delimiter(log_level_volume)
8770 call log_msg(
" DEBUG is: " // tostr(
is_debug) // &
8773 call log_delimiter(log_level_volume)
8782 test_autoalloc: block
8783 real(SRP),
allocatable,
dimension(:) :: test_array
8784 test_array = [ 1.0_srp, 2.0_srp, 3.0_srp ]
8785 if ( .not.
allocated(test_array) .or.
size(test_array) /= 3 )
then
8786 call log_delimiter(log_level_chapter)
8787 call log_msg(
ltag_crit //
"TEST_AUTOALLOC: Automatic array " // &
8788 "allocation is not enabled or supported" // &
8792 end block test_autoalloc
8797 test_auto_param_arrays: block
8801 real(SRP),
parameter,
dimension(*) :: test_array = &
8802 [ 1.0_srp, 2.0_srp, 3.0_srp ]
8803 if (
size(test_array) /= 3 .or. &
8804 test_array(1) /= 1.0_srp .or. &
8805 test_array(2) /= 2.0_srp .or. &
8806 test_array(3) /= 3.0_srp )
then
8807 call log_delimiter(log_level_chapter)
8808 call log_msg(
ltag_crit //
"TEST_AUTO_PARAM_ARRAYS: Constant array " &
8809 //
"automatic size determination is not supported" // &
8813 end block test_auto_param_arrays
8831 action=
'write', status=
'replace', position=
'append' )
8836 if ( lock_iostat /= 0 )
then
8838 ". Trying to continue but errors and crashes are " // &
8839 "expected due to disk write problems!" )
8872 use,
intrinsic :: iso_fortran_env, only : error_unit
8877 logical,
optional,
intent(in) :: is_error
8880 character (len=*),
optional,
intent(in) :: message
8889 logical,
optional,
intent(in) :: ignore_lockfile
8892 integer :: error_code
8893 character(len=LONG_LABEL_LENGTH) :: message_loc
8900 integer,
parameter :: EXIT_CODE_DEF = 0
8905 integer,
parameter :: EXIT_CODE_ERROR = 255
8908 integer :: lock_iostat
8910 logical :: do_not_touch_lock
8912 error_code = exit_code_def
8913 if (
present(is_error))
then
8914 if (is_error) error_code = exit_code_error
8917 if (
present(message))
then
8918 message_loc = message
8920 message_loc =
"Program terminated with exit code " // &
8921 tostr(error_code) //
"."
8930 if (
present(ignore_lockfile))
then
8931 do_not_touch_lock = ignore_lockfile
8933 do_not_touch_lock = .
false.
8935 if ( do_not_touch_lock .eqv. .
false. )
then
8937 if ( lock_iostat /= 0 )
then
8939 ", it will NOT be deleted automatically!" )
8946 call log_delimiter(log_level_volume)
8947 call log_msg(
ltag_major //
"EXITING with message: " // message_loc )
8950 call log_delimiter(log_level_volume)
8954 write(error_unit,*) message_loc
8957 select case (error_code)
8958 case (exit_code_error)
8959 stop exit_code_error
8960 case (exit_code_def)
8982 character (len=*),
parameter ::
procname =
"(logger_init)"
9000 character (len=FILENAME_LENGTH) :: logfile
9009 character (len=FILENAME_LENGTH) :: run_on_hostname
9013 integer :: logger_unit
9014 logical :: is_stdout, is_logfile
9020 character(len=LONG_LABEL_LENGTH),
allocatable,
dimension(:) :: &
9021 model_abstract_array
9027 logfile =
"output_model_debug_MAIN.log"
9033 call log_configure(
"timestamp", .
true.)
9037 call log_configure(
"level_string_volume", repeat(
"=",60))
9038 call log_configure(
"level_string_chapter", repeat(
"-",60))
9039 call log_configure(
"level_string_section", repeat(
"*",60))
9040 call log_configure(
"level_string_subsection", repeat(
"+",60))
9047 call log_startup (trim(logfile), .
false.)
9051 call log_delimiter(log_level_volume)
9052 call log_msg(
"Starting model: " //
model_name //
" --- Date Tag: " // &
9054 call log_msg(
"Model description: " //
model_descr)
9057 call log_msg(
" Revision ID: " //
svn_version //
".")
9061 call log_delimiter(log_level_chapter)
9063 call log_msg(
"Model Abstract (" // tostr(
size(model_abstract_array)) // &
9065 do i = 1,
size( model_abstract_array )
9066 call log_msg( model_abstract_array(i) )
9068 call log_delimiter(log_level_chapter)
9072 if ( platform_is_windows() )
then
9074 call log_msg(
" Running on Microsoft Windows platform: PLATFORM_WINDOWS.")
9077 call log_msg(
" Running on a Unix/Linux platform: PLATFORM_UNIX " // &
9104 run_on_hostname =
"undefined"
9110 call log_msg(
" DEBUG is: " // tostr(
is_debug) // &
9114 call log_cget(
"writeonstdout", is_stdout)
9115 call log_cget(
"writeonlogfile", is_logfile)
9116 call log_cget(
"logfileunit", logger_unit)
9117 call log_msg(
"Logger configuration options:")
9118 call log_msg(
" Write standard output is " // tostr(is_stdout) // &
9119 ", write to logfile is " // tostr(is_logfile) // &
9120 " with unit number " // tostr(logger_unit))
9123 call log_msg(
"Basic constants: ")
9124 call log_msg(
" Standard (SRP) precision: " // tostr(
srp))
9125 call log_msg(
" High (HRP) precision: " // tostr(
hrp))
9126 call log_msg(
" LONG integer precision: " // tostr(
long))
9127 call log_msg(
" ZERO (SRP): " // tostr(
zero))
9128 call log_msg(
" Smallest real value TINY_SRP: " // tostr(
tiny_srp))
9129 call log_msg(
" Default low tolerance TOLERANCE_LOW_DEF_SRP: " // &
9131 call log_msg(
" Default high tolerance TOLERANCE_HIGH_DEF_SRP: " // &
9136 call log_msg(
"Main parameters of the model:")
9137 call log_msg(
" Population size " // tostr(
popsize))
9138 call log_msg(
" Lifecycle length " // tostr(
lifespan))
9141 call log_msg(
"Genetic Algorithm parameters:")
9142 call log_msg(
" Pre-evolution selection of the best, proportion: " // &
9144 call log_msg(
" Pre-evolution life cycle starts from " // &
9150 call log_delimiter(log_level_volume)
9170 subroutine log_dbg(message_string, procname, modname)
9175 character (len=*),
intent(in) :: message_string
9177 character (len=*),
optional,
intent(in) :: procname
9179 character (len=*),
optional,
intent(in) :: modname
9182 character (len=:),
allocatable :: prefix_msg
9189 if (
present(procname))
then
9190 if (
present(modname))
then
9191 prefix_msg=
"DEBUG: " // modname //
"::" // procname //
": "
9193 prefix_msg=
"DEBUG: ::" // procname //
": "
9196 if (
present(modname))
then
9197 prefix_msg=
"DEBUG: " // modname //
":: "
9199 prefix_msg=
"DEBUG: "
9204 call log_msg( prefix_msg // message_string )
9217 character(len=*),
optional,
intent(in) :: ttag
9220 logical,
optional,
intent(in) :: always_log
9223 logical,
optional,
intent(in) :: reset_flags
9226 character(len=:),
allocatable :: ttag_loc
9227 logical :: always_log_here, reset_here
9229 integer :: ieee_report
9231 if (
present(ttag) )
then
9237 if (
present(always_log) )
then
9238 always_log_here = always_log
9241 always_log_here = .
true.
9243 always_log_here = .
false.
9247 if (
present(reset_flags) )
then
9248 reset_here = reset_flags
9255 if ( always_log_here )
then
9256 call log_msg(
ltag_info //
"IEEE Signalling: " // tostr(ieee_report) )
9258 if ( ieee_report > 0 ) &
9259 call log_msg(
ltag_info //
"IEEE Signalling: " // tostr(ieee_report) )
9274 character(len=:),
allocatable :: sversion
9277 character(len=len(SVN_VERSION_STRING)) :: &
9280 character(len=3) :: delims =
" :$"
9282 character(len=len(SVN_VERSION_STRING)),
dimension(3) :: sargs
9291 call parse(svn_string_copy, delims, sargs, n_args)
9292 sversion = trim(sargs(n_args))
9307 character(len=*),
optional,
intent(in) :: file_name
9310 character(len=LONG_LABEL_LENGTH),
allocatable,
dimension(:) :: abstract_array
9313 character(len=:),
allocatable :: file_name_loc
9316 integer :: abstract_unit, file_error_status
9317 logical :: file_is_success
9321 integer :: abstract_file_lines
9326 if (
present(file_name))
then
9327 file_name_loc = file_name
9334 abstract_file_lines = csv_file_lines_count( &
9335 csv_file_name=file_name_loc, &
9336 numeric_only=.
false., &
9337 csv_file_status=file_is_success )
9343 if ( .not. file_is_success .or. abstract_file_lines < 1 )
then
9351 allocate( abstract_array(abstract_file_lines) )
9355 abstract_unit = get_free_funit()
9358 open ( unit=abstract_unit, file=file_name_loc, status=
'old', &
9359 iostat=file_error_status)
9361 if ( file_error_status /= 0 )
then
9367 do i=1, abstract_file_lines
9368 read ( unit=abstract_unit, fmt=
"(a)", iostat=file_error_status ) &
9370 if ( file_error_status /= 0 )
exit
9376 close(abstract_unit)
9389 character (len=*),
parameter ::
procname =
"(tag_mmdd)"
9391 character(len=:),
allocatable ::
mmdd
9393 integer date_time(8)
9396 call date_and_time(b(1), b(2), b(3), date_time)
9398 mmdd = tostr(date_time(1),2016) // tostr(date_time(2),10) // &
9399 tostr(date_time(3),10)
Simple history stack function, add to the end of the stack. We need only to add components on top (en...
Calculate an average of an array excluding missing code values.
Check if two real values are nearly equal using the commondata::is_near_zero(). Thus function can be ...
Sigmoidal relationship between environmental factor and the organism response, as affected by the gen...
Check if a value is the maximum value of an array.
Check if a value is the minimum value of an array.
Checks if a real number is near 0.0. Thus function can be used for comparing two real values like thi...
Logical function to check if a value is within a specific range, lower <= X <= upper.
Arbitrary rescales value(s) from one range (A:B) to another (A1:B1).
Force a value within the range set by the vmin and vmax dummy parameter values.
COMMONDATA – definitions of global constants and procedures.
real(srp), parameter, public stomach_content_init_cv
Set the coefficient of variation for the stomach capacity at init.
real(srp), parameter, public reprfac_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for age perception effects on reproduction.
logical, parameter, public agent_can_assess_predator_attack_rate
A logical flag of whether the agents can assess the individual inherent attack rates of the predators...
elemental logical function, private is_near_zero_hrp(test_number, epsilon)
Checks if a real number is near 0.0. Thus function can be used for comparing two real values like the...
logical, dimension(max_nalleles, n_chromosomes), parameter, public energy_genotype_phenotype
The initial value of the energy reserves at birth is genetically determined. This is the Genotype x P...
logical, public, protected is_debug
Sets the model in the debug mode if TRUE. The Debug mode generates huge additional outputs and logs....
real(srp), parameter, public depth_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for depth perception effects on fear state.
pure real(srp) function, dimension(:), allocatable, private stack2arrays_r(a, b)
Concatenate two arrays a and b. This procedure uses array slices which would be faster in most cases ...
integer, parameter, public preevol_tsteps
Number of time steps in the agent's life at the pre-evolution stage.
character(len= *), parameter, private modname
MODNAME always refers to the name of the current module for use by the LOGGER function LOG_DBG....
integer, public global_generation_number_current
The current global generation number. This is a global non fixed-parameter variable that is updated i...
real(srp), parameter, public conspcount_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for conspecifics number count perception effects on hunger.
real(srp), parameter, public cost_factor_foraging_smr
Set the cost of foraging in terms of SMR.
real(srp), parameter, public history_perception_window_pred
The size of the memory window that is used in the assessment of predation risk, as a portion of the c...
character(len= *), parameter, public zip_file_extenssion
This parameter defines the compressed file extension for the external compression utility defined by ...
real(srp), parameter, public approach_offset_default
Default offset for approach, offset is the difference between the approaching agent and the target ob...
character(len= *), parameter, public ltag_error
elemental logical function, private float_approx_hrp_operator(value1, value2)
This is a wrapper for the commondata::float_equal_hrp() for building the user defined operator ....
real(srp), parameter, public attention_switch_reproduce_stomach
Baseline attention switch, see commondata::attention_switch_hunger_light.
integer, parameter, public pred_select_items_index_partial
Sets the limit for partial indexing and ranking of predators in the visual range of the agent.
character(len= *), parameter, public error_lock_preexists
logical, parameter, public init_agents_depth_is_fixed
This parameter determines if the agents are initialised at a fixed depth at the initialisation....
real(srp), parameter, public predator_attack_capture_probability_half
The probability of capture of a fish agent by a predator at the distance equal to 1/2 of the visual r...
logical, dimension(max_nalleles, n_chromosomes), parameter, public pred_meancount_reproduce_genotype_neuronal
The genotype structure for mean predator number perception effects on reproduction that goes via gamm...
real(srp), parameter, public body_length_max
Maximum body length.
real(srp), parameter, public attention_switch_hunger_light
Baseline attention switches control which perception components (i) can affect each of the motivatio...
real(srp), parameter, public probability_reproduction_base_factor
Default weighting factor for the baseline probability of successful reproduction ....
logical, dimension(max_nalleles, n_chromosomes), parameter, public conspcount_actv_avoid_genotype_neuronal
The genotype structure for conspecifics number perception effects on fear state that goes via gamma2g...
real(srp), parameter, public control_unselected_gerror_cv
Genotype to phenotype initialisation, Gaussian error parameter. Coefficient of variation for the cont...
real(srp), parameter, public food_item_size_default_cv
Coefficient of variation for Gaussian food items.
real(srp), parameter, public individual_mortality_risk_cv
The coefficient of variation for Gaussian stochastic individually-specific mortality risk of the agen...
real(srp), parameter, public migrate_predator_zero_hope
This parameter defines the hope function for calculating the general predation risk expectancy in the...
integer, parameter, public history_size_spatial
The size of the history for spatial moving objects, i.e. how many time steps positions to remember in...
real(srp), parameter, public reprod_modulation_devel_w2
Developmental modulation of reproductive motivation. This parameter sets the interpolation array weig...
real(srp), parameter, public attention_switch_hunger_energy
Baseline attention switch, see commondata::attention_switch_hunger_light.
integer, parameter, public long_label_length
The length of long labels.
logical, dimension(max_nalleles, n_chromosomes), parameter, public light_reproduce_genotype_neuronal
The genotype structure for light perception effects on reproduction that goes via gamma2gene percepti...
character(len= *), parameter, public exec_interpolate
There are a few external programs which are called from the model code. The name of the interpolation...
real(srp), parameter, public smr_init
This is the initial value of SMR that goes through the gamma2gene.
real(srp), parameter, public adrenaline_init
Genotype to phenotype gamma2gene initialisation value for adrenaline
real(srp), parameter, public genome_recombination_ratio_mother
The ratio of the genome that inherited from the mother. The other part is inherited from the father....
character(len= *), parameter, public error_no_autoalloc
Error message for **"no automatic intrinsic array allocation"**. Fortran compilers support automatic ...
logical, dimension(max_nalleles, n_chromosomes), parameter, public pred_meancount_actv_avoid_genotype_neuronal
The genotype structure for mean predator number perception effects on fear state that goes via gamma2...
real(srp), parameter, public hi_valid_sanitised
Higher bound for do_sanitise() procedure. This is the highest value that considered valid.
logical, dimension(max_nalleles, n_chromosomes), parameter, public sex_female_modulation_reproduce_genotype
The genotype structure for sex modulation coefficient affecting reproduction motivation state in fema...
real(srp), dimension(*), parameter, public approach_food_gain_compet_factor_abscissa
The grid abscissa defining the nonparametric relationship that determines the expected food gain for ...
logical, dimension(max_nalleles, n_chromosomes), parameter, public foodcount_hunger_genotype_neuronal
The genotype structure for food items count perception effects on hunger that goes via gamma2gene per...
character(len= *), parameter, private model_abstract_file
The name of the file that contains the Model abstract, a short description that can span several line...
logical, dimension(max_nalleles, n_chromosomes), parameter, public thyroid_genotype_phenotype
Genotype x Phenotype matrix for thyroid.
character(len= *), parameter, public model_name
Model name for tags, file names etc. Must be very short. See Model descriptors.
logical, dimension(max_nalleles, n_chromosomes), parameter, public estrogen_genotype_phenotype
Genotype x Phenotype matrix for ESTROGEN.
real(srp), parameter, public tolerance_low_def_srp
Default value of low tolerance (high precision). This is the standard commondata::srp precision....
real(srp), parameter, public energy_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for energy reserves perception effects on hunger.
character(len= *), parameter, public ps
Standard file extension for debug and other PostScript plots.
integer, parameter, public n_chromosomes
The number of chromosomes for the agents.
real(srp) function zeroin(ax, bx, f, tol)
This function calculates a zero of a function f(x) in the interval (ax,bx).
real(srp), parameter, public migrate_predator_maximum_hope
This parameter defines the hope function for calculating the general predation risk expectancy in the...
real(hrp), parameter, public tolerance_low_def_hrp
Default value of low tolerance (high precision). This is the high commondata::hrp precision....
real(srp), parameter, public attention_switch_reproduce_light
Baseline attention switch, see commondata::attention_switch_hunger_light.
subroutine do_sanitise(array, lvalid, hvalid, substval, only_wrong, tnote)
Sanitize a real commondata::srp array, so that any value that is smaller than the minimum sensible va...
real(srp), parameter, public sex_steroids_reproduction_threshold
This parameter defines the threshold of the current gonadal steroids level that should exceed the bas...
real(srp), dimension(*), parameter, public reproduct_body_mass_offspr_ordinate
The array defining the ordinate (Y) of the nonparametric function curve that defines the relationship...
real(srp), parameter, public daylight_cv
Coefficient of variation for stochastic DAYLIGHT,.
real(srp), parameter, public testosterone_gerror_cv
Genotype to phenotype gamma2gene Gaussian error parameter. This is really the coefficient of variatio...
logical, parameter, public no
subroutine debug_histogram_save(x_data, delete_csv, csv_out_file, enable_non_debug)
Produce a debug plot of histogram using an external program hthist from HEDTOOLS tools.
integer, parameter, public ga_fitness_dead
Fitness value ascribed to dead agent in pre-evol. See the_individual::individual_agent::fitness_calc(...
character(len= *), parameter, public ltag_stats
real(srp), parameter, public thyroid_gerror_cv
Genotype to phenotype gamma2gene Gaussian error parameter. This is really the coefficient of variatio...
real(srp), parameter, public age_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for age perception effects on fear state.
pure logical function, private is_maxval_r(value, array, tolerance)
Function to check if the value is the maximum value of an array (returns TRUE), or not (return FALSE)...
real(srp), parameter, public attention_switch_reproduce_depth
Baseline attention switch, see commondata::attention_switch_hunger_light.
logical, dimension(max_nalleles, n_chromosomes), parameter, public bodymass_reproduce_genotype_neuronal
The genotype structure for body mass perception effects on reproduction that goes via gamma2gene perc...
integer, parameter, public q_prec_128
elemental real(srp) function, private m2cm_r(value_m)
Convert m to cm.
logical, parameter, public init_agents_depth_is_gauss
This parameter determines if the agents are initialised at a fixed depth at the initialisation....
integer, parameter, public srp
Definition of the standard real type precision (SRP).
logical, dimension(max_nalleles, n_chromosomes), parameter, public control_unselected_genotype_phenotype
The initial value of the control unselected trait. This trait is is genetically determined but is not...
real(srp), parameter, public escape_dart_distance_default_stoch_cv
For stochastic escape, this parameter determines the coefficient of variation of the escape walk....
real(srp), parameter, public approach_conspecfic_dilute_adjust_pair_behind
Multiplication factor for subjective assessment of the direct risk of predation when the actor agent ...
real(srp), dimension(*), parameter, public attention_modulation_curve_ordinate
The array defining the ordinate (Y) of the nonparametric function that defines the attention modulati...
real(srp), parameter, public smr_min
Minimum SMR value, anything lower is not allowed.
elemental real(srp) function, private cm2m_i(value_cm)
Convert cm to m.
logical, dimension(max_nalleles, n_chromosomes), parameter, public reprfac_actv_avoid_genotype_neuronal
The genotype structure for reproductive factor perception effects on fear state that goes via gamma2g...
real(srp), parameter, public reprfac_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for reproductive factor perception effects on hunger.
logical, dimension(max_nalleles, n_chromosomes), parameter, public energy_reproduce_genotype_neuronal
The genotype structure for energy reserves perception effects on reproduction that goes via gamma2gen...
real(srp), parameter, public arousal_gos_dissipation_factor
Spontaneous arousal dissipation level when a simple fixed dissipation factor pattern is used....
real(srp), parameter, public pi
The PI number.
elemental real(srp) function cv2variance(cv, mean)
Calculate the variance from the coefficient of variation.
real(srp), parameter swimming_cost_exponent_laminar
Default swimming cost body mass exponent parameter for laminar flow. See doi:10.1242/jeb....
real(srp), parameter, public stom_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for stomach perception effects on hunger.
character(len= *), parameter, public model_descr
Model description - a fixed descriptive text, used in text outputs etc. See Model descriptors.
integer, parameter, public unknown
Numerical code for invalid or missing integer counts.
real(srp), parameter, public init_agents_depth_cv
This parameter sets the Coefficient of Variation for the Gaussian depth initialisation of the agents ...
real(srp), parameter, public linear_growth_exponent
Growth exponent linking linear growth and body mass growth. Based on Fulton's condition factor "cube ...
integer, parameter, public generations
Maximum number of generations in GA.
subroutine call_external(command, suppress_output, suppress_error, is_background_task, cmd_is_success, exit_code)
Call an external program using a command line. Wrapper to two alternative system shell calling intrin...
real(srp), parameter, public daylight
Maximum above-surface light intensity at midday, DAYLIGHT=500.0.
real(hrp), parameter, public tiny_hrp
The smallest positive number in the commondata::hrp high precision real model. See Float point comput...
character(len= *), parameter, public ltag_major
Tag prefixes for the logger system. The log may use tags for some common information pieces,...
logical, dimension(max_nalleles, n_chromosomes), parameter, public sex_genotype_phenotype
Sex definition can be implemented differently from all other traits. Here is an example of the phenot...
character(len= *), parameter, public ltag_crit
real(srp), parameter, public walk_random_food_gain_hope_agentl
The maximum walk distance, in units of the agent body length, when the expected food gain is calculat...
logical, dimension(max_nalleles, n_chromosomes), parameter, public adrenaline_genotype_phenotype
Genotype x Phenotype matrix for adrenaline
real(srp), parameter, public pred_direct_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for direct predation perception effects on hunger.
real(srp), parameter, public predator_attack_rate_cv
Coefficient of variation for a single predator attack among the whole population of stochastic predat...
real(srp), parameter, public up_down_walk_step_stdlength_factor
The default size of the up and down walks performed by the GO_DOWN_DEPTH and GO_UP_DEPTH,...
logical, dimension(max_nalleles, n_chromosomes), parameter, public cortisol_genotype_phenotype
Genotype x Phenotype matrix for cortisol.
real(srp), dimension(3), parameter, public universe_min_coord_notuse
Overall size of the global 3D universe of the model.
real(srp), parameter, public attention_switch_avoid_act_stomach
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public attention_switch_avoid_act_food_mem
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public food_item_density
The (physical) density of a single food item. TODO: need to parametrise!
subroutine debug_scatterplot_save(x_data, y_data, delete_csv, csv_out_file, enable_non_debug)
Produce a debug plot of 2-d scatterplot using an external program htscatter from HEDTOOLS tools.
integer, parameter, public sex_steroids_check_history
The number of the latest historical values that are checked for change when setting an increment of t...
real(srp), parameter, public swimming_cost_factor_buoyancy_up
This parameter defines the cost of the buoyancy-based locomotion as a fraction of normal laminar flow...
integer, parameter, public ga_fitness_select
Fitness threshold for the inclusion of the agent into the reproducing elite group.
real(srp), parameter, public eyesat
Saturation parameter of eye (Ke) (uE m-2 s-1), EYESAT=500.0.
real(srp), parameter, public attention_switch_reproduce_energy
Baseline attention switch, see commondata::attention_switch_hunger_light.
logical function check_external(exec)
Check if an external procedure is executable and can be run.
real(srp), parameter, public body_length_init
The initial value of body length, the average (gon-genetic).
integer, parameter, public filename_length
Set the standard length of the file name, are 255 characters enough?
real(srp), parameter, public pred_meancount_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for mean predator number perception effects on hunger.
logical, dimension(max_nalleles, n_chromosomes), parameter, public food_mem_reproduce_genotype_neuronal
The genotype structure for food items count perception effects on reproduction that goes via gamma2ge...
character(len= *), parameter stop_file
The name of the stop file. The stop file is checked before each new generation of the Genetic Algorit...
real(srp), parameter, public foodcount_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for food items count perception effects on hunger.
real(srp), parameter, public smr_gerror_cv
Genotype to phenotype initialisation, Gaussian error parameter. Coefficient of variation for the SMR_...
elemental integer function, private within_i(value_in, vmin, vmax)
Force a value within the range set by the vmin and vmax dummy parameter values. If the value is withi...
real(srp), parameter, public reproduction_cost_unsuccess
The energetic cost of unsuccessful reproduction in terms of the agent's body mass lost....
integer, parameter, public history_size_perception
Sets the size of the perception memory stack.
logical, dimension(max_nalleles, n_chromosomes), parameter, public smr_genotype_phenotype
The initial value of the standard metabolic rate (SMR) at birth is genetically determined....
character(len=:) function, allocatable, private timer_cpu_show(this)
A ready to use in output function that returns a formatted string for a timer combining its title and...
pure logical function, private is_minval_r(value, array, tolerance)
Function to check if the value is the minimum value of an array (returns TRUE), or not (return FALSE)...
real(srp), parameter, public attention_switch_avoid_act_depth
Baseline attention switch, see commondata::attention_switch_hunger_light.
logical, dimension(max_nalleles, n_chromosomes), parameter, public depth_reproduce_genotype_neuronal
The genotype structure for depth perception effects on reproduction that goes via gamma2gene percepti...
real(srp), parameter, public reproduction_cost_body_mass_fix
The energetic cost of reproduction in terms of the agent's body mass loss.
integer, parameter, public label_length
The length of standard character string labels. We use labels for various objects,...
logical, dimension(max_nalleles, n_chromosomes), parameter, public conspcount_hunger_genotype_neuronal
The genotype structure for conspecifics number perception effects on hunger that goes via gamma2gene ...
real(srp), parameter, public food_item_migrate_depth_cv
Coefficient of variation parameter for the local random walk movement of food items in the vertical (...
logical, dimension(max_nalleles, n_chromosomes), parameter, public genome_crossover_fixed_mother
Boolean 2D matrix that determines the pattern of fixed chromosome crossover. For each chromosome,...
integer, public platform_running
Global variable that shows what is the current platform. Should use the above platform constants,...
logical, dimension(max_nalleles, n_chromosomes), parameter, public light_actv_avoid_genotype_neuronal
The genotype structure for light perception effects on fear state that goes via gamma2gene perception...
real(srp), parameter, public pred_meancount_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for mean predator number perception effects on fear state.
real(srp), parameter, public reproduction_cost_body_mass_factor_female
The component of the energetic cost of reproduction in females that is proportional to the agent's bo...
logical, dimension(max_nalleles, n_chromosomes), parameter, public reprfac_reproduce_genotype_neuronal
The genotype structure for age perception effects on reproduction that goes via gamma2gene perception...
real(srp), dimension(*), parameter, public behav_walk_step_stdlen_static
This parameter array defines the repertoire of predetermined static walk step sizes,...
real(srp), parameter, public migrate_food_gain_ratio_zero_hope
This parameter defines the hope function for calculating the food gain expectancy in the migration be...
integer, parameter, public food_select_items_index_partial
Sets the limit for partial indexing and ranking of food items in the visual range of the agents.
real(srp), parameter, public attention_switch_hunger_bodymass
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public adrenaline_gerror_cv
Genotype to phenotype gamma2gene Gaussian error parameter. This is really the coefficient of variatio...
integer, parameter, public food_abundance_habitat_danger
The food abundance in the dangerous habitat.
integer, parameter, public ga_reproduce_n
Upper limit on the number of reproducing individuals in the fixed-fitness pre-evolution phase.
real(srp), parameter, public attention_switch_avoid_act_energy
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public eggmortality_def
Default level of egg mortality in the habitat.
integer, parameter, public s_prec_32
Standard precision for real data type. We first define 32, 64 and 128 bit real kinds.
real(srp), parameter, public growhorm_init
Genotype to phenotype gamma2gene initialisation value for growth hormone
real(srp), parameter, public food_mem_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for food items count perception effects on hunger.
logical, dimension(max_nalleles, n_chromosomes), parameter, public energy_actv_avoid_genotype_neuronal
The genotype structure for energy reserves perception effects on fear state that goes via gamma2gene ...
elemental logical function, private is_near_zero_srp(test_number, epsilon)
Checks if a real number is near 0.0. Thus function can be used for comparing two real values like the...
real(srp), parameter, public tiny_srp
The smallest positive number in the commondata::srp standard real model.
real(srp), dimension(3), parameter, public universe_whole_size_notuse
character(len=:) function, allocatable, private tag_mmdd()
Date (YYYYMMDD) tag for file names and logs.
real(srp), parameter, public predator_attack_capture_prob_frz_50
A parameter factor defining the probability of capture of an immobile (freezing) agent by a predator:...
real(srp), parameter, public other_risks_habitat_safe
Habitat-specific mortality risk (not linked with predation) in the safe habitat.
integer, parameter, public chromosome_ploidy
The ploidy of the chromosome set. Can theoretically be haploid (=1), diploid (=2) or,...
logical, dimension(max_nalleles, n_chromosomes), parameter, public stom_reproduce_genotype_neuronal
The genotype structure for stomach perception effects on reproduction that goes via gamma2gene percep...
real(srp), parameter, public predation_risk_weight_immediate
The weight of the immediately seen predators over those in the perceptual memory stack....
logical, dimension(max_nalleles, n_chromosomes), parameter, public depth_actv_avoid_genotype_neuronal
The genotype structure for depth perception effects on active avoidance that goes via gamma2gene perc...
real(srp), dimension(*), parameter, public approach_food_gain_compet_factor_ordinate
The grid ordinate defining the nonparametric relationship that determines the expected food gain for ...
real(srp), parameter, public cortisol_init
Genotype to phenotype gamma2gene initialisation value for cortisol
integer, parameter, public platform_unix
elemental logical function, private float_equal_hrp_operator(value1, value2)
This is a wrapper for the commondata::float_equal_hrp() for building the user defined operator ....
real(srp), parameter swimming_cost_exponent_turbulent
Default swimming cost body mass exponent parameter for turbulent flow. See doi:10....
elemental real(srp) function, private m2cm_i(value_m)
Convert m to cm.
logical, public, protected is_zip_outputs
This parameter enables or disables post-processing compression of the data: if TRUE,...
real(srp), parameter, public energy_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for energy reserves perception effects on fear state.
real(srp), parameter, public sex_female_modulation_reproduce_gerror_cv
Gaussian error parameter (cv) for the sex modulation coefficient affecting reproduction motivation st...
real(srp), parameter, public food_item_capture_probability_min
The minimum probability of capture a food item, when the item is at a distance equal to the visual ra...
integer, parameter, public additive_comps
Number of additive allele components.
elemental real(srp) function, private gamma2gene_reverse(neuronal_response, gs, gh, nc)
Reverse-calculate perception value from the given neural response value.
real(srp), parameter, public conspcount_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for conspecifics number count perception effects on fear sta...
real(srp), parameter, public light_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for light perception effects on reproduction.
integer, parameter, public predators_num_habitat_safe
The number of predators in the safe habitat.
real(srp), dimension(3), parameter, public habitat_danger_min_coord
real(srp), parameter, public walk_random_distance_default_factor
The weighting factor used in calculation of the default random walk distance, in terms of the agent's...
real(srp), parameter, public migrate_food_gain_maximum_hope
This parameter defines the hope function for calculating the food gain expectancy in the migration be...
real(srp), parameter, public stom_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for stomach perception effects on fear state.
real(srp), parameter, public max_stomach_capacity_def
Set the maximum stomach capacity default value – fraction of the body mass available for food....
real(srp), parameter, public missing
Numerical code for missing and invalid real type values.
logical, parameter, public daylight_stochastic
Flag for stochastic daylight pattern (if TRUE) or deterministic sinusoidal (when FALSE)....
real(srp), parameter, public attention_switch_reproduce_age
Baseline attention switch, see commondata::attention_switch_hunger_light.
integer, parameter, public allelerange_min
The minimum possible value of alleles (allele range minimum) See implementation notes on the_genome::...
real(srp), parameter, public attention_switch_reproduce_conspec
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public predator_attack_capture_probability_min
Minimum probability of capture, e.g. at a distance exceeding the visual range. The latter assumes tha...
elemental real(srp) function, private within_r(value_in, vmin, vmax)
Force a value within the range set by the vmin and vmax dummy parameter values. If the value is withi...
real(srp), parameter, public other_risks_habitat_danger
Habitat-specific mortality risk (not linked with predation) in the dangerous habitat.
real(srp), parameter, public walk_random_distance_stochastic_cv
The coefficient of variation of the distance for stochastic Gaussian random walk (distance is in term...
integer, parameter, public platform_windows
Runtime platform ID constants. Use these constants for determining the current runtime platform,...
real(srp), parameter, public ga_reproduce_min_prop
Minimum proportion of reproducing agents, but note that the number of number reproducers cannot be sm...
logical, dimension(max_nalleles, n_chromosomes), parameter, public testosterone_genotype_phenotype
Genotype x Phenotype matrix for testosterone.
elemental real(srp) function, private mm2m_i(value_mm)
Convert mm to m.
real(srp), parameter, public percept_error_cv_def
Default perception error in the commondata::gamma2gene() neuronal response functions....
logical, dimension(max_nalleles, n_chromosomes), parameter, public bodymass_hunger_genotype_neuronal
The genotype structure for body mass perception effects on hunger that goes via gamma2gene perception...
integer, dimension(n_chromosomes), parameter, public len_chromosomes
The number of alleles in each of the chromosomes. NOTE: This must be an array (vector) of the size co...
real(srp), parameter, public attention_switch_hunger_age
Baseline attention switch, see commondata::attention_switch_hunger_light.
elemental logical function, private is_within_r(x, lower, upper)
Logical function to check if a value is within a specific range, lower <= X <= upper....
logical, dimension(max_nalleles, n_chromosomes), parameter, public growhorm_genotype_phenotype
Genotype x Phenotype matrix for growth hormone.
real(srp), parameter, public estrogen_init
Genotype to phenotype gamma2gene initialisation value for estrogen
integer, parameter, public hrp
Definition of the high real precision (HRP). This real type kind is used in pieces where a higher lev...
logical, dimension(max_nalleles, n_chromosomes), parameter, public foodcount_actv_avoid_genotype_neuronal
The genotype structure for food items count perception effects on fear state that goes via gamma2gene...
real(srp), parameter, public attention_switch_avoid_act_pred_dir
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public approach_conspecfic_dilute_general_risk
Multiplication factor for the general risk of predation used when the agent evaluates the approach to...
real(srp), parameter, public reprod_modulation_devel_agefull
Developmental modulation of reproductive motivation. This parameter defines the age (time steps) at w...
real(srp), parameter, public attention_switch_avoid_act_conspec
Baseline attention switch, see commondata::attention_switch_hunger_light.
integer, parameter, public popsize
Maximum population size.
real(srp), dimension(*), parameter, public motivation_compet_threshold_curve_ordinate
The array defining the ordinate (Y) of the nonparametric function curve that defines the threshold fo...
subroutine log_dbg(message_string, procname, modname)
LOG_DBG: debug message to the log. The message goes to the logger only when running in the DEBUG mode...
real(srp), parameter, public attention_switch_reproduce_pred_dir
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(hrp), parameter, public tolerance_high_def_hrp
Default value of high tolerance (low precision). This is the high commondata::hrp precision real....
integer, parameter, public long
In some (perhaps quite rare) cases of exponentiation we may also need huge integers,...
real(srp), parameter, public predator_body_size
The body size of the predator. In this version all predators have the same body size set by this para...
real(srp), parameter, public ga_mutationrate_batch_max
Maximum batch mutation rate in the adaptive Fixed Fitness Genetic Algorithm.
real(srp), parameter, public food_mem_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for food items count perception effects on reproduction.
elemental real(srp) function, private mm2m_r(value_mm)
Convert mm to m.
real(srp), parameter, public bodymass_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for body mass perception effects on fear state.
integer, parameter, public predator_risk_group_select_index_partial
Sets the limit for partial indexing and ranking of prey agents in the visual range of the predator....
real(srp), dimension(3), parameter, public habitat_safe_max_coord
pure real(srp) function, private average_r(array_in, missing_code, undef_ret_null)
Calculate an average value of a real array, excluding MISSING values.
real(srp), parameter, public dist_expect_food_uncertain_fact
The weighting factor for the distance to the expected food item if the actual distance is uncertain (...
integer, parameter, public food_abundance_habitat_safe
The food abundance in the safe habitat.
real(srp), parameter, public pred_direct_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for direct predation perception effects on fear state.
subroutine log_check_external(exec, debug_only, is_valid)
Check if an external procedure can be called and log the result.
real(srp), dimension(*), parameter, public attention_modulation_curve_abscissa
The array defining the abscissa (X) of the nonparametric function that defines the attention modulati...
real(srp), parameter, public depth_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for depth perception effects on reproduction.
real(srp), parameter, public body_mass_min
Minimum possible body mass, hard limit.
pure subroutine, private add_to_history_char(history_array, add_this)
Simple history stack function, add to the end of the stack. We need only to add components on top of ...
subroutine, private timer_cpu_start(this, timer_title)
Start the timer object, stopwatch is now ON.
real(srp), parameter, public init_agents_depth
The fixed depth at which the agents are initialised at the start of the simulation....
integer, parameter, public allelerange_max
The maximum possible value of alleles (allele range maximum) See implementation notes on the_genome::...
character(len= *), parameter lock_file
The name of the lock file. The lock file is created at the start of the simulation and is deleted at ...
elemental logical function, private float_approx_srp_operator(value1, value2)
This is a wrapper for the commondata::float_equal_srp() for building the user defined operator ....
real(srp), parameter, public attention_switch_reproduce_predator
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public stomach_content_emptify_factor
Stomach content emptify factor at each step.
real(srp), parameter, public walk_random_vertical_shift_cv_ratio
The ratio of the vertical to the main horizontal coefficients of variation for the vertical depth dis...
elemental logical function, private float_equal_srp(value1, value2, epsilon)
Check if two real values are nearly equal using the commondata::is_near_zero(). Thus function can be ...
real(srp) function, private random_add_subtract(x, y)
Random operator, adds or subtracts two values with equal probability, used in the random walk functio...
character(len=long_label_length) function, dimension(:), allocatable parse_abstract(file_name)
Get and parse the model abstract. Model abstract is a short descriptive text that can span several li...
logical, dimension(max_nalleles, n_chromosomes), parameter, public body_length_genotype_phenotype
The initial value of the body length at birth is genetically determined. This is the Genotype x Pheno...
real(srp), parameter, public living_cost
Living cost in terms of food consumed. metabolic costs, p roportional to body size.
integer, parameter, public history_size_agent_prop
History stack size for the agent's basic properties, such as body length and body mass....
real(srp), parameter, public mutationrate_point
Mutation rate for point allele mutations.
real(srp), parameter, public thyroid_init
Genotype to phenotype gamma2gene initialisation value for thyroid
logical, parameter, public true
Safety parameter avoid errors in logical values, so we can now refer to standard Fortran ....
real(srp), parameter, public attention_switch_avoid_act_light
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public sex_ratio
Sex ratio for initialising genomes.
real(srp), parameter, public attention_switch_avoid_act_reprfac
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public energy_init
This is the initial value of the energy reserves, non-genetic mean.
subroutine system_halt(is_error, message, ignore_lockfile)
Halt execution of the system with a specific message and exit code. The exit code is normally passed ...
logical, parameter, public yes
integer, parameter, public label_cen
elemental real(hrp) function, private m2cm_hr(value_m)
Convert m to cm.
real(srp), public global_rescale_maximum_motivation
Global maximum sensory information that is updated for the whole population of agents.
real(srp), parameter, public age_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for age perception effects on reproduction.
character(len=:), allocatable, public, protected mmdd
MMDD tag, year, month and day, used in file names and outputs. The value of the tag should be obtaine...
real(srp), parameter, public predator_attack_rate_default
Mean rate of a single predator attack.
elemental logical function, private float_equal_srp_operator(value1, value2)
This is a wrapper for the commondata::float_equal_srp() for building the user defined operator ....
character(len= *), parameter, public error_allocation_fail
Error message **"Cannot allocate array or object"** is issued if an array or an object is checked and...
pure integer function, dimension(:), allocatable, private stack2arrays_i(a, b)
Concatenate two arrays a and b. This procedure uses array slices which would be faster in most cases ...
pure logical function, private is_maxval_i(value, array)
Function to check if the value is the maximum value of an array (returns TRUE), or not (return FALSE)...
real(srp), parameter, public migrate_dist_penetrate_offset
The offset, in terms of the body length of the actor agent, for initial penetrating into the target e...
real(srp), parameter, public zero
Some parameters should never be zero or below. In such cases they could be set to some smallest disti...
real(srp), dimension(*), parameter, public probability_reproduction_delta_mass_ordinate
Interpolation grid ordinate for the body mass ratio factor that scales the probability of reproductio...
real(srp), parameter, public relocation_swap_rate
Mutation rate for chromosome relocation, i.e. probability of a gene moving to a different position on...
integer, parameter, public dielcycles
Number of days and nights in a lifespan, DIELCYCLES=500.
logical, parameter, public zip_outputs_background
This parameter defines if the output files are compressed in the background in the parallel mode or t...
logical, public, protected is_screen_output
Sets the model in screen output mode. If TRUE, the logger output goes to the screen (standard output ...
integer, parameter, public lifespan
Number of time steps in the agent's maximum life length.
real(srp), dimension(*), parameter, public predator_risk_group_dilution_ordinate
The array defining the ordinate grid values for the weighting nonparametric function linking the dist...
logical, dimension(max_nalleles, n_chromosomes), parameter, public food_mem_hunger_genotype_neuronal
The genotype structure for food items count perception effects on hunger that goes via gamma2gene per...
integer, public global_frame_number
The current global time frame. Frames are time steps within the time step defined by the commondata::...
integer, parameter, public history_size_behaviours
The size of the behaviour labels history stack, i.e. for how many time steps should the stack remembe...
real(srp), parameter, public depth_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for depth perception effects on hunger.
real(srp), parameter, public preycontrast_default
Inherent contrast of prey, CONTRAST =1.0.
real(srp), parameter, public food_item_capture_prop_cost
The cost of the food item catching, in terms of the food item mass (proportional cost)....
logical, dimension(max_nalleles, n_chromosomes), parameter, public pred_meancount_hunger_genotype_neuronal
The genotype structure for mean predator number perception effects on hunger that goes via gamma2gene...
real(srp), parameter, public attention_switch_hunger_food_dir
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public mutationrate_batch
Mutation rate for point allele mutations, a whole batch of allele components.
real(srp), dimension(*), parameter, public reproduct_body_mass_offspr_abscissa
The array defining the abscissa (X) of the nonparametric function curve that defines the relationship...
elemental real(srp) function alleleconv(raw_value)
real(srp), parameter, public reprod_modulation_devel_agestart
Developmental modulation of reproductive motivation. This parameter defines the starting age (time st...
real(srp), parameter, public attention_switch_reproduce_reprfac
Baseline attention switch, see commondata::attention_switch_hunger_light.
elemental real(srp) function allelescale(raw_value)
Converts and rescales integer allele value to real value for neural response function.
real(srp), dimension(*), parameter, public behav_go_up_down_step_stdlen_static
This parameter array defines the step sizes, in units of the agent's body length, for the the_behavio...
real(srp) function std_dev(array_in, missing_code, undef_ret_null)
Calculate standard deviation using trivial formula:
logical, parameter, public modulation_appraisal_disable_all
Disable developmental or genetic modulation of the APPRAISAL completely. If set to TRUE,...
real(srp), parameter, public bodymass_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for body mass perception effects on reproduction.
pure subroutine, private add_to_history_r(history_array, add_this)
Simple history stack function, add to the end of the stack. We need only to add components on top of ...
real(srp), dimension(*), parameter, public linear_growth_hormone_increment_factor_curve_ordinate
The array defining the ordinate (Y) of the nonparametric function curve that defines the function lin...
logical, public, protected is_plotting
This parameter controls if the debug plots are produced. They can be huge number that takes lots of s...
real(srp), parameter, public invalid
logical, dimension(max_nalleles, n_chromosomes), parameter, public conspcount_reproduce_genotype_neuronal
The genotype structure for conspecifics number perception effects on reproduction that goes via gamma...
real(srp), parameter, public attention_switch_hunger_reprfac
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public light_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for light perception effects on hunger.
real(srp), dimension(*), parameter, public linear_growth_hormone_increment_factor_curve_abscissa
The array defining the abscissa (X) of the nonparametric function curve that defines the function lin...
real(srp), dimension(*), parameter, public arousal_gos_dissipation_nonpar_ordinate
This is the array defining the ordinate (Y) of the nonparametric spontaneous arousal dissipation fact...
logical, dimension(max_nalleles, n_chromosomes), parameter, public pred_direct_actv_avoid_genotype_neuronal
The genotype structure for direct predation perception effects on fear state that goes via gamma2gene...
elemental real(srp) function, private gamma2gene_fake_vals(signal, gs, gh, n_acomps)
This "fake" version of the gamma2gene is used to guess the response values in calculations.
elemental real(srp) function conv_l2r(flag, code_false, code_true)
Converts logical to standard (kind SRP) real, .FALSE. => 0, .TRUE. => 1.
logical, dimension(max_nalleles, n_chromosomes), parameter, public depth_hunger_genotype_neuronal
The genotype structure for depth perception effects on hunger that goes via gamma2gene perception to ...
real(srp), parameter, public attention_switch_hunger_pred_dir
Baseline attention switch, see commondata::attention_switch_hunger_light.
pure logical function, private is_within_operator_r(x, limits)
A wrapper function for commondata::is_within() to build a user defined operator. Basically,...
real(srp), parameter, public attention_switch_reproduce_food_mem
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp) function, private timer_cpu_elapsed(this)
Calculate the time elapsed since the stopwatch subroutine was called for this instance of the timer c...
logical, dimension(max_nalleles, n_chromosomes), parameter, public pred_direct_reproduce_genotype_neuronal
The genotype structure for direct predation perception effects on reproduction that goes via gamma2ge...
real(srp), parameter, public food_item_capture_probability_subjective_errorr_cv
Subjective error assessing the food item capture probability when assessing the subjective GOS expect...
elemental real(srp) function carea(R)
Calculate a circle area.
integer, parameter, public predation_risk_weight_memory_window
The length of the perceptual memory window that is taken into account and weighted against the curren...
character(len= *), parameter, public ltag_warn
real(srp), parameter, public attention_switch_hunger_depth
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public reprfac_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for reproductive factor perception effects on fear state.
character(len=:) function, allocatable, private parse_svn_version()
Parse and cut revision number in form of string from the whole SVN revision string....
subroutine debug_interpolate_plot_save(grid_xx, grid_yy, ipol_value, algstr, output_file, enable_non_debug)
Produce a debug plot of the interpolation data using an external program htinterp from the HEDTOOLS t...
real(srp), parameter, public energy_gerror_cv
Genotype to phenotype initialisation, Gaussian error parameter. Coefficient of variation for the ENER...
real(srp), dimension(3), parameter, public habitat_safe_min_coord
Definition of the habitat spatial limits.
real(srp), parameter, public attention_switch_hunger_predator
Baseline attention switch, see commondata::attention_switch_hunger_light.
integer, parameter, public d_prec_64
real(srp), parameter, public food_item_size_default
Default size of a single food item.
logical, dimension(max_nalleles, n_chromosomes), parameter, public age_reproduce_genotype_neuronal
The genotype structure for age perception effects on reproduction that goes via gamma2gene perception...
character(len= *), dimension(n_chromosomes), parameter, public lab_chromosomes
Set the labels of the chromosomes. NOTE, must be an array(vector) ) of the size commondata::n_chromos...
character(len= *), parameter, public exec_histogram
The name of the histogram program (hthist.f90 from HEDTOOLS) executable.
real(srp), dimension(3), parameter, public habitat_danger_max_coord
real(srp), parameter, public body_length_gerror_cv
Genotype to phenotype initialisation, Gaussian error parameter. Coefficient of variation for the BODY...
real(srp), parameter, public body_length_min
Minimum body length possible.
real(srp), parameter, public control_unselected_init
The initial value of the control unselected trait that goes through the gamma2gene.
real(srp), parameter, public foodcount_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for food items count perception effects on fear state.
real(srp), dimension(*), parameter, public probability_reproduction_delta_mass_abscissa
Interpolation grid abscissa for the body mass ratio factor that scales the probability of reproductio...
real(srp), parameter, public food_item_mean_size
The above is also the average size of a stochastic Gaussian food items.
real(srp), parameter, public escape_dart_distance_default_factor
The weighting factor used in calculation of the default escape distance. The escape distance is equal...
elemental real(hrp) function, private cm2m_hr(value_cm)
Convert cm to m.
real(srp), parameter, public beamatt
Beam attenuation coefficient of water (m-1),BEAMATT = 1.0.
real(srp), dimension(*), parameter reprod_modulation_devel_abscissa
Developmental modulation of reproductive motivation. This is the interpolation grid abscissa defining...
real(srp), parameter, public reproduction_cost_offspring_fract_female
The component of the energetic cost of reproduction in females that is proportional to the total offs...
elemental real(srp) function, private rescale_1(value_in, A1, B1)
Rescale a real variable with the range 0:1 to have the new range A1:B1.
real(srp), parameter, public age_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for age perception effects on hunger.
character(len=:) function, allocatable, private timer_cpu_title(this)
Return the title of the current timer object.
integer, public, protected lock_file_unit
This is the unit number that identifies the lock file. The lock file is created at the start of the s...
real(srp), parameter, public attention_switch_hunger_conspec
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), dimension(*), parameter, public walk_random_food_hope_abscissa
This parameter defines the hope function for calculating the food perception expectancy in the the_be...
logical, dimension(max_nalleles, n_chromosomes), parameter, public light_hunger_genotype_neuronal
The genotype structure for light perception effects on hunger that goes via gamma2gene perception to ...
real(srp), parameter, public attention_switch_avoid_act_age
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public food_item_migrate_depth_mean
Mean shift parameter for the local random walk movement of food items in the vertical (depth) plane.
integer, parameter, public label_cst
This parameter defines the range of characters that is used for generating random labels,...
elemental real(srp) function, private rescale_full(value_in, A, B, A1, B1)
Rescale a real variable with the range A:B to have the new range A1:B1.
real(srp), dimension(*), parameter, public arousal_gos_dissipation_nonpar_abscissa
This is the array defining the abscissa (X) of the nonparametric spontaneous arousal dissipation fact...
integer, parameter, public ga_reproduce_n_min
Absolute minimum number of reproducing agents in the adaptive GA procedure. See the_population::popul...
elemental logical function, private float_equal_hrp(value1, value2, epsilon)
Check if two real values are nearly equal using the commondata::is_near_zero(). Thus function can be ...
logical, parameter, public preevol_tsteps_force_debug_enabled
This parameter enables the forced smaller fixed number of time steps set by the commondata::preevol_t...
real(srp), parameter, public testosterone_init
Genotype to phenotype gamma2gene initialisation value for testosterone
integer, public global_time_step_model_current
The current global time step of the model. This is a global non fixed-parameter variable that is upda...
real(srp), parameter, public reproduction_cost_body_mass_factor_male
The component of the energetic cost of reproduction in males that is proportional to the agent's body...
real(srp), parameter, public foodcount_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for food items count perception effects on reproduction.
logical, dimension(max_nalleles, n_chromosomes), parameter, public age_actv_avoid_genotype_neuronal
The genotype structure for age perception effects on fear state that goes via gamma2gene perception t...
character(len=:), allocatable, public, protected svn_version
Subversion or Mercurial revision number that is parsed by commondata::parse_svn_version()....
subroutine system_init()
Initialises the system environment and sets basic parameters.
real(srp), parameter, public growhorm_gerror_cv
Genotype to phenotype gamma2gene Gaussian error parameter. This is really the coefficient of variatio...
real(srp), parameter, public attention_switch_reproduce_bodymass
Baseline attention switch, see commondata::attention_switch_hunger_light.
logical, dimension(max_nalleles, n_chromosomes), parameter, public foodcount_reproduce_genotype_neuronal
The genotype structure for food items count perception effects on reproduction that goes via gamma2ge...
elemental real(srp) function, private cm2m_r(value_cm)
Convert cm to m.
real(srp), parameter, public energy_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for energy reserves perception effects on reproduction.
logical, dimension(max_nalleles, n_chromosomes), parameter, public age_hunger_genotype_neuronal
The genotype structure for age perception effects on hunger that goes via gamma2gene perception to ne...
character(len= *), parameter, private procname
PROCNAME is the procedure name for logging and debugging (with commondata::modname).
pure subroutine, private add_to_history_i4(history_array, add_this)
Simple history stack function, add to the end of the stack. We need only to add components on top of ...
real(srp), parameter, public cortisol_gerror_cv
Genotype to phenotype gamma2gene Gaussian error parameter. This is really the coefficient of variatio...
integer, parameter, public preevol_tsteps_force_debug
Number of time steps in the agent's life at the fixed fitness pre-evolution stage....
logical, dimension(max_nalleles, n_chromosomes), parameter, public bodymass_actv_avoid_genotype_neuronal
The genotype structure for body mass perception effects on active avoidance that goes via gamma2gene ...
elemental real(srp) function length2sidearea_fish(body_length)
A function linking body length with the body area in fish.
real(srp), parameter, public relocation_shift_rate
real(srp), parameter, public ga_mutationrate_point_max
Maximum point mutation rate in the adaptive Fixed Fitness Genetic Algorithm.
real(srp), parameter, public allelescale_max
Conversion parameter that defines the scaling of the integer allele values ::ALLELERANGE_MIN to ALLEL...
real(srp), parameter, public attention_switch_avoid_act_bodymass
Baseline attention switch, see commondata::attention_switch_hunger_light.
logical, dimension(max_nalleles, n_chromosomes), parameter, public reprfac_hunger_genotype_neuronal
The genotype structure for reproductive factor perception effects on hunger that goes via gamma2gene ...
real(srp), parameter, public food_item_capture_probability
The baseline probability that the food item is captured. See the_neurobio::food_item_capture_probabil...
real(srp), parameter, public migrate_dist_max_step
The maximum distance (in units of the agent body length) a migrating agent can pass for a single time...
character(len= *), parameter, public csv
Standard data file extension for data output is now .csv.
real(srp), parameter, public attention_switch_avoid_act_food_dir
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), dimension(*), parameter, public motivation_compet_threshold_curve_abscissa
The array defining the abscissa (X) of the nonparametric function curve that defines the threshold fo...
real(srp), parameter, public conspcount_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for conspecifics number count perception effects on reproduc...
real(srp), parameter, public preyarea_default
Area of prey (m2), PREYAREA = 3.E-6.
integer, parameter, public consp_select_items_index_partial
Sets the limit for partial indexing and ranking of conspecifics in the visual range of the agent.
logical, parameter, public use_posix_fs_utils
Logical flag for setting if POSIX direct filesystem procedures are used. These utilities are implemen...
elemental integer function conv_l2i(flag, code_false, code_true)
Converts logical to integer following a rule, default FALSE = 0, TRUE = 1.
real(srp), parameter, public light_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for light perception effects on fear state.
elemental logical function, private is_within_i(x, lower, upper)
Logical function to check if a value is within a specific range, lower <= X <= upper....
real(srp), parameter, public walk_random_pred_risk_hope_agentl
The maximum walk distance, in units of the agent body length, when the expected predation risk is cal...
real(srp), dimension(*), parameter, public sex_steroids_increment_factor_age_curve_abscissa
The array defining the abscissa (X) of the nonparametric function curve that defines the relationship...
integer, parameter, public max_nalleles
This parameter defines the maximum number of alleles within the chromosome It IS NOT intended to vary...
real(srp), parameter, public ga_reproduce_pr
Percentage of the best reproducing agents in the pre-evolution phase.
real(srp), parameter, public food_item_migrate_xy_mean
Mean shift parameter for the local random walk movement of food items in the horizontal plane.
logical, dimension(max_nalleles, n_chromosomes), parameter, public energy_hunger_genotype_neuronal
The genotype structure for energy reserves perception effects on hunger that goes via gamma2gene perc...
integer, parameter, public history_size_motivation
Sets the size of the emotional state memory stack.
character(len= *), parameter, public exec_scatterplot
The name of the scatterplot program (htscatter.f90 from HEDTOOLS) executable.
real(srp), dimension(*), parameter, public sex_steroids_increment_factor_len_curve_ordinate
The array defining the ordinate (Y) of the nonparametric function curve that defines the relationship...
real(srp), parameter, public estrogen_gerror_cv
Genotype to phenotype gamma2gene Gaussian error parameter. This is really the coefficient of variatio...
real(srp), parameter, public food_mem_actv_avoid_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for food items count perception effects on fear state.
real(srp), parameter, public individual_mortality_risk_def
Default individually-specific mortality risk. It can increase or decrease depending on various factor...
real(srp), parameter, public migrate_random_max_dist_target
Default maximum distance towards the target environment (in units of the agent's body size) when the ...
real(srp), parameter, public lo_valid_sanitised
Lower bound for do_sanitise() procedure. This is the lowest value that considered valid.
integer function ieee_error_reporting(reset, tnote)
Check if an IEEE error condition has occurred.
real(srp), parameter, public attention_switch_hunger_food_mem
Baseline attention switch, see commondata::attention_switch_hunger_light.
integer, parameter, public predators_num_habitat_danger
The number of predators in the dangerous habitat.
subroutine log_ieee(ttag, always_log, reset_flags)
LOG_IEEE: Check and log IEEE signalling flags. Logging normally occurs only if any nonzero output fro...
subroutine, private logger_init()
logger_init Initialise the system and the system logger.
real(srp), parameter, public reproduction_cost_offspring_fract_male
The component of the energetic cost of reproduction in males that is proportional to the total offspr...
real(srp), parameter, public pred_direct_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for direct predation perception effects on reproduction.
real(srp), parameter, public food_item_minimum_size
The minimum size of a food item. This is the "floor" in case the stochastically generated (e....
real(srp), parameter, public tolerance_high_def_srp
Default value of high tolerance (low precision). This is the standard commondata::srp precision real....
pure real(srp) function, private average_i(array_in, missing_code, undef_ret_null)
Calculate an average value of an integer array, excluding MISSING values.
real(srp), parameter, public lightdecay
Vertical conservation of light, per depth (old code lightdecay=0.2).
real(srp), dimension(*), parameter, public walk_random_food_hope_ordinate
This parameter defines the hope function for calculating the food perception expectancy in the the_be...
real(srp), dimension(*), parameter, public sex_steroids_increment_factor_age_curve_ordinate
The array defining the ordinate (Y) of the nonparametric function curve that defines the relationship...
real(srp), parameter, public food_item_migrate_xy_cv
Coefficient of variation parameter for the local random walk movement of food items in the horizontal...
real(srp), parameter, public walk_random_vertical_shift_ratio
The ratio of the vertical to main horizontal shift parameters of the agent's Gaussian random walk....
pure logical function, private is_within_operator_i(x, limits)
A wrapper function for commondata::is_within() to build a user defined operator. Basically,...
logical, dimension(max_nalleles, n_chromosomes), parameter, public stom_actv_avoid_genotype_neuronal
The genotype structure for stomach perception effects on active avoidance that goes via gamma2gene pe...
real(srp), parameter, public pred_meancount_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for mean predator number perception effects on reproduction.
real(srp), parameter, public viscap
Dimensionless descriptor of fish eye quality, VISCAP=1.6E6.
character(len= *), parameter, public cmd_zip_output
This parameter defines the compression program that is executed to "zip" the data files if commondata...
character(len= *), parameter, public svn_version_string
Subversion or Mercurial revision number (or ID) of the model code.
real(srp), parameter, public history_perception_window_food
The size of the memory window that is used in the assessment of food gain, as a portion of the common...
real(srp) function, private gamma2gene_additive_r4(gs, gh, signal, erpcv)
The function gamma2gene finds the sigmoid relationship for a complex multicomponent 2-allele impact o...
real(srp), dimension(*), parameter, public sex_steroids_increment_factor_len_curve_abscissa
The array defining the abscissa (X) of the nonparametric function curve that defines the relationship...
logical, parameter, public lifecycle_predation_disabled_debug
This parameter completely disables predation in the GA life cycle procedure.
character(len= *), parameter, public male
Set names of the sexes – the allele labels.
logical, dimension(max_nalleles, n_chromosomes), parameter, public stom_hunger_genotype_neuronal
The genotype structure for stomach perception effects on hunger that goes via gamma2gene perception t...
real(srp), parameter, public swimming_cost_factor_buoyancy_down
This parameter defines the cost of the buoyancy-based locomotion as a fraction of normal laminar flow...
logical, dimension(max_nalleles, n_chromosomes), parameter, public sex_male_modulation_reproduce_genotype
The genotype structure for sex modulation coefficient affecting reproduction motivation state in male...
real(srp) function, private gamma2gene_additive_i4(gs, gh, signal, erpcv)
The function gamma2gene finds the sigmoid relationship for a complex multicomponent 2-allele impact o...
logical, parameter, public enable_save_agents_each_timestep
This parameter defines if all agents data is saved at each time step of the life cycle....
real(srp), parameter, public swimming_speed_cost_burst
Set the weighting factor parameter of burst swimming cost in terms of the agent body size and the dis...
real(srp), parameter, public sex_male_modulation_reproduce_gerror_cv
Gaussian error parameter (cv) for the sex modulation coefficient affecting reproduction motivation st...
real(srp), parameter, public walk_random_food_gain_hope
The maximum walk distance, in units of the average distance to food items in the current perception o...
character(len= *), parameter, public error_auto_param_arrays
Error message for **"no automatic determination of the size in parameter"** arrays in the style:
character(len= *), parameter, public female
real(srp), parameter, public individual_visual_contrast_default
Inherent contrast of the agent, It is used in determining the visual range of an agent in perception ...
real(srp), parameter, public attention_switch_avoid_act_predator
Baseline attention switch, see commondata::attention_switch_hunger_light.
character(len=label_length), parameter sexlocus_label
Labels for the sex locus alleles (gene) - vector as we don't need to label individual alleles....
character(len= *), parameter, public ltag_timer
pure logical function, private is_minval_i(value, array)
Function to check if the value is the minimum value of an array (returns TRUE), or not (return FALSE)...
character(len=:) function, allocatable, private timer_cpu_log(this)
A ready to use shortcut function to be used in logger, just adds the TIMER: tag in front of the norma...
real(srp), parameter, public stomach_content_init
Set average stomach capacity at birth/init in units of body weight,.
logical, dimension(max_nalleles, n_chromosomes), parameter, public pred_direct_hunger_genotype_neuronal
The genotype structure for direct predation perception effects on hunger that goes via gamma2gene per...
subroutine file_delete(file_name, success)
Delete a file from the local file system using Fortran open status=delete or fast POSIX C call.
real(srp), parameter, public stom_reproduce_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for stomach perception effects on reproduction.
real(srp), parameter, public other_risks_def
Default level of other mortality risks in the habitat.
logical, parameter, public false
real(srp), parameter, public predator_attack_capture_prob_frz_75
A parameter factor defining the probability of capture of an immobile (freezing) agent by a predator:...
logical, dimension(max_nalleles, n_chromosomes), parameter, public food_mem_actv_avoid_genotype_neuronal
The genotype structure for food items count perception effects on fear state that goes via gamma2gene...
character(len= *), parameter, public ltag_stage
real(srp), parameter, public mass_growth_threshold
A minimum body mass increment when any linear growth is possible, in units of the body mass (e....
character(len= *), parameter, public ltag_info
real(srp), parameter, public attention_switch_reproduce_food_dir
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public attention_switch_hunger_stomach
Baseline attention switch, see commondata::attention_switch_hunger_light.
real(srp), parameter, public bodymass_hunger_genotype_neuronal_gerror_cv
Gaussian perception error parameter (cv) for body mass perception effects on hunger.
CPU timer container object for debugging and speed/performance control. Arbitrary timers can be insta...