# Path: mpinterfaces/data_processor.py
# class MPINTVasprun(Vasprun):
#     """
#     Extend Vasprun to use custom ComputedEntry: MPINTComputedEntry
#     """
# 
#     def __init__(self, filename, ionic_step_skip=None,
#                  ionic_step_offset=0, parse_dos=True,
#                  parse_eigen=True, parse_projected_eigen=False,
#                  parse_potcar_file=True):
# 
#         Vasprun.__init__(self, filename,
#                          ionic_step_skip=ionic_step_skip,
#                          ionic_step_offset=ionic_step_offset,
#                          parse_dos=parse_dos, parse_eigen=parse_eigen,
#                          parse_projected_eigen=parse_projected_eigen,
#                          parse_potcar_file=parse_potcar_file)
# 
#     def get_computed_entry(self, inc_structure=False,
#                            inc_incar_n_kpoints=False,
#                            parameters=None, data=None):
#         """
#         Returns a ComputedEntry from the vasprun.
# 
#         Args:
#             inc_structure (bool): Set to True if you want
#                 ComputedStructureEntries to be returned instead of
#                 ComputedEntries.
#             inc_incar_n_kpoints (bool): along with inc_structure set
#                 to True if you want MPINTComputedEntries to be
#                 returned
#             parameters (list): Input parameters to include.
#                 It has to be one of the properties supported by the
#                 Vasprun object. If parameters == None, a default set
#                 of parameters that are necessary for typical
#                 post-processing will be set.
#             data (list): Output data to include. Has to be one of the
#                 properties supported by the Vasprun object.
# 
#         Returns:
#             ComputedStructureEntry/ComputedEntry
#         """
#         param_names = {"is_hubbard", "hubbards", "potcar_symbols",
#                        "run_type"}
#         if parameters:
#             param_names.update(parameters)
#         params = {p: getattr(self, p) for p in param_names}
#         data = {p: getattr(self, p) for p in data} if data is not None else {}
# 
#         if inc_structure and inc_incar_n_kpoints:
#             return MPINTComputedEntry(self.final_structure,
#                                       self.kpoints, self.incar,
#                                       self.final_energy,
#                                       parameters=params, data=data)
# 
#         elif inc_structure:
#             return ComputedStructureEntry(self.final_structure,
#                                           self.final_energy,
#                                           parameters=params,
#                                           data=data)
#         else:
#             return ComputedEntry(self.final_structure.composition,
#                                  self.final_energy, parameters=params,
#                                  data=data)
# 
# Path: mpinterfaces/default_logger.py
# def get_default_logger(name, output_stream=sys.stdout):
#     logger = logging.getLogger(name)
#     logger.setLevel(logging.DEBUG)
#     logger.propagate = False
#     formatter = logging.Formatter('%(levelname)s:%(name)s:%(message)s')
#     sh = logging.StreamHandler(stream=output_stream)
#     sh.setFormatter(formatter)
#     logger.addHandler(sh)
#     return logger


import os
import shutil
import subprocess
import logging
from pymatgen.io.vasp.inputs import Incar, Poscar, Potcar, Kpoints
from pymatgen.io.vasp.sets import DictSet
from custodian.custodian import Job, ErrorHandler
from monty.json import MontyDecoder
from fireworks.user_objects.queue_adapters.common_adapter import CommonAdapter
from mpinterfaces.data_processor import MPINTVasprun
from mpinterfaces.default_logger import get_default_logger
# Copyright (c) Henniggroup.
# Distributed under the terms of the MIT License.

from __future__ import division, print_function, unicode_literals, \
    absolute_import

"""
The instrument module:
defines the inputset and the job

"""

# uncomment for python2.7 pymatgen versions compatibility and more changes, refer
# ufhpc_py27_compat branch
#try:
#    from pymatgen.io.vasp.sets import DictVaspInputSet
#except ImportError:
#    from pymatgen.io.vasp.sets import DictSet as DictVaspInputSet





__author__ = "Kiran Mathew, Joshua J. Gabriel"
__copyright__ = "Copyright 2017, Henniggroup"
__maintainer__ = "Joshua J. Gabriel"
__email__ = "joshgabriel92@gmail.com"
__status__ = "Production"
__date__ = "March 3, 2017"


# Path: mpinterfaces/data_processor.py
# class MPINTVasprun(Vasprun):
#     """
#     Extend Vasprun to use custom ComputedEntry: MPINTComputedEntry
#     """
# 
#     def __init__(self, filename, ionic_step_skip=None,
#                  ionic_step_offset=0, parse_dos=True,
#                  parse_eigen=True, parse_projected_eigen=False,
#                  parse_potcar_file=True):
# 
#         Vasprun.__init__(self, filename,
#                          ionic_step_skip=ionic_step_skip,
#                          ionic_step_offset=ionic_step_offset,
#                          parse_dos=parse_dos, parse_eigen=parse_eigen,
#                          parse_projected_eigen=parse_projected_eigen,
#                          parse_potcar_file=parse_potcar_file)
# 
#     def get_computed_entry(self, inc_structure=False,
#                            inc_incar_n_kpoints=False,
#                            parameters=None, data=None):
#         """
#         Returns a ComputedEntry from the vasprun.
# 
#         Args:
#             inc_structure (bool): Set to True if you want
#                 ComputedStructureEntries to be returned instead of
#                 ComputedEntries.
#             inc_incar_n_kpoints (bool): along with inc_structure set
#                 to True if you want MPINTComputedEntries to be
#                 returned
#             parameters (list): Input parameters to include.
#                 It has to be one of the properties supported by the
#                 Vasprun object. If parameters == None, a default set
#                 of parameters that are necessary for typical
#                 post-processing will be set.
#             data (list): Output data to include. Has to be one of the
#                 properties supported by the Vasprun object.
# 
#         Returns:
#             ComputedStructureEntry/ComputedEntry
#         """
#         param_names = {"is_hubbard", "hubbards", "potcar_symbols",
#                        "run_type"}
#         if parameters:
#             param_names.update(parameters)
#         params = {p: getattr(self, p) for p in param_names}
#         data = {p: getattr(self, p) for p in data} if data is not None else {}
# 
#         if inc_structure and inc_incar_n_kpoints:
#             return MPINTComputedEntry(self.final_structure,
#                                       self.kpoints, self.incar,
#                                       self.final_energy,
#                                       parameters=params, data=data)
# 
#         elif inc_structure:
#             return ComputedStructureEntry(self.final_structure,
#                                           self.final_energy,
#                                           parameters=params,
#                                           data=data)
#         else:
#             return ComputedEntry(self.final_structure.composition,
#                                  self.final_energy, parameters=params,
#                                  data=data)
# 
# Path: mpinterfaces/default_logger.py
# def get_default_logger(name, output_stream=sys.stdout):
#     logger = logging.getLogger(name)
#     logger.setLevel(logging.DEBUG)
#     logger.propagate = False
#     formatter = logging.Formatter('%(levelname)s:%(name)s:%(message)s')
#     sh = logging.StreamHandler(stream=output_stream)
#     sh.setFormatter(formatter)
#     logger.addHandler(sh)
#     return logger


# Path: mpinterfaces/instrument.py
import os
import shutil
import subprocess
import logging
from pymatgen.io.vasp.inputs import Incar, Poscar, Potcar, Kpoints
from pymatgen.io.vasp.sets import DictSet
from custodian.custodian import Job, ErrorHandler
from monty.json import MontyDecoder
from fireworks.user_objects.queue_adapters.common_adapter import CommonAdapter
from mpinterfaces.data_processor import MPINTVasprun
from mpinterfaces.default_logger import get_default_logger

# Copyright (c) Henniggroup.
# Distributed under the terms of the MIT License.

from __future__ import division, print_function, unicode_literals, \
    absolute_import

"""
The instrument module:
defines the inputset and the job

"""

# uncomment for python2.7 pymatgen versions compatibility and more changes, refer
# ufhpc_py27_compat branch
#try:
#    from pymatgen.io.vasp.sets import DictVaspInputSet
#except ImportError:
#    from pymatgen.io.vasp.sets import DictSet as DictVaspInputSet





__author__ = "Kiran Mathew, Joshua J. Gabriel"
__copyright__ = "Copyright 2017, Henniggroup"
__maintainer__ = "Joshua J. Gabriel"
__email__ = "joshgabriel92@gmail.com"
__status__ = "Production"
__date__ = "March 3, 2017"


logger = get_default_logger(__name__)