# Path: pyDFTutils/vasp/vasp_dos.py
# def write_all_sum_dos(output='sum_dos.txt',nospin_output='sum_dos_nospin.txt',eg_polar_output='eg_polor.txt',erange=None):
#     mydos=MyVaspDos()
#     orbs=mydos.get_orbital_names()
#     symdict=get_symdict()
#     with open(output,'w') as myfile:
#         myfile.write('symnum '+'\t'.join([x.ljust(5) for x in orbs])+'\n')
#         for symnum in symdict:
#             sdoss=list(mydos.sum_dos_all(symdict[symnum],erange=erange).values())
#             myfile.write('%s\t%s\n'%(symnum.ljust(6),'\t'.join(["%.3f"%s for s in sdoss])))
# 
#     orbs=mydos.get_orbital_names_nospin()
#     with open(nospin_output,'w') as myfile:
#         myfile.write('symnum '+'\t'.join([x.ljust(5) for x in orbs])+'\n')
#         for symnum in symdict:
#             sdoss=list(mydos.sum_dos_all_nospin(symdict[symnum],erange=erange).values())
#             myfile.write('%s\t%s\n'%(symnum.ljust(6),'\t'.join(["%.3f"%s for s in sdoss])))
# 
#     try:
#         if eg_polar_output is not None:
#             with open(eg_polar_output,'w') as myfile:
#                 myfile.write('symnum '+'\t'.join(['dx2+','dx2-','dz2+','dz2-','dx2','dz2','rate'])+'\n')
#                 for symnum in symdict:
#                     dx2_up=mydos.sum_dos(symdict[symnum],'dx2+',erange=erange)
#                     dx2_down=mydos.sum_dos(symdict[symnum],'dx2-',erange=erange)
#                     dz2_up=mydos.sum_dos(symdict[symnum],'dz2+',erange=erange)
#                     dz2_down=mydos.sum_dos(symdict[symnum],'dz2-',erange=erange)
# 
#                     dx2=mydos.sum_dos_nospin(symdict[symnum],'dx2',erange=erange)
#                     dz2=mydos.sum_dos_nospin(symdict[symnum],'dz2',erange=erange)
#                     if dx2+dz2<0.0001:  #no eg
#                         porlar_rate=0
#                     else:
#                         porlar_rate=(dx2-dz2)/(dx2+dz2)
# 
#                     myfile.write('%s\t%s\n'%(symnum.ljust(6),'\t'.join(["%.3f"%s for s in [dx2_up,dx2_down,dz2_up,dz2_down,dx2,dz2,porlar_rate]])))
#     except Exception as exc:
#         print(("Warning: This is not a good DOSCAR for calculating eg polarization. \n %s"%exc))


from pyDFTutils.vasp.vasp_dos import write_all_sum_dos
from argparse import ArgumentParser
#!/usr/bin/env python
if __name__=='__main__':
    parser=ArgumentParser(description='sum the DOSCAR valence dos')
    parser.add_argument('-o','--output',help='output file name',default='sum_dos.txt')

# Path: pyDFTutils/vasp/vasp_dos.py
# def write_all_sum_dos(output='sum_dos.txt',nospin_output='sum_dos_nospin.txt',eg_polar_output='eg_polor.txt',erange=None):
#     mydos=MyVaspDos()
#     orbs=mydos.get_orbital_names()
#     symdict=get_symdict()
#     with open(output,'w') as myfile:
#         myfile.write('symnum '+'\t'.join([x.ljust(5) for x in orbs])+'\n')
#         for symnum in symdict:
#             sdoss=list(mydos.sum_dos_all(symdict[symnum],erange=erange).values())
#             myfile.write('%s\t%s\n'%(symnum.ljust(6),'\t'.join(["%.3f"%s for s in sdoss])))
# 
#     orbs=mydos.get_orbital_names_nospin()
#     with open(nospin_output,'w') as myfile:
#         myfile.write('symnum '+'\t'.join([x.ljust(5) for x in orbs])+'\n')
#         for symnum in symdict:
#             sdoss=list(mydos.sum_dos_all_nospin(symdict[symnum],erange=erange).values())
#             myfile.write('%s\t%s\n'%(symnum.ljust(6),'\t'.join(["%.3f"%s for s in sdoss])))
# 
#     try:
#         if eg_polar_output is not None:
#             with open(eg_polar_output,'w') as myfile:
#                 myfile.write('symnum '+'\t'.join(['dx2+','dx2-','dz2+','dz2-','dx2','dz2','rate'])+'\n')
#                 for symnum in symdict:
#                     dx2_up=mydos.sum_dos(symdict[symnum],'dx2+',erange=erange)
#                     dx2_down=mydos.sum_dos(symdict[symnum],'dx2-',erange=erange)
#                     dz2_up=mydos.sum_dos(symdict[symnum],'dz2+',erange=erange)
#                     dz2_down=mydos.sum_dos(symdict[symnum],'dz2-',erange=erange)
# 
#                     dx2=mydos.sum_dos_nospin(symdict[symnum],'dx2',erange=erange)
#                     dz2=mydos.sum_dos_nospin(symdict[symnum],'dz2',erange=erange)
#                     if dx2+dz2<0.0001:  #no eg
#                         porlar_rate=0
#                     else:
#                         porlar_rate=(dx2-dz2)/(dx2+dz2)
# 
#                     myfile.write('%s\t%s\n'%(symnum.ljust(6),'\t'.join(["%.3f"%s for s in [dx2_up,dx2_down,dz2_up,dz2_down,dx2,dz2,porlar_rate]])))
#     except Exception as exc:
#         print(("Warning: This is not a good DOSCAR for calculating eg polarization. \n %s"%exc))


# Path: pyDFTutils/vasp/sumdos.py
from pyDFTutils.vasp.vasp_dos import write_all_sum_dos
from argparse import ArgumentParser

#!/usr/bin/env python
if __name__=='__main__':
    parser=ArgumentParser(description='sum the DOSCAR valence dos')
    parser.add_argument('-o','--output',help='output file name',default='sum_dos.txt')

    args=parser.parse_args()