<jupyter_start><jupyter_text>Estimate Solvation ThermoThis script estimates solvation thermo (solute parameters, solvation free energy, and solvation enthalpy). It first checks whether the values can be found from the solute library, and if not, it uses the group additivity approach to estimate the solute parameters and solvation properties. Read documentation on solvation thermochemistry for detailed method (http://reactionmechanismgenerator.github.io/RMG-Py/users/rmg/liquids.html).You can also look up available solvents in RMG using a SMILES string with this script.Code written by <NAME><jupyter_code>import os.path
from rmgpy import settings
from rmgpy.rmg.main import Species
from rmgpy.data.solvation import SolvationDatabase

solvationDatabase = SolvationDatabase()
solvationDatabase.load(os.path.join(settings['database.directory'], 'solvation'))<jupyter_output><empty_output><jupyter_text>Search for available solvents using a SMILES string<jupyter_code>def print_find_solvent_results(match_list):
    dGsolv_param_list = ['e_g', 's_g', 'a_g', 'b_g', 'l_g', 'c_g']
    dHsolv_param_list = ['e_h', 's_h', 'a_h', 'b_h', 'l_h', 'c_h']
    viscosity_param_list = ['A', 'B', 'C', 'D', 'E']
    if len(match_list) == 0:
        print('No matching solvent is found in the RMG solvent library')
    else:
        count = 1
        for label, entry in match_list:
            print(f'Matched Solvent {count}: {label}')
            solven_data = entry.data
            if solven_data.e_g is None:
                print('- Solvation free energy calculation is not availble for this solvent.')
            else:
                print('- Solvation free energy calculation is available. The relevant Abraham solvent parameters are:')
                print(f'\te_g = {solven_data.e_g}, s_g = {solven_data.s_g}, a_g = {solven_data.a_g}, \
b_g = {solven_data.b_g}, l_g = {solven_data.l_g}, c_g = {solven_data.c_g}')
            if solven_data.e_h is None:
                print('- Solvation enthalpy calculation is not availble for this solvent.')
            else:
                print('- Solvation enthalpy calculation is available. The relevant Mintz solvent parameters are:')
                print(f'\te_h = {solven_data.e_h}, s_h = {solven_data.s_h}, a_h = {solven_data.a_h}, \
b_h = {solven_data.b_h}, l_h = {solven_data.l_h}, c_h = {solven_data.c_h}')
            if solven_data.A is None:
                print('- Viscosity is not availble for this solvent.')
            else:
                print('- Viscosity calculation is available. The relevant viscosity parameters are:')
                print(f'\tA = {solven_data.A}, B = {solven_data.B}, C = {solven_data.C}, \
D = {solven_data.D}, E = {solven_data.E}')
            print('')
            count += 1
# Example 1.

########### Input your SMILES string below ###############################

solvent_smiles = 'NC=O'

##########################################################################

match_list = solvationDatabase.find_solvent_from_smiles(solvent_smiles)
print_find_solvent_results(match_list)
# Example 2.

########### Input your SMILES string below ###############################

solvent_smiles = 'ClC=CCl'

##########################################################################

match_list = solvationDatabase.find_solvent_from_smiles(solvent_smiles)
print_find_solvent_results(match_list)
# Example 3.

########### Input your SMILES string below ###############################

solvent_smiles = 'C(CCl)O'

##########################################################################

match_list = solvationDatabase.find_solvent_from_smiles(solvent_smiles)
print_find_solvent_results(match_list)<jupyter_output><empty_output><jupyter_text>Estimate solute parameters, solvation energy, and solvation enthalpy from solute SMILES and solvent label<jupyter_code># Example 1.

########### Input your solute SMILES string and solvent label below ###############################

solute_smiles = 'CCCCOC(=O)C1=CC=CC=C1C(=O)OCC2=CC=CC=C2'
solvent_label = 'water'

###################################################################################################

solute_spc = Species().from_smiles(solute_smiles)
solute_spc.generate_resonance_structures()
solute_data = solvationDatabase.get_solute_data_from_groups(solute_spc)
solvent_data = solvationDatabase.get_solvent_data(solvent_label)

print(f'Estimated solute parameters are:')
print(solute_data)

try:
    dGsolv = '%.2f' % (solvationDatabase.calc_g(solute_data, solvent_data) / 4184) # in kcal/mol
    print(f'\nEstimated solvation free energy at 298 K is : {dGsolv} kcal/mol')
except:
    print(f'\nSolvation free energy cannot be calculated because {solvent_label} does not have \
Abraham solvent parameters.')
    
try:
    dHsolv = '%.2f' % (solvationDatabase.calc_h(solute_data, solvent_data) / 4184) # in kcal/mol
    print(f'\nEstimated solvation enthalpy at 298 K is : {dHsolv} kcal/mol')
except:
    print(f'\nSolvation enthalpy cannot be calculated because {solvent_label} does not have \
Mintz solvent parameters.')
# Example 2.

########### Input your solute SMILES string and solvent label below ###############################

solute_smiles = 'C1=CC(=CC(=C1)Cl)N'
solvent_label = 'trans-1,2-dichloroethene'

###################################################################################################

solute_spc = Species().from_smiles(solute_smiles)
solute_spc.generate_resonance_structures()
solute_data = solvationDatabase.get_solute_data_from_groups(solute_spc)
solvent_data = solvationDatabase.get_solvent_data(solvent_label)

print(f'Estimated solute parameters are:')
print(solute_data)

try:
    dGsolv = '%.2f' % (solvationDatabase.calc_g(solute_data, solvent_data) / 4184) # in kcal/mol
    print(f'\nEstimated solvation free energy at 298 K is : {dGsolv} kcal/mol')
except:
    print(f'\nSolvation free energy cannot be calculated because {solvent_label} does not have \
Abraham solvent parameters.')
    
try:
    dHsolv = '%.2f' % (solvationDatabase.calc_h(solute_data, solvent_data) / 4184) # in kcal/mol
    print(f'\nEstimated solvation enthalpy at 298 K is : {dHsolv} kcal/mol')
except:
    print(f'\nSolvation enthalpy cannot be calculated because {solvent_label} does not have \
Mintz solvent parameters.')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19113222486144102, 'fraction_numerical': 0.007600950118764846, 'mean_word_length': 4.821198156682027, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '555412', 'license': 'MIT', 'n_tokens_mistral': 2140, 'n_tokens_neox': 2003, 'n_words': 495, 'path': 'ipython/estimate_solvation_thermo_and_search_available_solvents.ipynb', 'repo_name': 'tza0035/RMG-Py', 'size': '6321'}