import time,sys,thread


class Simulation:
    def __init__(self, dt):

        self.t = 0.000
        self.dt = dt
        
        self.paused = 1
        self.pause = 1

        self.innerLoops = 64
       
        thread.start_new_thread(self.animSpins,(self.innerLoops,))
      

    def animSpins(self,innerLoops):
        print '-----------------------------'
        print "Simulation Started"
        print time.ctime()
        
        self.pause = 0
  
        while 1:
            self.paused = self.pause
            if self.paused != 1:
                self.t += self.dt
                self.nLattice.timeEvolve(self.t, self.dt, self.EBu, self.EBd, self.temp)


    def hold(self):
        self.pause = 1
        while self.paused == 0: pass

    def unhold(self):
        self.pause = 0

    def reset(self):
        self.t = 0.000

