1 Introduction

Hansen’s solubility parameters (HSPs) allow us to express the affinity between two or more substances and have a thermodynamic nature. The theoretical foundation, estimation methods and experimental determination have been extensively treated in the literature [1, 2]. This affinity can be defined as the degree of similarity between the solute and solvent molecules in terms of the solute–solvent interactions at infinite dilution and other theories are reported to express the solvent–solute relationship, such as the determination of the Kamlet-Taf parameters [3], and methods for the selection of solvents such as the solvent similarity index [4], although this article is focused on a particular case of the HSP determination and is beyond the comparison of solvent selection methods.

Experimental evaluation of a solute with several solvents of known HSPs, usually between 20 and 30 different solvents, and the classification of them in either “good” or “bad” solvents by visual inspection or any other method, help us to determine Hansen’s parameters of the solute. There are some softwares and algorithms for HSPs calculation, as was previously explained [5], but HSPiP software is the most complete and extended tool for this purpose [6].

HSPiP software allows not only to determine the HSPs of the target substance, but also to define the region in which other related solvents can be found, called a Hansen sphere. Usually, a single sphere is in-off to represent the solute’s solubility region, but there are some particular cases, such as di-block co-polymer, which are better described with two spheres [6]. Other substances, such as ionic liquids, which have an ionic domain and a nonpolar side that representing a neutral domain, may be also better represented by a Hansen double sphere; Agata and Yamamoto [7] calculated the HSPs of eight ionic liquids with different combinations of cations and anions using the double sphere methodology. Ionic liquids, as the family of 1-Alkyl-3-methylimidazolium Bromide ([CnC1im]Br, n = 5, 6, 7, 8) were also represented by a double Hansen’s sphere [8]. Nonionic solid compounds, as surfactants, were well fitted to a Hansen’s double sphere, because one sphere represents the hydrophilic group of the surfactant and the second one the hydrophobic group [8].

Yamamoto in his web page [10], showed the case of the swelling grade of a Fluoro-Polymer, which seems a hydrophobic polymer, because swelling very well to gasoline-ethanol hydrophilic solvents, indicating its double nature.

In previous work, the Microsoft Excel (ME) Workbook developed by Steven Abbott for HSPs determination using the Excel Solver add-in with the ability of Hansen’s sphere radius determination was improved. HSPiP software is probably the best and the only tool available for double Hansen’s sphere calculation. This communication provides the necessary information to extend the potentialities of the evolutionary algorithm of ME solver to the calculation of double Hansen’s sphere and other improvements available for ME 365 version.

2 Materials and methods

Microsoft Excel 2010 or higher can be used to determine both the coordinates and radius of systems characterized by a double Hansen solubility sphere. For the optimization of these parameters, the evolutionary algorithm has been used, whose adjustment values were: population size of 100, a random seed of 0, mutation rate of 0.75 and convergence of 0.0001. The ME spreadsheet was validated with the following examples of literature: ionic liquids as 1-ethyl-3-methylimidazolium hexafluorophosphate ([EMIM][PF6]), 1-butyl-3-methylimidazolium chloride ([BMIM][Cl]) and tetrabutylphosphonium, hexafluorophosphate ([TBP][PF6]) [7], polyoxyethylene(23)lauryl ether (PEL) [9] and a Fluoro-polymer [10]. The results were also verified with HSPiP software [6].

3 Results and discussion

3.1 Extending the spreadsheet to a double Hansen’s sphere calculation

Details of the ME spreadsheet for HSPs optimization for a single Hansen sphere was described in detail in previous work [5]. As it was explained, this kind of problem does not try to find an absolute optimum (maximum or minimum), but rather to define a region, as reduced as possible, which satisfies a multiresponse function, where all good solvents must be within one of the two spheres and all bad solvents remain outside both. Therefore, the probability of convergence to different solutions, each time the algorithm is executed, is higher in this case than when a simple sphere is fitted, even when HSPiP is used. This uncertainty can be discerned by the experimental evaluation of new solvents or solvent mixtures, whose HSPs are in the border of spheres.

The Excel spreadsheet is similar to the Steven Abbott spreadsheet, where the implementation of the calculation of HSPs in ME is extensively detailed, with the differences that two Hansen’s spheres are evaluated for each solvent, and the fit (fi,j) related to them is given by:

$${f}_{i,j}= {e}^{\left({R}_{0j}-{R}_{a i,j}\right)} \mathrm{for\,good\,solvents\,outside\,the\,spheres }(\mathrm{Rai},\,\,1 >\mathrm{ R}01\mathrm{\,or\,Ra\,i},2 >\mathrm{ R}02 )$$
$${f}_{i,j}= {e}^{\left({R}_{aj}-{R}_{0j}\right)} \mathrm{for\,bad\,solvents\,inside\,the\,sphere }(\mathrm{Ra i},,1 <\mathrm{ R}1\mathrm{\,and\,Ra i},,2 <\mathrm{ R}02)$$

where: i: solvent tested (for n solvents), j: sphere number (for m sphere; 2 in this case), R0j: Radius of sphere j, Ra i,j: Distances from center of j sphere to i solvent.

Good solvents have a bad fit (fit less than 1) when they fall outside of both Hansen's spheres; that is, a good solvent must remain within one of the two spheres, while bad solvents must remain outside both spheres. This condition represents the total fit (fi,t) and is calculated in column “L” using the following Excel formula for each solvent tested:

$$f_{i,t} = IF\left( {Gi = ;1;IF\left( {Y\left( {Gi = 1;O\left( {J_{i} = 1;Ki = 1} \right)} \right);1;MIN\left( {Ji:Ki} \right)} \right)} \right)$$

where in “G” column are records the score of the solvents, “i” is the row number, while in “J” and “K” columns the fi,j values are calculated. The identification of good solvents outside the spheres (WO) and bad solvents inside (WI) is highlighted in the column “O” with the following function:

$${\text{Excel}}\;{\text{Function}} = {\text{IF}}\left( {{\text{Gi}} = 1;{\text{IF}}\left( {{\text{O}}\left( {{\text{Mi}} < = 1;{\text{Ni}} < = 1} \right);;{\text{WO}}} \right);{\text{IF}}\left( {{\text{Gi}} = 0;{\text{IF}}\left( {O\left( {{\text{Mi}} < 1;{\text{Ni}} < 1} \right);{\text{WI}};} \right);} \right)} \right)$$

The objective function (OF) results from a multiplication of two product functions (P1, P2), one aimed at adjusting the good and bad solvents and the second one at minimizing the radius of the spheres R0j.

$${\text{OF}} = P_{1} \cdot P_{2}$$
$$OF= {\left(\prod_{i=1}^{n}{f}_{i,t}\right)}^\frac{1}{n}.{\left(\prod_{j=1}^{2}{R}_{0j}\right)}^{-\frac{1}{n}}$$

where “n” is the number of solvents tested.

The Excel model has been validated with the literature results mentioned above, which are summarized in Table 1. It shows the results of the adjustment in Excel and their comparison with the values reported in the literature and the verification of the adjustment with the HSPiP software. A tutorial is supplied as supplementary information.

Table 1 Results obtained for double Hansen’s sphere calculation with evolutionary algorithm of Microsoft Excel, HSPiP software and literature

As it can be seen, in all cases, the solution with ME provides a good fit; only for PEL and Fluoro-polymer, the adjustments with HSPiP (Table 1) were slightly higher. However, for most of the cases evaluated, the Hansen spheres obtained through optimization with ME report a smaller radius.

Figures 1 and 2 show the Hansen double spheres for each case evaluated, obtained by the HSPiP program and according to the results of ME.

Fig. 1
figure 1

Double Hansen’s spheres determined for [EMIM][PF6], [BMIM][Cl] and [TBP][PF6]; a calculated with HSPiP., b calculated with Evolutionary algorithm of solver add-in from Microsoft Excel

Fig. 2
figure 2

Double Hansen’s spheres determined for PEL and Fluoro-polymer; a calculated with HSPiP., b calculated with Evolutionary algorithm of solver add-in from Microsoft Excel

In Figs. 1 and 2 is shown that all cases have similar behavior; however, the optimization with ME reports spheres with a smaller radius, without affecting the adjustment of WO and WI. The objective function used by the HSPiP program is not known, but the one presented in this work has two components; a product function (P1) aimed at treating that all the good solvents fit inside the spheres and the bad solvents outside, while the second product function (P2) is focused on minimizing the radii of the spheres. The optimization algorithm used and its search strategy for the optimum determine the relative weight of P1 and P2 during the optimization process, and in the evolutionary method of Excel's Solver seems to be more effective in reducing the radius of the spheres than that used by the HSPiP program.

A slightly lower fit with ME is obtained for PEL and Fluoro-polymer examples. As has been explained in previous works [3], the optimization problem that concerns does not seek an absolute optimum (maximum or minimum) but rather to determine a region, as reduced as possible (spheres of minimum radius) that satisfies multiple answers, where to include or exclude each solvent in the sphere is an objective to be satisfied. Therefore, there are multiple solutions with small variations between them that satisfy the multi-response optimization. For this reason, it is not possible to conclude that one method is better than other; both tools, HSPiP and ME allow to solve this type of problem and provide valid solutions.

3.2 Improvements for ME 365

The new workbook, developed for ME 365, has other facilities for users. The "Chemicals” sheet has been included with more than 1200 HSPs of solvents and compounds, which can be incorporated into the calculation spreadsheets only by entering the Chemical Abstract number in column A. The management of matrixes and the use of the new FILTER function, only available in this ME version, facilitates the rendering of two-dimensional graphics from HSP.

The worksheet named “HSP Solvents Blends and Chi” has been updated with more functionalities such as: graphing the HSP coordinates and radius up to 5 substances (the reference and 4 more—selecting them in the N10:N14 range), calculation of the spheres overlap and the calculation of the proportions, up to a quaternary blend, to obtain the minimum distance possible through SOLVER optimization plug-in (substance constraints can also be included in the W25:X28 range).

Finally, a second worksheet named “Find a Similar Substance” allows the user to search the entire database to find HSP compounds that match the constraints included in the J3: L6 range table.

Microsoft Excel workbook with calculation procedure and enhancements can be downloaded from the following website [11]: https://www.hansen-solubility.com/downloads.php.

4 Conclusion

The evolutionary algorithm of the solver add-in from Microsoft Excel allows solving optimization problems that need to be represented by a double Hansen solubility sphere. The validation of the sheet, enabled for this purpose, shows that it is feasible to obtain adjustments similar to those obtained with the HSPiP software, despite the complexity of this type of multiobjective optimization, where the optimization process focuses on obtaining an optimal region and not an absolute optimal. Obtaining spheres with smaller radii with ME results from the combination of the elaborated objective function and the optimization algorithm used. A full solvents database and two dimensional graphic illustrations of the results were included in this new ME version.