Repository navigation
ts: keep the shape of triclinic cells across the reversible-scaling turning point - #289
Merged
Merged
Conversation
…g.dat Shear stress and the tilt factors were invisible in every calphy output, so a sheared cell under pressure_coupling iso/aniso (which barostat neither) could not be detected from a run (#13). - avg.dat gains columns xy xz yz pxx pyy pzz pxy pxz pyz, appended after the existing seven so that every reader of columns 1-7 keeps working. The variable definitions and the ave/time command now live in helpers (define_average_variables, average_fix_command, AVG_COLUMNS) instead of being repeated in solid, liquid and alchemy. - The equilibration and reversible-scaling thermo_style lines also print lx ly lz xy xz yz pxx pyy pzz pxy pxz pyz. No change in behaviour; the golden command streams and the avg.dat fixture are updated for the new columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every stage after the averaging resets the cell to the averaged reference box with helpers.remap_box, which ran `change_box x/y/z final` only. That leaves xy/xz/yz as they were read. For the backward reversible-scaling leg, which reads the hot end of the forward leg, a triclinic cell thus got the hot tilts on the cold lengths, a shear of ~tilt/l * (l_hot/l_cold - 1). Under pressure_coupling iso/aniso fix npt does not barostat the tilts but rescales them with the lengths (scalexy/xz/yz yes), so that shear is kept for the whole backward leg and biases the averaged free energy low. - The pressure convergence also averages xy/xz/yz from avg.dat and stores them on the job (Phase.xy/xz/yz, 0.0 for an orthogonal box). - remap_box takes the tilts and sets them with `xy/xz/yz final` whenever one is non-zero. An orthogonal box gets the identical command as before. - The isotropic rescale of the P-V fit used `change_box x/y/z scale`, which likewise leaves the tilts alone; it now scales them too (helpers.scale_box_command, `xy final $(xy*s)`). - tests/test_remap_box_tilts.py: emitted commands, the stored tilts, the backward-leg remap, the P-V rescale, and with a real lmp binary that the new command restores the cell while the old one keeps the hot tilts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The backward reversible-scaling sweep reads conf.ts.forward_<i>.data, an equilibrium sample at (lambda_f, lambda_f*P), and then reset the cell to the reference box measured at T0: https://github.com/ICAMS/calphy/blob/0b04e22564029a2111aeac610aef0a698c8dc24d/calphy/phase.py#L1733 That reset arrived with the split of the sweep into two LAMMPS sessions in b286426 ("switch to stepped ts"), which copied the forward sweep's setup: https://github.com/ICAMS/calphy/blob/b286426019cb81bfcf9a5c52c78590b8fbe271a1/calphy/phase.py#L1895 In the single-session version (36953b2) the backward sweep simply continued from the forward end state. The reset compresses the hot cell to the cold lengths, which the middle equilibration then has to undo (a +6.5 to +9.5 kbar pressure spike at its first step in the test runs of #14), and for a triclinic cell it also shears it: change_box ... final leaves the tilts at their hot values, and fix npt iso/aniso keeps that shear for the whole sweep (#13). Drop it. Under NVT the forward sweep never changes the cell, so nothing changes there. The other remap_box calls, which pin an equilibrium sample at T0 to the averaged reference cell, keep restoring the full cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mode: ts, a triclinic (tilted) cell runs the backward reversible-scaling sweep in a sheared box. At the turning point the cell is reset to the T0 reference lengths, but the tilt factors keep their hot values.fix npt iso/anisorescales the tilts with the lengths instead of barostatting them, so the shear persists for the whole sweep.ts_dissipationis inflated. Orthogonal boxes are not affected.pytestpasses, including thelammpsandslowtests and new tests for this.avg.datgains nine columns after the existing seven (xy xz yz pxx pyy pzz pxy pxz pyz), and the equilibration and sweep thermo output prints the cell and the stress tensor. Columns 1–7 are unchanged.Commits
2671e72: log the tilt factors and the full stress tensor (thermo andavg.dat). No change in behaviour.fedffda: the averaging stage stores the mean tilts.remap_boxrestores them, and an orthogonal box gets the same command as before. The P–V-fit rescale (change_box ... scale) scales the tilts too.df2d994: noremap_boxat the start of the backward sweep (phase.pyL1733). It came in with the session split in b286426 (L1895 there). Under NVT the cell never changes, so nothing changes there.Sketch of the mechanism
🤖 Generated with Claude Code