system_qmff = system.forceFields().forceField(qmff.ID()) new_molpro.addToQM(system_qmff.molecules(qmff.groups().qm())) new_molpro.addToMM(system_qmff.molecules(qmff.groups().mm()), {new_molpro.parameters().coulomb(): "charges"}) print("QM energy = %f, new molproff = %f" % \ ( system.forceFields().forceField(qmff.ID()).energy(), new_molpro.energy() )) qmff.change(system.forceFields().molecules()) print("qmff == %f" % qmff.energy()) # get the RDFs rdfmonitor = system.monitors().monitor(Symbol("RDF")) rdf = rdfmonitor.getRDF(oxygen, oxygen) print("OXYGEN-OXYGEN") for point in rdf.normalise(): print("%f %f" % point) print("\nOXYGEN-HYDROGEN") rdf = rdfmonitor.getRDF(oxygen, hydrogen) for point in rdf.normalise(): print("%f %f" % point)
new_molpro.setMolproExe(qmff.molproExe()) new_molpro.setEnergyOrigin(qmff.energyOrigin()) system_qmff = system.forceFields().forceField(qmff.ID()) new_molpro.addToQM(system_qmff.molecules(qmff.groups().qm())) new_molpro.addToMM(system_qmff.molecules(qmff.groups().mm()), {new_molpro.parameters().coulomb(): "charges"}) print("QM energy = %f, new molproff = %f" % (system.forceFields().forceField(qmff.ID()).energy(), new_molpro.energy())) qmff.change(system.forceFields().molecules()) print("qmff == %f" % qmff.energy()) # get the RDFs rdfmonitor = system.monitors().monitor(Symbol("RDF")) rdf = rdfmonitor.getRDF(oxygen, oxygen) print("OXYGEN-OXYGEN") for point in rdf.normalise(): print("%f %f" % point) print("\nOXYGEN-HYDROGEN") rdf = rdfmonitor.getRDF(oxygen, hydrogen) for point in rdf.normalise(): print("%f %f" % point)
system = System(groups, ffields, monitors) mc = RigidBodyMC(UniformSampler(solute)) mc.setTemperature(25 * celsius) mc.setMaximumTranslation(0.3 * angstrom) #for i in range(0,50): # moves = system.run(mc, 10000) # # mc = moves.moves()[0].clone() # print "%d accepted, %d rejected, ratio = %f %%" % \ # (mc.nAccepted(), mc.nRejected(), 100 * mc.acceptanceRatio()) # # print system.monitors().monitor(ffields.total()).average() mtsmc = MTSMC(mc, e_fast.function(), 500) mtsmc.setEnergyComponent(e_slow.function()) for i in range(0, 5000): moves = system.run(mtsmc, 20) mtsmc = moves.moves()[0].clone() print("%d accepted, %d rejected, ratio = %f %%" % \ (mtsmc.nAccepted(), mtsmc.nRejected(), 100 * mtsmc.acceptanceRatio())) print("AVGENERGY: %f" % system.monitors().monitor(ffields.total()).average()) print("ENERGY: %f" % system.forceFields().energy()) sys.stdout.flush()
system = System(groups, ffields, monitors) mc = RigidBodyMC( UniformSampler(solute) ) mc.setTemperature( 25 * celsius ) mc.setMaximumTranslation( 0.3 * angstrom ) #for i in range(0,50): # moves = system.run(mc, 10000) # # mc = moves.moves()[0].clone() # print "%d accepted, %d rejected, ratio = %f %%" % \ # (mc.nAccepted(), mc.nRejected(), 100 * mc.acceptanceRatio()) # # print system.monitors().monitor(ffields.total()).average() mtsmc = MTSMC(mc, e_fast.function(), 500) mtsmc.setEnergyComponent(e_slow.function()) for i in range(0,5000): moves = system.run(mtsmc, 20) mtsmc = moves.moves()[0].clone() print("%d accepted, %d rejected, ratio = %f %%" % \ (mtsmc.nAccepted(), mtsmc.nRejected(), 100 * mtsmc.acceptanceRatio())) print("AVGENERGY: %f" % system.monitors().monitor(ffields.total()).average()) print("ENERGY: %f" % system.forceFields().energy()) sys.stdout.flush()