def proc_val(key, val):
        """
        Static helper method to convert PWINPUT parameters to proper type, e.g.,
        integers, floats, etc.

        Args:
            key: PWINPUT parameter key
            val: Actual value of PWINPUT parameter.
        """
        float_keys = ('etot_conv_thr','forc_conv_thr','conv_thr','Hubbard_U','Hubbard_J0','defauss',
                      'starting_magnetization',)

        int_keys = ('nstep','iprint','nberrycyc','gdir','nppstr','ibrav','nat','ntyp','nbnd','nr1',
                    'nr2','nr3','nr1s','nr2s','nr3s','nspin','nqx1','nqx2','nqx3','lda_plus_u_kind',
                    'edir','report','esm_nfit','space_group','origin_choice','electron_maxstep',
                    'mixing_ndim','mixing_fixed_ns','ortho_para','diago_cg_maxiter','diago_david_ndim',
                    'nraise','bfgs_ndim','if_pos','nks','nk1','nk2','nk3','sk1','sk2','sk3','nconstr')

        bool_keys = ('wf_collect','tstress','tprnfor','lkpoint_dir','tefield','dipfield','lelfield',
                     'lorbm','lberry','lfcpopt','monopole','nosym','nosym_evc','noinv','no_t_rev',
                     'force_symmorphic','use_all_frac','one_atom_occupations','starting_spin_angle',
                     'noncolin','x_gamma_extrapolation','lda_plus_u','lspinorb','london',
                     'ts_vdw_isolated','xdm','uniqueb','rhombohedral','realxz','block',
                     'scf_must_converge','adaptive_thr','diago_full_acc','tqr','remove_rigid_rot',
                     'refold_pos')

        def smart_int_or_float(numstr):
            if numstr.find(".") != -1 or numstr.lower().find("e") != -1:
                return float(numstr)
            else:
                return int(numstr)

        try:
            if key in bool_keys:
                if val.lower() == ".true.":
                    return True
                elif val.lower() == ".false.":
                    return False
                else:
                    raise ValueError(key + " should be a boolean type!")

            if key in float_keys:
                return float(re.search(r"^-?\d*\.?\d*d?-?\d*", val.lower()).group(0).replace("d", "e"))

            if key in int_keys:
                return int(re.match(r"^-?[0-9]+", val).group(0))

        except ValueError:
            pass

        try:
            val = val.replace("d","e")
            return smart_int_or_float(val)
        except ValueError:
            pass

        if "true" in val.lower():
            return True
        if "false" in val.lower():
            return False

        m = re.match(r"^[\"|'](.+)[\"|']$", val)
        if m:
            return m.group(1)
def proc_val ( key , val ) : float_keys = ( 'etot_conv_thr' , 'forc_conv_thr' , 'conv_thr' , 'Hubbard_U' , 'Hubbard_J0' , 'defauss' , 'starting_magnetization' , ) int_keys = ( 'nstep' , 'iprint' , 'nberrycyc' , 'gdir' , 'nppstr' , 'ibrav' , 'nat' , 'ntyp' , 'nbnd' , 'nr1' , 'nr2' , 'nr3' , 'nr1s' , 'nr2s' , 'nr3s' , 'nspin' , 'nqx1' , 'nqx2' , 'nqx3' , 'lda_plus_u_kind' , 'edir' , 'report' , 'esm_nfit' , 'space_group' , 'origin_choice' , 'electron_maxstep' , 'mixing_ndim' , 'mixing_fixed_ns' , 'ortho_para' , 'diago_cg_maxiter' , 'diago_david_ndim' , 'nraise' , 'bfgs_ndim' , 'if_pos' , 'nks' , 'nk1' , 'nk2' , 'nk3' , 'sk1' , 'sk2' , 'sk3' , 'nconstr' ) bool_keys = ( 'wf_collect' , 'tstress' , 'tprnfor' , 'lkpoint_dir' , 'tefield' , 'dipfield' , 'lelfield' , 'lorbm' , 'lberry' , 'lfcpopt' , 'monopole' , 'nosym' , 'nosym_evc' , 'noinv' , 'no_t_rev' , 'force_symmorphic' , 'use_all_frac' , 'one_atom_occupations' , 'starting_spin_angle' , 'noncolin' , 'x_gamma_extrapolation' , 'lda_plus_u' , 'lspinorb' , 'london' , 'ts_vdw_isolated' , 'xdm' , 'uniqueb' , 'rhombohedral' , 'realxz' , 'block' , 'scf_must_converge' , 'adaptive_thr' , 'diago_full_acc' , 'tqr' , 'remove_rigid_rot' , 'refold_pos' ) def smart_int_or_float ( numstr ) : if numstr . find ( "." ) != - 1 or numstr . lower ( ) . find ( "e" ) != - 1 : return float ( numstr ) else : return int ( numstr ) try : if key in bool_keys : if val . lower ( ) == ".true." : return True elif val . lower ( ) == ".false." : return False else : raise ValueError ( key + " should be a boolean type!" ) if key in float_keys : return float ( re . search ( r"^-?\d*\.?\d*d?-?\d*" , val . lower ( ) ) . group ( 0 ) . replace ( "d" , "e" ) ) if key in int_keys : return int ( re . match ( r"^-?[0-9]+" , val ) . group ( 0 ) ) except ValueError : pass try : val = val . replace ( "d" , "e" ) return smart_int_or_float ( val ) except ValueError : pass if "true" in val . lower ( ) : return True if "false" in val . lower ( ) : return False m = re . match ( r"^[\"|'](.+)[\"|']$" , val ) if m : return m . group ( 1 )
Static helper method to convert PWINPUT parameters to proper type, e.g.,
        integers, floats, etc.

        Args:
            key: PWINPUT parameter key
            val: Actual value of PWINPUT parameter.