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

stjames/__init__.py CHANGED
@@ -9,6 +9,7 @@ from .workflows import *
9
9
  from .scf_settings import *
10
10
  from .int_settings import *
11
11
  from .opt_settings import *
12
+ from .compute_settings import *
12
13
  from .diis_settings import *
13
14
  from .thermochem_settings import *
14
15
  from .grid_settings import *
@@ -0,0 +1,10 @@
1
+ from .base import Base, LowercaseStrEnum
2
+
3
+
4
+ class ComputeType(LowercaseStrEnum):
5
+ CPU = "cpu"
6
+ GPU = "gpu"
7
+
8
+
9
+ class ComputeSettings(Base):
10
+ compute_type: ComputeType = ComputeType.CPU
stjames/method.py CHANGED
@@ -32,8 +32,10 @@ class Method(LowercaseStrEnum):
32
32
 
33
33
  AIMNET2_WB97MD3 = "aimnet2_wb97md3"
34
34
  MACE_MP_0 = "mace_mp_0"
35
+ MACE_MP_0B2_L = "mace_mp_0b2_l"
35
36
  OCP24_S = "ocp24_s"
36
37
  OCP24_L = "ocp24_l"
38
+ ORB_V2 = "orb_v2"
37
39
 
38
40
  GFN_FF = "gfn_ff"
39
41
  GFN0_XTB = "gfn0_xtb"
@@ -46,8 +48,14 @@ class Method(LowercaseStrEnum):
46
48
  OFF_SAGE_2_2_1 = "off_sage_2_2_1"
47
49
 
48
50
 
49
- NNPMethod = Literal[Method.AIMNET2_WB97MD3]
50
- NNP_METHODS = [Method.AIMNET2_WB97MD3]
51
+ PrepackagedNNPMethod = Literal[Method.AIMNET2_WB97MD3, Method.OCP24_S, Method.OCP24_L]
52
+ PREPACKAGED_NNP_METHODS = [Method.AIMNET2_WB97MD3, Method.OCP24_S, Method.OCP24_L]
53
+
54
+ CorrectableNNPMethod = Literal[Method.MACE_MP_0B2_L, Method.ORB_V2]
55
+ CORRECTABLE_NNP_METHODS = [Method.MACE_MP_0B2_L, Method.ORB_V2]
56
+
57
+ NNPMethod = PrepackagedNNPMethod | CorrectableNNPMethod
58
+ NNP_METHODS = [*PREPACKAGED_NNP_METHODS, *CORRECTABLE_NNP_METHODS]
51
59
 
52
60
  XTBMethod = Literal[Method.GFN_FF, Method.GFN0_XTB, Method.GFN1_XTB, Method.GFN2_XTB]
53
61
  XTB_METHODS = [Method.GFN_FF, Method.GFN0_XTB, Method.GFN1_XTB, Method.GFN2_XTB]
@@ -58,8 +66,8 @@ COMPOSITE_METHODS = [Method.HF3C, Method.B973C, Method.R2SCAN3C, Method.WB97X3C]
58
66
  FFMethod = Literal[Method.OFF_SAGE_2_2_1]
59
67
  FF_METHODS = [Method.OFF_SAGE_2_2_1]
60
68
 
61
- PrepackagedMethod = XTBMethod | CompositeMethod | NNPMethod | FFMethod
62
- PREPACKAGED_METHODS = [*XTB_METHODS, *COMPOSITE_METHODS, *NNP_METHODS, *FF_METHODS]
69
+ PrepackagedMethod = XTBMethod | CompositeMethod | PrepackagedNNPMethod | FFMethod
70
+ PREPACKAGED_METHODS = [*XTB_METHODS, *COMPOSITE_METHODS, *PREPACKAGED_NNP_METHODS, *FF_METHODS]
63
71
 
64
72
  MethodWithCorrection = Literal[Method.WB97XD3, Method.WB97XV, Method.WB97MV, Method.WB97MD3BJ, Method.DSDBLYPD3BJ]
65
73
  METHODS_WITH_CORRECTION = [Method.WB97XD3, Method.WB97XV, Method.WB97MV, Method.WB97MD3BJ, Method.DSDBLYPD3BJ, Method.B97D3BJ]
stjames/pdb.py ADDED
@@ -0,0 +1,197 @@
1
+ from datetime import date
2
+ from pathlib import Path
3
+ from typing import Any, Literal
4
+
5
+ import atomium # type: ignore [import-untyped]
6
+ from atomium.pdb import pdb_dict_to_data_dict, pdb_string_to_pdb_dict # type: ignore [import-untyped]
7
+ from pydantic import BaseModel, ConfigDict, Field
8
+
9
+ from stjames.types import Matrix3x3, Vector3D
10
+
11
+ # Mostly for testing purposes
12
+ EXTRA: Literal["allow", "ignore", "forbid"] = "allow"
13
+
14
+
15
+ class PDBAtom(BaseModel):
16
+ """An atom within a residue."""
17
+
18
+ model_config = ConfigDict(extra=EXTRA)
19
+
20
+ x: float
21
+ y: float
22
+ z: float
23
+ element: str
24
+ name: str
25
+ charge: float
26
+ occupancy: float
27
+ alt_loc: str | None
28
+ anisotropy: list[float]
29
+ bvalue: float
30
+ is_hetatm: bool
31
+
32
+
33
+ class PDBWater(BaseModel):
34
+ """A water molecule."""
35
+
36
+ model_config = ConfigDict(extra=EXTRA)
37
+
38
+ name: str | None
39
+ full_name: str | None
40
+ atoms: dict[int, PDBAtom] = {}
41
+ internal_id: str | None
42
+ polymer: str
43
+
44
+
45
+ class PDBResidue(BaseModel):
46
+ """A structure."""
47
+
48
+ model_config = ConfigDict(extra=EXTRA)
49
+
50
+ name: str | None
51
+ full_name: str | None = None
52
+ atoms: dict[int, PDBAtom] = {}
53
+ number: int
54
+
55
+
56
+ class PDBPolymer(BaseModel):
57
+ """A polymer chain."""
58
+
59
+ model_config = ConfigDict(extra=EXTRA)
60
+
61
+ internal_id: str
62
+ helices: list[list[str]] = []
63
+ residues: dict[str, PDBResidue] = {}
64
+ sequence: str | None
65
+ strands: list[list[str]] = []
66
+
67
+
68
+ class PDBNonPolymer(BaseModel):
69
+ """Non-polymeric molecules/atoms (e.g. ions and ligands)."""
70
+
71
+ model_config = ConfigDict(extra=EXTRA)
72
+
73
+ name: str
74
+ full_name: str | None = None
75
+ atoms: dict[int, PDBAtom]
76
+ internal_id: str
77
+ polymer: str
78
+
79
+
80
+ class PDBModel(BaseModel):
81
+ """Structure data."""
82
+
83
+ model_config = ConfigDict(extra=EXTRA)
84
+
85
+ polymer: dict[str, PDBPolymer] = {}
86
+ non_polymer: dict[str, PDBNonPolymer] = Field(alias="non-polymer", default_factory=dict)
87
+ branched: dict[str, Any] = {}
88
+ water: dict[str, PDBWater] = {}
89
+
90
+
91
+ class PDBTransformations(BaseModel):
92
+ """Transformations applied to the structure."""
93
+
94
+ model_config = ConfigDict(extra=EXTRA)
95
+
96
+ chains: list[str]
97
+ matrix: Matrix3x3
98
+ vector: Vector3D
99
+
100
+
101
+ class PDBAssembly(BaseModel):
102
+ """How the structure was assembled."""
103
+
104
+ model_config = ConfigDict(extra=EXTRA)
105
+
106
+ transformations: list[PDBTransformations]
107
+ software: str | None
108
+ buried_surface_area: float | None
109
+ surface_area: float | None
110
+ delta_energy: float | None
111
+ id: int
112
+
113
+
114
+ class PDBCrystallography(BaseModel):
115
+ """Crystallography related information."""
116
+
117
+ model_config = ConfigDict(extra=EXTRA)
118
+
119
+ space_group: str | None = None
120
+ unit_cell: list[float] | None = None
121
+
122
+
123
+ class PDBGeometry(BaseModel):
124
+ """Details of the geometry."""
125
+
126
+ model_config = ConfigDict(extra=EXTRA)
127
+
128
+ assemblies: list[PDBAssembly] = []
129
+ crystallography: PDBCrystallography = Field(default_factory=PDBCrystallography)
130
+
131
+
132
+ class PDBQuality(BaseModel):
133
+ """Quality metrics."""
134
+
135
+ model_config = ConfigDict(extra=EXTRA)
136
+
137
+ resolution: float | None = None
138
+ rfree: float | None = None
139
+ rvalue: float | None = None
140
+
141
+
142
+ class PDBMissingResidue(BaseModel):
143
+ model_config = ConfigDict(extra=EXTRA)
144
+
145
+ name: str
146
+ id: str
147
+
148
+
149
+ class PDBExperiment(BaseModel):
150
+ """Details of the experiment."""
151
+
152
+ model_config = ConfigDict(extra=EXTRA)
153
+
154
+ expression_system: str | None
155
+ missing_residues: list[PDBMissingResidue] = []
156
+ source_organism: str | None
157
+ technique: str | None
158
+
159
+
160
+ class PDBDescription(BaseModel):
161
+ """A description of the molecule."""
162
+
163
+ model_config = ConfigDict(extra=EXTRA)
164
+
165
+ code: str | None
166
+ title: str | None
167
+ authors: list[str] = []
168
+ classification: str | None
169
+ deposition_date: date | None
170
+ keywords: list[str] = []
171
+
172
+
173
+ class PDB(BaseModel):
174
+ """A PDB formatted file."""
175
+
176
+ model_config = ConfigDict(extra=EXTRA)
177
+
178
+ description: PDBDescription
179
+ experiment: PDBExperiment
180
+ geometry: PDBGeometry
181
+ models: list[PDBModel] = []
182
+ quality: PDBQuality = Field(default_factory=PDBQuality)
183
+
184
+
185
+ def read_pdb(path: Path | str) -> PDB:
186
+ """Read a pdb located at path."""
187
+ return PDB.model_validate(atomium.open(str(path), data_dict=True))
188
+
189
+
190
+ def fetch_pdb(code: str) -> PDB:
191
+ """Fetch a pdb from the Protein Data Bank."""
192
+ return PDB.model_validate(atomium.fetch(code, data_dict=True))
193
+
194
+
195
+ def pdb_from_string(pdb: str) -> PDB:
196
+ """Read a PDB from a string."""
197
+ return PDB.model_validate(pdb_dict_to_data_dict(pdb_string_to_pdb_dict(pdb)))
stjames/settings.py CHANGED
@@ -4,8 +4,9 @@ from pydantic import computed_field, field_validator, model_validator
4
4
 
5
5
  from .base import Base, UniqueList
6
6
  from .basis_set import BasisSet
7
+ from .compute_settings import ComputeSettings
7
8
  from .correction import Correction
8
- from .method import METHODS_WITH_CORRECTION, PREPACKAGED_METHODS, Method
9
+ from .method import CORRECTABLE_NNP_METHODS, METHODS_WITH_CORRECTION, PREPACKAGED_METHODS, Method
9
10
  from .mode import Mode
10
11
  from .opt_settings import OptimizationSettings
11
12
  from .scf_settings import SCFSettings
@@ -30,6 +31,7 @@ class Settings(Base):
30
31
  scf_settings: SCFSettings = SCFSettings()
31
32
  opt_settings: OptimizationSettings = OptimizationSettings()
32
33
  thermochem_settings: ThermochemistrySettings = ThermochemistrySettings()
34
+ compute_settings: ComputeSettings = ComputeSettings()
33
35
 
34
36
  # mypy has this dead wrong (https://docs.pydantic.dev/2.0/usage/computed_fields/)
35
37
  # Python 3.12 narrows the reason for the ignore to prop-decorator
@@ -38,12 +40,14 @@ class Settings(Base):
38
40
  def level_of_theory(self) -> str:
39
41
  corrections = list(filter(lambda x: x not in (None, ""), self.corrections))
40
42
 
41
- if self.method in PREPACKAGED_METHODS or self.basis_set is None:
43
+ if self.method in CORRECTABLE_NNP_METHODS:
44
+ method = self.method.value if not corrections else f"{self.method.value}-{'-'.join(c.value for c in corrections)}"
45
+ elif self.method in PREPACKAGED_METHODS or self.basis_set is None:
42
46
  method = self.method.value
43
- elif self.method in METHODS_WITH_CORRECTION or len(corrections) == 0:
47
+ elif self.method in METHODS_WITH_CORRECTION or not corrections:
44
48
  method = f"{self.method.value}/{self.basis_set.name.lower()}"
45
49
  else:
46
- method = f"{self.method.value}-{'-'.join([c.value for c in corrections])}/{self.basis_set.name.lower()}"
50
+ method = f"{self.method.value}-{'-'.join(c.value for c in corrections)}/{self.basis_set.name.lower()}"
47
51
 
48
52
  if self.solvent_settings is not None:
49
53
  method += f"/{self.solvent_settings.model.value}({self.solvent_settings.solvent.value})"
@@ -11,6 +11,9 @@ class HydrogenBondAcceptorSite(Base):
11
11
 
12
12
 
13
13
  class HydrogenBondBasicityWorkflow(Workflow):
14
+ do_csearch: bool = True
15
+ do_optimization: bool = True
16
+
14
17
  # UUID of optimization
15
18
  optimization: UUID | None = None
16
19
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: stjames
3
- Version: 0.0.47
3
+ Version: 0.0.49
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
@@ -8,6 +8,7 @@ Project-URL: Bug Tracker, https://github.com/rowansci/stjames/issues
8
8
  Requires-Python: >=3.11
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
+ Requires-Dist: atomium<2,>=1
11
12
  Requires-Dist: pydantic>=2.4
12
13
  Requires-Dist: numpy
13
14
 
@@ -1,23 +1,25 @@
1
- stjames/__init__.py,sha256=LkWCylP4VeXyQL0iu5w6yeYK1UHjcUH55hwWXTy4mQQ,576
1
+ stjames/__init__.py,sha256=8kqGRUcrOQY07DHp6VJN7GEttPPTHw49QpieMeQqkwE,608
2
2
  stjames/_deprecated_solvent_settings.py,sha256=gj5j9p3zakIwSTK5_ndqBXJx--IzjZNxZ75z-wipLOo,450
3
3
  stjames/atom.py,sha256=w7q-x9xpBw4sJ1WGrWt65WAaStxhz-m7dugXCYEOpq4,2064
4
4
  stjames/base.py,sha256=hroQjvC8G88UiK520i1TDqnOlgw_ihmzevQGTO5yeUY,1215
5
5
  stjames/basis_set.py,sha256=wI3M2q9uPf9jhKpAi4E2DrsyKzloDGLRjAlk7krdYgc,949
6
6
  stjames/calculation.py,sha256=O2LwwQ_cOLmDOGXTHA9J71YbUZXigUSbvbLA-fSVm3w,915
7
+ stjames/compute_settings.py,sha256=N312PevuI4V2EswJSimitLB_JC92thTCGoZJjXFccxo,191
7
8
  stjames/constraint.py,sha256=B6oV0rYjmAWr8gpi5f03gRy_uuqjUURVDVwoez5Cfbg,2442
8
9
  stjames/correction.py,sha256=ZVErCcj4TPyZeKrdvXVjHa0tFynsCaoy96QZUVxWFM8,413
9
10
  stjames/diis_settings.py,sha256=4m1EQQWBlpHhMnWopix8qOqJv7QCluvdnV9jSKJDFtE,552
10
11
  stjames/grid_settings.py,sha256=WrSNGc-8_f87YBZYt9Hh7RbhM4MweADoVzwBMcSqcsE,640
11
12
  stjames/int_settings.py,sha256=5HXp8opt5ZyY1UpmfaK7NVloWVLM5jkG0elEEqpVLUo,896
12
13
  stjames/message.py,sha256=Rq6QqmHZKecWxYH8fVyXmuoCCPZv8YinvgykSeorXSU,216
13
- stjames/method.py,sha256=teV0nQZTu8gRSZdFpMhjHtvLPf-XeTIMy330rYWDeZ8,1855
14
+ stjames/method.py,sha256=dWlDoB5xxWqPg6pdQyEeLG7aPsg4cux9ckfaA6GVsD0,2280
14
15
  stjames/mode.py,sha256=xw46Cc7f3eTS8i35qECi-8DocAlANhayK3w4akD4HBU,496
15
16
  stjames/molecule.py,sha256=v8NikFHfwOahXSo4VKGSqeHKI2HIoRdNjGE0GkZgNS4,10554
16
17
  stjames/opt_settings.py,sha256=gxXGtjy9l-Q5Wen9eO6T6HHRCuS8rfOofdVQIJj0JcI,550
18
+ stjames/pdb.py,sha256=goigN-UO72y-nnHmNF4HWp8K_ZYfJorg6TCqWpsNQIU,4519
17
19
  stjames/periodic_cell.py,sha256=JDCyynpamggTNi_HnTnnotRbeSMBfYc-srhD-IwUnrg,996
18
20
  stjames/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
21
  stjames/scf_settings.py,sha256=WotVgVrayQ_8PUHP39zVtG7iLT9PV41lpzruttFACP8,2356
20
- stjames/settings.py,sha256=tfgEYns6WdsheQ6wpR6uyI8O4s2iTqyH7YWtNQ36k74,8666
22
+ stjames/settings.py,sha256=NrNtHq-78BNp4RMP0tsABv4BjS5EscANakCyRdImI-A,8967
21
23
  stjames/solvent.py,sha256=u037tmu-9oa21s-WEDZ7VC7nuNVjkqR2ML4JWjWSME4,1158
22
24
  stjames/status.py,sha256=wTKNcNxStoEHrxxgr_zTyN90NITa3rxMQZzOgrCifEw,332
23
25
  stjames/task.py,sha256=OLINRqe66o7t8arffilwmggrF_7TH0L79u6DhGruxV8,329
@@ -39,7 +41,7 @@ stjames/workflows/conformer_search.py,sha256=y64WpdVZcrUit9ub-yWwJ0zNK8ofPlcjOG4
39
41
  stjames/workflows/descriptors.py,sha256=lRRCsGzad3nIg0wI1090ffaXB0FVh0nRRb2lNxCY0kI,281
40
42
  stjames/workflows/electronic_properties.py,sha256=0PqS04CfLM4pzx67Ph3JJTrzc1LCwDTT5E8x4_wW-g8,3888
41
43
  stjames/workflows/fukui.py,sha256=CsJ3_gvzqEqcxwYN7bnNIa37F3KlLm7obsU77TGmDgo,348
42
- stjames/workflows/hydrogen_bond_basicity.py,sha256=xn4AP_PbCUluzrj05ufw3LaN-xBMsAmt2mFsVy1bf-8,455
44
+ stjames/workflows/hydrogen_bond_basicity.py,sha256=Luvov2DlDvZN06W-mU6YaN7wcIrTLwzdoWww-jNE3x4,517
43
45
  stjames/workflows/molecular_dynamics.py,sha256=4HmYETU1VT2BA4-PqAayRZLjnj1WuYxd5bqpIyH9g5k,2465
44
46
  stjames/workflows/multistage_opt.py,sha256=0ou-UYMGIrewZIg3QZIgwS_eweYdsh2pRplxgRCqLcE,13572
45
47
  stjames/workflows/pka.py,sha256=zpR90Yv2L-D56o2mGArM8027DWpnFFnay31UR9Xh5Nc,774
@@ -48,8 +50,8 @@ stjames/workflows/scan.py,sha256=cQ29DKlLCH7_6_1TFATnaM3ac9G1asUoRoDDlQYAfG0,860
48
50
  stjames/workflows/spin_states.py,sha256=TXHqB7ClTkkCy1Yfcsv99v2woAhT8oG1-uaF20-oMbQ,4592
49
51
  stjames/workflows/tautomer.py,sha256=owZOOfGlohxlaOG1pGpx7dVPvas8ZEnl_9Ms5F0Kpms,421
50
52
  stjames/workflows/workflow.py,sha256=tIu5naADYgYS7kdW8quvGEWHWosBcrIdcD7L86v-uMQ,976
51
- stjames-0.0.47.dist-info/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
52
- stjames-0.0.47.dist-info/METADATA,sha256=jJX69FHFW3VDQtIwM7lR7tIZgM_CDeIvbC8qeERRhMU,1627
53
- stjames-0.0.47.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
54
- stjames-0.0.47.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
55
- stjames-0.0.47.dist-info/RECORD,,
53
+ stjames-0.0.49.dist-info/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
54
+ stjames-0.0.49.dist-info/METADATA,sha256=NFSiP9l2CXcYhOCEGaOQ95nXTxRxwQHSewRZit1FW88,1656
55
+ stjames-0.0.49.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
56
+ stjames-0.0.49.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
57
+ stjames-0.0.49.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.7.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5