These are chat archives for iambernie/olisms

22nd
Mar 2014
iambernie
@iambernie
Mar 22 2014 01:45
Hoi
tylocus
@tylocus
Mar 22 2014 01:47
Hoi
iambernie
@iambernie
Mar 22 2014 01:47
```
    def ewolve(self):
        J = 1
        kB = 1
        g = self.grid

        prob = 1.0 - np.exp(-2.0*J/(kB*self.temperature))

        cluster = set()
        perimeter_spins = set()
        tested = set()

        seed = self.choose_site()

        cluster.add(seed)
        perimeter_spins.add(neighbors(seed))

        site = seed
        while len(perimeter_spins) != 0:
            site_to_test = self.random.choice(perimeter_spins) 

            determinant = np.random.ranf()
            if g[site] == g[site_to_test]:
                if determinant <= prob:
                    cluster.add(site) 
                    perimeter_spins.add( neighbors(site) )
                    perimeter_spins.difference_update(tested)
                else:                 
                    tested.update(site)
            else:                     
               pass #add with probablity 0 if s_i != s_j

        for site in cluster:
            g[site] = -g[site]
            self.printlattice()


        if self.printit is not None:
           self.printlattice()