Exemplo n.º 1
0
# Add the root path of the pygra library
import os ; import sys ; sys.path.append(os.environ['PYGRAROOT'])

# zigzag ribbon
import numpy as np
from pygra import geometry
from pygra import scftypes
from pygra import operators
from scipy.sparse import csc_matrix
g = geometry.chain()
g = geometry.honeycomb_lattice()
#g = geometry.kagome_lattice()
g = g.supercell(3)
h = g.get_hamiltonian() # create hamiltonian of the system
h = h.get_multicell()
h.remove_spin()
mf = np.random.random(h.intra.shape) -.5  
mf = np.matrix(mf)
mf = mf + mf.H
scf = scftypes.selfconsistency(h,nkp=1,filling=0.5,g=3.0,
              mix=0.9,mf=mf,mode="V")
h = scf.hamiltonian # get the Hamiltonian
h.get_bands() # calculate band structure
from pygra import groundstate
groundstate.hopping(h,nrep=3) # write three replicas
#spectrum.fermi_surface(h)
Exemplo n.º 2
0
# Add the root path of the pygra library
import os
import sys
sys.path.append(os.environ['PYGRAROOT'])

# zigzag ribbon
import numpy as np
from pygra import geometry
from pygra import scftypes
from pygra import operators
from scipy.sparse import csc_matrix
g = geometry.chain()
g = geometry.honeycomb_lattice()
#g = geometry.kagome_lattice()
g = g.supercell(3)
h = g.get_hamiltonian()  # create hamiltonian of the system
h = h.get_multicell()
h.remove_spin()
mf = np.random.random(h.intra.shape) - .5
mf = np.matrix(mf)
mf = mf + mf.H
scf = scftypes.selfconsistency(h,
                               nkp=1,
                               filling=0.5,
                               g=3.0,
                               mix=0.9,
                               mf=mf,
                               mode="V")
h = scf.hamiltonian  # get the Hamiltonian
h.get_bands()  # calculate band structure
from pygra import groundstate
Exemplo n.º 3
0
# Add the root path of the pygra library
import os
import sys
sys.path.append(os.environ['PYGRAROOT'])

# zigzag ribbon
from pygra import geometry
g = geometry.honeycomb_armchair_ribbon(2)  # create geometry of a zigzag ribbon
g = geometry.chain(2)  # create geometry of a zigzag ribbon
g.dimensionality = 0
g.write()
h = g.get_hamiltonian()
from pygra import ldos
ldos.multi_ldos(h, projection="atomic")
Exemplo n.º 4
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 potentials
import numpy as np


g = geometry.chain(400) # chain
g.dimensionality = 0
vs = np.linspace(0.0,4.0,30) # potentials
# loop over v's


def discard(w):
  """Discard edge wavefunctions"""
  w2 = np.abs(w)*np.abs(w) # absolute value
  n = len(w)
  if np.sum(w2[0:n//10])>0.5 or np.sum(w2[9*n//10:n])>0.5: return False
  else: return True


fo = open("LAMBDA_VS_V.OUT","w")
lm = [] # empty array
for v in vs: # loop over strengths of the potential
  h = g.get_hamiltonian(has_spin=False) # get the Hamiltonian
  fun = potentials.aahf1d(v=v,beta=0.0) # function with the AAH potential
  h.add_onsite(fun) # add onsite energies
  (es,ls) = h.get_tails(discard=discard) # return the localization length
  lm.append(np.mean(ls)) # store
  # write in file
Exemplo n.º 5
0
# Add the root path of the pygra library
import os ; import sys ; sys.path.append(os.environ['PYGRAROOT'])

# zigzag ribbon
from pygra import geometry
from pygra import scftypes
import numpy as np
# this calculates
g = geometry.chain() # chain geometry
h0 = g.get_hamiltonian() # create hamiltonian of the system


fo = open("STIFFNESS.OUT","w") # open file
for a in np.linspace(0.,1.0,100): # loop over angles, in units of 2pi
  h = h0.copy()
  h.generate_spin_spiral(vector=[0.,0.,1.],qspiral=[a,0.,0.])
  h.add_zeeman([1.0,0.0,0.0])
  e = h.get_total_energy(nk=10)
  fo.write(str(a)+"    "+str(e)+"\n") # write
  print(a,e)
fo.close()
Exemplo n.º 6
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 chi
import numpy as np
n = 100
g = geometry.chain(n) # chain
g.dimensionality = 0
Bs = np.linspace(0.0,3.0,300)
fo = open("SWEEP.OUT","w")
for B in Bs:
  def ft(r1,r2):
      dr = r1-r2
      dr = dr.dot(dr)
      if 0.9<dr<1.1: return 0.8*np.cos(r1[0]*B*np.pi) + 1.0
      return 0.0
  h = g.get_hamiltonian(fun=ft,has_spin=False)
  
  es = np.linspace(0.0,7.0,200)
  cout = []
  for i in range(10,n-10):
    es,cs = chi.chargechi(h,es=es,i=i,j=i)
    cout.append(cs)
  cs = es*0.0 +0j
  for o in cout: cs += o
  cs /= len(cout)
  for (ie,ic) in zip(es,cs):
      fo.write(str(B)+"   ")
      fo.write(str(ie)+"   ")
      fo.write(str(abs(ic.imag))+"\n")
Exemplo n.º 7
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 potentials
import numpy as np

g = geometry.chain(400)  # chain
g.dimensionality = 0
vs = np.linspace(0.0, 4.0, 30)  # potentials
# loop over v's


def discard(w):
    """Discard edge wavefunctions"""
    w2 = np.abs(w) * np.abs(w)  # absolute value
    n = len(w)
    if np.sum(w2[0:n // 10]) > 0.5 or np.sum(w2[9 * n // 10:n]) > 0.5:
        return False
    else:
        return True


fo = open("LAMBDA_VS_V.OUT", "w")
lm = []  # empty array
for v in vs:  # loop over strengths of the potential
    h = g.get_hamiltonian(has_spin=False)  # get the Hamiltonian
    fun = potentials.aahf1d(v=v, beta=0.0)  # function with the AAH potential
    h.add_onsite(fun)  # add onsite energies
Exemplo n.º 8
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
from pygra import operators
g = geometry.chain()  # create geometry of a chain
h = g.get_hamiltonian(has_spin=True)  # get the Hamiltonian, spinfull
h.add_rashba(0.5)  # add Rashba SOC
h.add_zeeman(0.3)  # add Zeeman field
h.shift_fermi(2.)  # add Zeeman field
h.add_swave(0.2)  # add swave pairing
h.get_bands(operator=operators.get_sy(h))
Exemplo n.º 9
0
# Add the root path of the pygra library
import os
import sys
sys.path.append(os.environ['PYGRAROOT'])

# zigzag ribbon
from pygra import geometry
from pygra import scftypes
import numpy as np
# this spin calculates the spin stiffness of an interacting 1d chain
g = geometry.chain()  # chain geometry
h0 = g.get_hamiltonian()  # create hamiltonian of the system
fo = open("STIFFNESS.OUT", "w")  # open file
for a in np.linspace(0., .2, 20):  # loop over angles, in units of pi
    h = h0.copy()
    h.generate_spin_spiral(angle=a, vector=[0., 1., 0.])
    scf = scftypes.hubbardscf(h,
                              filling=0.1,
                              nkp=100,
                              g=2.5,
                              silent=True,
                              mag=[[0., 0., .1]],
                              mix=0.9,
                              maxerror=1e-4)
    fo.write(str(a) + "    " + str(scf.total_energy) + "\n")  # write
    print(a, scf.total_energy)
fo.close()
Exemplo n.º 10
0
# Add the root path of the pygra library
import os ; import sys ; sys.path.append(os.environ['PYGRAROOT'])

# zigzag ribbon
import numpy as np
from pygra import geometry
from pygra import topology
from pygra import phasediagram
g = geometry.chain() # 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.5) # add Rashba SOC
  h.add_zeeman(x1+0.5) # add Zeeman field
  h.shift_fermi(2.0) # add Zeeman field
  h.add_swave(x2) # add swave pairing
  phi = topology.berry_phase(h) # get the berry phase
  return np.abs(phi/np.pi)
# now write the Phase diagram in a file
phasediagram.diagram2d(getz2,x=np.linspace(-1,1,20,endpoint=True),y=np.linspace(-1,2.,20,endpoint=True),nite=4)
Exemplo n.º 11
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 ldos
import numpy as np

n = 40
w = n / 2.  # cutoff for the hopping
g = geometry.chain(n)  # chain
g.dimensionality = 0


def ft(n):
    def f0(i1, i2):
        if abs(i1 - i2) == 1:
            i0 = (i1 + i2) / 2.0 / n  # average
            return np.tanh(4. * i0**2)
        else:
            return 0.

    return f0  # return function


f0 = ft(n)  # function


def f(r1, r2):