stjames 0.0.101__py3-none-any.whl → 0.0.102__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.

Potentially problematic release.


This version of stjames might be problematic. Click here for more details.

@@ -4,10 +4,17 @@ from typing import Annotated, Self
4
4
 
5
5
  from pydantic import AfterValidator, BaseModel, model_validator
6
6
 
7
- from ..types import round_list
7
+ from ..base import LowercaseStrEnum
8
+ from ..types import round_list, round_optional_list
8
9
  from .workflow import SMILESWorkflow
9
10
 
10
11
 
12
+ class SolubilityMethod(LowercaseStrEnum):
13
+ FASTSOLV = "fastsolv"
14
+ KINGFISHER = "kingfisher"
15
+ ESOL = "esol"
16
+
17
+
11
18
  class SolubilityResult(BaseModel):
12
19
  """
13
20
  Solubility result.
@@ -17,7 +24,7 @@ class SolubilityResult(BaseModel):
17
24
  """
18
25
 
19
26
  solubilities: Annotated[list[float], AfterValidator(round_list(6))]
20
- uncertainties: Annotated[list[float], AfterValidator(round_list(6))]
27
+ uncertainties: Annotated[list[float | None], AfterValidator(round_optional_list(6))]
21
28
 
22
29
  @model_validator(mode="after")
23
30
  def check_size(self) -> Self:
@@ -41,9 +48,10 @@ class SolubilityWorkflow(SMILESWorkflow):
41
48
  :param solubilities: {solvent: SolubilityResult}
42
49
  """
43
50
 
51
+ solubility_method: SolubilityMethod = SolubilityMethod.FASTSOLV
44
52
  initial_smiles: str
45
- solvents: list[str]
46
- temperatures: list[float] = [273.15, 298.15, 323.15, 348.15, 373.15, 398.15, 423.15] # 0–150 °C
53
+ solvents: list[str] = ["O"]
54
+ temperatures: list[float] = [298.15]
47
55
 
48
56
  solubilities: dict[str, SolubilityResult] = {}
49
57
 
@@ -55,6 +63,22 @@ class SolubilityWorkflow(SMILESWorkflow):
55
63
  raise ValueError(f"Solubilities for {solvent} must have the same length as temperatures.")
56
64
 
57
65
  if solvent not in self.solvents:
58
- raise ValueError(f"Solvent {solvent} not in initial list of solvents")
66
+ raise ValueError(f"Solvent {solvent} not in initial list of solvents.")
67
+
68
+ return self
69
+
70
+ @model_validator(mode="after")
71
+ def check_solvent_temperature(self) -> Self:
72
+ """Check that models with limited domain of applicability are predicting within correct domain."""
73
+ match self.solubility_method:
74
+ case SolubilityMethod.KINGFISHER | SolubilityMethod.ESOL:
75
+ if (len(self.solvents) > 1) or (self.solvents[0] != "O"):
76
+ raise ValueError(f"Method `{self.solubility_method}` can only predict aqueous solubility, so `solvents` must be [`O`] only.")
77
+ if (len(self.temperatures) > 1) or (abs(self.temperatures[0] - 298.15) > 0.1):
78
+ raise ValueError(
79
+ f"Method `{self.solubility_method}` can only predict solubility at room temperature, so `temperatures` must be [298.15] only."
80
+ )
81
+ case _:
82
+ pass
59
83
 
60
84
  return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stjames
3
- Version: 0.0.101
3
+ Version: 0.0.102
4
4
  Summary: standardized JSON atom/molecule encoding scheme
5
5
  Author-email: Corin Wagen <corin@rowansci.com>
6
6
  Project-URL: Homepage, https://github.com/rowansci/stjames
@@ -60,12 +60,12 @@ stjames/workflows/pose_analysis_md.py,sha256=ES0XlzaLpTjhLrNvcB0zFZa1b1ZHXekN72E
60
60
  stjames/workflows/protein_cofolding.py,sha256=6WWbVOGzFjIRgQLMmMVODfIxo1jYFmRS1xnJmN0kOBw,3016
61
61
  stjames/workflows/redox_potential.py,sha256=7S18t9Y3eynSnA3lZbRlvLfdbgeBopdiigLzt1zxg5c,3871
62
62
  stjames/workflows/scan.py,sha256=DXQBpa2t2PowAtOwmdgpxaSLq--fEShljzAGSb8Nf5U,2993
63
- stjames/workflows/solubility.py,sha256=kGfVyPPGDLRpf2j6dSY7woCkfsoXSbUzdSImA4mcMpw,1898
63
+ stjames/workflows/solubility.py,sha256=C5FD16p3bkvJz9rhZkgrg_gMrYGY4mnqvXPqqLbixiw,2991
64
64
  stjames/workflows/spin_states.py,sha256=0degmE-frovgoXweshZyjfjqL7nkbaFoO9YoJhvQnaI,4748
65
65
  stjames/workflows/tautomer.py,sha256=7eYKziGPg8Km6lfowTzSkgJfJ4SHUPrAmnTf8Bi-SB0,1164
66
66
  stjames/workflows/workflow.py,sha256=OE05pt2ZOd8TzTOlBngXCVg9wv_553ZR60VNRPlq0f8,1953
67
- stjames-0.0.101.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
68
- stjames-0.0.101.dist-info/METADATA,sha256=TNvGMRniR9D4VJTlQygqa0ZuEtgVLsqeN9jfkNRLdxQ,1725
69
- stjames-0.0.101.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
- stjames-0.0.101.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
71
- stjames-0.0.101.dist-info/RECORD,,
67
+ stjames-0.0.102.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
68
+ stjames-0.0.102.dist-info/METADATA,sha256=sRGYL13y6ucmCcnYzhSzmmClIOn-uyzvURPkABaJ8Lo,1725
69
+ stjames-0.0.102.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
+ stjames-0.0.102.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
71
+ stjames-0.0.102.dist-info/RECORD,,