HSPiPy 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- HSPiPy-0.0.1.dist-info/LICENSE +21 -0
- HSPiPy-0.0.1.dist-info/METADATA +14 -0
- HSPiPy-0.0.1.dist-info/RECORD +8 -0
- HSPiPy-0.0.1.dist-info/WHEEL +5 -0
- HSPiPy-0.0.1.dist-info/top_level.txt +1 -0
- hspipy/__init__.py +1 -0
- hspipy/src/__init__.py +0 -0
- hspipy/src/hspipy.py +32 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Alejandro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: HSPiPy
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Hansen Solubility Parameters in Python
|
|
5
|
+
Home-page: https://github.com/Gnpd/HSPy
|
|
6
|
+
Author: Alejandro Gutierrez
|
|
7
|
+
Author-email: agutierrez@g-npd.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: scipy
|
|
14
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
hspipy/__init__.py,sha256=j9mJ5cD4lttcUmVWduBUDxJM2maol3v3so-FpxgY_i8,33
|
|
2
|
+
hspipy/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
hspipy/src/hspipy.py,sha256=qRpAI1tKBfbPFTOTTFEIFxPMZIdD-XT8YUW_ppmVQa4,1156
|
|
4
|
+
HSPiPy-0.0.1.dist-info/LICENSE,sha256=tUEinO8rnAfrpzzkHnaEaCNzNc0xE9zlOrZPQ-qE_oI,1087
|
|
5
|
+
HSPiPy-0.0.1.dist-info/METADATA,sha256=QxoLdwJW-wz9p0Ywkq3kvZLjSmS8AWbsGp8PGnCdpoQ,428
|
|
6
|
+
HSPiPy-0.0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
7
|
+
HSPiPy-0.0.1.dist-info/top_level.txt,sha256=amz1AVUztVrgiqZ86SocDgpTdlghRWncpg1Qa6gRNbA,7
|
|
8
|
+
HSPiPy-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hspipy
|
hspipy/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .src.hspipy import get_hsp
|
hspipy/src/__init__.py
ADDED
|
File without changes
|
hspipy/src/hspipy.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from scipy.optimize import differential_evolution
|
|
2
|
+
|
|
3
|
+
def get_hsp_error(HSP,grid,inside_limit):
|
|
4
|
+
errors = []
|
|
5
|
+
for solvent, D, P, H, score in grid:
|
|
6
|
+
# Calculate the Euclidean distance between (D, P, H) and (HSP[0], HSP[1], HSP[2]).
|
|
7
|
+
distance = (
|
|
8
|
+
4*(D-HSP[0])**2+
|
|
9
|
+
(P-HSP[1])**2+
|
|
10
|
+
(H-HSP[2])**2)**0.5
|
|
11
|
+
|
|
12
|
+
# Calculate the Relative Euclidean Distance (RED).
|
|
13
|
+
RED = distance/HSP[3]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
if ( (RED <= 1 and score == inside_limit) or (RED > 1 and score != inside_limit) ):
|
|
17
|
+
errors.append(0)
|
|
18
|
+
else:
|
|
19
|
+
errors.append(abs(RED - 1))
|
|
20
|
+
|
|
21
|
+
return sum(errors)/len(errors)
|
|
22
|
+
|
|
23
|
+
def build_minimization_function(grid,inside_limit):
|
|
24
|
+
def fun(array):
|
|
25
|
+
return get_hsp_error(array, grid,inside_limit)
|
|
26
|
+
return fun
|
|
27
|
+
|
|
28
|
+
def get_hsp(grid,inside_limit=1):
|
|
29
|
+
minimization_function = build_minimization_function(grid,inside_limit)
|
|
30
|
+
bounds= [(1,30), (1, 30), (1, 30), (1, 20)]
|
|
31
|
+
optimization_result = differential_evolution(func=minimization_function, bounds=bounds, tol=1e-8)
|
|
32
|
+
return optimization_result
|