Ejemplo n.º 1
0
Archivo: main.py Proyecto: obaica/pygra
# Add the root path of the pygra library
import os
import sys
sys.path.append(os.environ['PYGRAROOT'])

from pygra import geometry
from pygra import meanfield
import numpy as np

omega = 1. / np.sqrt(2)

g = geometry.bichain()
g = g.supercell(40)  # get the geometry
g.dimensionality = 0

h = g.get_hamiltonian()  # compute Hamiltonian
phi = 0.5
delta = 2. * np.cos(phi)
maf = 2. * np.sin(phi) * np.array([1., 0., 0.])


def fsc(r):
    return delta * np.cos(omega * np.pi * 2 * r[0])


def faf(r):
    return maf * np.sin(omega * np.pi * 2 * r[0])


h.add_antiferromagnetism(faf)
h.add_swave(fsc)
Ejemplo n.º 2
0
# Add the root path of the pygra library
import os ; import sys ; sys.path.append(os.environ['PYGRAROOT'])

from pygra import geometry
from pygra import topology
import numpy as np
from pygra import phasediagram
g = geometry.bichain() # create geometry of a chain
def getz2(x1,x2): 
  # calculate the Z2 invariant for certain Zeeman and Rashba
  h = g.get_hamiltonian(has_spin=True) # get the Hamiltonian, spinfull
  h.add_rashba(0.3) # add SOC
  h.shift_fermi(x2) # add SOC
  h.add_zeeman([0.,0.,0.3]) # add mass
  h.add_swave(x1) # add mass
  z2 = abs(topology.berry_phase(h,nk=40)/np.pi) # get the Z2
  print(x1,x2,z2)
  return z2
# now write the Phase diagram in a file
phasediagram.diagram2d(getz2,x=np.linspace(-.0,0.3,30,endpoint=True),y=np.linspace(0.,4.,30,endpoint=True),nite=1)
Ejemplo n.º 3
0
# Add the root path of the pygra library
import os ; import sys ; sys.path.append(os.environ['PYGRAROOT'])

from pygra import geometry
from pygra import hamiltonians
from pygra import sculpt  # to modify the geometry
from pygra import correlator
from pygra import kpm
import numpy as np
import matplotlib.pyplot as plt
import time
g = geometry.bichain()
g = g.supercell(40)
g.center()
g.dimensionality = 0
g.write()
def fs(r):
    if r[0]<0.0: return 0.5
    else: return 0.0
def faf(r):
    if r[0]>0.0: return 0.5
    else: return 0.0
h = g.get_hamiltonian()
h.add_antiferromagnetism(faf)
h.add_swave(fs)
from pygra import ldos
#ldos.multi_ldos(h,np.linspace(-3.0,3.0,40),delta=0.1)
h.get_bands()
Ejemplo n.º 4
0
# Add the root path of the pygra library
import os ; import sys 
sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../src")





from pygra import geometry
from pygra import potentials
import numpy as np


g = geometry.bichain(100) # bipartitie chain geometry
g.dimensionality = 0 # zero dimensional (finite system)

def get_energies(omega=0.0,phi=0.0):
    """Compute the energies"""
    h = g.get_hamiltonian(has_spin=True) # generate Hamiltonian
    def fm(r):
        """Function that add the antiferromagnetism"""
        return .5 + .5*np.cos(2*np.pi*(omega*r[0]+phi)) # local AF magnetization
    h.add_antiferromagnetism(fm)
    inds,es = h.get_bands() # compute eigenstates
    return es # return eigenstates

# compute the Hofstadter butterfly
f = open("HOFSTADTER.OUT","w") # output file
omegas = np.linspace(0.,1.,100) # different frequencies
for omega in omegas:
    es = get_energies(omega=omega) # return energies