Skip to content

Pcorr - #283

Merged
srmnitc merged 10 commits into
mainfrom
pcorr
Sep 29, 2026
Merged

Pcorr#283
srmnitc merged 10 commits into
mainfrom
pcorr

Conversation

@srmnitc

@srmnitc srmnitc commented Sep 29, 2026

Copy link
Copy Markdown
Member

No description provided.

…weeps

The scaled system at (T0, lambda) samples the real system at (T0/lambda, P)
only if the barostat imposes P_RS = lambda*P (de Koning, Antonelli, Yip,
J. Chem. Phys. 115, 11025 (2001), Eq. 11), and integrate_rs assumes that
when it integrates U + P V at constant P.  Both sweeps computed pf = lf*pi
and logged the ramp, but the fix that stayed active through the sweep was
created with a constant target pi, so the sweep sampled the real system at
P/lambda and the middle equilibration of the backward sweep sat at the
wrong scaled pressure.

fix npt can only ramp its target linearly over one run, so the constant
pressure equilibration fix is now replaced right before each sweep by one
ramping pi -> pf (forward) and pf -> pi (backward), with the COM-corrected
temperature rebound to the new fix; the middle equilibration holds pf.

Exactly a no-op at pressure 0, which is where the golden streams are
recorded; they only gain the unfix/fix/fix_modify triple.  Cross-check with
a direct fe at the sweep endpoint (Cu01, 500 atoms, 2500/5000 steps): at
50 kbar 400 -> 700 K both old and new agree with fe within 0.5 meV/atom;
at 300 kbar 400 -> 1000 K the old sweep ends at a real pressure of 750 kbar
and is off by 30 meV/atom, the new one agrees within 0.3 meV/atom.
…kward

temperature_scaling and scan_temperature_range ramp the real temperature
with the thermostat; lambda = T0/T is only the recorded label.  Both
nevertheless ramped the barostat to (T0/Tf)*P, the scaled-pressure end
point that belongs to the lambda-scaled Hamiltonian of reversible_scaling,
and so sampled the wrong isobar at finite pressure (a no-op at 0 bar).
The real pressure is now held throughout.

Since "switch to stepped ts" (b286426) the tscale backward sweep was also
created with temp T0 T0 instead of Tf T0, i.e. it quenched to T0 at the
start of the sweep instead of mirroring the forward ramp, corrupting the
backward integral at any pressure.  Restored to Tf -> T0.
The golden streams are recorded at pressure 0, where the scaled and the
real pressure coincide, so they cannot tell a ramped from a constant
barostat.  Record the same driver methods at 50 kbar and assert the
targets directly: the ts sweeps ramp P <-> (T0/Tf)*P and the backward
middle equilibration sits at (T0/Tf)*P; tscale and the pre-scan hold the
real pressure and tscale ramps Tf -> T0 on the way back.
… linearly

The uniform_temperature schedule made T0/lambda linear in the step, which
only redistributes samples along T: both schedules integrate to the same
G(T).  At finite pressure it was also wrong.  fix npt ramps its pressure
target linearly in the step, so it follows the scaled pressure lambda*P
(de Koning, Antonelli, Yip, J. Chem. Phys. 115, 11025 (2001), Eq. 11)
only when lambda is linear too; under uniform_temperature the sweep sampled
the real system at up to 1.22*P in the middle for 400 -> 1000 K.  For Cu01
at 300 kbar this put G(1000 K) 3.2-3.9 meV/atom above a direct fe, against
0.2 meV/atom for the linear schedule.  Splitting the sweep into chunks
fixes the pressure but restarts the Nose-Hoover chain at every chunk and
is not worth it for a sampling preference.

lambda_schedule is now a removed input key with a migration message, like
savefile and seed; the uniform_temperature golden stream goes with it.
fix atom/swap got ${ftemp} / ${btemp}, which LAMMPS substitutes once when
the command is parsed.  ramp() returns its first argument between runs, so
the forward sweep swapped at T0 and the backward sweep at Tf, fixed.

atom/swap accepts on the energy of the scaled potential, lambda*dU, and the
scaled system is canonical at the thermostat temperature T0, so
exp(-lambda*dU / kT0) is the Boltzmann factor of the real system at T0/lambda
-- the swap temperature is T0 throughout.  The forward sweep was right by
accident; the backward sweep swapped as if the real system were at Tf/lambda,
Tf^2/T0 at its start (2500 K for a 400 -> 1000 K sweep), over-disordering
the chemical order and biasing the backward work of every ts run with
monte_carlo.n_swaps > 0 and reverse_swap_types set.  A per-step T0/lambda,
which the variable names suggest was intended, would have been wrong too.

The ftemp, btemp and T0_rs variables only fed the swap fixes and go; the
golden streams lose those three lines and ts_mc_swaps swaps at 400 K.
ts_dissipation, the high-dissipation warning and the copy of that warning
in the melting_temperature log all read the value integrate_rs returns,
which was np.min over the iterations.  One sweep that crossed a phase
transition was therefore hidden as long as another iteration was clean,
although the contaminated sweep still enters the averaged free energy.
The docs and the caller's comment already described it as the maximum.
pyproject.toml and the environment files require pyscal3>=4.0.0, but a
conda environment or a --no-deps install bypasses that pin and would run
against the pyscal 3 API.  Check the installed version when calphy.helpers
is imported and fail with the upgrade command.  A test keeps the pin in
pyproject.toml and the three environment files at the same floor.
@srmnitc
srmnitc merged commit cb1f22b into main Sep 29, 2026
6 checks passed
@srmnitc
srmnitc deleted the pcorr branch October 6, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant