# Path: twod_materials/stability/startup.py
# PACKAGE_PATH = twod_materials.__file__.replace('__init__.pyc', '')
# PACKAGE_PATH = PACKAGE_PATH.replace('__init__.py', '')
# PACKAGE_PATH = '/'.join(PACKAGE_PATH.split('/')[:-2])
# INCAR_DICT = {
#     '@class': 'Incar', '@module': 'pymatgen.io.vasp.inputs', 'AGGAC': 0.0,
#     'EDIFF': 1e-04, 'GGA': 'Bo', 'IBRION': 2, 'ISIF': 3, 'ISMEAR': 1,
#     'LAECHG': True, 'LCHARG': True, 'LREAL': 'Auto', 'LUSE_VDW': True,
#     'NPAR': 4, 'NSW': 50, 'PARAM1': 0.1833333333, 'PARAM2': 0.22,
#     'PREC': 'Accurate', 'ENCUT': 500, 'SIGMA': 0.1, 'LVTOT': True,
#     'LVHAR': True, 'ALGO': 'Fast', 'ISPIN': 2
#     }
#     MPR = MPRester(os.environ['MP_API'])
#     MPR = MPRester(config_vars['mp_api'])
# VASP = config_vars['normal_binary']
# VASP_2D = config_vars['twod_binary']
# VDW_KERNEL = config_vars['vdw_kernel']
#     QUEUE = config_vars['queue_system'].lower()
#     QUEUE = 'slurm'
#     QUEUE = 'pbs'
# def relax(dim=2, submit=True, force_overwrite=False):


import os
from pymatgen.io.vasp.inputs import Incar
from twod_materials.stability.startup import get_magmom_string, INCAR_DICT
def run_major_axis_anisotropy_calculations(submit=True):
    """
    Perform static calculations with the magnetic axis along
    100, 010, and 001.

    Kwargs:
        submit (bool): Whether or not to submit the job.
    """

    if not os.path.isdir('MAE'):
        os.mkdir('MAE')
    os.chdir('MAE')
    for d in ['100', '010', '001']:
        if not os.path.isdir(d):
            os.path.mkdir(d)
        os.chdir(d)
        os.system('cp ../CONTCAR POSCAR')
        os.system('cp ../POTCAR .')
        axis = [float(char) for char in d]
        # Small positive number, see vasp manual
        if d in ['001', '010']:
            axis[0] = 0.00000001
        else:
            axis[1] = 0.00000001

        saxis = ' '.join(axis)
        incar_dict = INCAR_DICT
        incar_dict.update({'EDIFF': 1e-8, 'GGA_COMPAT': False, 'ISMEAR': -5,
                           'LORBIT': 11, 'LSORBIT': True, 'LWAVE': False,
                           'LCHARG': False, 'LAECHG': False,

# Path: twod_materials/stability/startup.py
# PACKAGE_PATH = twod_materials.__file__.replace('__init__.pyc', '')
# PACKAGE_PATH = PACKAGE_PATH.replace('__init__.py', '')
# PACKAGE_PATH = '/'.join(PACKAGE_PATH.split('/')[:-2])
# INCAR_DICT = {
#     '@class': 'Incar', '@module': 'pymatgen.io.vasp.inputs', 'AGGAC': 0.0,
#     'EDIFF': 1e-04, 'GGA': 'Bo', 'IBRION': 2, 'ISIF': 3, 'ISMEAR': 1,
#     'LAECHG': True, 'LCHARG': True, 'LREAL': 'Auto', 'LUSE_VDW': True,
#     'NPAR': 4, 'NSW': 50, 'PARAM1': 0.1833333333, 'PARAM2': 0.22,
#     'PREC': 'Accurate', 'ENCUT': 500, 'SIGMA': 0.1, 'LVTOT': True,
#     'LVHAR': True, 'ALGO': 'Fast', 'ISPIN': 2
#     }
#     MPR = MPRester(os.environ['MP_API'])
#     MPR = MPRester(config_vars['mp_api'])
# VASP = config_vars['normal_binary']
# VASP_2D = config_vars['twod_binary']
# VDW_KERNEL = config_vars['vdw_kernel']
#     QUEUE = config_vars['queue_system'].lower()
#     QUEUE = 'slurm'
#     QUEUE = 'pbs'
# def relax(dim=2, submit=True, force_overwrite=False):


# Path: twod_materials/magnetism/startup.py
import os
from pymatgen.io.vasp.inputs import Incar
from twod_materials.stability.startup import get_magmom_string, INCAR_DICT

def run_major_axis_anisotropy_calculations(submit=True):
    """
    Perform static calculations with the magnetic axis along
    100, 010, and 001.

    Kwargs:
        submit (bool): Whether or not to submit the job.
    """

    if not os.path.isdir('MAE'):
        os.mkdir('MAE')
    os.chdir('MAE')
    for d in ['100', '010', '001']:
        if not os.path.isdir(d):
            os.path.mkdir(d)
        os.chdir(d)
        os.system('cp ../CONTCAR POSCAR')
        os.system('cp ../POTCAR .')
        axis = [float(char) for char in d]
        # Small positive number, see vasp manual
        if d in ['001', '010']:
            axis[0] = 0.00000001
        else:
            axis[1] = 0.00000001

        saxis = ' '.join(axis)
        incar_dict = INCAR_DICT
        incar_dict.update({'EDIFF': 1e-8, 'GGA_COMPAT': False, 'ISMEAR': -5,
                           'LORBIT': 11, 'LSORBIT': True, 'LWAVE': False,
                           'LCHARG': False, 'LAECHG': False,

                           'MAGMOM': get_magmom_string(), 'SAXIS': saxis})