NBodySimulator.jl
NBodySimulator.jl copied to clipboard
Differential Learning of Interactions
Hi,
I was wondering if it is possible to combine NBodySimulator.jl with DiffEqFlux.jl to learn interaction parameters to reproduce a given RDF. loss is the distance euclidean distance between ground truth and current parameter RDFs to make it differentiable. I have done something similar for stochastic lotka_volterra.
Calculation of RDF is done through a function like this, where x's are radial distances of neighboring atoms.
rkMin = 0 # Ang rkMax = 10 #Ang nrk = 80 rk = LinRange(rkMin, rkMax, nrk)
function kernelHist(x, rk=rk) dr = rk[2] - rk[1] #x = reshape(x, (1, size(x)[2]size(x)[1])) dx2 = .-(rk .- x).^2 ./ (2dr^2) denUn = exp.(dx2 ./ (2dr^2)) denN = denUn ./ sum(denUn .+ 1e-16, dims=1) totalDenUn = sum(denN, dims = 2) totalDenUn ./= sum(totalDenUn . dr) totalDenUn = reshape(totalDenUn, size(totalDenUn)[1]) #totalDenUn totalDenUn end