Source code for grogupy.io

# Copyright (c) [2024] []
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from argparse import ArgumentParser
from pickle import dump, load

import numpy as np

default_args = dict(
    infile=None,
    outfile=None,
    scf_xcf_orientation=np.array([0, 0, 1]),
    ref_xcf_orientations=[
        dict(o=np.array([1, 0, 0]), vw=[np.array([0, 1, 0]), np.array([0, 0, 1])]),
        dict(o=np.array([0, 1, 0]), vw=[np.array([1, 0, 0]), np.array([0, 0, 1])]),
        dict(o=np.array([0, 0, 1]), vw=[np.array([1, 0, 0]), np.array([0, 1, 0])]),
    ],
    kset=2,
    kdirs="xyz",
    ebot=None,
    eset=42,
    esetp=1000,
    parallel_solver_for_Gk=False,
    padawan_mode=True,
)

# parser = ArgumentParser()

# parser.add_argument('--input'   , dest = 'infile' , default=None                       , help = 'Input file name')
# parser.add_argument('--output'  , dest = 'outfile', default=None                       , help = 'Output file name')

# parser.add_argument('--kset'    , dest = 'kset'   , default  = 2           , type=int  , help = 'k-space resolution of Jij calculation')
# parser.add_argument('--kdirs'   , dest = 'kdirs'  , default  = 'xyz'                   , help = 'Definition of k-space dimensionality')
# parser.add_argument('--ebot'    , dest = 'ebot'   , default  = None        , type=float, help = 'Bottom energy of the contour')
# parser.add_argument('--eset'    , dest = 'eset'   , default  = 42          , type=int  , help = 'Number of energy points on the contour')
# parser.add_argument('--eset-p'  , dest = 'esetp'  , default  = 1000        , type=int  , help = 'Parameter tuning the distribution on the contour')

# cmd_line_args = parser.parse_args()


[docs] def save_pickle(outfile, data): """Saves the data in the outfile with pickle. Args: outfile : str Path to outfile data : dict Contains the data """ # save dictionary with open(outfile, "wb") as output_file: dump(data, output_file)
[docs] def load_pickle(infile): """Loads the data from the infile with pickle. Args: infile : str Path to infile Returns: data : dict A dictionary of data """ # open and read file with open(infile, "wb") as input_file: data = load(data, input_file) return data