<commit_before>import numpy as np

class Generator( dict ):
    """
    Used to create molecules, write dalton .mol files 
    using -param for study with use_calculator.py

    water currently implemented only

    plans to implement methanol

    """
    def __init__(self, *args, **kwargs):

#This waater is TIP3P model,
        self[ ("water", "tip3p", "a_hoh", "degree") ] = 104.52
        self[ ("water", "tip3p", "r_oh", "AA") ] = 0.9572

#This waater is SPC model,
        self[ ("water", "spc", "a_hoh", "degree") ] = 109.47
        self[ ("water", "spc", "r_oh", "AA") ] = 1.0

        self[ ("methanol", "gas_opt", "r_oh", "AA" ) ] = 0.967
        self[ ("methanol", "gas_opt", "r_co", "AA" ) ] = 1.428
        self[ ("methanol", "gas_opt", "r_ch", "AA" ) ] = 1.098

        self[ ("methanol", "gas_opt", "a_coh", "degree" ) ] = 107.16
        self[ ("methanol", "gas_opt", "a_hch", "degree" ) ] = 109.6
        self[ ("methanol", "gas_opt", "a_hco", "degree" ) ] = 109.342

        self[ ("methanol", "gas_opt", "d_hcoh", "h4", "degree" ) ] =  60.0
        self[ ("methanol", "gas_opt", "d_hcoh", "h5", "degree" ) ] = -60.0
        self[ ("methanol", "gas_opt", "d_hcoh", "h6", "degree" ) ] =  180.0

        
#Default options for water
        for val in ["r", "tau", "theta", "rho1", "rho2", "rho3", ]:
            self[ ( val, 'min') ]    = 0.0
            self[ ( val, 'max') ]    = 0.0
            self[ ( val, 'points') ] = 1
        self[ ( 'r', 'min') ]    = 5.0
        self[ ( 'r', 'max') ]    = 10.0
        self[ ( 'r', 'points') ] = 1

# Set by default all parameters to False
        for val in ["r", "tau", "theta", "rho1", "rho2", "rho3", ]:
            self[ ( val, "active" ) ]  = False

    @staticmethod
    def get_pe_b3lyp_dal( co = 1.0, AA = True, max_l = 2, sites = 3):
        r_order = max_l + 1
        if AA:
            aa = "AA"
        else:
            aa = "AU"
            co /= a0
        st = """**DALTON INPUT
.RUN WAVE FUNCTION
.DIRECT
.PARALLELL
.PEQM
*PEQM
.BORDER
REDIST -%d %.1f %s %d
**WAVE FUNCTION
.DFT
B3LYP
**END OF DALTON INPUT""" % (max_l+1, co, aa, sites)
        return st

    @staticmethod
    def get_qmmm_b3lyp_dal( damp = False):
        if damp:
            damp = "\n.DAMP"
        else:
            damp = ""
        st = """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
*QMMM
.QMMM%s
**WAVE FUNCTION
.DFT
B3LYP
**END OF DALTON INPUT""" % damp
        return st

    @staticmethod
    def get_b3lypqua_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.DFT
B3LYP
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*QUADRATIC
.QLOP
.DIPLEN
**END OF DALTON INPUT""" 

    @staticmethod
    def get_hfqua_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.HF
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*QUADRATIC
.QLOP
.DIPLEN
**END OF DALTON INPUT""" 

    @staticmethod
    def get_hflin_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.HF
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*LINEAR
.DIPLEN
**END OF DALTON INPUT""" 

    @staticmethod
    def get_b3lyplin_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.DFT
B3LYP
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*LINEAR
.DIPLEN
**END OF DALTON INPUT""" 





    def gen_mols_param(self, mol = "water", 
            model = 'tip3p',
            basis = ["ano-1 2 1", "ano-1 3 2 1"],<commit_msg>added get_b3lyp_freqs_lin in Generator to generate dalfile with frequencies for linear response<commit_after>import numpy as np

class Generator( dict ):
    """
    Used to create molecules, write dalton .mol files 
    using -param for study with use_calculator.py

    water currently implemented only

    plans to implement methanol

    """
    def __init__(self, *args, **kwargs):

#This waater is TIP3P model,
        self[ ("water", "tip3p", "a_hoh", "degree") ] = 104.52
        self[ ("water", "tip3p", "r_oh", "AA") ] = 0.9572

#This waater is SPC model,
        self[ ("water", "spc", "a_hoh", "degree") ] = 109.47
        self[ ("water", "spc", "r_oh", "AA") ] = 1.0

        self[ ("methanol", "gas_opt", "r_oh", "AA" ) ] = 0.967
        self[ ("methanol", "gas_opt", "r_co", "AA" ) ] = 1.428
        self[ ("methanol", "gas_opt", "r_ch", "AA" ) ] = 1.098

        self[ ("methanol", "gas_opt", "a_coh", "degree" ) ] = 107.16
        self[ ("methanol", "gas_opt", "a_hch", "degree" ) ] = 109.6
        self[ ("methanol", "gas_opt", "a_hco", "degree" ) ] = 109.342

        self[ ("methanol", "gas_opt", "d_hcoh", "h4", "degree" ) ] =  60.0
        self[ ("methanol", "gas_opt", "d_hcoh", "h5", "degree" ) ] = -60.0
        self[ ("methanol", "gas_opt", "d_hcoh", "h6", "degree" ) ] =  180.0

        
#Default options for water
        for val in ["r", "tau", "theta", "rho1", "rho2", "rho3", ]:
            self[ ( val, 'min') ]    = 0.0
            self[ ( val, 'max') ]    = 0.0
            self[ ( val, 'points') ] = 1
        self[ ( 'r', 'min') ]    = 5.0
        self[ ( 'r', 'max') ]    = 10.0
        self[ ( 'r', 'points') ] = 1

# Set by default all parameters to False
        for val in ["r", "tau", "theta", "rho1", "rho2", "rho3", ]:
            self[ ( val, "active" ) ]  = False

    @staticmethod
    def get_pe_b3lyp_dal( co = 1.0, AA = True, max_l = 2, sites = 3):
        r_order = max_l + 1
        if AA:
            aa = "AA"
        else:
            aa = "AU"
            co /= a0
        st = """**DALTON INPUT
.RUN WAVE FUNCTION
.DIRECT
.PARALLELL
.PEQM
*PEQM
.BORDER
REDIST -%d %.1f %s %d
**WAVE FUNCTION
.DFT
B3LYP
**END OF DALTON INPUT""" % (max_l+1, co, aa, sites)
        return st

    @staticmethod
    def get_qmmm_b3lyp_dal( damp = False):
        if damp:
            damp = "\n.DAMP"
        else:
            damp = ""
        st = """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
*QMMM
.QMMM%s
**WAVE FUNCTION
.DFT
B3LYP
**END OF DALTON INPUT""" % damp
        return st

    @staticmethod
    def get_b3lypqua_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.DFT
B3LYP
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*QUADRATIC
.QLOP
.DIPLEN
**END OF DALTON INPUT""" 

    @staticmethod
    def get_hfqua_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.HF
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*QUADRATIC
.QLOP
.DIPLEN
**END OF DALTON INPUT""" 

    @staticmethod
    def get_hflin_dal( ):
        return """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.HF
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*LINEAR
.DIPLEN
**END OF DALTON INPUT""" 

    @staticmethod
    def get_b3lyplin_freq_dal( freqs = ["0.0"], au = True, nm = False  ):
        _string = """**DALTON INPUT
.RUN RESPONSE
.DIRECT
.PARALLELL
**WAVE FUNCTION
.DFT
B3LYP
.INTERFACE
**INTEGRAL
.DIPLEN
.SECMOM
**RESPONSE
.PROPAV
XDIPLEN
.PROPAV
YDIPLEN
.PROPAV
ZDIPLEN
*LINEAR
.DIPLEN
.FREQUE
 %d
""" %( len(freqs) )
        _string += " ".join( map(str,freqs) ) + '\n'
        _string += "**END OF DALTON INPUT\n"
        return _string




    def gen_mols_param(self, mol = "water", 
            model = 'tip3p',
            basis = ["ano-1 2 1", "ano-1 3 2 1"],
{'fraction_non_alphanumeric': 0.16527087149960742, 'fraction_numerical': 0.026825438366919654, 'mean_word_length': 2.4074899687917966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '717415', 'n_tokens_mistral': 3329, 'n_tokens_neox': 3133, 'n_words': 832}