# Path: pyDFTutils/vasp/vasp_utils.py
# def read_poscar_and_unsort(filename='CONTCAR'):
#     """
#     read poscar and unsort. return the symbols,positions and cell in unsorted order.
#     """
#     atoms = read_vasp(filename)
#     symbols = get_unsorted(atoms.get_chemical_symbols())
#     positions = get_unsorted(atoms.get_positions())
#     cell = atoms.get_cell()
#     return symbols, positions, cell
# 
# Path: pyDFTutils/ase_utils/symbol.py
# def symbol_number(symbols):
#     """
#     symbols can be also atoms. Thus the chemical symbols will be used.
#     Fe Fe Fe O -> {Fe1:0 Fe2:1 Fe3:2 O1:3}
#     """
#     try:
#         symbs=symbols.copy().get_chemical_symbols()
#     except Exception:
#         symbs=symbols
#     symdict={}
#     result=OrderedDict()
#     for i,sym in enumerate(symbs):
#         if sym in symdict:
#             symdict[sym]=symdict[sym]+1
#         else:
#             symdict[sym]=1
#         result[sym+str(symdict[sym])]=i
#     return result


from pyDFTutils.vasp.vasp_utils import read_poscar_and_unsort
from ase.calculators.vasp import Vasp, Vasp2
from ase.dft.kpoints import get_bandpath
from os.path import join
from ase.utils import devnull, basestring
from pyDFTutils.ase_utils.symbol import symbol_number
from shutil import copyfile, move
import ase.calculators.vasp.create_input
import matplotlib.pyplot as plt
import os
import sys
import numpy as np
import tempfile
import ase.io
import socket
        eigenvalues = self.get_eig_array()
        plt.clf()
        if window is not None:
            plt.ylim(window[0], window[1])
        if self.get_number_of_spins() == 1:

            for i in range(self.nbands):
                band_i = eigenvalues[i, :] - self.get_fermi_level()
                plt.plot(self.band_xs, band_i)
        else:

            for i in range(self.nbands):
                band_i = eigenvalues[i, :, spin] - self.get_fermi_level()
                plt.plot(self.band_xs, band_i)
        plt.xlabel('K-points')
        plt.ylabel('$Energy-E_{fermi} (eV)$')
        plt.ylim(yrange)
        plt.axhline(0, color='black', linestyle='--')
        if self.special_kpts_names is not None:
            plt.xticks(self.band_special_xs, self.special_kpts_names)

        if output_filename is not None:
            plt.savefig(output_filename)
        if show:
            plt.show()

    def read_contcar(self, atoms, filename='CONTCAR'):
        """
        read from contcar and set the positions and cellpars. Note that in vasp, "sort" is True. so read and !!!!unsort!!!!.
        """

# Path: pyDFTutils/vasp/vasp_utils.py
# def read_poscar_and_unsort(filename='CONTCAR'):
#     """
#     read poscar and unsort. return the symbols,positions and cell in unsorted order.
#     """
#     atoms = read_vasp(filename)
#     symbols = get_unsorted(atoms.get_chemical_symbols())
#     positions = get_unsorted(atoms.get_positions())
#     cell = atoms.get_cell()
#     return symbols, positions, cell
# 
# Path: pyDFTutils/ase_utils/symbol.py
# def symbol_number(symbols):
#     """
#     symbols can be also atoms. Thus the chemical symbols will be used.
#     Fe Fe Fe O -> {Fe1:0 Fe2:1 Fe3:2 O1:3}
#     """
#     try:
#         symbs=symbols.copy().get_chemical_symbols()
#     except Exception:
#         symbs=symbols
#     symdict={}
#     result=OrderedDict()
#     for i,sym in enumerate(symbs):
#         if sym in symdict:
#             symdict[sym]=symdict[sym]+1
#         else:
#             symdict[sym]=1
#         result[sym+str(symdict[sym])]=i
#     return result


# Path: pyDFTutils/vasp/myvasp.py
from pyDFTutils.vasp.vasp_utils import read_poscar_and_unsort
from ase.calculators.vasp import Vasp, Vasp2
from ase.dft.kpoints import get_bandpath
from os.path import join
from ase.utils import devnull, basestring
from pyDFTutils.ase_utils.symbol import symbol_number
from shutil import copyfile, move
import ase.calculators.vasp.create_input
import matplotlib.pyplot as plt
import os
import sys
import numpy as np
import tempfile
import ase.io
import socket

        eigenvalues = self.get_eig_array()
        plt.clf()
        if window is not None:
            plt.ylim(window[0], window[1])
        if self.get_number_of_spins() == 1:

            for i in range(self.nbands):
                band_i = eigenvalues[i, :] - self.get_fermi_level()
                plt.plot(self.band_xs, band_i)
        else:

            for i in range(self.nbands):
                band_i = eigenvalues[i, :, spin] - self.get_fermi_level()
                plt.plot(self.band_xs, band_i)
        plt.xlabel('K-points')
        plt.ylabel('$Energy-E_{fermi} (eV)$')
        plt.ylim(yrange)
        plt.axhline(0, color='black', linestyle='--')
        if self.special_kpts_names is not None:
            plt.xticks(self.band_special_xs, self.special_kpts_names)

        if output_filename is not None:
            plt.savefig(output_filename)
        if show:
            plt.show()

    def read_contcar(self, atoms, filename='CONTCAR'):
        """
        read from contcar and set the positions and cellpars. Note that in vasp, "sort" is True. so read and !!!!unsort!!!!.
        """

        symbols, positions, cell = read_poscar_and_unsort(filename=filename)