Skip to content

Commit 528c2bd

Browse files
authored
Merge pull request #142 from marcelmbn/dev/gp3_ipea
Update `xtb` constraints
2 parents a572e5f + c4b66ea commit 528c2bd

9 files changed

Lines changed: 573 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
56
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

78
## [Unreleased]
89

10+
### Added
11+
12+
- Distance constraints for xTB (normalized parsing, config validation, runtime enforcement, and optional integration test).
13+
914
## [0.6.0] - 2025-04-01
15+
1016
### Changed
17+
1118
- to set the elemental composition it is now possible to use dicts with not only int but also the element symbols (str)
1219
- dict keys for elemental compositions will now always be checked for validity
1320
- Renamed GP3-xTB to g-xTB
1421
- Moved constants and (empirical) parameters to the `data` module
1522
- Default for optimization cycles in the postprocessing step set to program default (convergence)
1623

1724
### Deprecated
25+
1826
- Nothing will be printed while multiple molecules are generated in parallel, tqdm-based progress bar instead
1927
- Some debugging statements from generate had to be removed (esp. w.r.t. early stopping)
2028

2129
### Added
30+
2231
- `GXTBConfig` class for the g-xTB method, supporting SCF cycles check
2332
- support for TURBOMOLE as QM engine
2433
- updated the parallelization to work over the number of molecules
@@ -27,14 +36,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2736
- support for a manually defined temporary directory for the QM calculations
2837

2938
### Fixed
39+
3040
- version string is now correctly formatted and printed
3141
- precision (# significant digits) of the coordinate files (`get_coord_str` and `get_xyz_str`) increased from 7 to 14
3242
- catch encoding errors when reading `Turbomole._run_opt` output files
3343
- bug in the parallelization, leading to a dead `mindlessgen` execution as a consequence of not allowing the required number of cores
3444
- stop_event checked before every external call to avoid unnecessary executions
3545

3646
## [0.5.0] - 2024-12-16
47+
3748
### Changed
49+
3850
- vdW radii scaling parameter can now be adjusted via `mindlessgen.toml` or CLI
3951
- check_distance function now checks based on the sum of the van der Waals radii and a scaling factor acessible via `mindlessgen.toml` or CLI
4052
- better type hints for `Callables`
@@ -46,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4658
- modify atom list adaption to `element_composition` such that a random integer in the given range is taken and not the lower/upper bound
4759

4860
### Fixed
61+
4962
- unit conversion for (currenly unused) vdW radii from the original Fortran project
5063
- minor print output issues (no new line breaks, more consistent verbosity differentiation, ...)
5164
- bug in `postprocess_mol` which led to an unassigned return variable in the single-point case
@@ -55,6 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5568
- legacy pseudo random number generation removed and replaced by `np.random.default_rng()` for avoiding interference with other packages
5669

5770
### Added
71+
5872
- support for the novel "g-xTB" method (previous working title: GP3-xTB)
5973
- function which contracts the coordinates after the initial generation
6074
- function which is able to printout the xyz coordinates to the terminal similar to the `.xyz` layout
@@ -64,13 +78,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6478
- `element_composition` and `forbidden_elements` can now be directly set to a `dict` or `list`, respectively, via API access
6579

6680
### Breaking Changes
81+
6782
- Removal of the `dist_threshold` flag and in the `-toml` file.
6883
- The number of unpaired electrons (`Molecule.uhf`) is now set to 0 if `xtb` is used as `QMMethod` and a lanthanide is within the molecule to match the `f-in-core` approximation.
6984
- "Contract Coordinates" functionality set to `true` by default in the `mindlessgen.toml` file.
7085
- `basename.UHF` and `basename.CHRG` are only written to disk if they differ from the default value (0 and 0, respectively).
7186

7287
## [0.4.0] - 2024-09-19
88+
7389
### Changed
90+
7491
- Default file name of `.xyz` file contains prefix `mlm_`
7592
- Comment line of `.xyz` file contains the total charge and number of unpaired electrons
7693
- Default ORCA calculation changed from r2SCAN-3c to PBE/def2-SVP
@@ -82,12 +99,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8299
- `mindless.molecules` file is written continuously during generation
83100

84101
### Fixed
102+
85103
- `test_iterative_optimization` more deterministic
86104
- wrong atom range check in for the isomerization mode ([#21](https://github.com/grimme-lab/MindlessGen/pull/21))
87105
- `forbidden_elements` and `element_composition` influences hydrogen and organic element addition
88106
- more realistic default `mindlessgen.toml` entries
89107

90108
### Added
109+
91110
- Optimization via DFT in the post-processing step
92111
- Detailed input of ORCA settings (functional, basis, grid size, SCF cycles, ...) possible
93112
- `min_num_atoms` and `max_num_atoms` consistency check
@@ -101,20 +120,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
101120
- `PyPi` and `TestPyPi` upload of releases (new workflow)
102121

103122
## [0.3.0] - 2024-08-20
123+
104124
### Breaking Changes
125+
105126
- ...
106127

107128
### Added
129+
108130
- ...
109131

110132
### Changed
133+
111134
- ...
112135

113136
### Removed
137+
114138
- ...
115139

116140
### Fixed
141+
117142
- ...
118143

119144
### Deprecations
145+
120146
- ...

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,26 @@ When using the program for academic purposes, please cite _1)_ the new Python im
167167

168168

169169
1. The new implementation of `mindlessgen`, accompanied by a benchmark study evaluating density functionals, semiempirical quantum-mechanical methods, and machine learning potentials:
170-
T. Gasevic, M. Müller, J. Schöps, S. Lanius, J. Hermann, S. Grimme, and A. Hansen, “Chemical Space Exploration with Artificial ”Mindless” Molecules,” (2025)
170+
T. Gasevic, M. Müller, J. Schöps, S. Lanius, J. Hermann, S. Grimme, and A. Hansen, “Chemical Space Exploration with Artificial ‘Mindless’ Molecules,” _J. Chem. Inf. Model._ **65**(18), 9576–9587 (2025).
171+
171172
```
172-
@misc{gasevicChemicalSpaceExploration2025,
173-
title = {Chemical {{Space Exploration}} with {{Artificial}} ''{{Mindless}}'' {{Molecules}}},
173+
@article{gasevicChemicalSpaceExploration2025,
174+
title = {Chemical Space Exploration with Artificial "Mindless" Molecules},
174175
author = {Gasevic, Thomas and M{\"u}ller, Marcel and Sch{\"o}ps, Jonathan and Lanius, Stephanie and Hermann, Jan and Grimme, Stefan and Hansen, Andreas},
175-
year = {2025},
176-
month = jun,
177-
publisher = {ChemRxiv},
178-
doi = {10.26434/chemrxiv-2025-rdsd0},
179-
urldate = {2025-06-14},
180-
archiveprefix = {ChemRxiv},
181-
langid = {english},
182-
keywords = {benchmarking,DFT,FF,MLIP,SQM}
176+
year = 2025,
177+
month = sep,
178+
journal = {Journal of Chemical Information and Modeling},
179+
volume = {65},
180+
number = {18},
181+
pages = {9576--9587},
182+
publisher = {American Chemical Society},
183+
issn = {1549-9596},
184+
doi = {10.1021/acs.jcim.5c01364},
185+
urldate = {2025-10-14},
183186
}
187+
```
184188
185-
2. The original idea of "mindless" molecules for benchmarking density functional theory:
189+
3. The original idea of "mindless" molecules for benchmarking density functional theory:
186190
M. Korth, and S. Grimme, “Mindless DFT benchmarking,” _J. Chem. Theory Comput._ **5**(4), 993–1003 (2009).
187191
```
188192
@article{korth_mindless_2009,
@@ -202,7 +206,7 @@ When using the program for academic purposes, please cite _1)_ the new Python im
202206
}
203207
```
204208
205-
3. First use of the novel `mindlessgen` implementation:
209+
4. First use of the novel `mindlessgen` implementation:
206210
M. Müller, T. Froitzheim, A. Hansen, and S. Grimme, “Advanced Charge Extended Hückel (CEH) Model and a Consistent Adaptive Minimal Basis Set for the Elements Z = 1–103,” _J. Phys. Chem. A_ **128**(49), 10723–10736 (2024).
207211
208212
```

mindlessgen.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ ncores = 4
8787
xtb_path = "/path/to/xtb"
8888
# > The GFN<n>-xTB method that should be used: Options: <int = 0> -> GFN-0-xTB, <int = 1> -> GFN-1-xTB, <int = 2> -> GFN-2-xTB
8989
level = 2
90+
# > Optional shared force constant applied to all distance constraints. Options: <float>
91+
# distance_constraint_force_constant = 0.5
92+
# > Define atom-type distance constraints applied during refinement.
93+
# > Provide element pairs via `pair` and a target distance in Å.
94+
# [[xtb.distance_constraints]]
95+
# pair = ["O", "H"]
96+
# distance = 1.02
9097

9198
[orca]
9299
# > Path to the orca executable. The names `orca` and `orca_dev` are automatically searched for. Options: <str | Path>

src/mindlessgen/cli/cli_parser.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
import argparse
88
from collections.abc import Sequence
99
from ..__version__ import __version__
10+
from ..prog import DistanceConstraint
11+
12+
13+
def _parse_distance_constraint_arg(value: str) -> DistanceConstraint:
14+
"""
15+
Parse CLI distance constraint specifications formatted as A,B,d.
16+
"""
17+
try:
18+
return DistanceConstraint.from_cli_string(value)
19+
except (ValueError, TypeError) as exc:
20+
raise argparse.ArgumentTypeError(str(exc)) from exc
1021

1122

1223
def cli_parser(argv: Sequence[str] | None = None) -> dict:
@@ -251,6 +262,26 @@ def cli_parser(argv: Sequence[str] | None = None) -> dict:
251262
required=False,
252263
help="Level of theory to use in xTB.",
253264
)
265+
parser.add_argument(
266+
"--xtb-distance-constraint",
267+
action="append",
268+
type=_parse_distance_constraint_arg,
269+
required=False,
270+
help=(
271+
"Distance constraint applied during xTB optimization. "
272+
"Format: ElementA,ElementB,distance (Å). "
273+
"Option can be provided multiple times."
274+
),
275+
)
276+
parser.add_argument(
277+
"--xtb-distance-constraint-force-constant",
278+
type=float,
279+
required=False,
280+
help=(
281+
"Force constant applied to all xTB distance constraints. "
282+
"Provide a positive float value."
283+
),
284+
)
254285

255286
### ORCA specific arguments ###
256287
parser.add_argument(
@@ -356,6 +387,10 @@ def cli_parser(argv: Sequence[str] | None = None) -> dict:
356387
rev_args_dict["xtb"] = {
357388
"xtb_path": args_dict["xtb_path"],
358389
"level": args_dict["xtb_level"],
390+
"distance_constraints": args_dict["xtb_distance_constraint"],
391+
"distance_constraint_force_constant": args_dict[
392+
"xtb_distance_constraint_force_constant"
393+
],
359394
}
360395
# ORCA specific arguments
361396
rev_args_dict["orca"] = {

src/mindlessgen/prog/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
RefineConfig,
1515
PostProcessConfig,
1616
SymmetrizationConfig,
17+
DistanceConstraint,
1718
)
1819
from .parallel import setup_managers, ResourceMonitor, setup_blocks
1920

@@ -31,4 +32,5 @@
3132
"ResourceMonitor",
3233
"setup_blocks",
3334
"SymmetrizationConfig",
35+
"DistanceConstraint",
3436
]

0 commit comments

Comments
 (0)