rdworks 0.45.2__py3-none-any.whl → 0.47.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.
rdworks/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = '0.45.2'
1
+ __version__ = '0.47.1'
2
2
 
3
3
  from rdworks.conf import Conf
4
4
  from rdworks.mol import Mol
rdworks/mol.py CHANGED
@@ -445,6 +445,7 @@ class Mol:
445
445
  calculator: str | Callable = 'MMFF94',
446
446
  fmax: float = 0.05,
447
447
  max_iter: int = 1000,
448
+ **kwargs
448
449
  ) -> Self:
449
450
  """Optimizes 3D geometry of conformers.
450
451
 
@@ -469,12 +470,12 @@ class Mol:
469
470
  Returns:
470
471
  Self: modified self.
471
472
  """
472
- self.confs = [ conf.optimize(calculator, fmax, max_iter) for conf in self.confs ]
473
+ self.confs = [ conf.optimize(calculator, fmax, max_iter, **kwargs) for conf in self.confs ]
473
474
 
474
475
  return self
475
476
 
476
477
 
477
- def sort_confs(self, calculator: str | Callable | None = None) -> Self:
478
+ def sort_confs(self, calculator: str | Callable | None = None, **kwargs) -> Self:
478
479
  """Sorts by `E_tot(kcal/mol)` or `E_tot(eV)` and sets `E_rel(kcal/mol)`.
479
480
 
480
481
  Args:
@@ -501,7 +502,7 @@ class Mol:
501
502
  if calculator is not None:
502
503
  # re-calculate potential energies
503
504
  for conf in self.confs:
504
- PE = conf.potential_energy(calculator=calculator) # sets `E_tot(kcal/mol)`
505
+ PE = conf.potential_energy(calculator=calculator, **kwargs) # sets `E_tot(kcal/mol)`
505
506
 
506
507
  if all(['E_tot(kcal/mol)' in conf.props for conf in self.confs]):
507
508
  sort_by = 'E_tot(kcal/mol)'
rdworks/torsion.py CHANGED
@@ -462,7 +462,7 @@ def create_torsion_fragment(rdmol: Chem.Mol,
462
462
 
463
463
  # fragmented
464
464
  WBO_filtered = False
465
- if GFN2xTB().version() is not None:
465
+ if GFN2xTB.is_ready():
466
466
  # filter candidate(s) by Wiberg bond order (WBO) if xTB is available
467
467
  jk = tuple(sorted([j, k]))
468
468
  wbo_passed_candidates = {}
rdworks/xtb/wrapper.py CHANGED
@@ -45,42 +45,28 @@ class GFN2xTB:
45
45
  resource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
46
46
 
47
47
 
48
- def version(self) -> str | None:
49
- """Check xtb version.
50
-
51
- Returns:
52
- str | None: version statement.
53
- """
54
- cmd = ['xtb', '--version']
55
- proc = subprocess.run(cmd, capture_output=True, text=True)
56
- assert proc.returncode == 0, "GFN2xTB() Error: xtb not available"
57
- for line in proc.stdout.split('\n'):
58
- line = line.strip()
59
- if 'version' in line:
60
- return line
61
-
62
- return None
63
-
64
-
65
- def is_xtb_ready(self, cmd: str = 'xtb') -> bool:
48
+ @staticmethod
49
+ def is_xtb_ready() -> bool:
66
50
  """Check if xtb is available.
67
51
 
68
52
  Returns:
69
53
  bool: True if `xtb` is available, False otherwise.
70
54
  """
71
- return shutil.which(cmd) is not None
55
+ return shutil.which('xtb') is not None
72
56
 
73
57
 
74
- def is_cpx_ready(self, cmd: str = 'cpx') -> bool:
58
+ @staticmethod
59
+ def is_cpx_ready() -> bool:
75
60
  """Checks if the CPCM-X command-line tool, `cpx`, is accessible in the system.
76
61
 
77
62
  Returns:
78
63
  bool: True if the cpx is found, False otherwise.
79
64
  """
80
- return shutil.which(cmd) is not None
65
+ return shutil.which('cpx') is not None
81
66
 
82
67
 
83
- def is_cpcmx_ready(self) -> bool:
68
+ @staticmethod
69
+ def is_cpcmx_option_ready() -> bool:
84
70
  """Checks if xtb works with the `--cpcmx` option.
85
71
 
86
72
  xtb distributed by the conda does not include CPCM-X function (as of June 17, 2025).
@@ -89,18 +75,50 @@ class GFN2xTB:
89
75
  Returns:
90
76
  bool: True if the --cpcmx option is working, False otherwise.
91
77
  """
92
- cmd = ['xtb', '--cpcmx']
93
- proc = subprocess.run(cmd, capture_output=True, text=True)
94
- # we are expecting an error because no input file is given
95
- assert proc.returncode != 0
96
- for line in proc.stdout.split('\n'):
97
- line = line.strip()
98
- if 'CPCM-X library was not included' in line:
99
- return False
78
+ if GFN2xTB.is_xtb_ready():
79
+ cmd = ['xtb', '--cpcmx']
80
+ proc = subprocess.run(cmd, capture_output=True, text=True)
81
+ # we are expecting an error because no input file is given
82
+ assert proc.returncode != 0
83
+ for line in proc.stdout.split('\n'):
84
+ line = line.strip()
85
+ if 'CPCM-X library was not included' in line:
86
+ return False
100
87
 
101
88
  return True
102
89
 
103
90
 
91
+ @staticmethod
92
+ def is_ready() -> bool:
93
+ """Check if `xtb` and `cpx` are accessible and `xtb --cpcmx` are available.
94
+
95
+ Returns:
96
+ bool: True if both `xtb` and `cpx` are accessible, False otherwise.
97
+ """
98
+ return all([GFN2xTB.is_xtb_ready(),
99
+ GFN2xTB.is_cpx_ready(),
100
+ GFN2xTB.is_cpcmx_option_ready()])
101
+
102
+
103
+ @staticmethod
104
+ def version() -> str | None:
105
+ """Check xtb version.
106
+
107
+ Returns:
108
+ str | None: version statement.
109
+ """
110
+ if GFN2xTB.is_ready():
111
+ cmd = ['xtb', '--version']
112
+ proc = subprocess.run(cmd, capture_output=True, text=True)
113
+ assert proc.returncode == 0, "GFN2xTB() Error: xtb not available"
114
+ for line in proc.stdout.split('\n'):
115
+ line = line.strip()
116
+ if 'version' in line:
117
+ return line
118
+
119
+ return None
120
+
121
+
104
122
  def to_xyz(self) -> str:
105
123
  """Export to XYZ formatted string.
106
124
 
@@ -345,7 +363,7 @@ class GFN2xTB:
345
363
  elif water == 'alpb':
346
364
  options += ['--alpb', 'water']
347
365
  # it does not provide Gsolv contribution to the total energy
348
- elif water == 'cpcmx' and self.is_cpcmx_ready():
366
+ elif water == 'cpcmx' and self.is_cpcmx_option_ready():
349
367
  options += ['--cpcmx', 'water']
350
368
 
351
369
  # 'xtbout.json', 'xtbrestart', 'xtbtopo.mol', 'charges', and 'wbo' files will be
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdworks
3
- Version: 0.45.2
3
+ Version: 0.47.1
4
4
  Summary: Routine tasks built on RDKit and other tools
5
5
  Author-email: Sung-Hun Bae <sunghun.bae@gmail.com>
6
6
  Maintainer-email: Sung-Hun Bae <sunghun.bae@gmail.com>
@@ -1,10 +1,10 @@
1
- rdworks/__init__.py,sha256=SK_EU8Z7TY12w-fszqAQN03x6MydoGabg98zBOetlLI,1368
1
+ rdworks/__init__.py,sha256=CkKXxGhqvK8jzCxjOXnj2IOOvdHKpHE6ekjM5ZECSUw,1368
2
2
  rdworks/conf.py,sha256=iQLb3Qg3pjGiiMVMJ5-d57BC1id3zxEhEGlhhrLrA_c,34162
3
3
  rdworks/descriptor.py,sha256=34T_dQ6g8v3u-ym8TLKbQtxIIV5TEo-d3pdedq3o-cg,2106
4
4
  rdworks/display.py,sha256=JR0gR26UpH-JCxVOaqXZCUj2MiGZSrx9Me87FncspVI,13469
5
5
  rdworks/ionized.py,sha256=5oIjMRpkX792RIpEEE2Ir96icfFaN_h21mSihhfQPAw,6713
6
6
  rdworks/matchedseries.py,sha256=A3ON4CUpQV159mu9VqgNiJ8uoQ9ePOry9d3ra4NCAgc,10377
7
- rdworks/mol.py,sha256=JC1IHM6mw9uap_uV3i5d6ZAnZqA1kcyOnvwB6lgH4xA,68070
7
+ rdworks/mol.py,sha256=e62DYV8XeqLL1mBydbS881pSUfJjaeHxalG64CIant8,68133
8
8
  rdworks/mollibr.py,sha256=X4UBO6Ga-QmNS7RwUiaDYAx0Q5hnWs71yTkEpH02Qb4,37696
9
9
  rdworks/pka.py,sha256=NVJVfpcNEMlX5QRyLBgUM7GIT7VMjO-llAR4LWc8J2c,1656
10
10
  rdworks/readin.py,sha256=0bnVcZcAmSLqc6zu1mYcv0LdBv2agQfOpKGwpSRL9VE,11742
@@ -14,7 +14,7 @@ rdworks/std.py,sha256=qOVS_lGogueLKh4rsbrsYIMR0c7z_xh6BqLEzD4X9sE,7938
14
14
  rdworks/stereoisomers.py,sha256=g8hhPI-mbYX-MzbF1uAqo5fDZOCNiKYjxI-kLBGdGgg,4980
15
15
  rdworks/tautomers.py,sha256=gtZHZJ-aJbryhBdljHbfjx7xhVW3u_OzdYPtwPail54,610
16
16
  rdworks/testdata.py,sha256=TmbNPA-ju6nTBt_Yts4EJUFmL9Cd6DCVXrDF42QLlHw,1732
17
- rdworks/torsion.py,sha256=7xlOUYXmBSkjPuNxGXNF-F3G9XWO2ER15xGOY0ejpcc,18801
17
+ rdworks/torsion.py,sha256=UUaYOvNS89SlLFauYiAboUqysy32EN0_Gktc4xxuDQI,18788
18
18
  rdworks/units.py,sha256=nljKPHcr6IWoAp0CkL7y1gSNDd6a07NeVfxXwSMuHQM,365
19
19
  rdworks/utils.py,sha256=d2Sio8WTlGPsmBOHIYDCMWg_7X4rTWjJQAqzd7ywo2A,14191
20
20
  rdworks/xml.py,sha256=aaMhwVRGvt1VzasaKDnkYnZ4kp2cIgvGb1CsmMgwQ_c,10704
@@ -65,9 +65,9 @@ rdworks/predefined/misc/reactive-part-2.xml,sha256=0vNTMwWrrQmxBpbgbyRHx8sVs83cq
65
65
  rdworks/predefined/misc/reactive-part-3.xml,sha256=LgWHSEbRTVmgBoIO45xbTo1xQJs0Xu51j3JnIapRYo4,3094
66
66
  rdworks/predefined/misc/reactive.xml,sha256=syedoQ6VYUfRLnxy99ObuDniJ_a_WhrWAJbTKFfJ6VY,11248
67
67
  rdworks/xtb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
- rdworks/xtb/wrapper.py,sha256=GqcseDk_sgmKbmKvDvObjNTk0tvAWYd7ZxjnLq0uVK0,21596
69
- rdworks-0.45.2.dist-info/licenses/LICENSE,sha256=UOkJSBqYyQUvtCp7a-vdCANeEcLE2dnTie_eB1By5SY,1074
70
- rdworks-0.45.2.dist-info/METADATA,sha256=DfyxepI-h3XBWrwQzzCLVQWBXs-mc5snQ4LIKbGzW4w,1967
71
- rdworks-0.45.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
72
- rdworks-0.45.2.dist-info/top_level.txt,sha256=05C98HbvBK2axUBogC_hAT_CdpOeQYGnQ6vRAgawr8s,8
73
- rdworks-0.45.2.dist-info/RECORD,,
68
+ rdworks/xtb/wrapper.py,sha256=NQgkdRKN5YEtv_UPYKWDijzMEs5v2kFrhUWHqiro7bE,22174
69
+ rdworks-0.47.1.dist-info/licenses/LICENSE,sha256=UOkJSBqYyQUvtCp7a-vdCANeEcLE2dnTie_eB1By5SY,1074
70
+ rdworks-0.47.1.dist-info/METADATA,sha256=w8BCgsWZ6AqzjSjZL1z4ker0-mwca09u5XiBsXa0ycw,1967
71
+ rdworks-0.47.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
72
+ rdworks-0.47.1.dist-info/top_level.txt,sha256=05C98HbvBK2axUBogC_hAT_CdpOeQYGnQ6vRAgawr8s,8
73
+ rdworks-0.47.1.dist-info/RECORD,,