def __init__(self, args):

        self.dft = args.dft
        self.np = args.np
        self.structurename = args.structurename
        self.nowin = args.nowin

        # Update the total number of bands after DFT calculation.
        # If you don't want this set flag nowin.
        self.updatewanbands = True
        self.wanbands = 0

        # import the VASP class. This can be used for other DFT codes as well.
        self.create_DFTmu()
        self.DFT = VASP.VASP_class(dft=self.dft,
                                   structurename=self.structurename)

        # Initial guess for Fermi energy
        self.DFT.EFERMI = 7.0

        # Wannier parameters
        self.kmeshtol = 1e-06
        self.dos_kmesh = 64
        self.num_iter = 1000

        # create bands_plot directory
        if not os.path.exists("bands_plot"):
            os.makedirs("bands_plot")

        # Starting the calculation
        if self.dft == "siesta":
            self.fdf_to_poscar()

        self.dft_run()
        self.postw90_run()
        self.calculator()
Esempio n. 2
0
                idx[d_orb.index(orb)] = loc_idx
        sym_idx.append(idx.tolist())
    #print sym_idx
#      for at in ats:
#   for i,ats in enumerate(cor_at):
#      for ii,at in enumerate(ats):
#         at_idx=int(at[-1])-1
#         d_orb=TB.TB_orbs[at]
#         for j,orbs in enumerate(cor_orb[i]):
#            if ii==0: loc_idx+=1
#            for orb in orbs:
#               idx[d_orb.index(orb)]=loc_idx
#         sym_idx[at_idx].append(idx)

    DMFT = DMFT_MOD.DMFT_class(p, pC, TB)
    DFT = VASP.VASP_class()

    ETOT_old = 0.0
    ETOT2_old = 0.0
    ETOT = 0.0
    ETOT2 = 0.0
    CHGDIFF = 0.
    CHGDIFF2 = 0.
    shutil.copy2('sig.inp', 'sig.inp.0')

    for itt in range(p['Niter']):
        main_out.write('--- Starting Charge loop ' + str(itt + 1) + now() +
                       '---')
        main_out.write('\n')
        main_out.flush()
Esempio n. 3
0
        [9.77481016, 7.79245421, 7.98959054],
        [15.22469429, 7.79201704, 7.98943559],
        [8.46632515, 10.17202968, 7.99540983],
        [8.53256540, 5.62907836, 7.99458204],
        [16.46612157, 5.62801086, 7.99582303],
        [16.53337285, 10.17092209, 7.99467923],
        [11.13544681, 19.42130452, 7.97773530],
        [13.86508896, 19.42136867, 7.97785955],
        [5.82074273, 10.21941636, 7.97126648],
        [19.17882835, 10.21844766, 7.97010409],
        [7.18631774, 7.85639597, 7.96997322],
        [17.81284174, 7.85499234, 7.97028496]]

# hlcluster.py inputfile.gjf -n +n n-n

lattice, basis, elements, num_atoms, selectiveflag, coordinate_type, coordinates, selective = VASP.read_poscar(
    'POSCAR')
with open(sys.argv[1]) as IN:
    input_file = IN.readlines()
    space = re.compile(r'\s+')
    a = int(sys.argv[2]) - 1
    b = int(sys.argv[3]) - 1
    temp = sys.argv[4].split('-')
    c = int(temp[0]) - 1
    d = int(temp[1])

    gjfcoord = []
    for i in xrange(5, len(input_file)):
        if input_file[i].strip() == '':
            break
        line = space.split(input_file[i].strip())
        gjfcoord.append(
Esempio n. 4
0
# -*- coding=utf-8 -*-

import VASP
import sys

# if len(sys.argv) < 4:
#     print "Usage: gvextend.py file1 file2 ... X Y Z"
#     print "Try again!"
#     exit(0)

elements, num_atoms, coordinates = VASP.read_gjf('temp.gjf')
print elements
print num_atoms

Esempio n. 5
0
    loc_idx = 0
    for i, ats in enumerate(cor_at):
        d_orb = TB.TB_orbs[ats[0]]
        # idx=zeros(len(d_orb),dtype=int)
        idx = zeros(len(d_orb) * p["nspin"], dtype=int)
        for ispin in range(p["nspin"]):
            for j, orbs in enumerate(cor_orb[i]):
                loc_idx += 1
                for orb in orbs:
                    # idx[d_orb.index(orb)]=loc_idx
                    idx[d_orb.index(orb) + ispin * len(d_orb)] = loc_idx
        sym_idx.append(idx.tolist())

    DMFT = DMFT_MOD.DMFT_class(p, pC, TB)
    DFT = VASP.VASP_class(dft=args.dft,
                          structurename=args.structurename,
                          aiida=args.aiida)

    ETOT_old = 0.0
    ETOT2_old = 0.0
    ETOT = 0.0
    ETOT2 = 0.0
    CHGDIFF = 0.0
    CHGDIFF2 = 0.0
    shutil.copy2("sig.inp", "sig.inp.0")

    # ----------------------- Starting DFT+DMFT loop -----------------------------

    for itt in range(p["Niter"]):
        main_out.write("--- Starting charge loop " + str(itt + 1) + now() +
                       "---")
Esempio n. 6
0
#!/home/noische/python

from VASP import *
import numpy as np
from numpy import sqrt
import bgftools

m = VASP()
#h = m._latticeVectors = [[5.0, 0, 0], [5*sqrt(2)/2, 5*sqrt(2)/2, 0], [0, 0, 5.0]]
h = m._latticeVectors = [[5.0, 0, 0], [5, 5, 0], [0, 0, 5.0]]
hinv = m._inv_latticeVectors = np.linalg.inv(m._latticeVectors)
#dim = [1.0, 1.0, 2.0]
#points = [[0, 0, 0], [1, 1, 2], [1, 0, 2], [0.5, 0.5, 1.5]]
points = [[2, 1, 0], [2, 3, 0]]
for i in points:
	for j in points:
		if i==j: continue;
		print("vasp dist: " + str(i) + str(j) + str(m.distance(i, j, h, hinv)))
		#print("pbc_dist: " + str(i) + str(j) + str(bgftools.pbc_dist(i, j, dim)))
		print("")

print(sqrt(5))
print(sqrt(10))
Esempio n. 7
0
#!/home/noische/python

import sys
import nutils as nu
from VASP import *

if len(sys.argv) < 2: nu.die(sys.argv[0] + " poscar_file bgf_file")

m = VASP(sys.argv[1])
value = raw_input("Want to create bonds for S? ")
if value: m.find_S_bonds()
m.saveBGF(sys.argv[2])
Esempio n. 8
0
    def __init__(self, args):
        """
	Contains common functions for all methods.
	This launches the dmft calculation as well.
	"""

        print("Initializing calculation...\n")

        if os.path.exists("para_com.dat"):
            fipa = open("para_com.dat", "r")
            self.para_com = str(fipa.readline())[:-1]
            fipa.close()
        else:
            self.para_com = "mpirun -np 40"

        if os.path.exists("para_com_dft.dat"):
            fid = open("para_com_dft.dat")
            self.para_com_dft = str(fid.readline())[:-1]
            fid.close()
        else:
            self.para_com_dft = self.para_com

        # initial chemical potential
        self.create_DFTmu()

        # import the VASP class. This can be used for other DFT codes as well.
        self.DFT = VASP.VASP_class(dft=args.dft,
                                   aiida=args.aiida,
                                   structurename=args.structurename)

        self.dir = os.getcwd()  # dft running directory (current directory)
        self.structurename = (
            args.structurename
        )  # name of structure. Required for siesta (structurename.fdf).
        self.kmeshtol = args.kmeshtol  # kmesh tolerence for wannier mesh
        self.force = args.force  # force dmft calculation True of False
        self.v = args.v  # Verbosity
        self.dft = args.dft  # DFT type
        self.aiida = args.aiida  # Flag for aiida calculation
        self.lowdin = args.lowdin  # Flag for Siesta Lowdin
        self.nowin = args.nowin  # Flag for .win generation

        ####### DFT and wannier90 initialization #######

        # wannier90 executable
        self.wannier90_exec = "wannier90.x"
        self.wanbands = 0
        self.updatewanbands = True

        # VASP calculation
        if self.dft == "vasp":
            self.vasp_exec = "vaspDMFT"  # vasp executable

        # Siesta calculation
        elif self.dft == "siesta":
            self.siesta_exec = "siesta"  # siesta executable
            self.fdf_to_poscar()

        # QE calculation
        elif self.dft == "qe" and self.aiida is False:
            # Nothing to do here for now since we only have
            # QE aiida calculations.
            self.qe_exec = "pw.x"
            self.qe_to_poscar()

        # aiida calculation
        if self.aiida:
            self.win_to_poscar(input="aiida.win")

        ####### DMFT initialization #######

        # Generate initial self energy.
        self.gen_sig()

        # Setting  DMFT type
        if args.dmft:
            self.type = "DMFT"

        elif args.hf:
            self.type = "HF"

        # Launch DMFT calculation
        self.run_dmft()
Esempio n. 9
0
    def __init__(self, args):
        """
        Contains common functions for all methods.
        This launches the dmft calculation as well.
        """

        self.kmeshtol = args.kmeshtol  # kmesh tolerence for wannier mesh
        self.force = args.force  # force dmft calculation True of False
        self.v = args.v  # Verbosity
        self.dft = args.dft  # DFT type
        self.aiida = args.aiida  # Flag for aiida calculation
        self.lowdin = args.lowdin  # Flag for Siesta Lowdin
        self.nowin = args.nowin  # Flag for .win generation
        self.resume = args.resume  # Flag to resume existing calculation

        ####### DFT and wannier90 initialization #######

        # wannier90 executable
        self.wannier90_exec = "wannier90.x"
        self.wanbands = 0
        self.updatewanbands = True

        # VASP calculation
        if self.dft == "vasp":
            self.vasp_exec = "vasp_std"  # vasp executable

        # Siesta calculation
        elif self.dft == "siesta":
            self.siesta_exec = "siesta"  # siesta executable
            self.fdf_to_poscar()

        # QE calculation
        elif self.dft == "qe" and self.aiida is False:
            # Nothing to do here for now since we only have
            # QE aiida calculations.
            self.qe_exec = "pw.x"
            self.qe_to_poscar()

        # aiida calculation
        if self.aiida:
            self.win_to_poscar(input="aiida.win")

        # setting up parallelization
        if os.path.exists("para_com.dat"):
            fipa = open("para_com.dat", "r")
            self.para_com = str(fipa.readline())[:-1]
            fipa.close()
        else:
            self.para_com = "mpirun -np 40"

        if os.path.exists("para_com_dft.dat"):
            fid = open("para_com_dft.dat")
            self.para_com_dft = str(fid.readline())[:-1]
            fid.close()
        else:
            self.para_com_dft = self.para_com

        ####### DMFT initialization #######

        # Setting  DMFT type
        if args.dmft:
            self.type = "DMFT"

        elif args.hf:
            self.type = "HF"

        if not self.resume:
            print("Initializing calculation...\n")

            # initial chemical potential
            self.create_DFTmu()

            # Generate initial self energy.
            self.gen_sig()

        else:
            print("Resuming calculation...\n")

            # Checking if previous DMFT calculation exists
            pathstr = self.type + os.sep + "INFO_TIME"

            if os.path.exists(pathstr):

                # cleaning DMFT directory to prepare for resumed calculation
                for chgcar in glob.glob("./DMFT/CHGCAR.*"):
                    os.remove(chgcar)
                for gloc in glob.glob("./DMFT/G_loc.out.*"):
                    os.remove(gloc)
                for sig in glob.glob("./DMFT/sig.inp.*"):
                    os.remove(sig)
            else:
                print("No previous DMFT calculation has been initialized!")
                print("Running from scratch...")
                self.resume = False

                # initial chemical potential
                self.create_DFTmu()

                # Generate initial self energy.
                self.gen_sig()

        # import the VASP class. This can be used for other DFT codes as well.
        self.DFT = VASP.VASP_class(dft=args.dft,
                                   aiida=args.aiida,
                                   structurename=args.structurename)

        self.dir = os.getcwd()  # dft running directory (current directory)
        self.structurename = (
            args.structurename
        )  # name of structure. Required for siesta (structurename.fdf).

        # Creating seedname.dat for non-VASP calculations
        if self.structurename:
            fi = open("seedname.dat", "w")
            fi.write(str(self.structurename))
            fi.close()

        # Launch DMFT calculation
        self.run_dmft()
Esempio n. 10
0
    while 1:
        if content[index].strip() == '':
            index += 4
            break
        index += 1

    while 1:
        if content[index].strip() == '':
            break
        lines = space.split(content[index].strip())
        elements.append(lines[0])
        coordinates.append([float(lines[2]), float(lines[3]), float(lines[4])])
        index += 1

total_atoms = len(elements)
content = VASP.grep_outcar("grep 'Standard orientation:' -A %d %s" %
                           (total_atoms + 5, sys.argv[1][:-4] + '.log'))

with open(sys.argv[1][:-4] + '.xyz', 'w') as xyz_file:
    # xyz_file.write(str(total_atoms) + '\n')
    # xyz_file.write('Create from *.log file\n')
    # for element, coor in zip(elements, coordinates):
    #     xyz_file.write("%2s    %16.10f    %16.10f    %16.10f\n" % (element, coor[0], coor[1], coor[2]))

    pattern = re.compile(r'Standard orientation:')
    index = 0
    while index < len(content):
        while index < len(content):
            if pattern.search(content[index]) is not None:
                index += 5
                break
            index += 1