You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a Monte Carlo simulation that I have some structure and I apply Gaussian displacements over time. I thought that MetropolisMonteCarloIntegrator is appropriate class to do something like that. I have a code like the following one,
pdb=PDBxFile(self.save_path+'MultiEM_init.cif') ifinit_struct_path==Noneorbuild_init_mmcifelsePDBxFile(init_struct_path)
self.mass_center=np.average(get_coordinates_mm(pdb.positions),axis=0)
forcefield=ForceField('forcefields/ff.xml')
self.system=forcefield.createSystem(pdb.topology)
integrator=MetropolisMonteCarloIntegrator(Temperature,0.2,5)
# integrator = mm.LangevinIntegrator(Temperature, 0.05, 10 * mm.unit.femtosecond)# Import forcefieldprint('\nImporting forcefield...')
self.add_forcefield()
print('---Done!---')
# Run simulation / Energy minimizationprint('\nEnergy minimization...')
platform=mm.Platform.getPlatformByName(pltf)
simulation=Simulation(pdb.topology, self.system, integrator, platform)
simulation.reporters.append(StateDataReporter(stdout, (MD_steps*sim_step)//20, step=True, totalEnergy=True, potentialEnergy=True, temperature=True))
simulation.reporters.append(DCDReporter(self.save_path+'MultiEM_annealing.dcd', 5))
simulation.context.setPositions(pdb.positions)
simulation.context.setVelocitiesToTemperature(Temperature, 0)
current_platform=simulation.context.getPlatform()
print(f"Simulation will run on platform: {current_platform.getName()}.")
start_time=time.time()
simulation.minimizeEnergy()
state=simulation.context.getState(getPositions=True)
PDBxFile.writeFile(pdb.topology, state.getPositions(), open(self.save_path+'MultiEM_minimized.cif', 'w'))
print(f"--- Energy minimization done!! Executed in {(time.time() -start_time)/60:.2f} minutes. :D ---\n")
Until here everything is ok. Energy is minimized. And now I do simulated annealing, and I use it as I use any other integrator in OpenMM,
And here the structure remains unchanged and the potential energy remains the same.
what is wrong? Is there any simple way to integrate like Langevin integrator? Or should I use these samplers that you have in documentation, instead of Simulation class? I would like to have both .dcd trajectory and an ensemble of structures if it is possible.
The text was updated successfully, but these errors were encountered:
BlackPianoCat
changed the title
MetropolisMonteCarloIntegrator does not work when I apply time steps over time.
MetropolisMonteCarloIntegrator does not work when I apply steps over time.
Feb 17, 2024
I am trying to create a Monte Carlo simulation that I have some structure and I apply Gaussian displacements over time. I thought that
MetropolisMonteCarloIntegrator
is appropriate class to do something like that. I have a code like the following one,Until here everything is ok. Energy is minimized. And now I do simulated annealing, and I use it as I use any other integrator in OpenMM,
And here the structure remains unchanged and the potential energy remains the same.
what is wrong? Is there any simple way to integrate like Langevin integrator? Or should I use these samplers that you have in documentation, instead of
Simulation
class? I would like to have both .dcd trajectory and an ensemble of structures if it is possible.The text was updated successfully, but these errors were encountered: