rdf.add(MolIdx(0) + AtomName("O00"), AtomName("O00")) rdf2 = RDFMonitor(0 * angstrom, 10 * angstrom, 0.05 * angstrom) rdf2.add(MolIdx(0) + AtomName("O00"), AtomName("H01")) rdf2.add(MolIdx(0) + AtomName("O00"), AtomName("H02")) system.add(cljff) system.add("O-O RDF", rdf) system.add("O-H RDF", rdf2) t.start() system.collectStats() ms = t.elapsed() print("Collecting stats took %d ms" % ms) rdf = system.monitor(MonitorName("O-O RDF")) print("\nO-O RDF") for i in range(0, rdf.nBins()): print(rdf[i].middle().to(angstrom), rdf[i].value()) rdf = system.monitor(MonitorName("O-H RDF")) print("\nO-H RDF") for i in range(0, rdf.nBins()): print(rdf[i].middle().to(angstrom), rdf[i].value())
# output="BOND-A1A2.dat") #histoAnalysis(nbins=nbins, # avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), # values=system.monitor( MonitorName("bond23") ).accumulator().values(), # mode="bond", # output="BOND-A2A3.dat") #histoAnalysis(nbins=nbins, # avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), # values=system.monitor( MonitorName("bond34") ).accumulator().values(), # mode="bond", # output="BOND-A3A4.dat") #histoAnalysis(nbins=nbins, # avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), # values=system.monitor( MonitorName("theta123") ).accumulator().values(), # mode="angle", # output="ANGLE-A1A2A3.dat") #histoAnalysis(nbins=nbins, # avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), # values=system.monitor( MonitorName("theta234") ).accumulator().values(), # mode="angle", # output="ANGLE-A2A3A4.dat") histoAnalysis(nbins=nbins, avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), values=list(system.monitor( MonitorName("phi1234") ).accumulator().values()), mode="angle", output="DIHEDRAL-A1A2A3A4.dat") #** Output the trajectory #system.monitor( MonitorName("trajectory") ).writeToDisk("outputXXXXXX.pdb")
.setProperty("b-factor",beta_ljnrg).molecule().commit() total_mol = total_mol.atom(atoms[j].index()).edit() \ .setProperty("b-factor",beta_total).molecule().commit() coul_group.update(coul_mol) lj_group.update(lj_mol) total_group.update(total_mol) print("Total energies: %f %f %f" % (cnrg, ljnrg, cnrg + ljnrg)) PDB().write(coul_group, "test_coul_%0004d.pdb" % id) PDB().write(lj_group, "test_lj_%0004d.pdb" % id) PDB().write(total_group, "test_total_%0004d.pdb" % id) print("Running a simulation...") for i in range(1, 11): system = moves.move(system, 2000, True) nrgmon = system.monitor(MonitorName("solute_shell")) PDB().write(system.molecules(), "test_sim_%0004d.pdb" % i) system.clearStatistics() print("Step %d of 10: Energy = %s" % (i, system.energy())) view(nrgmon, i)
rdf2 = RDFMonitor( 0*angstrom, 10*angstrom, 0.05*angstrom ) rdf2.add( MolIdx(0) + AtomName("O00"), AtomName("H01") ) rdf2.add( MolIdx(0) + AtomName("O00"), AtomName("H02") ) system.add(cljff) system.add("O-O RDF", rdf) system.add("O-H RDF", rdf2) t.start() system.collectStats() ms = t.elapsed() print("Collecting stats took %d ms" % ms) rdf = system.monitor( MonitorName("O-O RDF") ) print("\nO-O RDF") for i in range(0,rdf.nBins()): print(rdf[i].middle().to(angstrom), rdf[i].value()) rdf = system.monitor( MonitorName("O-H RDF") ) print("\nO-H RDF") for i in range(0,rdf.nBins()): print(rdf[i].middle().to(angstrom), rdf[i].value())
t = QTime() t.start() # Run the simulation for i in range(0, nblocks): print("Running nmove...") t.restart() system = moves.move(system, nmoves, True) print("...took %d ms" % t.elapsed()) print("Analysis...") # make an histogram... nbins = 31 histoAnalysis( nbins=nbins, values=list(system.monitor(MonitorName("bond12")).accumulator().values()), mode="bond", output="BOND-A1A2.dat") histoAnalysis( nbins=nbins, values=list(system.monitor(MonitorName("bond23")).accumulator().values()), mode="bond", output="BOND-A2A3.dat") histoAnalysis(nbins=nbins, values=list( system.monitor( MonitorName("angle123")).accumulator().values()), mode="angle", output="ANGLE-A1A2A3.dat")
lj_mol = lj_mol.atom(atoms[j].index()).edit() \ .setProperty("b-factor",beta_ljnrg).molecule().commit() total_mol = total_mol.atom(atoms[j].index()).edit() \ .setProperty("b-factor",beta_total).molecule().commit() coul_group.update(coul_mol) lj_group.update(lj_mol) total_group.update(total_mol) print("Total energies: %f %f %f" % (cnrg, ljnrg, cnrg+ljnrg)) PDB().write(coul_group, "test_coul_%0004d.pdb" % id) PDB().write(lj_group, "test_lj_%0004d.pdb" % id) PDB().write(total_group, "test_total_%0004d.pdb" % id) print("Running a simulation...") for i in range(1,11): system = moves.move(system, 2000, True) nrgmon = system.monitor( MonitorName("solute_shell") ) PDB().write(system.molecules(), "test_sim_%0004d.pdb" % i) system.clearStatistics() print("Step %d of 10: Energy = %s" % (i, system.energy())) view(nrgmon, i)
break moves = SameMoves(solute_mover) print("Production") for i in range(0,nblocks): print("Running block %d " % i) system = moves.move(system, nmoves, True) #sys.exit(-1) print("Analysis...") # make an histogram... nbins=31 for bond in var_bonds: bmonitor = "b_%s_%s" % (bond.atom0().value(),bond.atom1().value()) histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName(bmonitor) ).accumulator().values()), avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), mode="bond", output="BOND-%s.dat" % bmonitor) for angle in var_angles: amonitor = "a_%s_%s_%s" % (angle.atom0().value(), angle.atom1().value(), angle.atom2().value() ) histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName(amonitor) ).accumulator().values()), avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), mode="angle", output="ANGLE-%s.dat" % amonitor)
t = QTime() t.start() # Run the simulation for i in range(0,nblocks): print("Running nmove...") t.restart() system = moves.move(system, nmoves, True) print("...took %d ms" % t.elapsed()) print("Analysis...") # make an histogram... nbins=31 histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName("bond12") ).accumulator().values()), mode="bond", output="BOND-A1A2.dat") histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName("bond23") ).accumulator().values()), mode="bond", output="BOND-A2A3.dat") histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName("angle123") ).accumulator().values()), mode="angle", output="ANGLE-A1A2A3.dat") #** Output the trajectory #system.monitor( MonitorName("trajectory") ).writeToDisk("outputXXXXXX.pdb")
e_total = system.totalComponent() system.add( "total_energy", MonitorComponent(e_total, Average()) ) #system.add( "trajectory", TrajectoryMonitor(system[MGIdx(0)]), 1 ) # Run the simulation for i in range(0,nblocks): print("Running nmove...") system = moves.move(system, nmoves, True) print("Analysis...") # make an histogram... nbins=31 histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName("bond12") ).accumulator().values()), avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), mode="bond", output="BOND-A1A2.dat") histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName("bond23") ).accumulator().values()), avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), mode="bond", output="BOND-A2A3.dat") histoAnalysis(nbins=nbins, values=list(system.monitor( MonitorName("angle123") ).accumulator().values()), avgnrg = system.monitor( MonitorName("total_energy") ).accumulator().average(), mode="angle", output="ANGLE-A1A2A3.dat") #** Output the trajectory