TreeMig Code
Loading...
Searching...
No Matches
EvaluateResultFunctions.f90
Go to the documentation of this file.
1!=====================================================================
15!===============================================================
16
17 REAL function biodivindex(nspc, specbio, sumbio)
18
19 ! <CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
20 IMPLICIT NONE
21
22 ! <Passed variables>--------------------------------------------------------------------------------
23 INTEGER, INTENT(in) :: nspc ! Passed number of species
24 REAL, INTENT(in) :: specbio(nspc), & ! species biomass
25 sumbio
26
27 ! <Local variables>---------------------------------------------------------------------------------
28 INTEGER :: i ! loop-counter
29 REAL :: diversity, rnspc, value
30
31 ! <Here the SUBROUTINE starts>**********************************************************************
32 !----- Calculation of diversity per species
33 rnspc = nspc
34 diversity = 0.0
35
36 if (abs(sumbio) < 1.e-20) then
37 diversity = 0.0
38 else
39 byspc2: do i = 1, nspc
40 value = specbio(i) / sumbio
41 if (value .gt. 1.e-5 ) then
42 value = -value * log(value)
43 diversity = diversity + value / log(rnspc)
44 end if
45 end do byspc2
46 end if
47
48 biodivindex = diversity
49
50end function biodivindex
51!****<Here the SUBROUTINE ends>********************************************************************
52
53
real function biodivindex(nspc, specbio, sumbio)
BiodivIndex