mc = RigidBodyMC( UniformSampler(all_mols) ) mc.setMaximumTranslation( 0.1 * angstrom ) volmc = VolumeMove( MapAsMolecules(all_mols) ) volmc.setVolumeChangingFunction( UniformVolumeChange(50 * angstrom3) ) moves = WeightedMoves() moves.add(mc, 125) moves.add(volmc, 1) for i in range(1,1001): print("Running block %d" % i) timer.start() moves = system.run(moves, 100000) print("Took %d ms" % timer.elapsed()) print("Energy = %f | Volume = %f" % (system.forceFields().energy(), system.info().space().volume())) print("MC Accept %d Reject %d" % (moves.moves()[0].clone().nAccepted(), moves.moves()[0].clone().nRejected())) print("VMC Accept %d Reject %d" % (moves.moves()[1].clone().nAccepted(), moves.moves()[1].clone().nRejected())) PDB().write(system.forceFields().molecules(), "test%0004d.pdb" % i)
# set the space in which the simulation will occur system.setSpace(space) # create a rigid body MC move that moves random solvent # molecules, with the solvent molecules picked uniformly mc = RigidBodyMC(PrefSampler(tip4p, 200.0, all_mols)) # Create a multiple-time-step MC move that performs 500 # rigid body moves of the solvent using e_fast, then accepts # or rejects the whole block of moves using e_total mtsmc = MTSMC(mc, e_fast.function(), 500) mtsmc.setEnergyComponent(e_total.function()) PDB().write(system.info().groups().molecules(), "test000.pdb") for i in range(1, 21): nmoves = 1000 print("Block %d: Running %d moves" % (i, nmoves)) timer.start() moves = system.run(mtsmc, nmoves) ms = timer.elapsed() print("%d moves took %d ms" % (nmoves, ms)) PDB().write(system.info().groups().molecules(), "test%3.3d.pdb" % i)
system = System(all_mols, ffields) system.setSpace(space) mc = RigidBodyMC(UniformSampler(all_mols)) mc.setMaximumTranslation(0.1 * angstrom) volmc = VolumeMove(MapAsMolecules(all_mols)) volmc.setVolumeChangingFunction(UniformVolumeChange(50 * angstrom3)) moves = WeightedMoves() moves.add(mc, 125) moves.add(volmc, 1) for i in range(1, 1001): print("Running block %d" % i) timer.start() moves = system.run(moves, 100000) print("Took %d ms" % timer.elapsed()) print("Energy = %f | Volume = %f" % (system.forceFields().energy(), system.info().space().volume())) print("MC Accept %d Reject %d" % (moves.moves()[0].clone().nAccepted(), moves.moves()[0].clone().nRejected())) print("VMC Accept %d Reject %d" % (moves.moves()[1].clone().nAccepted(), moves.moves()[1].clone().nRejected())) PDB().write(system.forceFields().molecules(), "test%0004d.pdb" % i)
# set the space in which the simulation will occur system.setSpace(space) # create a rigid body MC move that moves random solvent # molecules, with the solvent molecules picked uniformly mc = RigidBodyMC(PrefSampler(tip4p, 200.0, all_mols)) # Create a multiple-time-step MC move that performs 500 # rigid body moves of the solvent using e_fast, then accepts # or rejects the whole block of moves using e_total mtsmc = MTSMC(mc, e_fast.function(), 500) mtsmc.setEnergyComponent(e_total.function()) PDB().write(system.info().groups().molecules(), "test000.pdb") for i in range(1, 21): nmoves = 1000 print("Block %d: Running %d moves" % (i, nmoves)) timer.start() moves = system.run(mtsmc, nmoves) ms = timer.elapsed() print("%d moves took %d ms" % (nmoves, ms)) PDB().write(system.info().groups().molecules(), "test%3.3d.pdb" % i)