# vim:ft=plumed
# Read energy and order parameter
energy: READ FILE=COLVAR-READ VALUES=energy IGNORE_FORCES
op: READ FILE=COLVAR-READ VALUES=op.morethan IGNORE_FORCES

# Construct a bias potential using VES
# The hyperparameters used here might not reflect correct values for simulations
# Please refer to the original papers for suitable hyperparameters

# Basis functions
bf1: BF_LEGENDRE ORDER=8 MINIMUM=-26500 MAXIMUM=-23500
bf2: BF_LEGENDRE ORDER=8 MINIMUM=0.0 MAXIMUM=250.0

# Target distribution

TD_MULTICANONICAL ...
 LABEL=td_multitp
 MIN_TEMP=350.0
 MAX_TEMP=450.0
 SIGMA=250.0,10.0
 THRESHOLD=15
 STEPS_TEMP=20
... TD_MULTICANONICAL

# Expansion

VES_LINEAR_EXPANSION ...
 ARG=energy,op.morethan
 BASIS_FUNCTIONS=bf1,bf2
 TEMP=400.0
 GRID_BINS=50,50
 TARGET_DISTRIBUTION=td_multitp
 LABEL=b1
... VES_LINEAR_EXPANSION

# Optimization algorithm

OPT_AVERAGED_SGD ...
  BIAS=b1
  STRIDE=1
  LABEL=o1
  STEPSIZE=0.1
  FES_OUTPUT=10000
  BIAS_OUTPUT=10000
  TARGETDIST_OUTPUT=10000
  COEFFS_OUTPUT=5000
  TARGETDIST_STRIDE=5000
  COEFFS_FMT=%12.6f
... OPT_AVERAGED_SGD

PRINT ARG=* FILE=COLVAR STRIDE=10

