Example #1
0
import time

# ======= setup

path = './'

decay = -1.0  # WARRNING ... with positive decay you get bullshit

# ======= Prepare inputs

eigEn, coefs, Ratin = RS.read_FIREBALL_all(name=path + 'phik_example_',
                                           geom=path + 'crazy_mol.xyz',
                                           fermi=None,
                                           orbs='sp',
                                           pbc=(0, 0),
                                           cut_min=-1.0,
                                           cut_max=+1.0,
                                           cut_at=-1,
                                           lower_atoms=[],
                                           lower_coefs=[])

print("---------------")
print("Ratin ", Ratin)
print("---------------")
print("coefs ", coefs)
print("---------------")
print("eigEn.shape ", eigEn.shape)
print("coefs.shape ", coefs.shape)
print("Ratin.shape ", Ratin.shape)

atoms = ocl.xyzq2float4(
Example #2
0
    print(
        "Importing positions of PP from the PP-AFM calculations. Path for the data:"
    )
    path_pos = "Q%1.2fK%1.2f/" % (Q, K)
    print(path_pos)
    tip_r, lvec, nDim = GU.load_vec_field(path_pos + 'PPpos',
                                          data_format=data_format)
    extent = (lvec[0, 0], lvec[0, 0] + lvec[1, 0], lvec[0, 1],
              lvec[0, 1] + lvec[2, 1])
    #print "DEBUG: extent", extent
    print("PP postions imported")
    dx = lvec[1, 0] / (nDim[2] - 1)
    dy = lvec[2, 1] / (nDim[1] - 1)
    dz = lvec[3, 2] / (nDim[0] - 1)
    tip_r0 = RS.mkSpaceGrid(lvec[0, 0], lvec[0, 0] + lvec[1, 0], dx,
                            lvec[0, 1], lvec[0, 1] + lvec[2, 1], dy,
                            lvec[0, 2], lvec[0, 2] + lvec[3, 2], dz)
    #print "DEBUG: dx, dy, dz", dx, dy, dz
    #print "DEBUG: tip_r.shape, tip_r0.shape", tip_r.shape, tip_r0.shape
else:
    print("Priparing the scan grid for fixed scan")
    extent = (x[0], x[1], y[0], y[1])
    tip_r = RS.mkSpaceGrid(x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1],
                           z[2])
    lvec = np.array([[x[0], y[0], z[0]], [x[1] - x[0], 0., 0.],
                     [0., y[1] - y[0], 0.], [0., 0., z[1] - z[0]]])
    #print "DEBUG: extent", extent
    #print "DEBUG: lvec", lvec
    tip_r0 = tip_r
    print("scan grids prepared")
Example #3
0
    together = ''.join(map(str, args))    # avoid the arg is not str
    #print together
    return together

# --- Initial check --- #

assert( PNG or TXT ), "No output set to be True; I'm not going to do anything if there is no output. I'm too lazy like a Gartfield. "

# --- reading of the eigen-energies, the LCAO coefficients and geometry --- #

print("Reading electronic & geometry structure files")

cell=[[0,0],[0,0]];pbc=(0,0);lower_coefs=[];

if ((dft_code == 'fireball') or(dft_code == 'Fireball') or (dft_code == 'FIREBALL')):
    eigEn, coefs, Ratin = RS.read_FIREBALL_all(name = files_path + 'phik_0001_', geom=files_path+geometry_file, lvs = cell, fermi=fermi, orbs = sample_orbs, pbc=pbc, cut_min=cut_min, cut_max=cut_max,cut_at=cut_atoms, lower_atoms=lower_atoms, lower_coefs=lower_coefs);

elif ((dft_code == 'gpaw') or(dft_code == 'GPAW')):
    eigEn, coefs, Ratin = RS.read_GPAW_all(    name = files_path + cp2k_name + '.gpw', fermi=fermi, orbs = sample_orbs, pbc=pbc, cut_min=cut_min, cut_max=cut_max, cut_at=cut_atoms, lower_atoms=lower_atoms, lower_coefs=lower_coefs);

elif ((dft_code == 'aims') or(dft_code == 'AIMS') or (dft_code == 'FHI-AIMS')):
    if ((spin == None) or (spin == False)):
        name = 'KS_eigenvectors.band_1.kpt_1.out'
    elif ((spin == 'up')or(spin == 'alpha')or(spin == 'both')):
        name = 'KS_eigenvectors_up.band_1.kpt_1.out'
    elif ((spin == 'down')or(spin == 'beta')or(spin == 'dn')):
        name = 'KS_eigenvectors_dn.band_1.kpt_1.out'
    else :
        print("unknown spin, I'm going to sleep. Good Night"); exit()
    eigEn, coefs, Ratin = RS.read_AIMS_all(name = files_path + name , geom= files_path + geometry_file, fermi=fermi, orbs = sample_orbs, pbc=pbc, cut_min=cut_min, cut_max=cut_max, cut_at=cut_atoms, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
    if (spin == 'both'):
Example #4
0
            lvec2).all(), "lvec1 != lvec2 control your input files"
        assert np.array(nDim2).all() == np.array(
            nDim2).all(), "nDim1 != nDim2 control your input files"
        print("STM for V:", namez[i], " imported")
        #print "DEBUG: current1.shape", current1.shape
lvec = lvec1
nDim = nDim1
extent = (lvec[0,
               0], lvec[0, 0] + lvec[1, 0], lvec[0,
                                                 1], lvec[0, 1] + lvec[2, 1])
#print "DEBUG: extent", extent
dx = lvec[1, 0] / (nDim[2] - 1)
dy = lvec[2, 1] / (nDim[1] - 1)
dz = lvec[3, 2] / (nDim[0] - 1)
tip_r0 = RS.mkSpaceGrid(lvec[0, 0], lvec[0, 0] + lvec[1, 0], dx, lvec[0, 1],
                        lvec[0, 1] + lvec[2, 1], dy, lvec[0, 2],
                        lvec[0, 2] + lvec[3, 2], dz)
#print "DEBUG: tip_r0", tip_r0

# --- main part --- #

if STM_b:
    current = tip_orb1_amount * current1 + tip_orb2_amount * current2
if didv_b:
    didv = tip_orb1_amount * didv1 + tip_orb2_amount * didv2

# =========== Utils for plotting atoms =========================


def plotAtoms(atoms, atomSize=0.1, edge=True, ec='k', color='w'):
    plt.fig = plt.gcf()
Example #5
0
eta = 0.1  # 0.1 - standart for semiconductors
# -- next two parameters will be specified in the main loop
#WF_decay=1.0	# for STM only - how fast the exponential decay fall, with the applied bias ( if 1 - 1:1 correspondence with bias; if 0, it doesn't change)
#nV = 9			# for STM only - number of STM integrational steps nV ~ V/eta
lower_atoms = [
]  # No atoms has lowered hopping - be aware python numbering occurs here [0] - means lowering of the 1st atom
lower_coefs = []  # Lowering of the hoppings

# --- downloading and examples of downloading of the eigen-energies, the LCAO coefficients and geometry (this time for spin-unpolarized calculations):

eigEn, coefs, Ratin = RS.read_FIREBALL_all(name=path + 'phik_0001_',
                                           geom=path + 'input.xyz',
                                           fermi=fermi,
                                           orbs=orbs,
                                           pbc=pbc,
                                           cut_min=cut_min,
                                           cut_max=cut_max,
                                           cut_at=cut_at,
                                           lvs=lvs,
                                           lower_atoms=lower_atoms,
                                           lower_coefs=lower_coefs)
#eigEn, coefs, Ratin = RS.read_AIMS_all(name = 'KS_eigenvectors_up.band_1.kpt_1.out', geom='geometry.in',fermi=fermi, orbs = 'sp', pbc=pbc,
#					imaginary = False, cut_min=cut_min, cut_max=cut_max, cut_at=cut_at,
#					lower_atoms=lower_atoms, lower_coefs=lower_coefs)
#eigEn, coefs, Ratin  = RS.read_GPAW_all(name = 'out_LCAO_LDA.gpw', fermi=fermi, orbs = orbs, pbc=pbc,
#					cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);

# --- the grid on which the STM signal is calculated; tip_r2 - uniform grid:

dz = 0.1
dx = dy = 0.25
Example #6
0
eta = 0.01	# very low to pronounce single orbitals only
# --- these two not needed now (no STM in this script)
#WF_decay=1.0	# for STM only - how fast the exponential decay fall, with the applied bias ( if 1 - 1:1 correspondence with bias; if 0, it doesn't change)
#nV = 9		# for STM only - number of STM integrational steps nV ~ V/eta
lower_atoms=[22,23,24]		# atoms 23-25 - oxygens will have lowered tunneling  !!! python numbering of atoms !!!
lower_coefs=[0.75,0.75,0.75]	# Lowering of the hoppings # NOTE: it seems, that for the CP2K input there is not suc a big need to lower down the contributions from
                # oxygens (on a TOAT), then from the other codes - 0.5

# --- downloading and examples of downloading of the eigen-energies, the LCAO coefficients and geometry (this time for spin-unpolarized calculations):

#eigEn, coefs, Ratin = RS.read_FIREBALL_all(name = path+'phik_example_', geom=path+'crazy_mol.xyz', fermi=fermi, orbs = orbs, pbc=pbc,
#					    cut_min=cut_min, cut_max=cut_max,cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn, coefs, Ratin = RS.read_AIMS_all(name = 'KS_exx_1_spin_up.out', geom='geometry.in',fermi=fermi, orbs = orbs, pbc=pbc,
#					imaginary = False, cut_min=cut_min, cut_max=cut_max, cut_at=cut_at,
#					lower_atoms=lower_atoms, lower_coefs=lower_coefs)
eigEn, coefs, Ratin  = RS.read_CP2K_all(name = 'TOAT', fermi=fermi, orbs = orbs, pbc=pbc,
                                        cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn, coefs, Ratin  = RS.read_GPAW_all(name = 'out_LCAO_LDA.gpw', fermi=fermi, orbs = orbs, pbc=pbc,
#					cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);

# --- the grid on which the STM signal is calculated; no tip_r1 - PP distored by the relaxation in the PPAFM code;  only tip_r2 - uniform grid:

tip_r1, lvec, nDim = GU.load_vec_field( path_pos+'PPpos' ,data_format=data_format)

dz=0.1
dx=dy =0.1

xl = lvec[1,0]
yl = lvec[2,1]
zl = lvec[3,2]
extent = (lvec[0,0],lvec[0,0]+xl,lvec[0,1],lvec[0,1]+yl)
#eigEn, coefs, Ratin = RS.read_FIREBALL_all(name = path+'phik_example_', geom=path+'crazy_mol.xyz', fermi=fermi, orbs = orbs, pbc=pbc,
#					    cut_min=cut_min, cut_max=cut_max,cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn1, coefs1, Ratin = RS.read_AIMS_all(name = 'KS_eigenvectors_up.band_1.kpt_1.out', geom='geometry.in',fermi=fermi, orbs = orbs, pbc=pbc,
#					imaginary = False, cut_min=cut_min, cut_max=cut_max, cut_at=cut_at,
#					lower_atoms=lower_atoms, lower_coefs=lower_coefs)
#eigEn2, coefs2, Ratin = RS.read_AIMS_all(name = 'KS_eigenvectors_dn.band_1.kpt_1.out', geom='geometry.in',fermi=fermi, orbs = orbs, pbc=pbc,
#					imaginary = False, cut_min=cut_min, cut_max=cut_max, cut_at=cut_at,
#					lower_atoms=lower_atoms, lower_coefs=lower_coefs)
#eigEn, coefs, Ratin  = RS.read_GPAW_all(name = 'out_LCAO_LDA.gpw', fermi=fermi, orbs = orbs, pbc=pbc,
#					cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
eigEn1, coefs1, Ratin = RS.read_CP2K_all(name='CuPc',
                                         fermi=fermi,
                                         orbs=orbs,
                                         pbc=pbc,
                                         cut_min=cut_min,
                                         cut_max=cut_max,
                                         cut_at=cut_at,
                                         lower_atoms=lower_atoms,
                                         lower_coefs=lower_coefs,
                                         spin="alpha")
eigEn2, coefs2, Ratin = RS.read_CP2K_all(name='CuPc',
                                         fermi=fermi,
                                         orbs=orbs,
                                         pbc=pbc,
                                         cut_min=cut_min,
                                         cut_max=cut_max,
                                         cut_at=cut_at,
                                         lower_atoms=lower_atoms,
                                         lower_coefs=lower_coefs,
                                         spin="beta")
Example #8
0
#nV = 9		# for STM only - number of STM integrational steps nV ~ V/eta
lower_atoms = [
]  # No atoms has lowered hopping - be aware python numbering occurs here [0] - means lowering of the 1st atom
lower_coefs = []  # Lowering of the hoppings
M = 16  # Effective mass of CO frustrated translation - only O - 16

# --- downloading and examples of downloading of the eigen-energies, the LCAO coefficients and geometry (this time for spin-unpolarized calculations):

#eigEn, coefs, Ratin = RS.read_FIREBALL_all(name = path+'phik_example_', geom=path+'crazy_mol.xyz', fermi=fermi, orbs = orbs, pbc=pbc,
#					    cut_min=cut_min, cut_max=cut_max,cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
eigEn1, coefs1, Ratin = RS.read_AIMS_all(name="eigen_up.out",
                                         geom='geom-cube.in',
                                         fermi=fermi,
                                         orbs=orbs,
                                         pbc=pbc,
                                         imaginary=False,
                                         cut_min=cut_min,
                                         cut_max=cut_max,
                                         cut_at=cut_at,
                                         lower_atoms=lower_atoms,
                                         lower_coefs=lower_coefs)
eigEn2, coefs2, Ratin = RS.read_AIMS_all(name="eigen_dn.out",
                                         geom='geom-cube.in',
                                         fermi=fermi,
                                         orbs=orbs,
                                         pbc=pbc,
                                         imaginary=False,
                                         cut_min=cut_min,
                                         cut_max=cut_max,
                                         cut_at=cut_at,
                                         lower_atoms=lower_atoms,
#lvs = np.array([[15., 0.,0.],[0.,15.,0],[0.,0.,15.]]
WorkFunction = 5.0 #more or less standart.
fermi=None    # the Fermi from phik ... .dat file; !!! All energies are relative to Fermi !!!! None -  means: -5.04612664712 eV
orbs= 'sp'    # 'sp' works now, 'spd' works for fireball as well
cut_min=-1.0    # H**O -0.88 bellow the Fermi Level, other orbitals cut
cut_max=+1.0    # LUMO -0.88 above the Fermi Level
cut_at=-1    # All atoms of the molecule
eta = 0.01    # very low, to pronounce the single orbitals only
WF_decay=1.0    # for STM only - how fast the exponential decay fall, with the applied bias ( if 1 - 1:1 correspondence with bias; if 0, it doesn't change)
nV = 9        # for STM only - number of STM integrational steps nV ~ V/eta
lower_atoms=[]    # No atoms has lowered hopping - be aware python numbering occurs here [0] - means lowering of the 1st atom
lower_coefs=[]    # Lowering of the hoppings

# --- downloading and examples of downloading of the eigen-energies, the LCAO coefficients and geometry (this time for spin-unpolarized calculations):

eigEn, coefs, Ratin = RS.read_FIREBALL_all(name = path+'phik_example_', geom=path+'crazy_mol.xyz', fermi=fermi, orbs = orbs, pbc=pbc,
                        cut_min=cut_min, cut_max=cut_max,cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn, coefs, Ratin = RS.read_AIMS_all(name = 'KS_eigenvectors_up.band_1.kpt_1.out', geom='geometry.in',fermi=fermi, orbs = 'sp', pbc=pbc,
#                    imaginary = False, cut_min=cut_min, cut_max=cut_max, cut_at=cut_at,
#                    lower_atoms=lower_atoms, lower_coefs=lower_coefs)
#eigEn, coefs, Ratin  = RS.read_GPAW_all(name = 'out_LCAO_LDA.gpw', fermi=fermi, orbs = orbs, pbc=pbc,
#                    cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn, coefs, Ratin  = RS.read_CP2K_all(name = 'crazy_mol', fermi=fermi, orbs = orbs, pbc=pbc,
#                    cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);

# --- the grid on which the STM signal is calculated; tip_r1 - PP distored by the relaxation in the PPAFM code; tip_r2 - uniform grid:

tip_r1, lvec, nDim = GU.load_vec_field( path_pos+'PPpos' ,data_format=data_format)

dz=0.1
dx=dy =0.1
Example #10
0
cut_at = 18  # All atoms of the highest layer
eta = 0.1  # very low, to pronounce the single orbitals only
# -- next two not needed for IETS
#WF_decay=1.0	# for STM only - how fast the exponential decay fall, with the applied bias ( if 1 - 1:1 correspondence with bias; if 0, it doesn't change)
#nV = 9		# for STM only - number of STM integrational steps nV ~ V/eta
lower_atoms = [
]  # No atoms has lowered hopping - be aware python numbering occurs here [0] - means lowering of the 1st atom
lower_coefs = []  # Lowering of the hoppings

# --- downloading and examples of downloading of the eigen-energies, the LCAO coefficients and geometry (this time for spin-unpolarized calculations):

eigEn, coefs, Ratin = RS.read_FIREBALL_all(name='phik_0001_',
                                           geom='input.xyz',
                                           fermi=fermi,
                                           orbs=orbs,
                                           pbc=pbc,
                                           cut_min=cut_min,
                                           cut_max=cut_max,
                                           cut_at=cut_at,
                                           lower_atoms=lower_atoms,
                                           lower_coefs=lower_coefs)

# --- on which energies you want to plot pseudo-projected density of states

energies = np.arange(-2.0, 2.0, 0.01)

# --- getting P-PDOS for different atoms and spherical functions

#PDOS0 = SU.pPDOS(eigEn, coefs, energies, eta=eta, atoms=[], orbs=orbs ,spherical='all') # all atoms = []
PDOS1 = SU.pPDOS(eigEn,
                 coefs,
                 energies,