Ejemplo n.º 1
0
import sys
import time

import numpy as np
import joblib

# This are the subroutines and functions
import contatempo
from headerfooter import header, footer
import loaddata as d

# pylint: disable=C0103
###################################################################################
if __name__ == "__main__":
    header("CONDUTIVITY", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) < 3:
        print(
            "     ERROR in number of arguments. Has to have two integers.\n \
              If the first is negative, it will only calculate transitions between the too bands."
        )
        sys.exit("Stop")
    elif len(sys.argv) == 3:
        bandfilled = int(sys.argv[1])  # Number of the last filled band at k=0
        bandempty = int(sys.argv[2])  # Number of the last empty band at k=0
        inputfile = ""
    elif len(sys.argv) == 4:
        bandfilled = int(sys.argv[1])  # Number of the last filled band at k=0
Ejemplo n.º 2
0
import itertools
import numpy as np
from findiff import Gradient
import joblib

# This are the subroutines and functions
import contatempo
from headerfooter import header, footer
import loaddata as d
from comutator import comute, comute3, comutederiv

# pylint: disable=C0103
###################################################################################
if __name__ == "__main__":
    header("SHG", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) < 3:
        print("     ERROR in number of arguments. Has to have two integers.\n \
               If the first is negative, it will only calculate transitions between the too bands."
              )
        sys.exit("Stop")
    elif len(sys.argv) == 3:
        bandfilled = int(sys.argv[1])  # Number of the last filled band at k=0
        bandempty = int(sys.argv[2])  # Number of the last empty band at k=0
        inputfile = ""
    elif len(sys.argv) == 4:
        bandfilled = int(sys.argv[1])  # Number of the last filled band at k=0
        bandempty = int(sys.argv[2])  # Number of the last empty band at k=0
Ejemplo n.º 3
0
import time

from random import randrange
import math
import itertools
import numpy as np

import contatempo
from headerfooter import header, footer
import loaddata as d
from write_k_points import bands_numbers

# pylint: disable=C0103
###################################################################################
if __name__ == "__main__":
    header("COMPARA", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) > 1:  # To enter an initial value for k-point (optional)
        firskpoint = int(sys.argv[1])
    else:
        firskpoint = -1

    print("     Directory where the wfc are:", d.wfcdirectory)
    print("     Number of k-points in each direction:", d.nkx, d.nky, d.nkz)
    print("     Total number of k-points:", d.nks)
    print("     Number of bands:", d.nbnd)
    print()
    print("     Neighbors loaded")
    print("     Eigenvalues loaded")
Ejemplo n.º 4
0
    print("     Finished calculating Berry curvature for index " +
          str(gradwfc00) + "  " + str(gradwfc11) + ".\
           \n     Saving results to file   " +
          inter_time(time.time() - STARTTIME))
    sys.stdout.flush()

    filename = "./berry_curvature" + str(gradwfc00) + "-" + str(gradwfc11)
    # output units of Berry curvature is none

    joblib.dump(berry_curvature, filename + ".gz", compress=3)


###################################################################################
if __name__ == "__main__":
    header("BERRY CURVATURE", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) == 2:
        print("     Will calculate all combinations of bands from 0 up to " +
              str(sys.argv[1]))
        for gradwfc0 in range(int(sys.argv[1]) + 1):
            for gradwfc1 in range(int(sys.argv[1]) + 1):
                berry_curv(gradwfc0, gradwfc1)

    elif len(sys.argv) == 3:
        print("     Will calculate just for band " + str(sys.argv[1]) +
              " and " + str(sys.argv[2]))
        gradwfc0 = int(sys.argv[1])
        gradwfc1 = int(sys.argv[2])
Ejemplo n.º 5
0
    for ite in range(1, npontospolinomial):
        for alpha in range(npontospolinomial - ite):
            mpol = alpha - ite
            pol[ite,
                alpha] = ((xpol0 - xpol[mpol]) * pol[ite - 1, alpha] +
                          (xpol[alpha] - xpol0) * pol[ite - 1, alpha + 1]) / (
                              xpol[alpha] - xpol[mpol])

    return pol[npontospolinomial, 0]


###################################################################################

if __name__ == "__main__":
    header("INTERPOLATION", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) != 2:
        print("     ERROR in number of arguments.\
                    You probably want to give the last band to be considered.")
        sys.exit("Stop")

    lastband = int(sys.argv[1])

    # Reading data needed for the run
    berrypath = d.berrypath
    print("     Path to BERRY files:", berrypath)
    print("     Directory where the wfc are:", d.wfcdirectory)
    print("     Number of k-points in each direction:", d.nkx, d.nky, d.nkz)
Ejemplo n.º 6
0
"""

import sys
import time

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

import contatempo
from headerfooter import header, footer
import loaddata as d

# pylint: disable=C0103
###################################################################################
header("DRAWBANDS", d.version, time.asctime())

starttime = time.time()  # Starts counting time

if len(sys.argv) != 3:
    print(" ERROR in number of arguments. Has to have two integers.")
    print(" The first is the first band, the second is last band.")
    sys.exit("Stop")

startband = int(sys.argv[1])  # Number of the first band
endband = int(sys.argv[2])  # Number of the last band

fig = plt.figure(figsize=(6, 6))

cores = [
    "black",
Ejemplo n.º 7
0
import os
import sys
import time
import xml.etree.ElementTree as ET
import numpy as np

import contatempo
import dft
from headerfooter import header, footer
from parserQE import parser
from write_k_points import list_kpoints

# pylint: disable=C0103
###################################################################################
if __name__ == "__main__":
    header("PREPROCESSING", __version__, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) != 2:
        print(" *!*!*!*!*!*!*!*!*!*!*!")
        print(" ERROR in number of arguments. No input file.")
        print(" *!*!*!*!*!*!*!*!*!*!*!")
        print()
        sys.exit("Stop")

    print("     Reading from input file:", sys.argv[1])
    print()

    # Check python version
    python_version = (
Ejemplo n.º 8
0
    print("     Finished calculating Berry connection for index " +
          str(bandwfc0) + "  " + str(gradwfc0) + "  \
         \n     Saving results to file  " +
          inter_time(time.time() - STARTTIME))
    sys.stdout.flush()

    filename = "./berryCon" + str(bandwfc0) + "-" + str(gradwfc0)
    # output units of Berry connection are bohr

    joblib.dump(berry_connection, filename + ".gz", compress=3)


###################################################################################
if __name__ == "__main__":
    header("BERRY CONNECTION", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) == 2:
        print("     Will calculate all combinations of bands from 0 up to " +
              str(sys.argv[1]))
        for bandwfc in range(int(sys.argv[1]) + 1):
            for gradwfc in range(int(sys.argv[1]) + 1):
                berry_connect(bandwfc, gradwfc)

    elif len(sys.argv) == 3:
        print("     Will calculate just for band " + str(sys.argv[1]) +
              " and " + str(sys.argv[2]))
        bandwfc = int(sys.argv[1])
        gradwfc = int(sys.argv[2])
Ejemplo n.º 9
0
  If it has 2 arguments, it will run just for 1 k-point and 1 band, specified by the arguments
"""
import os
import sys
import time

# This are the subroutines and functions
import contatempo
import dft
from headerfooter import header, footer
import loaddata as d

# pylint: disable=C0103
###################################################################################
if __name__ == "__main__":
    header("GENERATEWFC", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    WFCDIRECTORY = str(d.wfcdirectory)
    DFTDIRECTORY = str(d.dftdirectory)

    # Creates directory for wfc
    os.system("mkdir -p " + WFCDIRECTORY)
    print("     Wavefunctions will be saved in directory", WFCDIRECTORY)
    print("     DFT files are in directory", DFTDIRECTORY)
    print("     This program will run in " + str(d.npr) + " processors")
    print()
    print("     Total number of k-points:", d.nks)
    print("     Number of r-points in each direction:", d.nr1, d.nr2, d.nr3)
    print("     Total number of points in real space:", d.nr)
Ejemplo n.º 10
0
                d.wfcdirectory + "k0" + str(neighborconn) + "b0" + str(banda1) + ".wfc"
            )
            with open(infile, "rb") as fichconn:
                wfc1 = np.load(fichconn)
            fichconn.close()

            # calculates the dot products u_1.u_2* and u_2.u_1*
            dpc1[banda0, banda1] = np.sum(dphaseconn * wfc0 * np.conjugate(wfc1)) / d.nr
            dpc2[banda1, banda0] = np.conjugate(dpc1[banda0, banda1])

    return dpc1, dpc2


###################################################################################
if __name__ == "__main__":
    header("DOTPRODUCT", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    # Reading data needed for the run

    print("     Directory where the wfc are:", d.wfcdirectory)
    print("     Total number of k-points:", d.nks)
    print("     Total number of points in real space:", d.nr)
    print("     Number of processors to use", d.npr)
    print("     Number of bands:", d.nbnd)
    print()
    print("     Phases loaded")
    # print(d.phase[10000,10]) # d.phase[d.nr,d.nks]
    print("     Neighbors loaded")
Ejemplo n.º 11
0
import sys
import time
import numpy as np
from findiff import Gradient

import joblib

# These are the subroutines and functions
from contatempo import tempo, inter_time
from headerfooter import header, footer
import loaddata as d

# pylint: disable=C0103
###################################################################################
if __name__ == "__main__":
    header("R2K", d.version, time.asctime())

    STARTTIME = time.time()  # Starts counting time

    if len(sys.argv) < 2:
        print("     ERROR in number of arguments.")
        print("     Have to give the number of bands that will be considered.")
        print("     One number and calculates from 0 to that number.")
        print("     Two numbers and calculates from first to second.")
        sys.exit("Stop")
    elif len(sys.argv) == 2:
        NBNDMIN = 0
        NBNDMAX = int(sys.argv[1]) + 1  # Number of bands to be considered
        print("     Will calculate bands and their gradient for bands 0 to",
              NBNDMAX)
    elif len(sys.argv) == 3: