Go to the source code of this file.
|
| module | qs_electrons_charge_mixing |
| | Dual integer-electron-endpoint charge mixing for constant-potential MD, built on top of CP2K's stock MIXED force_eval (METHOD MIXED / MIXING_TYPE LINEAR_COMBINATION). Energy, forces and virial are already interpolated by stock force_env_methods.F's mixed_energy_forces using the LAMBDA value read from the input structure at every call; this module (a) pushes the dynamically tracked lambda into that input structure each step, (b) mixes Fermi level / workfunction, which stock MIXED does not touch, and (c) rebuilds a sub_force_env at a new integer CHARGE whenever q(t) drifts outside the currently-built bracket ("boundary crossing").
|
|
| subroutine, public | qs_electrons_charge_mixing::qs_electrons_charge_mixing_lambda (electrons, lambda, n_lo, n_hi) |
| | Given the current electronic coordinate q and the integer span S, compute the bracketing integers N_lo/N_hi and the mixing weight lambda = (q - N_lo)/S.
|
| subroutine, public | qs_electrons_charge_mixing::push_lambda_to_mixed_env (force_env, lambda) |
| | Push a dynamically computed lambda into the MIXED force_eval's input structure. force_env_methods.F::mixed_energy_forces reads MIXEDLINEARLAMBDA fresh from the input structure every call, so this alone is sufficient to make energy/force/virial mixing track our own extended-variable dynamics with zero changes to stock CP2K.
|
| subroutine, public | qs_electrons_charge_mixing::compute_mixed_workfunction (force_env, axis, wf_min, wf_max, q, span, fermi_level_ev, workfunction_ev, lambda_in) |
| | Fermi level / workfunction mixing across the two integer-charge endpoints. Stock MIXED only combines energy/force/virial/dipole (mixed_environment_utils.F::mixed_map_forces), so these two quantities – needed every step by our own O-B-A-B-O potentiostat to decide how to move q(t) – are interpolated here, mirroring FFChargeMixTwoSockets._mix_results's fermi/workfunction lines.
|
| subroutine, public | qs_electrons_charge_mixing::charge_mixing_maybe_rebuild (force_env, electrons) |
| | Check whether q(t) has drifted outside the currently-built [N_lo,N_hi] bracket and, if so, rebuild whichever endpoint(s) are now stale at the new integer electron count. Must be called every step, right after qs_electrons_drift and before push_lambda_to_mixed_env, so LAMBDA is always pushed against a bracket that actually matches the physically-built sub_force_env pair.
|
| subroutine, public | qs_electrons_charge_mixing::charge_mixing_sync_endpoint_state (force_env, electrons) |
| | Record which integer electron counts the two FORCE_EVAL blocks are ACTUALLY built for, by interrogating them, so that the very first charge_mixing_maybe_rebuild can tell whether the input agrees with q.
|