Metadynamic simulation does not start with MonteCarlo integrator
linkerst opened this issue · 1 comments
Metadynamics simulation does not start when integrator is MonteCarlo type. No error is raised but simulation is stuck in the first step.
Example:
import os, sys
my_path = os.getcwd()+"/.."
print(my_path)
sys.path.append(my_path)
import numpy as np
from matplotlib import pyplot as plt
from ensembler.potentials.TwoD import wavePotential
from ensembler.potentials.biasTwoD import addedPotentials2D, metadynamicsPotential2D
from ensembler.integrator.stochastic import monteCarloIntegrator, metropolisMonteCarloIntegrator
from ensembler.system import system
##Visualisation
from ensembler.visualisation.plotSimulations import static_sim_plots, static_sim_plots_bias
#Simulation Setup
sim_steps = 2000
origpot = wavePotential(amplitude=(10,10), multiplicity=[1/6.,1/6.], degree=False)
#Add the bias and the original system
totpot = metadynamicsPotential2D(origpot, amplitude=1, sigma=(5,5), n_trigger=10, bias_grid_min=(0,0), bias_grid_max=(100,100), numbins=(1000,1000))
integrator = metropolisMonteCarloIntegrator(randomnessIncreaseFactor=5)
sys=system(potential=totpot, integrator=integrator, position=np.array([60,60]), temperature=1)
#simulate
cur_state = sys.simulate(sim_steps, withdrawTraj=True, initSystem=False)
print("Trajectory length: ",len(sys.trajectory))
print()
print("last_state: ", cur_state)
print(len(sys.trajectory))
sys.trajectory.head()
This was fixed, due to the major restructuring, the code changed a bit:
`import os, sys
my_path = os.getcwd()+"/.."
print(my_path)
sys.path.append(my_path)
import numpy as np
from matplotlib import pyplot as plt
from ensembler.potentials.TwoD import wavePotential
from ensembler.potentials.TwoD import addedPotentials, metadynamicsPotential
from ensembler.samplers.stochastic import monteCarloIntegrator, metropolisMonteCarloIntegrator
from ensembler.system import system
##Visualisation
from ensembler.visualisation.plotSimulations import simulation_analysis_plot
#Simulation Setup
sim_steps = 2000
origpot = wavePotential(amplitude=(10,10), multiplicity=[1/6.,1/6.], radians=True)
#Add the bias and the original system
totpot = metadynamicsPotential(origpot, amplitude=1, sigma=(5,5), n_trigger=10, bias_grid_min=(0,0), bias_grid_max=(100,100), numbins=(1000,1000))
integrator = metropolisMonteCarloIntegrator()
sys=system(potential=totpot, sampler=integrator, start_position=np.array([60,60]), temperature=1)
#simulate
cur_state = sys.simulate(sim_steps)
print("Trajectory length: ",len(sys.trajectory))
print()
print("last_state: ", cur_state)
print(len(sys.trajectory))
sys.trajectory.head()
`