Hide code cell content

import os
from pathlib import Path

import jax
import jax.numpy as jnp
from jax import tree_util, random

import jax_md_mod
from jax_md import space, energy, partition, simulate

import optax

import matplotlib.pyplot as plt

from chemtrain.data import preprocessing
from chemtrain.trainers import ForceMatching, RelativeEntropy
from chemtrain import ensemble, quantity

base_path = Path(os.environ.get("DATA_PATH", "./data"))
/home/docs/checkouts/readthedocs.org/user_builds/chemtrain/envs/latest/lib/python3.11/site-packages/chemtrain/__init__.py:35: RuntimeWarning: JAX default matmul precision is not set. For float32 model training, evaluation, and deployment export, consider setting JAX_DEFAULT_MATMUL_PRECISION=highest or jax.config.update('jax_default_matmul_precision', 'highest') for more reproducible matmul/contraction behavior.
  _warn_if_default_matmul_precision_unset()

Relative Entropy Minimization#

Principle of Relative Entropy#

Relative entropy provides a fundamental link between models of different scales [1]. Measuring the loss of information induced by the coarse-graining [2], it is thus a desirable objective to minimize.

For a corase-grained model $p^\text{CG}_\theta(\mathbf R)$ on coarse-grained sites $\mathbf R$ connected to the sites of a fine-scale model $p^\text{AA}(\mathbf r)$ via a mapping $\mathbf R = M(\mathbf r)$, the relative entropy is [2]

$$ S_\text{rel} = S_\text{map} + \int p^\text{AA}(\mathbf r)\log \frac{p^\text{AA}(\mathbf r)}{p^\text{CG}(M(\mathbf r))}d\mathbf r. $$

For a canonical ensemble $p(\mathbf r) \propto e^{-\beta U(\mathbf r)}$ at temperature $T = \frac{1}{k_B \beta}$, the relative entropy further decomposes to

$$ S_\text{rel} = S_\text{map} + \beta \left\langle U_\theta^\text{CG}(M(\mathbf r)) - U^\text{AA}(\mathbf r)\right\rangle_\text{AA} - \beta(A_\theta^\text{CG} - A^\text{AA}). $$

The first part $S_\text{rel}$ measures the unavoidable loss of information due to the degeneracy of the mapping. This part is, however, independent of the fine-grained and coarse-grained distributions.

The second part is the expected difference between the predicted potential energies $U_\theta^\text{CG}(M(\mathbf r)) - U^\text{AA}(\mathbf r)$ in the fine-scaled ensemble. This part is simple to estimate. Analogous to force-matching, the estimation involves pre-computing an atomistic trajectory, followed by a batched gradient-based optimization.

The last part is the free energy difference between the fine-scaled and coarse-grained ensembles. Since the free energy normalizes a distribution

$$ A_\theta = -\frac{1}{\beta}\log \int e^{-\beta U_\theta}dx, $$ it is not a quantity directly predictable from individual samples of the potential energy model. However, several routines exist to estimate the difference of free energies $A_\theta^\text{CG} = \Delta A_\theta^\text{CG} + \tilde A^\text{CG}$ to a reference potential $\tilde U^\text{CG}$.

Thus, the exact computation of the relative entropy is infeasible. Nevertheless, we can collect all terms directly depending on $\theta$ in a new objective

$$ \mathcal L_\text{RE}(\theta) = \beta\left(\left\langle U_\theta^\text{CG}(M(R))\right\rangle_\text{AA} - \Delta A_\theta^\text{CG}\right). $$

This objective has precisely the same gradients as the relative entropy

$$ \frac{\partial}{\partial \theta} \mathcal L(\theta) = \frac{\partial}{\partial \theta}S_\text{rel}. $$

Unfortunately, the objective is no longer lower bound by $0$, reached by the relative entropy under perfect preservation of information. Nevertheless, chemtrain enables the estimation of all the contributions to the loss. Thus, chemtrain can compute the correct gradients via algorithmic differentiation and enable training via the Relative Entropy objective.

Load Data#

This example follows the Force Matching guide. Again, we use reference data from an all-atomistic simulation of ethane. We obtained this data in the example Prior Simulation.

Ethane
train_ratio = 0.5

box = jnp.asarray([1.0, 1.0, 1.0])
kT = 2.56

all_forces = preprocessing.get_dataset(base_path / "forces_ethane.npy")
all_positions = preprocessing.get_dataset(base_path / "positions_ethane.npy")

Compute Mapping#

The reference data contains only fine-grained forces $\mathbf f_i$ and positions $\mathbf r_i$. Thus, we must define a mapping $M$ that derives the positions of the coarse-grained sites $\mathcal I_I$ [3]

\[\mathbf R_I = \sum_{i \in \mathcal I_I} c_{Ii} \mathbf r_i.\]

We select the two carbon atoms $C_1$ and $C_2$ as locations of the coarse-grained sites $\mathcal I_1$ and $\mathcal I_2$ and neglect the hydrogen atoms.

# Heacy-atoms mapping
displacement_fn, shift_fn = space.periodic_general(box, fractional_coordinates=True)

# Scale the position data into fractional coordinates
position_dataset = preprocessing.scale_dataset_fractional(all_positions, box)

masses = jnp.asarray([15.035, 1.011, 1.011, 1.011])

weights = jnp.asarray([
    [1, 0.0000, 0, 0, 0, 0.000, 0.000, 0.000],
    [0.0000, 1, 0.000, 0.000, 0.000, 0, 0, 0]
])

position_dataset = preprocessing.map_dataset(
    position_dataset, displacement_fn, shift_fn, weights, 
)

Setup Model#

As a coarse-grained potential model, we choose a simple spring bond

\[ U(\mathbf R) = \frac{1}{2} k_b (|\mathbf R_1 - \mathbf R_2| - b_0)^2.\]

To ensure that the model parameters remain positive during optimization, we transform them into a constraint space $\theta_1 = \log b_0,\ \theta_2= \log k_b$.

r_init = position_dataset[0, ...]

displacement_fn, shift_fn = space.periodic_general(box, fractional_coordinates=True)
neighbor_fn = partition.neighbor_list(
    displacement_fn, box, 1.0, fractional_coordinates=True, disable_cell_list=True)

nbrs_init = neighbor_fn.allocate(r_init)

init_params = {
    "log_b0": jnp.log(0.11),
    "log_kb": jnp.log(1000.0)
}

def energy_fn_template(energy_params):
    harmonic_energy_fn = energy.simple_spring_bond(
        displacement_fn, bond=jnp.asarray([[0, 1]]),
        length=jnp.exp(energy_params["log_b0"]),
        epsilon=jnp.exp(energy_params["log_kb"]),
        alpha=2.0
    )
    
    return harmonic_energy_fn    

sample_idx = 0

print(f"Energy with initial params is {energy_fn_template(init_params)(position_dataset[sample_idx, ...], neighbor=nbrs_init)}")
Energy with initial params is 1.5405478477478027
/home/docs/checkouts/readthedocs.org/user_builds/chemtrain/envs/latest/lib/python3.11/site-packages/jax/_src/numpy/reductions.py:230: UserWarning: Explicitly requested dtype float64 requested in sum is not available, and will be truncated to dtype float32. To enable more dtypes, set the jax_enable_x64 configuration option or the JAX_ENABLE_X64 shell environment variable. See https://github.com/jax-ml/jax#current-gotchas for more.
  return _reduction(a, "sum", lax.add, 0, preproc=_cast_to_numeric,
/home/docs/checkouts/readthedocs.org/user_builds/chemtrain/envs/latest/lib/python3.11/site-packages/jax/_src/numpy/reductions.py:161: UserWarning: Explicitly requested dtype float64 requested in convert_element_type is not available, and will be truncated to dtype float32. To enable more dtypes, set the jax_enable_x64 configuration option or the JAX_ENABLE_X64 shell environment variable. See https://github.com/jax-ml/jax#current-gotchas for more.
  return lax.convert_element_type(result, dtype or result_dtype)

Analytical Solution#

As our model relies only on the magnitude of the displacement between $C_1$ and $C_2$, we compute this distance and plot it.

disp = jax.vmap(displacement_fn)(position_dataset[:, 0, :], position_dataset[:, 1, :])
dist_CC = jnp.sqrt(jnp.sum(disp ** 2, axis=-1))

plt.figure()
plt.hist(dist_CC, bins=100)
plt.xlabel("Distance C_1 - C_2 [nm]")
plt.ylabel("Count")
Text(0, 0.5, 'Count')
../_images/7e3f099d2137ea2fdf3d6493cf2df80d4a7f3e94a0988ff65954ccfa447816ed.png

Indeed, the distance between the two carbon atoms is approximately Gaussian distributed. Hence, the choice of a harmonic potential model is reasonable.

Thus, we might estimate the parameters of the model by computing the mean and variance of the particle distance.

$$ b_0 = \mathbb E[|\mathbf R_1 - \mathbf R_2|], \quad k_b = \frac{1}{\beta \operatorname{Var}[|\mathbf R_1 - \mathbf R_2|]} $$

# Analytical solution
b0 = jnp.mean(dist_CC)
kb = kT / jnp.var(dist_CC)

print(f"Estimated potential parameters are {kb :.1f} kJ/mol/nm^2 and {b0 :.3f} nm")
Estimated potential parameters are 10645.0 kJ/mol/nm^2 and 0.156 nm

Setup Optimizer#

epochs = 100
initial_lr = 0.5
lr_decay = 0.1

lrd = int(position_dataset.shape[0] / epochs)
lr_schedule = optax.exponential_decay(initial_lr, lrd, lr_decay)
optimizer = optax.chain(
    optax.scale_by_adam(),
    optax.scale_by_schedule(lr_schedule),
    # Flips the sign of the update for gradient descend
    optax.scale_by_learning_rate(1.0),
)

Setup Simulator#

timings = ensemble.sampling.process_printouts(
    time_step=0.002, total_time=1e3, t_equilib=1e2,
    print_every=0.1, t_start=0.0
)

init_ref_state, sim_template = ensemble.sampling.initialize_simulator_template(
    simulate.nvt_langevin, shift_fn=shift_fn, nbrs=nbrs_init,
    init_with_PRNGKey=True, extra_simulator_kwargs={"kT": kT, "gamma": 1.0, "dt": 0.002}
)

cg_masses = masses[0]

reference_state = init_ref_state(
    random.PRNGKey(11), r_init,
    energy_or_force_fn=energy_fn_template(init_params),
    init_sim_kwargs={"mass": cg_masses, "neighbor": nbrs_init}
)

Setup Relative Entropy Minimization#

relative_entropy = RelativeEntropy(
    init_params=init_params, optimizer=optimizer,
    reweight_ratio=1.1, sim_batch_size=1,
    energy_fn_template=energy_fn_template,
)

subsampled_dataset = position_dataset[::100, ...]
print(f"Dataset has shape {subsampled_dataset.shape}")

relative_entropy.add_statepoint(
    position_dataset, energy_fn_template,
    sim_template, neighbor_fn, timings,
    {'kT': kT}, reference_state,  
)

relative_entropy.init_step_size_adaption(0.1)

Hide code cell output

/home/docs/checkouts/readthedocs.org/user_builds/chemtrain/envs/latest/lib/python3.11/site-packages/chemtrain/trainers/base.py:275: UserWarning: [RelativeEntropy] Attribute gradient_norm_history is marked for checkpoining twice.
  warnings.warn(f"[{self.__class__.__name__}] Attribute {duplicate_key} is marked for checkpoining twice.")
/home/docs/checkouts/readthedocs.org/user_builds/chemtrain/envs/latest/lib/python3.11/site-packages/chemtrain/ensemble/reweighting.py:842: UserWarning: Propagation function is not safe by default. Do not forget to use the wrapper around the compute function to ensure that the neighborlist does not overflow.
  warnings.warn(
Dataset has shape (90, 2, 3)
No reference batch size provided. Using number of generated CG snapshots by default.
[Propagation] Time for trajectory compilation 0: 0.029113046328226724 mins
[Propagation] Time for trajectory simulation 0: 9.13540522257487e-06 mins
[Step size] Use 7 iterations for 10 interior points.
relative_entropy.train(epochs)

Hide code cell output

[Propagate] Effective sample size: 8999.970703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 1.6919856071472168

[RE] Epoch 0
	Mean Delta RE loss = 0.45689
	Gradient norm: 0.1195855438709259
	Elapsed time = 0.083 min

[Statepoint 0]

	kT = 2.641 ref_kT = 2.560

[Propagate] Effective sample size: 4887.2158203125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 1.170046329498291

[RE] Epoch 1
	Mean Delta RE loss = 1.56230
	Gradient norm: 24.03537368774414
	Elapsed time = 0.067 min

[Statepoint 0]

	kT = 2.561 ref_kT = 2.560

[Propagate] Effective sample size: 2899.91845703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.066394329071045

[RE] Epoch 2
	Mean Delta RE loss = -0.03774
	Gradient norm: 3.529275894165039
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.547 ref_kT = 2.560

[Propagate] Effective sample size: 7106.654296875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.118812084197998

[RE] Epoch 3
	Mean Delta RE loss = 0.16935
	Gradient norm: 32.42744445800781
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.525 ref_kT = 2.560

[Propagate] Effective sample size: 7489.09765625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 1.8283343315124512

[RE] Epoch 4
	Mean Delta RE loss = -0.11849
	Gradient norm: 8.33803653717041
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.627 ref_kT = 2.560

[Propagate] Effective sample size: 5601.14794921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.1144347190856934

[RE] Epoch 5
	Mean Delta RE loss = 0.18276
	Gradient norm: 1.6038310527801514
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.493 ref_kT = 2.560

[Propagate] Effective sample size: 7456.38671875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.298182964324951

[RE] Epoch 6
	Mean Delta RE loss = 0.78781
	Gradient norm: 21.030115127563477
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.531 ref_kT = 2.560

[Propagate] Effective sample size: 8960.4384765625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.184792995452881

[RE] Epoch 7
	Mean Delta RE loss = 0.67649
	Gradient norm: 16.309253692626953
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.555 ref_kT = 2.560

[Propagate] Effective sample size: 7999.90185546875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.1538777351379395

[RE] Epoch 8
	Mean Delta RE loss = 0.18509
	Gradient norm: 2.208169460296631
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.558 ref_kT = 2.560

[Propagate] Effective sample size: 7756.36669921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.239161968231201

[RE] Epoch 9
	Mean Delta RE loss = -0.12361
	Gradient norm: 1.5201416015625
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.525 ref_kT = 2.560

[Propagate] Effective sample size: 8446.888671875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.298391819000244

[RE] Epoch 10
	Mean Delta RE loss = -0.17319
	Gradient norm: 8.889102935791016
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.524 ref_kT = 2.560

[Propagate] Effective sample size: 8962.310546875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.277893543243408

[RE] Epoch 11
	Mean Delta RE loss = -0.18856
	Gradient norm: 12.565180778503418
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.591 ref_kT = 2.560

[Propagate] Effective sample size: 8780.46875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2169699668884277

[RE] Epoch 12
	Mean Delta RE loss = -0.25536
	Gradient norm: 6.932672500610352
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.570 ref_kT = 2.560

[Propagate] Effective sample size: 8261.5166015625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.208418369293213

[RE] Epoch 13
	Mean Delta RE loss = -0.24071
	Gradient norm: 0.4811742901802063
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.529 ref_kT = 2.560

[Propagate] Effective sample size: 8191.15283203125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2729458808898926

[RE] Epoch 14
	Mean Delta RE loss = -0.06307
	Gradient norm: 3.9344003200531006
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.562 ref_kT = 2.560

[Propagate] Effective sample size: 8737.150390625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2923636436462402

[RE] Epoch 15
	Mean Delta RE loss = 0.08400
	Gradient norm: 14.73017692565918
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.590 ref_kT = 2.560

[Propagate] Effective sample size: 8908.4462890625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.220114231109619

[RE] Epoch 16
	Mean Delta RE loss = -0.07834
	Gradient norm: 10.956337928771973
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.636 ref_kT = 2.560

[Propagate] Effective sample size: 8287.517578125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.212860584259033

[RE] Epoch 17
	Mean Delta RE loss = -0.39117
	Gradient norm: 0.4899870753288269
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.637 ref_kT = 2.560

[Propagate] Effective sample size: 8227.6201171875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2852864265441895

[RE] Epoch 18
	Mean Delta RE loss = -0.54324
	Gradient norm: 5.461236000061035
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.594 ref_kT = 2.560

[Propagate] Effective sample size: 8845.6220703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2853198051452637

[RE] Epoch 19
	Mean Delta RE loss = -0.57023
	Gradient norm: 15.72575569152832
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.490 ref_kT = 2.560

[Propagate] Effective sample size: 8845.91796875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2112107276916504

[RE] Epoch 20
	Mean Delta RE loss = -0.65015
	Gradient norm: 9.019468307495117
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.501 ref_kT = 2.560

[Propagate] Effective sample size: 8214.0654296875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.233391284942627

[RE] Epoch 21
	Mean Delta RE loss = -0.65731
	Gradient norm: 0.1430906504392624
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.498 ref_kT = 2.560

[Propagate] Effective sample size: 8398.28515625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.301222324371338

[RE] Epoch 22
	Mean Delta RE loss = -0.50873
	Gradient norm: 16.366310119628906
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.542 ref_kT = 2.560

[Propagate] Effective sample size: 8987.71484375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.222480297088623

[RE] Epoch 23
	Mean Delta RE loss = -0.55748
	Gradient norm: 16.133953094482422
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.594 ref_kT = 2.560

[Propagate] Effective sample size: 8307.1650390625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2293782234191895

[RE] Epoch 24
	Mean Delta RE loss = -0.76459
	Gradient norm: 0.10462702065706253
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.531 ref_kT = 2.560

[Propagate] Effective sample size: 8364.6494140625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3009190559387207

[RE] Epoch 25
	Mean Delta RE loss = -0.81696
	Gradient norm: 10.346741676330566
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.551 ref_kT = 2.560

[Propagate] Effective sample size: 8984.9892578125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2543187141418457

[RE] Epoch 26
	Mean Delta RE loss = -0.82632
	Gradient norm: 15.831894874572754
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.602 ref_kT = 2.560

[Propagate] Effective sample size: 8575.8916015625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.225536823272705

[RE] Epoch 27
	Mean Delta RE loss = -0.86045
	Gradient norm: 1.5526257753372192
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.499 ref_kT = 2.560

[Propagate] Effective sample size: 8332.5791015625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2972140312194824

[RE] Epoch 28
	Mean Delta RE loss = -0.76722
	Gradient norm: 7.871126651763916
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.477 ref_kT = 2.560

[Propagate] Effective sample size: 8951.7607421875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2692904472351074

[RE] Epoch 29
	Mean Delta RE loss = -0.71800
	Gradient norm: 16.685497283935547
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.522 ref_kT = 2.560

[Propagate] Effective sample size: 8705.25390625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2520480155944824

[RE] Epoch 30
	Mean Delta RE loss = -0.83501
	Gradient norm: 1.7566484212875366
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.541 ref_kT = 2.560

[Propagate] Effective sample size: 8556.4404296875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.29478120803833

[RE] Epoch 31
	Mean Delta RE loss = -0.88629
	Gradient norm: 4.075547218322754
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.601 ref_kT = 2.560

[Propagate] Effective sample size: 8930.009765625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.292445659637451

[RE] Epoch 32
	Mean Delta RE loss = -0.87350
	Gradient norm: 10.753045082092285
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.507 ref_kT = 2.560

[Propagate] Effective sample size: 8909.177734375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2692923545837402

[RE] Epoch 33
	Mean Delta RE loss = -0.87428
	Gradient norm: 3.2796742916107178
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.561 ref_kT = 2.560

[Propagate] Effective sample size: 8705.2705078125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2867369651794434

[RE] Epoch 34
	Mean Delta RE loss = -0.82339
	Gradient norm: 0.693458080291748
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.620 ref_kT = 2.560

[Propagate] Effective sample size: 8858.462890625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3018975257873535

[RE] Epoch 35
	Mean Delta RE loss = -0.74873
	Gradient norm: 6.6217122077941895
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.674 ref_kT = 2.560

[Propagate] Effective sample size: 8993.78515625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.288292407989502

[RE] Epoch 36
	Mean Delta RE loss = -0.75507
	Gradient norm: 4.195957183837891
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.518 ref_kT = 2.560

[Propagate] Effective sample size: 8872.251953125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.287365436553955

[RE] Epoch 37
	Mean Delta RE loss = -0.80421
	Gradient norm: 0.23526959121227264
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.531 ref_kT = 2.560

[Propagate] Effective sample size: 8864.03125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2997584342956543

[RE] Epoch 38
	Mean Delta RE loss = -0.82784
	Gradient norm: 1.5611928701400757
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.569 ref_kT = 2.560

[Propagate] Effective sample size: 8974.5673828125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.30110502243042

[RE] Epoch 39
	Mean Delta RE loss = -0.82373
	Gradient norm: 3.6328341960906982
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.575 ref_kT = 2.560

[Propagate] Effective sample size: 8986.6689453125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2938666343688965

[RE] Epoch 40
	Mean Delta RE loss = -0.81462
	Gradient norm: 2.064887523651123
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.512 ref_kT = 2.560

[Propagate] Effective sample size: 8921.845703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2938361167907715

[RE] Epoch 41
	Mean Delta RE loss = -0.78824
	Gradient norm: 0.021214408800005913
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.636 ref_kT = 2.560

[Propagate] Effective sample size: 8921.57421875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3011670112609863

[RE] Epoch 42
	Mean Delta RE loss = -0.75146
	Gradient norm: 0.9227509498596191
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.515 ref_kT = 2.560

[Propagate] Effective sample size: 8987.216796875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3018107414245605

[RE] Epoch 43
	Mean Delta RE loss = -0.73177
	Gradient norm: 2.071582317352295
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.560 ref_kT = 2.560

[Propagate] Effective sample size: 8993.0048828125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.297879695892334

[RE] Epoch 44
	Mean Delta RE loss = -0.74684
	Gradient norm: 1.214765191078186
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.605 ref_kT = 2.560

[Propagate] Effective sample size: 8957.7216796875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2975573539733887

[RE] Epoch 45
	Mean Delta RE loss = -0.77807
	Gradient norm: 0.061354175209999084
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.555 ref_kT = 2.560

[Propagate] Effective sample size: 8954.8349609375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3014473915100098

[RE] Epoch 46
	Mean Delta RE loss = -0.80142
	Gradient norm: 0.5630966424942017
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.586 ref_kT = 2.560

[Propagate] Effective sample size: 8989.7373046875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3022685050964355

[RE] Epoch 47
	Mean Delta RE loss = -0.81108
	Gradient norm: 1.50251305103302
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.572 ref_kT = 2.560

[Propagate] Effective sample size: 8997.1220703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3003010749816895

[RE] Epoch 48
	Mean Delta RE loss = -0.81285
	Gradient norm: 0.7935738563537598
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.523 ref_kT = 2.560

[Propagate] Effective sample size: 8979.447265625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.2997021675109863

[RE] Epoch 49
	Mean Delta RE loss = -0.80451
	Gradient norm: 0.05411778762936592
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.621 ref_kT = 2.560

[Propagate] Effective sample size: 8974.0625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.301297664642334

[RE] Epoch 50
	Mean Delta RE loss = -0.79258
	Gradient norm: 0.08423203974962234
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.524 ref_kT = 2.560

[Propagate] Effective sample size: 8988.3916015625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025460243225098

[RE] Epoch 51
	Mean Delta RE loss = -0.78204
	Gradient norm: 0.9954246282577515
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.606 ref_kT = 2.560

[Propagate] Effective sample size: 8999.619140625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3016676902770996

[RE] Epoch 52
	Mean Delta RE loss = -0.78785
	Gradient norm: 0.5085210800170898
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.510 ref_kT = 2.560

[Propagate] Effective sample size: 8991.7177734375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3006701469421387

[RE] Epoch 53
	Mean Delta RE loss = -0.80260
	Gradient norm: 0.17099013924598694
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.623 ref_kT = 2.560

[Propagate] Effective sample size: 8982.7529296875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.301696300506592

[RE] Epoch 54
	Mean Delta RE loss = -0.82000
	Gradient norm: 0.06498652696609497
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.511 ref_kT = 2.560

[Propagate] Effective sample size: 8991.9755859375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025240898132324

[RE] Epoch 55
	Mean Delta RE loss = -0.83143
	Gradient norm: 0.2765901982784271
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.547 ref_kT = 2.560

[Propagate] Effective sample size: 8999.421875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3024544715881348

[RE] Epoch 56
	Mean Delta RE loss = -0.83673
	Gradient norm: 0.24408885836601257
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.620 ref_kT = 2.560

[Propagate] Effective sample size: 8998.794921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.301964282989502

[RE] Epoch 57
	Mean Delta RE loss = -0.83769
	Gradient norm: 0.19748927652835846
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.548 ref_kT = 2.560

[Propagate] Effective sample size: 8994.3857421875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3017735481262207

[RE] Epoch 58
	Mean Delta RE loss = -0.83415
	Gradient norm: 0.03210469335317612
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.569 ref_kT = 2.560

[Propagate] Effective sample size: 8992.669921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3023009300231934

[RE] Epoch 59
	Mean Delta RE loss = -0.82816
	Gradient norm: 0.06553775817155838
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.536 ref_kT = 2.560

[Propagate] Effective sample size: 8997.4140625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302579402923584

[RE] Epoch 60
	Mean Delta RE loss = -0.82471
	Gradient norm: 0.26039230823516846
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.592 ref_kT = 2.560

[Propagate] Effective sample size: 8999.919921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3023200035095215

[RE] Epoch 61
	Mean Delta RE loss = -0.82747
	Gradient norm: 0.17064888775348663
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.538 ref_kT = 2.560

[Propagate] Effective sample size: 8997.5849609375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3022122383117676

[RE] Epoch 62
	Mean Delta RE loss = -0.83505
	Gradient norm: 0.04192807152867317
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.552 ref_kT = 2.560

[Propagate] Effective sample size: 8996.6240234375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302372455596924

[RE] Epoch 63
	Mean Delta RE loss = -0.84198
	Gradient norm: 0.011076856404542923
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.510 ref_kT = 2.560

[Propagate] Effective sample size: 8998.0576171875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025755882263184

[RE] Epoch 64
	Mean Delta RE loss = -0.84678
	Gradient norm: 0.07727829366922379
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.564 ref_kT = 2.560

[Propagate] Effective sample size: 8999.8857421875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302553653717041

[RE] Epoch 65
	Mean Delta RE loss = -0.84741
	Gradient norm: 0.0916406512260437
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.616 ref_kT = 2.560

[Propagate] Effective sample size: 8999.6875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302445888519287

[RE] Epoch 66
	Mean Delta RE loss = -0.84598
	Gradient norm: 0.055349305272102356
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.570 ref_kT = 2.560

[Propagate] Effective sample size: 8998.7177734375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302428722381592

[RE] Epoch 67
	Mean Delta RE loss = -0.84192
	Gradient norm: 0.005905568599700928
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.619 ref_kT = 2.560

[Propagate] Effective sample size: 8998.5634765625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025364875793457

[RE] Epoch 68
	Mean Delta RE loss = -0.83641
	Gradient norm: 0.02761559560894966
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.619 ref_kT = 2.560

[Propagate] Effective sample size: 8999.533203125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302579402923584

[RE] Epoch 69
	Mean Delta RE loss = -0.83224
	Gradient norm: 0.042860280722379684
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.565 ref_kT = 2.560

[Propagate] Effective sample size: 8999.919921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302553653717041

[RE] Epoch 70
	Mean Delta RE loss = -0.82948
	Gradient norm: 0.046175517141819
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.511 ref_kT = 2.560

[Propagate] Effective sample size: 8999.6875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025479316711426

[RE] Epoch 71
	Mean Delta RE loss = -0.82809
	Gradient norm: 0.0020204451866447926
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.463 ref_kT = 2.560

[Propagate] Effective sample size: 8999.64453125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025574684143066

[RE] Epoch 72
	Mean Delta RE loss = -0.82647
	Gradient norm: 0.0004944100510329008
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.507 ref_kT = 2.560

[Propagate] Effective sample size: 8999.72265625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025670051574707

[RE] Epoch 73
	Mean Delta RE loss = -0.82386
	Gradient norm: 0.0065583703108131886
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.640 ref_kT = 2.560

[Propagate] Effective sample size: 8999.80859375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302579402923584

[RE] Epoch 74
	Mean Delta RE loss = -0.82341
	Gradient norm: 0.0020800037309527397
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.545 ref_kT = 2.560

[Propagate] Effective sample size: 8999.927734375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 75
	Mean Delta RE loss = -0.82344
	Gradient norm: 0.002929702401161194
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.624 ref_kT = 2.560

[Propagate] Effective sample size: 8999.9794921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025765419006348

[RE] Epoch 76
	Mean Delta RE loss = -0.82388
	Gradient norm: 0.04125835373997688
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.497 ref_kT = 2.560

[Propagate] Effective sample size: 8999.8935546875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025641441345215

[RE] Epoch 77
	Mean Delta RE loss = -0.82308
	Gradient norm: 0.005857247393578291
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.617 ref_kT = 2.560

[Propagate] Effective sample size: 8999.7822265625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302565097808838

[RE] Epoch 78
	Mean Delta RE loss = -0.82172
	Gradient norm: 0.00045860809041187167
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.573 ref_kT = 2.560

[Propagate] Effective sample size: 8999.791015625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025565147399902

[RE] Epoch 79
	Mean Delta RE loss = -0.82053
	Gradient norm: 0.003226227592676878
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.501 ref_kT = 2.560

[Propagate] Effective sample size: 8999.7138671875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302584171295166

[RE] Epoch 80
	Mean Delta RE loss = -0.81907
	Gradient norm: 0.015504184179008007
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.510 ref_kT = 2.560

[Propagate] Effective sample size: 8999.962890625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025803565979004

[RE] Epoch 81
	Mean Delta RE loss = -0.81851
	Gradient norm: 0.04886997491121292
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.557 ref_kT = 2.560

[Propagate] Effective sample size: 8999.927734375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025431632995605

[RE] Epoch 82
	Mean Delta RE loss = -0.81924
	Gradient norm: 0.0458541214466095
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.607 ref_kT = 2.560

[Propagate] Effective sample size: 8999.59375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302516460418701

[RE] Epoch 83
	Mean Delta RE loss = -0.82073
	Gradient norm: 0.010808659717440605
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.638 ref_kT = 2.560

[Propagate] Effective sample size: 8999.353515625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025708198547363

[RE] Epoch 84
	Mean Delta RE loss = -0.82268
	Gradient norm: 0.026489051058888435
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.539 ref_kT = 2.560

[Propagate] Effective sample size: 8999.8427734375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 85
	Mean Delta RE loss = -0.82346
	Gradient norm: 0.03196624293923378
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.553 ref_kT = 2.560

[Propagate] Effective sample size: 9000.005859375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025784492492676

[RE] Epoch 86
	Mean Delta RE loss = -0.82324
	Gradient norm: 0.02570241503417492
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.456 ref_kT = 2.560

[Propagate] Effective sample size: 8999.9111328125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025622367858887

[RE] Epoch 87
	Mean Delta RE loss = -0.82208
	Gradient norm: 0.012891869060695171
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.499 ref_kT = 2.560

[Propagate] Effective sample size: 8999.765625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025412559509277

[RE] Epoch 88
	Mean Delta RE loss = -0.82063
	Gradient norm: 0.016533033922314644
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.521 ref_kT = 2.560

[Propagate] Effective sample size: 8999.576171875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302565097808838

[RE] Epoch 89
	Mean Delta RE loss = -0.81824
	Gradient norm: 0.006588511634618044
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.590 ref_kT = 2.560

[Propagate] Effective sample size: 8999.791015625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 90
	Mean Delta RE loss = -0.81584
	Gradient norm: 0.05229593813419342
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.639 ref_kT = 2.560

[Propagate] Effective sample size: 9000.005859375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302581310272217

[RE] Epoch 91
	Mean Delta RE loss = -0.81524
	Gradient norm: 0.01802448369562626
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.499 ref_kT = 2.560

[Propagate] Effective sample size: 8999.9365234375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302572727203369

[RE] Epoch 92
	Mean Delta RE loss = -0.81525
	Gradient norm: 0.013113495893776417
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.551 ref_kT = 2.560

[Propagate] Effective sample size: 8999.8681640625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.30256986618042

[RE] Epoch 93
	Mean Delta RE loss = -0.81556
	Gradient norm: 0.0016504923114553094
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.533 ref_kT = 2.560

[Propagate] Effective sample size: 8999.833984375 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 94
	Mean Delta RE loss = -0.81585
	Gradient norm: 0.023382682353258133
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.477 ref_kT = 2.560

[Propagate] Effective sample size: 8999.970703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 95
	Mean Delta RE loss = -0.81484
	Gradient norm: 0.00560044078156352
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.524 ref_kT = 2.560

[Propagate] Effective sample size: 8999.9794921875 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.302584171295166

[RE] Epoch 96
	Mean Delta RE loss = -0.81319
	Gradient norm: 0.000296993792289868
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.467 ref_kT = 2.560

[Propagate] Effective sample size: 8999.962890625 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 97
	Mean Delta RE loss = -0.81132
	Gradient norm: 0.0023609085474163294
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.560 ref_kT = 2.560

[Propagate] Effective sample size: 8999.970703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 98
	Mean Delta RE loss = -0.81009
	Gradient norm: 0.005309790372848511
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.580 ref_kT = 2.560

[Propagate] Effective sample size: 8999.970703125 (9900.0) -> Recompute is True
[Step Size] Found optimal step size 1.0 with residual 2.3025851249694824

[RE] Epoch 99
	Mean Delta RE loss = -0.81003
	Gradient norm: 0.019647834822535515
	Elapsed time = 0.011 min

[Statepoint 0]

	kT = 2.476 ref_kT = 2.560

Results#

plt.figure()
plt.plot(relative_entropy.delta_re[0])
plt.xticks(ticks=range(0, epochs + 1, 25))
plt.xlabel("Epoch")
plt.ylabel("Loss")

plt.figure()
plt.plot(relative_entropy.gradient_norm_history)
plt.xticks(ticks=range(0, epochs + 1, 25))
plt.xlabel("Epoch")
plt.ylabel("Gradient Norm")
Text(0, 0.5, 'Gradient Norm')
../_images/b78afa40b275ab7c478a5f95b928785f06b4064e827a022c4d197ba671d20fb8.png ../_images/cbd3bb362376dad7a10165f08b23a314d02d6415173591870601bf8b65a282d0.png

Finally, we compare the values obtained from a Gaussian fit to those obtained from relative entropy minimization.

pred_parameters = tree_util.tree_map(jnp.exp, relative_entropy.params)

b0_err = jnp.abs(b0 - pred_parameters["log_b0"])
kb_err = jnp.abs(kb - pred_parameters["log_kb"])

print(f"RE min. predicted {pred_parameters['log_b0']:.3f} nm and {pred_parameters['log_kb']:.1f} kJ/mol/nm^2")
print(f"Gaussian fit predicted {b0:.3f} nm and {kb:.1f} kJ/mol/nm^2")
print(f"Absolute error in b0 is {b0_err:.3f} nm and in kb is {kb_err:.1f} kJ/mol/nm^2")
RE min. predicted 0.153 nm and 10274.6 kJ/mol/nm^2
Gaussian fit predicted 0.156 nm and 10645.0 kJ/mol/nm^2
Absolute error in b0 is 0.003 nm and in kb is 370.3 kJ/mol/nm^2

Further Reading#

Examples#

Publications#

  1. Stephan Thaler, Maximilian Stupp, Julija Zavadlav; Deep coarse-grained potentials via relative entropy minimization. J. Chem. Phys. 28 December 2022; 157 (24): 244103. https://doi.org/10.1063/5.0124538

References#