Multihistogram

ParallelTemperingMonteCarlo.Multihistogram.EntropycalcMethod
Entropycalc(alpha::Vector, bmat::Matrix, HistArray::Matrix, nsum::VorS, NBins::Int)

Having determined the vector solution to Ax=b, we input alpha and the "b-matrix" the term n_{ij}*(ln(n_{ij} + beta_iE_j) we can find the entropy as a function of energy.

source
ParallelTemperingMonteCarlo.Multihistogram.analysisMethod
analysis(energyvector::VorS, S_E::Vector, beta::VorS, kB::Float64, NPoints::Int; debug = false)

NPoints determines how densely the points are populated.

Analysis takes in the energy bin values, entropy per energy and inverse temperatures beta. It calculates the temperatures T, and then finds the partition function – note that the boltzmann factors XP are self-scaling so they vary from 1 to 100, this is not necessary but prevents numerical errors in regions where the partition function would otherwise explode in value.

Output is the partition function, heat capacity and its first derivative as a function of temperature.

source
ParallelTemperingMonteCarlo.Multihistogram.bvectorMethod
bvector(HistArray::Matrix{N}, energyvector::VorS, beta::VorS, nsum::VorS, NTraj::Int, NBins::Int; debug = false) where N <: Number

Function to calculate the b vector relevant to solving the RHS of the multihistogram equation.

source
ParallelTemperingMonteCarlo.Multihistogram.initialiseMethod
initialise(xdir::String)
initialise(Output::Output,Tvec::TempGrid)

Function to retrieve all histogram information from the histogram directory outputted by Edison's PTMC code for method one, or directly from the output data given from the Julia PTMC code.

We read the files with readfile, process the file with processhist! and output all relevant arrays and constants as defined in the constituent functions.

source
ParallelTemperingMonteCarlo.Multihistogram.multihistogramMethod
multihistogram(xdir::String; NPoints = 1000)
multihistogram(output::Output, Tvec::TempGrid; outdir = pwd(), NPoints = 1000)

Function has two methods which vary only in how the initialise function is called: one takes a directory and writes the output of the multihistogram analysis to that directory, the other takes the output and temperature grid and writes to the current directory unless specified otherwise. The output of this function are the four files defined in run_multihistogram.

source
ParallelTemperingMonteCarlo.Multihistogram.processhist!Method
processhist!(HistArray::Matrix{N}, energyvector::VorS, NBins::Int, NTraj::Int) where N <: Number

This function normalises the histograms, collates the bins into their total counts and then deletes any energy bin containing no counts – this step is required to prevent NaN errors when doing the required calculations.

HistArray,energyvector are the total histograms and values of the energy bins respectively, they are only changed by normalisation and removal of unnecessary rows nsum is merely the total histogram count for each energy bin

source
ParallelTemperingMonteCarlo.Multihistogram.readfileMethod
readfile(xdir::String; debug = false)
readfile(output::Output, Tvals::TempGrid)

Method 1: xdir::String -reads output files for the FORTRAN PTMC code written by Edison Florez. Method 2: output::Output, Tvals::TempGrid - designed to receive output data from the Julia PTMC program: as the beta vector and NBins are defined in the structs they can be directly unpacked as output.

xdir is the directory containing the histogram information usually /path/to/output/histograms

HistArray is the NTrajxNBins array containing all histogram counts energyvector is an NBins length vector containing the energy value of each bin beta is an NTraj length vector of 1/(kBT) NBins,NTraj,kB are constant values required throughout

source
ParallelTemperingMonteCarlo.Multihistogram.run_multihistogramMethod
run_multihistogram(HistArray::Matrix{N}, energyvector::VorS, beta::VorS, nsum::VorS, NTraj::Int, NBins::Int, kB::Float64, outdir::String, NPoints::Int; debug = false) where N <: Number

This function completely determines the properties of a system given by the output of the initialise function and a specified directory to write to. It outputs four files with the following information:

  • histograms.data The top line are the corresponding energy values and the next NTraj lines are the raw histogram data. This file can be used to plot the histograms if needed.
  • Sol.X containing the solution to the linear equation Ax=B,
  • S.data containing the energy values and corresponding entropies
  • analysis.NVT containing the temperatures, partition function, heat capacity and its derivative. NB now includes the temperature dependent Entropy function.
source
ParallelTemperingMonteCarlo.Multihistogram.systemsolverMethod
systemsolver(HistArray::Matrix, energyvector::VorS, beta::VorS, nsum::VorS, NTraj::Int, NBins::Int; debug = false)

systemsolver is used to determine the solution Alpha to the linear equation Ax = b where A and b are the A matrix and b vector described above. This is fundamentally how the multihistogram method works.

source