|
49 | 49 | from ase.io import read, write |
50 | 50 | import shutil |
51 | 51 |
|
52 | | -__version__ = "1.8.2" |
| 52 | +__version__ = "1.8.3" |
53 | 53 |
|
54 | 54 |
|
55 | 55 | def _check_equal(val): |
@@ -248,33 +248,41 @@ class Queue(BaseModel, title="Options for configuring queue"): |
248 | 248 | class Tolerance(BaseModel, title="Tolerance settings for convergence"): |
249 | 249 | lattice_constant: Annotated[float, Field(default=0.0002, ge=0)] |
250 | 250 | spring_constant: Annotated[float, Field(default=0.1, gt=0)] |
251 | | - solid_fraction: Annotated[float, Field(default=0.7, ge=0)] |
252 | | - liquid_fraction: Annotated[float, Field(default=0.05, ge=0)] |
| 251 | + # Structural phase-stability checks during equilibration are OFF by |
| 252 | + # default: solid_fraction=0 means the melt check (solid_fraction < this) |
| 253 | + # never fires, and liquid_fraction=1.0 means the solidify check |
| 254 | + # (solid_fraction > this) never fires. Set solid_fraction > 0 (e.g. 0.7) |
| 255 | + # to re-enable melt detection for a solid run, or liquid_fraction < 1 |
| 256 | + # (e.g. 0.05) to re-enable solidification detection for a liquid run. |
| 257 | + solid_fraction: Annotated[float, Field(default=0.0, ge=0)] |
| 258 | + liquid_fraction: Annotated[float, Field(default=1.0, ge=0)] |
253 | 259 | pressure: Annotated[float, Field(default=10.0, ge=0)] |
254 | 260 |
|
255 | 261 |
|
256 | | -class PhaseTransitionDetection(BaseModel, title="Settings for fluctuation-based phase transition detection"): |
| 262 | +class PhaseTransitionDetection(BaseModel, title="Settings for the pre-flight temperature-range scan"): |
257 | 263 | mode: Annotated[ |
258 | | - Literal["none", "warn", "recover", "stop"], |
| 264 | + Literal["none", "adapt", "warn", "stop"], |
259 | 265 | Field( |
260 | 266 | default="none", |
261 | 267 | description=( |
262 | | - "Controls what happens when a phase transition is detected " |
263 | | - "during a reversible-scaling sweep.\n" |
264 | | - " 'none' — detection is disabled; sweep always completes " |
265 | | - "(default).\n" |
266 | | - " 'warn' — detection runs and a warning is logged with the " |
267 | | - "estimated transition temperature and triggering signals; " |
268 | | - "response-function plots are generated; the sweep continues " |
269 | | - "to completion uninterrupted. Use this to observe detection " |
270 | | - "without changing the calculation outcome.\n" |
271 | | - " 'recover' — truncate the forward sweep at the last clean " |
272 | | - "block boundary, save a checkpoint, and continue with a " |
273 | | - "backward sweep over the reduced range [T0, T_k]. A valid " |
274 | | - "free-energy curve is produced for the single-phase region.\n" |
275 | | - " 'stop' — raise PhaseTransitionError and abort. Use " |
276 | | - "when you want to inspect the raw data before deciding how " |
277 | | - "to proceed." |
| 268 | + "Controls the pre-flight temperature-range scan that runs " |
| 269 | + "before a reversible-scaling (ts) sweep. The scan performs a " |
| 270 | + "single fast real-thermostat temperature ramp (T0 -> Tf under " |
| 271 | + "NPT) and watches the fluctuation response functions for the " |
| 272 | + "onset of a phase transition.\n" |
| 273 | + " 'none' — the scan is disabled; the ts sweep runs over the " |
| 274 | + "requested [T0, Tf] range as-is (default).\n" |
| 275 | + " 'adapt' — if the scan detects a transition, reduce the upper " |
| 276 | + "temperature to the detected clean onset and run the ts sweep " |
| 277 | + "over [T0, T_clean] (keeping the same number of switching " |
| 278 | + "steps). If the scan is clean the range is unchanged.\n" |
| 279 | + " 'warn' — run the scan and log the detected clean range, but " |
| 280 | + "do NOT modify the calculation; the ts sweep runs over the full " |
| 281 | + "requested range. Use this to observe detection without " |
| 282 | + "changing the outcome.\n" |
| 283 | + " 'stop' — if a transition is detected, raise " |
| 284 | + "PhaseTransitionError reporting the clean range so you can " |
| 285 | + "re-submit with a corrected temperature range." |
278 | 286 | ), |
279 | 287 | ), |
280 | 288 | ] |
@@ -312,29 +320,71 @@ class PhaseTransitionDetection(BaseModel, title="Settings for fluctuation-based |
312 | 320 | default=4.0, |
313 | 321 | gt=0, |
314 | 322 | description=( |
315 | | - "Walk-back threshold used to locate the onset temperature from a " |
316 | | - "detected peak. Applied to all signals: variance-based signals " |
317 | | - "(Cp, kappa_T, alpha_P) walk back to where the signal falls below " |
318 | | - "baseline_median + onset_sigma * MAD; slope-break signals " |
319 | | - "(H_break, V_break) walk back to where |z| falls below onset_sigma. " |
320 | | - "Lower values give earlier (more conservative) onsets and therefore " |
321 | | - "earlier recovery cuts; higher values place the onset closer to the " |
322 | | - "unambiguous part of the peak. Default 4.0." |
| 323 | + "Walk-back threshold for the variance-based signals (Cp, " |
| 324 | + "kappa_T, alpha_P), whose rolling-window peak sits AT the " |
| 325 | + "transition. Their onset is walked back from the peak to where " |
| 326 | + "the signal falls below baseline_median + onset_sigma * MAD. " |
| 327 | + "The slope-break signals use onset_level instead. Default 4.0." |
323 | 328 | ), |
324 | 329 | ), |
325 | 330 | ] |
326 | | - baseline_window: Annotated[int, Field(default=50, ge=5)] |
327 | | - recent_window: Annotated[int, Field(default=50, ge=5)] |
328 | | - min_samples_before_check: Annotated[int, Field(default=100, ge=10)] |
329 | | - temperature_window: Annotated[ |
| 331 | + onset_level: Annotated[ |
330 | 332 | float, |
331 | 333 | Field( |
332 | | - default=50.0, |
333 | | - ge=0, |
| 334 | + default=1.5, |
| 335 | + gt=0, |
| 336 | + description=( |
| 337 | + "Low-sigma walk-back level for the slope-break signals (H_break, " |
| 338 | + "V_break), used to place the clean boundary at the FOOT of the " |
| 339 | + "transition — where the mean enthalpy/volume first starts leaving " |
| 340 | + "the single-phase equation of state — rather than at its collapse. " |
| 341 | + "This matters because a reversible-scaling sweep equilibrates the " |
| 342 | + "system at the boundary temperature, so the boundary must sit " |
| 343 | + "where the phase is still cleanly stable, not at the point where a " |
| 344 | + "fast diagnostic ramp finally lost (super)stability. It is " |
| 345 | + "phase-agnostic (melting, solid-solid, freezing). Lower values " |
| 346 | + "place the cut earlier (more margin); higher values place it " |
| 347 | + "closer to the collapse. Default 1.5." |
| 348 | + ), |
| 349 | + ), |
| 350 | + ] |
| 351 | + onset_fraction: Annotated[ |
| 352 | + float, |
| 353 | + Field( |
| 354 | + default=0.85, |
| 355 | + gt=0, |
| 356 | + le=1.0, |
| 357 | + description=( |
| 358 | + "Fractional safety margin applied to the detected onset: the " |
| 359 | + "adapted upper temperature is " |
| 360 | + "T_clean = T0 + onset_fraction * (T_onset - T0). The detected " |
| 361 | + "onset is the foot of the deviation in a *fast* diagnostic ramp, " |
| 362 | + "but a reversible-scaling sweep then EQUILIBRATES at the boundary " |
| 363 | + "for many steps and the metastable phase has more time to " |
| 364 | + "nucleate the transition there — so its practical stability " |
| 365 | + "limit is somewhat below the ramp onset, and the exact onset is " |
| 366 | + "also noisy. Backing the boundary off by a fraction of the " |
| 367 | + "super-heated/cooled span makes the adapted sweep robust to both " |
| 368 | + "effects. 1.0 disables the margin (cut exactly at the onset); " |
| 369 | + "lower values give more margin (and less usable range). " |
| 370 | + "Default 0.85." |
| 371 | + ), |
| 372 | + ), |
| 373 | + ] |
| 374 | + prescan_steps: Annotated[ |
| 375 | + int, |
| 376 | + Field( |
| 377 | + default=20000, |
| 378 | + ge=1000, |
334 | 379 | description=( |
335 | | - "Split each TS sweep into blocks of this width (in Kelvin). " |
336 | | - "The transition detector is called at each block boundary. " |
337 | | - "Set to 0 to run a single sweep with post-hoc detection only." |
| 380 | + "Number of MD steps for the pre-flight temperature ramp from " |
| 381 | + "T0 to Tf. Typically a little shorter than the production " |
| 382 | + "switching length. Note that a *faster* ramp superheats (or " |
| 383 | + "supercools) the metastable phase further and yields noisier " |
| 384 | + "response-function signals, pushing the detected onset closer " |
| 385 | + "to the collapse; if the adapted ts sweep melts/freezes during " |
| 386 | + "its equilibration, increase this (or lower onset_level). " |
| 387 | + "Default 20000." |
338 | 388 | ), |
339 | 389 | ), |
340 | 390 | ] |
|
0 commit comments