nicfel / CoupledMCMC

Adaptive parallel tempering for Beast2
GNU General Public License v3.0
7 stars 4 forks source link

Fix attempt for issue with state file names when the state file name is user defined. #9

Closed jscire closed 4 years ago

jscire commented 4 years ago

I noticed a bug when using CoupledMCMC, the state files are mangled, written on top of themselves, preventing the MCMC chain from resuming. I think the bug comes from the use of the setStateFile method in the Runnable class. setStateFile only assigns fileName to the stateFileName variable if the the state file name is not user-defined already, so if the -state option is not used when launching beast. So when using a -state option, all the setStateFile(filename) calls from HeatedChain are void, since the stateFileName variable is assigned back to the content of the -state option. I tried to fix that by overriding the setStateFile method in HeatedChain. It seems to work, I'm able to use the -state option and resume analysis.

PS: I just noticed the changes in imports that my commit has. I'm not sure where they come from, they are not intentional on my part. Feel free to reject the pull request if that causes an issue.