From 10b99e5899c2ce66724029bb7f72acefb27a31a0 Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Fri, 6 Dec 2024 13:55:01 -0800 Subject: [PATCH] fix: Ensure tempering level state is initialized --- ...ulation.tempered_differential_evolution.F90 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/posterior_sampling.simulation.tempered_differential_evolution.F90 b/source/posterior_sampling.simulation.tempered_differential_evolution.F90 index cadd0b544d..8a0719314f 100644 --- a/source/posterior_sampling.simulation.tempered_differential_evolution.F90 +++ b/source/posterior_sampling.simulation.tempered_differential_evolution.F90 @@ -54,9 +54,9 @@ function is heated up and cooled down to allow chains to more easily walk throug Implementation of a posterior sampling simulation class which implements a tempered differential evolution algorithm. !!} private - integer :: untemperedStepCount , temperingLevelCount , & + integer :: untemperedStepCount , temperingLevelCount , & & stepsPerLevel - integer :: temperingStep , temperingLevelMonotonic + integer :: temperingStep , temperingLevelMonotonic double precision :: temperatureMaximum class (posteriorSampleDffrntlEvltnPrpslSzTmpExpClass), pointer :: posteriorSampleDffrntlEvltnPrpslSzTmpExp_ => null() double precision , allocatable, dimension(:) :: temperatures @@ -64,8 +64,8 @@ function is heated up and cooled down to allow chains to more easily walk throug contains !![ - - + + !!] final :: temperedDifferentialEvolutionDestructor @@ -186,6 +186,8 @@ subroutine temperedDifferentialEvolutionInitialize(self,posteriorSampleDffrntlEv self%untemperedStepCount = untemperedStepCount self%stepsPerLevel = stepsPerLevel self%temperatureMaximum = temperatureMaximum + self%temperingLevelMonotonic = 0 + self%temperingStep = 0 allocate(self%temperatures(temperingLevelCount)) allocate(posteriorSampleStateSimple :: self%temperedStates(temperingLevelCount)) do i=1,temperingLevelCount @@ -328,10 +330,10 @@ integer function temperedDifferentialEvolutionLevel(self) class(posteriorSampleSimulationTemperedDffrntlEvltn), intent(inout) :: self temperedDifferentialEvolutionLevel=self%temperingLevelMonotonic - if (self%temperingLevelMonotonic > self%temperingLevelCount) & - & temperedDifferentialEvolutionLevel= 2 & - & *self%temperingLevelCount & - & -self%temperingLevelMonotonic + if (self%temperingLevelMonotonic > self%temperingLevelCount) & + & temperedDifferentialEvolutionLevel=+2 & + & *self%temperingLevelCount & + & -self%temperingLevelMonotonic return end function temperedDifferentialEvolutionLevel