예제 #1
0
    def get_results(self):
        lattice = pymc.GrapheneLattice(6)
        FK = pymc.Hamiltonian(lattice, t=-1, U=2, cp=1, T=0.2)
        FK.put_adatoms(18, "random")

        obs = pymc.ObsList([pymc.DeltaObs(FK),
                            pymc.EnergyObs(FK), pymc.CVObs(FK),
                            pymc.CorrelationObs(FK), pymc.NeObs(FK)])
        obs_conv = pymc.ObsList(
            [pymc.DeltaObs(FK), pymc.EnergyObs(FK), pymc.CorrelationObs(FK)])

        series = pymc.ObsSeries(obs, ["T"])
        sym = pymc.Simulator(FK, pymc.metropolis_numpy, obs, obs_conv)

        T_range = [0.2, 0.18, 0.16, 0.14, 0.12,
                   0.10, 0.08, 0.06, 0.04, 0.03, 0.02, 0.01]

        for T in T_range:
            FK.T = T
            sym.run_termalization(10**2)
            res = sym.run_measurements(10**2)
            series.add(res, [T])

        expected = np.loadtxt(
            "tests/simulate/half_filling_1.csv", delimiter=",")

        res = series.get_df().values
        return (expected, res)
예제 #2
0
 def prepare_model_cv(self, n, nad, order, T):
     l1 = pymc.GrapheneLattice(n)
     FK = pymc.Hamiltonian(lattice=l1, t=-1, U=2, T=T)
     o_cv = pymc.CVObs(FK)
     for _ in range(50):
         FK.put_adatoms(nad, order)
         FK.calculate_eigv()
         o_cv.calculate()
     return o_cv.get_result()
예제 #3
0
 def test_obs_cv_2(self):
     l1 = pymc.GrapheneLattice(10)
     FK = pymc.Hamiltonian(lattice=l1, t=-1, U=2, T=0.2)
     o_cv = pymc.CVObs(FK)
     for _ in range(50):
         FK.put_adatoms(50, "random")
         FK.calculate_eigv()
         o_cv.calculate()
     o_cv.reset()
     assert o_cv.get_result() is None
예제 #4
0
import pymc
import matplotlib.pyplot as plt
from tqdm import tqdm
import numpy as np

lattice = pymc.GrapheneLattice(6)
FK = pymc.Hamiltonian(lattice, t=-1, U=2, cp=-1, T=0.2)
FK.put_adatoms(6 * 3, "random")

obs = pymc.ObsList([
    pymc.DeltaObs(FK),
    pymc.EnergyObs(FK),
    pymc.CVObs(FK),
    pymc.CorrelationObs(FK),
    pymc.NeObs(FK)
])
obs_conv = pymc.ObsList(
    [pymc.DeltaObs(FK),
     pymc.EnergyObs(FK),
     pymc.CorrelationObs(FK)])
series = pymc.ObsSeries(obs, ["T"])

sym = pymc.Simulator(FK, pymc.metropolis_numpy, obs, obs_conv)

T_range = [
    0.2, 0.18, 0.16, 0.14, 0.12, 0.10, 0.08, 0.06, 0.04, 0.03, 0.02, 0.01
]
for T in tqdm(T_range, desc="Main loop"):
    FK.T = T

    sym.run_termalization(10**4)