예제 #1
0
 def takeStep(self, coords, **kwargs):
     # ake a new monte carlo class
     mc = MonteCarlo(coords,
                     self.potential,
                     self.mcstep,
                     temperature=self.T,
                     outstream=None)
     mc.run(self.nsteps)
     coords[:] = mc.coords[:]
예제 #2
0
파일: LJ_MC.py 프로젝트: borislavujo/pele
natoms = 40

coords = np.random.rand(natoms*3)


lj = LJ() 

ret = quench(coords, lj)
coords = ret.coords

takestep = TakeStep(stepsize=0.1 )

#do equilibration steps, adjusting stepsize
tsadapt = AdaptiveStepsize(takestep)
mc = MonteCarlo(coords, lj, tsadapt, temperature = 0.5)
equilout = open("equilibration","w")
#mc.outstream = equilout
mc.setPrinting(equilout, 1)
mc.run(10000)

#fix stepsize and do production run
mc.takeStep = takestep
mcout = open("mc.out", "w")
mc.setPrinting(mcout, 10)
#print coords from time to time
xyzout = open("out.xyz", "w")
printevent = PrintEvent(xyzout, 300)
mc.addEventAfterStep(printevent.printwrapper)

mc.run(10000)
예제 #3
0
 def takeStep(self, coords, **kwargs):
     # make a new monte carlo class
     mc = MonteCarlo(coords, self.potential, self.mcstep,
                     temperature=self.T, outstream=None)
     mc.run(self.nsteps)
     coords[:] = mc.coords[:]
예제 #4
0
#set up the step taking routine
#Normal basin hopping takes each step from the quenched coords.  This modified step taking routine takes a step from the 
#last accepted coords, not from the quenched coords
from pele.take_step.random_displacement import takeStep
takestep = takeStep(stepsize=.01)


#pass a function which rejects the step if the system leaved the inital basin.
import do_quenching
dostuff = do_quenching.DoQuenching(pot, coords, quench=quench)
accept_test_list = [dostuff.acceptReject]





#set up basin hopping
from pele.mc import MonteCarlo
temperature = 1.0
event_after_step = []
mc = MonteCarlo(coords, pot, takestep, \
                  event_after_step = event_after_step, \
                  acceptTests = accept_test_list, temperature = temperature)

#run basin hopping
mc.run(200)

print mc.naccepted, "steps accepted out of", mc.stepnum
print "quench: ", dostuff.nrejected, "steps rejected out of", dostuff.ntot