Пример #1
0
def test_walk_plan_json():
    lattice = Lattice([24, 2])
    wf = FreeFermionWavefunction(lattice=lattice, orbitals=[Bands([8, 4], [periodic_bc, periodic_bc])])
    subsystem = SimpleSubsystem([8, 2], lattice)

    renyi_modpossible_plan = RenyiModPossibleWalkPlan(wf, subsystem)
    assert WalkPlan.from_json(renyi_modpossible_plan.to_json(), wf) == renyi_modpossible_plan
    assert RenyiModPossibleWalkPlan.from_json(renyi_modpossible_plan.to_json(), wf) == renyi_modpossible_plan

    renyi_sign_plan = RenyiSignWalkPlan(wf, subsystem)
    assert WalkPlan.from_json(renyi_sign_plan.to_json(), wf) == renyi_sign_plan
    assert RenyiSignWalkPlan.from_json(renyi_sign_plan.to_json(), wf) == renyi_sign_plan

    with pytest.raises(Exception):
        RenyiSignWalkPlan.from_json(renyi_modpossible_plan.to_json(), wf)
Пример #2
0
def test_walk_plan_json():
    lattice = Lattice([24, 2])
    wf = FreeFermionWavefunction(lattice=lattice, orbitals=[Bands([8, 4], [periodic_bc, periodic_bc])])
    walk_plan = StandardWalkPlan(wf)
    assert WalkPlan.from_json(walk_plan.to_json(), wf) == walk_plan
    assert StandardWalkPlan.from_json(walk_plan.to_json(), wf) == walk_plan