Using MLACS with the Multi-Bennett Aceptance Ratio (MBAR)

In this tutorial, we will show you how to set up MLACS using multiple (same) NPT states. We will also see how to add weight to the sampled configurations using the Multi-Bennett Acceptance Ratio (MBAR). To illustrate the power of MBAR, we will study a simple Copper crystal at 100GPa and 400K, starting from the ground state configuration (0GPa, 0K).

Setting up the simulation

In this tutorial, we will set up MLACS: - using 5 NPT states, - and using the Multi-Bennett Aceptance Ratio (MBAR).

Setting up the system

The first component is the actual system to be simulated. In this tutorial, we will simulate a vacancy in copper cristal with a EMT potential.

As input, we can use the bulk function of the ASE package.

[1]:
from ase.build import bulk
at = bulk("Cu", cubic=True).repeat(4)  # This create a 4x4x4 supercell of copper

For the potential, we can use the EMT implementation in ASE

[2]:
from ase.calculators.emt import EMT
calc = EMT()

Setting up the states

The second ingredient for a MLACS simulation are states. A good strategy is to sample the same state multiple times to benefit from randomness of the thermodynamic sampling.

We will start by setting up some parameters.

[3]:
temperature = 400  # The temperature, in K
pressure = 50  # The pressure, in GPa
nsteps = 100  # The number of steps

We also have to provide the path to the LAMMPS binary.

[4]:
import os
os.environ["ASE_LAMMPSRUN_COMMAND"] = "lmp"

Now, we can import the state, that will consist here in a LAMMPS molecular dynamics with a Langevin thermostat set to 300K and a barostat set to 0 GPa. Then the state will be copy 5 times.

[5]:
from mlacs.state import LammpsState
states = list(LammpsState(temperature, pressure, nsteps=nsteps) for i in range(5))

Setting up the machine-learning interatomic potential

And the final ingredient is the machine-learning interatomic potential that will drive the molecular dynamics and will be updated based on the reference data gathered.

In this example, we will use a SNAP potential. Instead of attributing the same weights to each reference configuration, this time they will be reweighted according to their Boltzmann weights by using the Multi-Bennett Acceptance Ratio (MBAR).

The MBAR is computed using the pymbar Python package, which is optional when building mlacs. So make sure you properly install the pymbar Python package to proceed further in the tutorial.

In this case, a SNAP potential needs to be set up in three steps:

  • Define the descriptor

[6]:
from mlacs.mlip import SnapDescriptor
parameters = {"twojmax": 6}
descriptor = SnapDescriptor(at,
                            parameters=parameters)
  • define the MBAR manager

[7]:
from mlacs.mlip import MbarManager
parameters = {"solver": "L-BFGS-B"}
mbar = MbarManager(parameters=parameters)
  • finally we define the model

[8]:
from mlacs.mlip import LinearPotential
mlip_mbar = LinearPotential(descriptor, weight=mbar)

Gathering everything and launching the simulation with MBAR

Now that everything is set up, we can gather everything into a OtfMlacs object

[9]:
from mlacs import OtfMlacs
dyn = OtfMlacs(at,
               states,
               calc,
               mlip_mbar,
               workdir='Mbar_Trajectory',
               neq=0)
===============================================================================
            On-the-fly Machine-Learning Assisted Canonical Sampling
            *******************************************************

                      Copyright (C) 2022-2024 MLACS group.
                    MLACS comes with ABSOLUTELY NO WARRANTY.
               This package is distributed under the terms of the
                   GNU General Public License, see LICENSE.md
                    or http://www.gnu.org.copyleft/gpl.txt.

                      MLACS is common project of the CEA,
           Université de Liège, Université du Québec à Trois-Rivières
                 and other collaborators, see CONTRIBUTORS.md.
                  Please read ACKNOWLEDGMENTS.md for suggested
                      acknowledgments of the MLACS effort.
===============================================================================

version 0.0.13

date: 31-10-2024 13:42:32



===============================================================================
                       Recap of the simulation parameters

Recap of the states
*******************
State 1/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 2/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 3/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 4/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 5/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)




Recap of the calculator
***********************
True potential parameters:
Calculator : emt
parameters :



Recap of the MLIP
*****************
Linear potential
Parameters:
-----------
Fit method :            ols

Descriptor used in the potential:
SNAP descriptor
---------------
Elements :
Cu
Parameters :
rcut                5.0
chemflag            0
twojmax             6
rfac0               0.99363
rmin0               0.0
switchflag          1
bzeroflag           1
wselfallflag        0
dimension           31


===============================================================================
                            Starting the simulation

and launch the simulation for 10 steps. It can take a while … Time for a coffee break ?

[10]:
dyn.run(10)
===============================================================================
Step 0
Running initial step
There are 1 unique configuration in the states
Computation done, creating trajectories

Computing energy with true potential on training configurations

===============================================================================
Step 1

Production step for state 1, configurations 1 for this state
Production step for state 2, configurations 1 for this state
Production step for state 3, configurations 1 for this state
Production step for state 4, configurations 1 for this state
Production step for state 5, configurations 1 for this state

Training new MLIP

Number of configurations for training: 2
Number of atomic environments for training: 512

Weighted RMSE Energy    0.0002 eV/at
Weighted MAE Energy     0.0002 eV/at
Weighted RMSE Forces    0.0087 eV/angs
Weighted MAE Forces     0.0048 eV/angs
Weighted RMSE Stress    0.0100 GPa
Weighted MAE Stress     0.0072 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 1.37475e+01 Ha
        - Value for state 2 : 1.38278e+01 Ha
        - Value for state 3 : 1.38575e+01 Ha
        - Value for state 4 : 1.37425e+01 Ha
        - Value for state 5 : 1.36648e+01 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 7.00391e-01 Ha
        - Value for state 2 : 7.43948e-01 Ha
        - Value for state 3 : 7.61725e-01 Ha
        - Value for state 4 : 6.71658e-01 Ha
        - Value for state 5 : 7.61095e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 1.30471e+01 Ha
        - Value for state 2 : 1.30838e+01 Ha
        - Value for state 3 : 1.30958e+01 Ha
        - Value for state 4 : 1.30708e+01 Ha
        - Value for state 5 : 1.29037e+01 Ha
Routine computation of the temperature
        - Value for state 1 : 5.75954e+02 K
        - Value for state 2 : 6.11772e+02 K
        - Value for state 3 : 6.26390e+02 K
        - Value for state 4 : 5.52325e+02 K
        - Value for state 5 : 6.25872e+02 K
Routine computation of the volume
        - Value for state 1 : 1.27599e+04 Bohr^3
        - Value for state 2 : 1.27484e+04 Bohr^3
        - Value for state 3 : 1.27417e+04 Bohr^3
        - Value for state 4 : 1.27586e+04 Bohr^3
        - Value for state 5 : 1.27805e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 5.04846e-03 Ha/Bohr^3
        - Value for state 2 : 5.06464e-03 Ha/Bohr^3
        - Value for state 3 : 5.07189e-03 Ha/Bohr^3
        - Value for state 4 : 5.05346e-03 Ha/Bohr^3
        - Value for state 5 : 5.00981e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 2

Production step for state 1, configurations 2 for this state
Production step for state 2, configurations 2 for this state
Production step for state 3, configurations 2 for this state
Production step for state 4, configurations 2 for this state
Production step for state 5, configurations 2 for this state

Training new MLIP

******* JAX 64-bit mode is now on! *******
*     JAX is now set to 64-bit mode!     *
*   This MAY cause problems with other   *
*      uses of JAX in the same code.     *
******************************************

/home/duvalc/pyenv/lib64/python3.9/site-packages/numpy/core/getlimits.py:518: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/duvalc/pyenv/lib64/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
Unable to initialize backend 'cuda':
Unable to initialize backend 'rocm': module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'
Unable to initialize backend 'tpu': INTERNAL: Failed to open libtpu.so: libtpu.so: cannot open shared object file: No such file or directory
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 1.35e-08

Number of configurations for training: 7
Number of atomic environments for training: 1792

Using MBAR weighting
Effective number of configurations:    5.00000
Number of uncorrelated snapshots for each k state:
[2 5]
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0553 eV/angs
Weighted MAE Forces     0.0392 eV/angs
Weighted RMSE Stress    0.1993 GPa
Weighted MAE Stress     0.1401 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 2.72820e+00 Ha
        - Value for state 2 : 2.81042e+00 Ha
        - Value for state 3 : 2.81265e+00 Ha
        - Value for state 4 : 2.70189e+00 Ha
        - Value for state 5 : 2.82991e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.07148e-01 Ha
        - Value for state 2 : 4.66718e-01 Ha
        - Value for state 3 : 4.41441e-01 Ha
        - Value for state 4 : 4.32879e-01 Ha
        - Value for state 5 : 4.37381e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.32106e+00 Ha
        - Value for state 2 : 2.34371e+00 Ha
        - Value for state 3 : 2.37121e+00 Ha
        - Value for state 4 : 2.26901e+00 Ha
        - Value for state 5 : 2.39253e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.34811e+02 K
        - Value for state 2 : 3.83797e+02 K
        - Value for state 3 : 3.63011e+02 K
        - Value for state 4 : 3.55970e+02 K
        - Value for state 5 : 3.59672e+02 K
Routine computation of the volume
        - Value for state 1 : 1.65445e+04 Bohr^3
        - Value for state 2 : 1.65196e+04 Bohr^3
        - Value for state 3 : 1.65002e+04 Bohr^3
        - Value for state 4 : 1.65705e+04 Bohr^3
        - Value for state 5 : 1.65023e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.33546e-03 Ha/Bohr^3
        - Value for state 2 : 1.34688e-03 Ha/Bohr^3
        - Value for state 3 : 1.35835e-03 Ha/Bohr^3
        - Value for state 4 : 1.31671e-03 Ha/Bohr^3
        - Value for state 5 : 1.36161e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 3

Production step for state 1, configurations 3 for this state
Production step for state 2, configurations 3 for this state
Production step for state 3, configurations 3 for this state
Production step for state 4, configurations 3 for this state
Production step for state 5, configurations 3 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 4.27e-08

Number of configurations for training: 12
Number of atomic environments for training: 3072

Using MBAR weighting
Effective number of configurations:    5.00000
Number of uncorrelated snapshots for each k state:
[2 5 5]
Weighted RMSE Energy    0.0026 eV/at
Weighted MAE Energy     0.0026 eV/at
Weighted RMSE Forces    0.0641 eV/angs
Weighted MAE Forces     0.0504 eV/angs
Weighted RMSE Stress    0.4933 GPa
Weighted MAE Stress     0.3606 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.84516e+00 Ha
        - Value for state 2 : 4.03325e+00 Ha
        - Value for state 3 : 3.91368e+00 Ha
        - Value for state 4 : 3.98149e+00 Ha
        - Value for state 5 : 3.93531e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.15410e-01 Ha
        - Value for state 2 : 5.29434e-01 Ha
        - Value for state 3 : 5.09223e-01 Ha
        - Value for state 4 : 5.30804e-01 Ha
        - Value for state 5 : 5.34606e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.32975e+00 Ha
        - Value for state 2 : 3.50381e+00 Ha
        - Value for state 3 : 3.40446e+00 Ha
        - Value for state 4 : 3.45069e+00 Ha
        - Value for state 5 : 3.40070e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.23838e+02 K
        - Value for state 2 : 4.35370e+02 K
        - Value for state 3 : 4.18750e+02 K
        - Value for state 4 : 4.36497e+02 K
        - Value for state 5 : 4.39623e+02 K
Routine computation of the volume
        - Value for state 1 : 1.58168e+04 Bohr^3
        - Value for state 2 : 1.57339e+04 Bohr^3
        - Value for state 3 : 1.57604e+04 Bohr^3
        - Value for state 4 : 1.57578e+04 Bohr^3
        - Value for state 5 : 1.57771e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.77464e-03 Ha/Bohr^3
        - Value for state 2 : 1.83734e-03 Ha/Bohr^3
        - Value for state 3 : 1.81028e-03 Ha/Bohr^3
        - Value for state 4 : 1.81887e-03 Ha/Bohr^3
        - Value for state 5 : 1.80327e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 4

Production step for state 1, configurations 4 for this state
Production step for state 2, configurations 4 for this state
Production step for state 3, configurations 4 for this state
Production step for state 4, configurations 4 for this state
Production step for state 5, configurations 4 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 3.74e-08

Number of configurations for training: 17
Number of atomic environments for training: 4352

Using MBAR weighting
Effective number of configurations:    5.00501
Number of uncorrelated snapshots for each k state:
[2 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0338 eV/angs
Weighted MAE Forces     0.0266 eV/angs
Weighted RMSE Stress    0.0417 GPa
Weighted MAE Stress     0.0345 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.37114e+00 Ha
        - Value for state 2 : 3.29079e+00 Ha
        - Value for state 3 : 3.34611e+00 Ha
        - Value for state 4 : 3.31200e+00 Ha
        - Value for state 5 : 3.35943e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.62121e-01 Ha
        - Value for state 2 : 5.01617e-01 Ha
        - Value for state 3 : 4.97546e-01 Ha
        - Value for state 4 : 5.03533e-01 Ha
        - Value for state 5 : 4.91483e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.90902e+00 Ha
        - Value for state 2 : 2.78917e+00 Ha
        - Value for state 3 : 2.84857e+00 Ha
        - Value for state 4 : 2.80847e+00 Ha
        - Value for state 5 : 2.86795e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.80016e+02 K
        - Value for state 2 : 4.12495e+02 K
        - Value for state 3 : 4.09148e+02 K
        - Value for state 4 : 4.14071e+02 K
        - Value for state 5 : 4.04161e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60525e+04 Bohr^3
        - Value for state 2 : 1.61401e+04 Bohr^3
        - Value for state 3 : 1.61205e+04 Bohr^3
        - Value for state 4 : 1.61231e+04 Bohr^3
        - Value for state 5 : 1.61174e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.61287e-03 Ha/Bohr^3
        - Value for state 2 : 1.55919e-03 Ha/Bohr^3
        - Value for state 3 : 1.57603e-03 Ha/Bohr^3
        - Value for state 4 : 1.56948e-03 Ha/Bohr^3
        - Value for state 5 : 1.58110e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 5

Production step for state 1, configurations 5 for this state
Production step for state 2, configurations 5 for this state
Production step for state 3, configurations 5 for this state
Production step for state 4, configurations 5 for this state
Production step for state 5, configurations 5 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 1.75e-05

Number of configurations for training: 22
Number of atomic environments for training: 5632

Using MBAR weighting
Effective number of configurations:    9.73109
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0313 eV/angs
Weighted MAE Forces     0.0243 eV/angs
Weighted RMSE Stress    0.0530 GPa
Weighted MAE Stress     0.0424 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.65791e+00 Ha
        - Value for state 2 : 3.79899e+00 Ha
        - Value for state 3 : 3.73151e+00 Ha
        - Value for state 4 : 3.82051e+00 Ha
        - Value for state 5 : 3.75910e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.09853e-01 Ha
        - Value for state 2 : 5.10134e-01 Ha
        - Value for state 3 : 5.00009e-01 Ha
        - Value for state 4 : 5.49867e-01 Ha
        - Value for state 5 : 5.08201e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.14805e+00 Ha
        - Value for state 2 : 3.28886e+00 Ha
        - Value for state 3 : 3.23151e+00 Ha
        - Value for state 4 : 3.27064e+00 Ha
        - Value for state 5 : 3.25090e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.19268e+02 K
        - Value for state 2 : 4.19499e+02 K
        - Value for state 3 : 4.11173e+02 K
        - Value for state 4 : 4.52173e+02 K
        - Value for state 5 : 4.17910e+02 K
Routine computation of the volume
        - Value for state 1 : 1.58922e+04 Bohr^3
        - Value for state 2 : 1.58284e+04 Bohr^3
        - Value for state 3 : 1.58507e+04 Bohr^3
        - Value for state 4 : 1.58632e+04 Bohr^3
        - Value for state 5 : 1.58490e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.71589e-03 Ha/Bohr^3
        - Value for state 2 : 1.76417e-03 Ha/Bohr^3
        - Value for state 3 : 1.74595e-03 Ha/Bohr^3
        - Value for state 4 : 1.74655e-03 Ha/Bohr^3
        - Value for state 5 : 1.74962e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 6

Production step for state 1, configurations 6 for this state
Production step for state 2, configurations 6 for this state
Production step for state 3, configurations 6 for this state
Production step for state 4, configurations 6 for this state
Production step for state 5, configurations 6 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 2.17e-05

Number of configurations for training: 27
Number of atomic environments for training: 6912

Using MBAR weighting
Effective number of configurations:   14.70920
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0305 eV/angs
Weighted MAE Forces     0.0236 eV/angs
Weighted RMSE Stress    0.0514 GPa
Weighted MAE Stress     0.0399 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.47207e+00 Ha
        - Value for state 2 : 3.39971e+00 Ha
        - Value for state 3 : 3.42724e+00 Ha
        - Value for state 4 : 3.47200e+00 Ha
        - Value for state 5 : 3.45422e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.42413e-01 Ha
        - Value for state 2 : 4.89411e-01 Ha
        - Value for state 3 : 4.66379e-01 Ha
        - Value for state 4 : 5.19397e-01 Ha
        - Value for state 5 : 4.91259e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.02966e+00 Ha
        - Value for state 2 : 2.91030e+00 Ha
        - Value for state 3 : 2.96086e+00 Ha
        - Value for state 4 : 2.95260e+00 Ha
        - Value for state 5 : 2.96296e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.63810e+02 K
        - Value for state 2 : 4.02458e+02 K
        - Value for state 3 : 3.83518e+02 K
        - Value for state 4 : 4.27116e+02 K
        - Value for state 5 : 4.03977e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60007e+04 Bohr^3
        - Value for state 2 : 1.60442e+04 Bohr^3
        - Value for state 3 : 1.60188e+04 Bohr^3
        - Value for state 4 : 1.60469e+04 Bohr^3
        - Value for state 5 : 1.60441e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.65252e-03 Ha/Bohr^3
        - Value for state 2 : 1.61688e-03 Ha/Bohr^3
        - Value for state 3 : 1.63500e-03 Ha/Bohr^3
        - Value for state 4 : 1.62226e-03 Ha/Bohr^3
        - Value for state 5 : 1.62460e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 7

Production step for state 1, configurations 7 for this state
Production step for state 2, configurations 7 for this state
Production step for state 3, configurations 7 for this state
Production step for state 4, configurations 7 for this state
Production step for state 5, configurations 7 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 1.43e-05

Number of configurations for training: 32
Number of atomic environments for training: 8192

Using MBAR weighting
Effective number of configurations:   19.83779
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0300 eV/angs
Weighted MAE Forces     0.0232 eV/angs
Weighted RMSE Stress    0.0522 GPa
Weighted MAE Stress     0.0400 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.58556e+00 Ha
        - Value for state 2 : 3.68245e+00 Ha
        - Value for state 3 : 3.61586e+00 Ha
        - Value for state 4 : 3.70196e+00 Ha
        - Value for state 5 : 3.63962e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.67648e-01 Ha
        - Value for state 2 : 4.75198e-01 Ha
        - Value for state 3 : 4.83994e-01 Ha
        - Value for state 4 : 5.23023e-01 Ha
        - Value for state 5 : 4.71517e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.11792e+00 Ha
        - Value for state 2 : 3.20725e+00 Ha
        - Value for state 3 : 3.13186e+00 Ha
        - Value for state 4 : 3.17894e+00 Ha
        - Value for state 5 : 3.16810e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.84562e+02 K
        - Value for state 2 : 3.90770e+02 K
        - Value for state 3 : 3.98003e+02 K
        - Value for state 4 : 4.30098e+02 K
        - Value for state 5 : 3.87743e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59093e+04 Bohr^3
        - Value for state 2 : 1.58847e+04 Bohr^3
        - Value for state 3 : 1.59138e+04 Bohr^3
        - Value for state 4 : 1.58956e+04 Bohr^3
        - Value for state 5 : 1.59053e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.70380e-03 Ha/Bohr^3
        - Value for state 2 : 1.72771e-03 Ha/Bohr^3
        - Value for state 3 : 1.70432e-03 Ha/Bohr^3
        - Value for state 4 : 1.71883e-03 Ha/Bohr^3
        - Value for state 5 : 1.71238e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 8

Production step for state 1, configurations 8 for this state
Production step for state 2, configurations 8 for this state
Production step for state 3, configurations 8 for this state
Production step for state 4, configurations 8 for this state
Production step for state 5, configurations 8 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 0.000294

Number of configurations for training: 37
Number of atomic environments for training: 9472

Using MBAR weighting
Effective number of configurations:   24.85817
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0297 eV/angs
Weighted MAE Forces     0.0229 eV/angs
Weighted RMSE Stress    0.0531 GPa
Weighted MAE Stress     0.0409 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.49183e+00 Ha
        - Value for state 2 : 3.49581e+00 Ha
        - Value for state 3 : 3.50313e+00 Ha
        - Value for state 4 : 3.48220e+00 Ha
        - Value for state 5 : 3.51669e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.55099e-01 Ha
        - Value for state 2 : 5.00497e-01 Ha
        - Value for state 3 : 4.69358e-01 Ha
        - Value for state 4 : 4.42391e-01 Ha
        - Value for state 5 : 4.64849e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.03673e+00 Ha
        - Value for state 2 : 2.99531e+00 Ha
        - Value for state 3 : 3.03377e+00 Ha
        - Value for state 4 : 3.03981e+00 Ha
        - Value for state 5 : 3.05184e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.74242e+02 K
        - Value for state 2 : 4.11574e+02 K
        - Value for state 3 : 3.85967e+02 K
        - Value for state 4 : 3.63792e+02 K
        - Value for state 5 : 3.82260e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59683e+04 Bohr^3
        - Value for state 2 : 1.60163e+04 Bohr^3
        - Value for state 3 : 1.59984e+04 Bohr^3
        - Value for state 4 : 1.59859e+04 Bohr^3
        - Value for state 5 : 1.59756e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.66732e-03 Ha/Bohr^3
        - Value for state 2 : 1.64061e-03 Ha/Bohr^3
        - Value for state 3 : 1.65511e-03 Ha/Bohr^3
        - Value for state 4 : 1.66051e-03 Ha/Bohr^3
        - Value for state 5 : 1.66628e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 9

Production step for state 1, configurations 9 for this state
Production step for state 2, configurations 9 for this state
Production step for state 3, configurations 9 for this state
Production step for state 4, configurations 9 for this state
Production step for state 5, configurations 9 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 9.98e-05

Number of configurations for training: 42
Number of atomic environments for training: 10752

Using MBAR weighting
Effective number of configurations:   29.87780
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0294 eV/angs
Weighted MAE Forces     0.0228 eV/angs
Weighted RMSE Stress    0.0543 GPa
Weighted MAE Stress     0.0415 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.62715e+00 Ha
        - Value for state 2 : 3.71148e+00 Ha
        - Value for state 3 : 3.63345e+00 Ha
        - Value for state 4 : 3.55127e+00 Ha
        - Value for state 5 : 3.56598e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.11465e-01 Ha
        - Value for state 2 : 5.45990e-01 Ha
        - Value for state 3 : 5.25698e-01 Ha
        - Value for state 4 : 4.51144e-01 Ha
        - Value for state 5 : 4.78999e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.11568e+00 Ha
        - Value for state 2 : 3.16549e+00 Ha
        - Value for state 3 : 3.10776e+00 Ha
        - Value for state 4 : 3.10012e+00 Ha
        - Value for state 5 : 3.08698e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.20594e+02 K
        - Value for state 2 : 4.48985e+02 K
        - Value for state 3 : 4.32298e+02 K
        - Value for state 4 : 3.70989e+02 K
        - Value for state 5 : 3.93896e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59377e+04 Bohr^3
        - Value for state 2 : 1.59113e+04 Bohr^3
        - Value for state 3 : 1.59252e+04 Bohr^3
        - Value for state 4 : 1.59175e+04 Bohr^3
        - Value for state 5 : 1.59253e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.69199e-03 Ha/Bohr^3
        - Value for state 2 : 1.71056e-03 Ha/Bohr^3
        - Value for state 3 : 1.69529e-03 Ha/Bohr^3
        - Value for state 4 : 1.69762e-03 Ha/Bohr^3
        - Value for state 5 : 1.69255e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00


===============================================================================
               Max number of step reached, stoping the simulation
===============================================================================

===============================================================================
                      Copyright (C) 2022-2024 MLACS group.
                    MLACS comes with ABSOLUTELY NO WARRANTY.
               This package is distributed under the terms of the
                   GNU General Public License, see LICENSE.md
                    or http://www.gnu.org.copyleft/gpl.txt.

                      MLACS is common project of the CEA,
           Université de Liège, Université du Québec à Trois-Rivières
                 and other collaborators, see CONTRIBUTORS.md.
===============================================================================

===============================================================================
                  Suggested acknowledgments of the MLACS usage
                  ********************************************

The MLACS theory and algorithm
A. Castellano, F. Bottin, J. Bouchet, A. Levitt, G. Stoltz
Phys. Rev. B 106, L161110 (2022)

The MLACS package
A. Castellano, R. Béjaud, P. Richard, O. Nadeau, G. Geneste,
G. Antonius, J. Bouchet, A. Levitt, G. Stoltz, F. Bottin
(To be submitted (2024))
===============================================================================

And that’s it !

Note that you can find the computed weights in the MLIP repertory. We can plot them !

[11]:
import numpy as np
import matplotlib.pyplot as plt
from mlacs.utilities.plots import plot_weights, init_rcParams

plt.rcParams.update({'figure.figsize': (20,10)})
fig, ax0 = plt.subplots()
init_rcParams()
w = mbar.weight*mbar.get_effective_conf()
w /= max(w)                                  # Just to have weights from 0 to 1
ax0 = plot_weights(ax0, w)
plt.show()
../_images/tutorials_mlacs_tuto2_23_0.png

You can also notice the very low RMSE and MAE at the end of the MLACS simulation. This is due to the reweighting. As an example, we can run a new MLACS simulation without the MBAR weights and compare the results.

[12]:
from mlacs.utilities.plots import plot_correlation

e_data = np.loadtxt('Mbar_Trajectory/MLIP-Energy_comparison.dat')
f_data = np.loadtxt('Mbar_Trajectory/MLIP-Forces_comparison.dat')
s_data = np.loadtxt('Mbar_Trajectory/MLIP-Stress_comparison.dat')

plt.rcParams.update({'figure.figsize': (30,15)})
fig, (ax0, ax1, ax2) = plt.subplots(1,3)
ax0 = plot_correlation(ax0, e_data, weight=mbar.weight)
ax1 = plot_correlation(ax1, f_data, weight=mbar.weight)
ax2 = plot_correlation(ax2, s_data, weight=mbar.weight)
plt.show()

error1 = mlip_mbar.fit_res
../_images/tutorials_mlacs_tuto2_25_0.png

Launch the same simulation with Uniform weighting policy

We can run the simulation again with uniform configuration weights (this is the default in MLACS). To do it, we need to redefine the MLIP object without specifying a weighting policy. Then we create a new OtfMlacs object and launch the simulation again … Time for another coffee ?

[13]:
mlip_uni = LinearPotential(descriptor)
states = list(LammpsState(temperature, pressure, nsteps=nsteps) for i in range(5))
dyn = OtfMlacs(at,
               states,
               calc,
               mlip_uni,
               workdir='Uniform_Trajectory',
               neq=0)
dyn.run(10)
===============================================================================
            On-the-fly Machine-Learning Assisted Canonical Sampling
            *******************************************************

                      Copyright (C) 2022-2024 MLACS group.
                    MLACS comes with ABSOLUTELY NO WARRANTY.
               This package is distributed under the terms of the
                   GNU General Public License, see LICENSE.md
                    or http://www.gnu.org.copyleft/gpl.txt.

                      MLACS is common project of the CEA,
           Université de Liège, Université du Québec à Trois-Rivières
                 and other collaborators, see CONTRIBUTORS.md.
                  Please read ACKNOWLEDGMENTS.md for suggested
                      acknowledgments of the MLACS effort.
===============================================================================

version 0.0.13

date: 31-10-2024 13:44:40



===============================================================================
                       Recap of the simulation parameters

Recap of the states
*******************
State 1/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 2/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 3/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 4/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 5/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       100
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)




Recap of the calculator
***********************
True potential parameters:
Calculator : emt
parameters :



Recap of the MLIP
*****************
Linear potential
Parameters:
-----------
Fit method :            ols

Descriptor used in the potential:
SNAP descriptor
---------------
Elements :
Cu
Parameters :
rcut                5.0
chemflag            0
twojmax             6
rfac0               0.99363
rmin0               0.0
switchflag          1
bzeroflag           1
wselfallflag        0
dimension           31


===============================================================================
                            Starting the simulation
===============================================================================
Step 0
Running initial step
There are 1 unique configuration in the states
Computation done, creating trajectories

Computing energy with true potential on training configurations

===============================================================================
Step 1

Production step for state 1, configurations 1 for this state
Production step for state 2, configurations 1 for this state
Production step for state 3, configurations 1 for this state
Production step for state 4, configurations 1 for this state
Production step for state 5, configurations 1 for this state

Training new MLIP

Number of configurations for training: 2
Number of atomic environments for training: 512

Using Uniform weighting
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0092 eV/angs
Weighted MAE Forces     0.0050 eV/angs
Weighted RMSE Stress    0.0084 GPa
Weighted MAE Stress     0.0051 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 1.39842e+01 Ha
        - Value for state 2 : 1.39754e+01 Ha
        - Value for state 3 : 1.39274e+01 Ha
        - Value for state 4 : 1.38794e+01 Ha
        - Value for state 5 : 1.38074e+01 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 7.57132e-01 Ha
        - Value for state 2 : 7.29888e-01 Ha
        - Value for state 3 : 7.26248e-01 Ha
        - Value for state 4 : 7.33199e-01 Ha
        - Value for state 5 : 7.10597e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 1.32271e+01 Ha
        - Value for state 2 : 1.32455e+01 Ha
        - Value for state 3 : 1.32012e+01 Ha
        - Value for state 4 : 1.31462e+01 Ha
        - Value for state 5 : 1.30968e+01 Ha
Routine computation of the temperature
        - Value for state 1 : 6.22613e+02 K
        - Value for state 2 : 6.00209e+02 K
        - Value for state 3 : 5.97216e+02 K
        - Value for state 4 : 6.02932e+02 K
        - Value for state 5 : 5.84346e+02 K
Routine computation of the volume
        - Value for state 1 : 1.27180e+04 Bohr^3
        - Value for state 2 : 1.27214e+04 Bohr^3
        - Value for state 3 : 1.27296e+04 Bohr^3
        - Value for state 4 : 1.27331e+04 Bohr^3
        - Value for state 5 : 1.27519e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 5.11184e-03 Ha/Bohr^3
        - Value for state 2 : 5.11149e-03 Ha/Bohr^3
        - Value for state 3 : 5.09782e-03 Ha/Bohr^3
        - Value for state 4 : 5.08663e-03 Ha/Bohr^3
        - Value for state 5 : 5.06297e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 2

Production step for state 1, configurations 2 for this state
Production step for state 2, configurations 2 for this state
Production step for state 3, configurations 2 for this state
Production step for state 4, configurations 2 for this state
Production step for state 5, configurations 2 for this state

Training new MLIP

Number of configurations for training: 7
Number of atomic environments for training: 1792

Using Uniform weighting
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0002 eV/at
Weighted RMSE Forces    0.0543 eV/angs
Weighted MAE Forces     0.0395 eV/angs
Weighted RMSE Stress    0.1749 GPa
Weighted MAE Stress     0.1217 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 2.79915e+00 Ha
        - Value for state 2 : 2.83337e+00 Ha
        - Value for state 3 : 2.74663e+00 Ha
        - Value for state 4 : 2.72594e+00 Ha
        - Value for state 5 : 2.78908e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.18419e-01 Ha
        - Value for state 2 : 4.39932e-01 Ha
        - Value for state 3 : 4.37053e-01 Ha
        - Value for state 4 : 3.84189e-01 Ha
        - Value for state 5 : 4.41711e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.38073e+00 Ha
        - Value for state 2 : 2.39344e+00 Ha
        - Value for state 3 : 2.30957e+00 Ha
        - Value for state 4 : 2.34175e+00 Ha
        - Value for state 5 : 2.34737e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.44079e+02 K
        - Value for state 2 : 3.61770e+02 K
        - Value for state 3 : 3.59403e+02 K
        - Value for state 4 : 3.15930e+02 K
        - Value for state 5 : 3.63233e+02 K
Routine computation of the volume
        - Value for state 1 : 1.64942e+04 Bohr^3
        - Value for state 2 : 1.65228e+04 Bohr^3
        - Value for state 3 : 1.65200e+04 Bohr^3
        - Value for state 4 : 1.65133e+04 Bohr^3
        - Value for state 5 : 1.65322e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.36221e-03 Ha/Bohr^3
        - Value for state 2 : 1.35356e-03 Ha/Bohr^3
        - Value for state 3 : 1.34170e-03 Ha/Bohr^3
        - Value for state 4 : 1.34879e-03 Ha/Bohr^3
        - Value for state 5 : 1.34336e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 3

Production step for state 1, configurations 3 for this state
Production step for state 2, configurations 3 for this state
Production step for state 3, configurations 3 for this state
Production step for state 4, configurations 3 for this state
Production step for state 5, configurations 3 for this state

Training new MLIP

Number of configurations for training: 12
Number of atomic environments for training: 3072

Using Uniform weighting
Weighted RMSE Energy    0.0031 eV/at
Weighted MAE Energy     0.0029 eV/at
Weighted RMSE Forces    0.0717 eV/angs
Weighted MAE Forces     0.0541 eV/angs
Weighted RMSE Stress    0.4165 GPa
Weighted MAE Stress     0.2843 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.79373e+00 Ha
        - Value for state 2 : 3.95270e+00 Ha
        - Value for state 3 : 3.91424e+00 Ha
        - Value for state 4 : 3.70509e+00 Ha
        - Value for state 5 : 3.94378e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.48296e-01 Ha
        - Value for state 2 : 5.16633e-01 Ha
        - Value for state 3 : 5.20096e-01 Ha
        - Value for state 4 : 5.17658e-01 Ha
        - Value for state 5 : 4.94423e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.34543e+00 Ha
        - Value for state 2 : 3.43607e+00 Ha
        - Value for state 3 : 3.39414e+00 Ha
        - Value for state 4 : 3.18743e+00 Ha
        - Value for state 5 : 3.44936e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.68648e+02 K
        - Value for state 2 : 4.24843e+02 K
        - Value for state 3 : 4.27691e+02 K
        - Value for state 4 : 4.25686e+02 K
        - Value for state 5 : 4.06579e+02 K
Routine computation of the volume
        - Value for state 1 : 1.58075e+04 Bohr^3
        - Value for state 2 : 1.57623e+04 Bohr^3
        - Value for state 3 : 1.57869e+04 Bohr^3
        - Value for state 4 : 1.58809e+04 Bohr^3
        - Value for state 5 : 1.57748e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.78121e-03 Ha/Bohr^3
        - Value for state 2 : 1.81459e-03 Ha/Bohr^3
        - Value for state 3 : 1.79785e-03 Ha/Bohr^3
        - Value for state 4 : 1.72642e-03 Ha/Bohr^3
        - Value for state 5 : 1.81199e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 4

Production step for state 1, configurations 4 for this state
Production step for state 2, configurations 4 for this state
Production step for state 3, configurations 4 for this state
Production step for state 4, configurations 4 for this state
Production step for state 5, configurations 4 for this state

Training new MLIP

Number of configurations for training: 17
Number of atomic environments for training: 4352

Using Uniform weighting
Weighted RMSE Energy    0.0039 eV/at
Weighted MAE Energy     0.0035 eV/at
Weighted RMSE Forces    0.0692 eV/angs
Weighted MAE Forces     0.0520 eV/angs
Weighted RMSE Stress    0.3818 GPa
Weighted MAE Stress     0.2679 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.29857e+00 Ha
        - Value for state 2 : 3.27371e+00 Ha
        - Value for state 3 : 3.23278e+00 Ha
        - Value for state 4 : 3.38498e+00 Ha
        - Value for state 5 : 3.23249e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.66364e-01 Ha
        - Value for state 2 : 4.98863e-01 Ha
        - Value for state 3 : 4.88353e-01 Ha
        - Value for state 4 : 4.77784e-01 Ha
        - Value for state 5 : 4.58372e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.83220e+00 Ha
        - Value for state 2 : 2.77485e+00 Ha
        - Value for state 3 : 2.74443e+00 Ha
        - Value for state 4 : 2.90719e+00 Ha
        - Value for state 5 : 2.77412e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.83505e+02 K
        - Value for state 2 : 4.10230e+02 K
        - Value for state 3 : 4.01587e+02 K
        - Value for state 4 : 3.92897e+02 K
        - Value for state 5 : 3.76934e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60956e+04 Bohr^3
        - Value for state 2 : 1.61839e+04 Bohr^3
        - Value for state 3 : 1.61660e+04 Bohr^3
        - Value for state 4 : 1.60777e+04 Bohr^3
        - Value for state 5 : 1.61647e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.58337e-03 Ha/Bohr^3
        - Value for state 2 : 1.53979e-03 Ha/Bohr^3
        - Value for state 3 : 1.54199e-03 Ha/Bohr^3
        - Value for state 4 : 1.60249e-03 Ha/Bohr^3
        - Value for state 5 : 1.54773e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 5

Production step for state 1, configurations 5 for this state
Production step for state 2, configurations 5 for this state
Production step for state 3, configurations 5 for this state
Production step for state 4, configurations 5 for this state
Production step for state 5, configurations 5 for this state

Training new MLIP

Number of configurations for training: 22
Number of atomic environments for training: 5632

Using Uniform weighting
Weighted RMSE Energy    0.0037 eV/at
Weighted MAE Energy     0.0031 eV/at
Weighted RMSE Forces    0.0664 eV/angs
Weighted MAE Forces     0.0495 eV/angs
Weighted RMSE Stress    0.3531 GPa
Weighted MAE Stress     0.2407 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.62593e+00 Ha
        - Value for state 2 : 3.77419e+00 Ha
        - Value for state 3 : 3.71656e+00 Ha
        - Value for state 4 : 3.66704e+00 Ha
        - Value for state 5 : 3.75591e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.88833e-01 Ha
        - Value for state 2 : 5.16620e-01 Ha
        - Value for state 3 : 4.98656e-01 Ha
        - Value for state 4 : 5.24063e-01 Ha
        - Value for state 5 : 5.24520e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.13710e+00 Ha
        - Value for state 2 : 3.25757e+00 Ha
        - Value for state 3 : 3.21791e+00 Ha
        - Value for state 4 : 3.14298e+00 Ha
        - Value for state 5 : 3.23139e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.01982e+02 K
        - Value for state 2 : 4.24832e+02 K
        - Value for state 3 : 4.10061e+02 K
        - Value for state 4 : 4.30953e+02 K
        - Value for state 5 : 4.31329e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59105e+04 Bohr^3
        - Value for state 2 : 1.58514e+04 Bohr^3
        - Value for state 3 : 1.58679e+04 Bohr^3
        - Value for state 4 : 1.59243e+04 Bohr^3
        - Value for state 5 : 1.58912e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.70629e-03 Ha/Bohr^3
        - Value for state 2 : 1.74982e-03 Ha/Bohr^3
        - Value for state 3 : 1.73634e-03 Ha/Bohr^3
        - Value for state 4 : 1.70153e-03 Ha/Bohr^3
        - Value for state 5 : 1.72846e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 6

Production step for state 1, configurations 6 for this state
Production step for state 2, configurations 6 for this state
Production step for state 3, configurations 6 for this state
Production step for state 4, configurations 6 for this state
Production step for state 5, configurations 6 for this state

Training new MLIP

Number of configurations for training: 27
Number of atomic environments for training: 6912

Using Uniform weighting
Weighted RMSE Energy    0.0038 eV/at
Weighted MAE Energy     0.0029 eV/at
Weighted RMSE Forces    0.0640 eV/angs
Weighted MAE Forces     0.0473 eV/angs
Weighted RMSE Stress    0.3320 GPa
Weighted MAE Stress     0.2252 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.43506e+00 Ha
        - Value for state 2 : 3.34217e+00 Ha
        - Value for state 3 : 3.41185e+00 Ha
        - Value for state 4 : 3.52054e+00 Ha
        - Value for state 5 : 3.44760e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.84171e-01 Ha
        - Value for state 2 : 4.91922e-01 Ha
        - Value for state 3 : 4.78790e-01 Ha
        - Value for state 4 : 5.00867e-01 Ha
        - Value for state 5 : 5.04986e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.95089e+00 Ha
        - Value for state 2 : 2.85025e+00 Ha
        - Value for state 3 : 2.93306e+00 Ha
        - Value for state 4 : 3.01967e+00 Ha
        - Value for state 5 : 2.94261e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.98149e+02 K
        - Value for state 2 : 4.04523e+02 K
        - Value for state 3 : 3.93724e+02 K
        - Value for state 4 : 4.11878e+02 K
        - Value for state 5 : 4.15266e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60266e+04 Bohr^3
        - Value for state 2 : 1.60875e+04 Bohr^3
        - Value for state 3 : 1.60626e+04 Bohr^3
        - Value for state 4 : 1.60363e+04 Bohr^3
        - Value for state 5 : 1.60616e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.63004e-03 Ha/Bohr^3
        - Value for state 2 : 1.59018e-03 Ha/Bohr^3
        - Value for state 3 : 1.61265e-03 Ha/Bohr^3
        - Value for state 4 : 1.63691e-03 Ha/Bohr^3
        - Value for state 5 : 1.61417e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 7

Production step for state 1, configurations 7 for this state
Production step for state 2, configurations 7 for this state
Production step for state 3, configurations 7 for this state
Production step for state 4, configurations 7 for this state
Production step for state 5, configurations 7 for this state

Training new MLIP

Number of configurations for training: 32
Number of atomic environments for training: 8192

Using Uniform weighting
Weighted RMSE Energy    0.0037 eV/at
Weighted MAE Energy     0.0027 eV/at
Weighted RMSE Forces    0.0620 eV/angs
Weighted MAE Forces     0.0455 eV/angs
Weighted RMSE Stress    0.3165 GPa
Weighted MAE Stress     0.2145 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.63576e+00 Ha
        - Value for state 2 : 3.65111e+00 Ha
        - Value for state 3 : 3.64668e+00 Ha
        - Value for state 4 : 3.57697e+00 Ha
        - Value for state 5 : 3.62532e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.30790e-01 Ha
        - Value for state 2 : 4.92530e-01 Ha
        - Value for state 3 : 5.02517e-01 Ha
        - Value for state 4 : 4.92508e-01 Ha
        - Value for state 5 : 4.81202e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.10497e+00 Ha
        - Value for state 2 : 3.15858e+00 Ha
        - Value for state 3 : 3.14416e+00 Ha
        - Value for state 4 : 3.08447e+00 Ha
        - Value for state 5 : 3.14412e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.36485e+02 K
        - Value for state 2 : 4.05023e+02 K
        - Value for state 3 : 4.13236e+02 K
        - Value for state 4 : 4.05004e+02 K
        - Value for state 5 : 3.95707e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59517e+04 Bohr^3
        - Value for state 2 : 1.58894e+04 Bohr^3
        - Value for state 3 : 1.59219e+04 Bohr^3
        - Value for state 4 : 1.59427e+04 Bohr^3
        - Value for state 5 : 1.59143e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.68383e-03 Ha/Bohr^3
        - Value for state 2 : 1.71824e-03 Ha/Bohr^3
        - Value for state 3 : 1.70241e-03 Ha/Bohr^3
        - Value for state 4 : 1.68539e-03 Ha/Bohr^3
        - Value for state 5 : 1.70565e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 8

Production step for state 1, configurations 8 for this state
Production step for state 2, configurations 8 for this state
Production step for state 3, configurations 8 for this state
Production step for state 4, configurations 8 for this state
Production step for state 5, configurations 8 for this state

Training new MLIP

Number of configurations for training: 37
Number of atomic environments for training: 9472

Using Uniform weighting
Weighted RMSE Energy    0.0037 eV/at
Weighted MAE Energy     0.0025 eV/at
Weighted RMSE Forces    0.0600 eV/angs
Weighted MAE Forces     0.0438 eV/angs
Weighted RMSE Stress    0.3006 GPa
Weighted MAE Stress     0.2013 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.53015e+00 Ha
        - Value for state 2 : 3.44439e+00 Ha
        - Value for state 3 : 3.49950e+00 Ha
        - Value for state 4 : 3.49375e+00 Ha
        - Value for state 5 : 3.42078e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.05665e-01 Ha
        - Value for state 2 : 4.65399e-01 Ha
        - Value for state 3 : 4.96948e-01 Ha
        - Value for state 4 : 4.81830e-01 Ha
        - Value for state 5 : 4.82481e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.02449e+00 Ha
        - Value for state 2 : 2.97900e+00 Ha
        - Value for state 3 : 3.00255e+00 Ha
        - Value for state 4 : 3.01192e+00 Ha
        - Value for state 5 : 2.93829e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.15824e+02 K
        - Value for state 2 : 3.82712e+02 K
        - Value for state 3 : 4.08656e+02 K
        - Value for state 4 : 3.96224e+02 K
        - Value for state 5 : 3.96759e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60134e+04 Bohr^3
        - Value for state 2 : 1.60347e+04 Bohr^3
        - Value for state 3 : 1.60214e+04 Bohr^3
        - Value for state 4 : 1.60033e+04 Bohr^3
        - Value for state 5 : 1.60077e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.64617e-03 Ha/Bohr^3
        - Value for state 2 : 1.63084e-03 Ha/Bohr^3
        - Value for state 3 : 1.63978e-03 Ha/Bohr^3
        - Value for state 4 : 1.64871e-03 Ha/Bohr^3
        - Value for state 5 : 1.63605e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 9

Production step for state 1, configurations 9 for this state
Production step for state 2, configurations 9 for this state
Production step for state 3, configurations 9 for this state
Production step for state 4, configurations 9 for this state
Production step for state 5, configurations 9 for this state

Training new MLIP

Number of configurations for training: 42
Number of atomic environments for training: 10752

Using Uniform weighting
Weighted RMSE Energy    0.0036 eV/at
Weighted MAE Energy     0.0023 eV/at
Weighted RMSE Forces    0.0585 eV/angs
Weighted MAE Forces     0.0425 eV/angs
Weighted RMSE Stress    0.2874 GPa
Weighted MAE Stress     0.1894 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.60717e+00 Ha
        - Value for state 2 : 3.57400e+00 Ha
        - Value for state 3 : 3.63585e+00 Ha
        - Value for state 4 : 3.53697e+00 Ha
        - Value for state 5 : 3.57663e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.31634e-01 Ha
        - Value for state 2 : 4.57514e-01 Ha
        - Value for state 3 : 4.95774e-01 Ha
        - Value for state 4 : 4.60311e-01 Ha
        - Value for state 5 : 4.73722e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.07553e+00 Ha
        - Value for state 2 : 3.11648e+00 Ha
        - Value for state 3 : 3.14007e+00 Ha
        - Value for state 4 : 3.07666e+00 Ha
        - Value for state 5 : 3.10291e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.37179e+02 K
        - Value for state 2 : 3.76228e+02 K
        - Value for state 3 : 4.07691e+02 K
        - Value for state 4 : 3.78528e+02 K
        - Value for state 5 : 3.89556e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59654e+04 Bohr^3
        - Value for state 2 : 1.59230e+04 Bohr^3
        - Value for state 3 : 1.59304e+04 Bohr^3
        - Value for state 4 : 1.59534e+04 Bohr^3
        - Value for state 5 : 1.59445e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.67401e-03 Ha/Bohr^3
        - Value for state 2 : 1.69829e-03 Ha/Bohr^3
        - Value for state 3 : 1.69793e-03 Ha/Bohr^3
        - Value for state 4 : 1.67955e-03 Ha/Bohr^3
        - Value for state 5 : 1.68705e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00


===============================================================================
               Max number of step reached, stoping the simulation
===============================================================================

===============================================================================
                      Copyright (C) 2022-2024 MLACS group.
                    MLACS comes with ABSOLUTELY NO WARRANTY.
               This package is distributed under the terms of the
                   GNU General Public License, see LICENSE.md
                    or http://www.gnu.org.copyleft/gpl.txt.

                      MLACS is common project of the CEA,
           Université de Liège, Université du Québec à Trois-Rivières
                 and other collaborators, see CONTRIBUTORS.md.
===============================================================================

===============================================================================
                  Suggested acknowledgments of the MLACS usage
                  ********************************************

The MLACS theory and algorithm
A. Castellano, F. Bottin, J. Bouchet, A. Levitt, G. Stoltz
Phys. Rev. B 106, L161110 (2022)

The MLACS package
A. Castellano, R. Béjaud, P. Richard, O. Nadeau, G. Geneste,
G. Antonius, J. Bouchet, A. Levitt, G. Stoltz, F. Bottin
(To be submitted (2024))
===============================================================================

We can plot the correlation functions of the “uniform” trajectory.

[14]:
from mlacs.utilities.plots import plot_correlation

e_data = np.loadtxt('Uniform_Trajectory/MLIP-Energy_comparison.dat')
f_data = np.loadtxt('Uniform_Trajectory/MLIP-Forces_comparison.dat')
s_data = np.loadtxt('Uniform_Trajectory/MLIP-Stress_comparison.dat')

plt.rcParams.update({'figure.figsize': (30,15)})
fig, (ax0, ax1, ax2) = plt.subplots(1,3)
ax0 = plot_correlation(ax0, e_data)
ax1 = plot_correlation(ax1, f_data)
ax2 = plot_correlation(ax2, s_data)
plt.show()

error2 = mlip_uni.fit_res
../_images/tutorials_mlacs_tuto2_30_0.png

It is clear that the MBAR weighting policy can be very useful, especially when the starting configurations are far from the equilibrium ones. In such cases, the sampled database may not accurately represent the true equilibrium state, which can be problematic when computing representative thermodynamic properties. By using the MBAR weighting policy, we can ensure that the sampled data is properly reweighted to account for any discrepancies between the starting and equilibrium configurations, leading to more accurate and reliable results.

Replay the simulation with MBAR and the Database Calculator

The final simulation we ran was not in vain, even if it turns out that the resulting database is not representative of the thermodynamic ensemble. In this section, we will explore how we can replay an MLACS simulation without performing any new calculations, and update the database by adding MBAR weights to the sampling configurations. This allows us to make use of the existing data and improve the accuracy of our results without expending additional computational resources.

The DatabaseCalc is a calculator that sequentially reads a previously calculated traj files. We will use it in the present example to replay a MLACS.

[15]:
from mlacs.calc import DatabaseCalc

wdir = 'Uniform_Trajectory'
traj = [f'{wdir}/Trajectory_{i}.traj' for i in range(1,6)]
train = f'{wdir}/Training_configurations.traj'
calc = DatabaseCalc(trajfile=traj, trainfile=train)

We also need to update the MLIP object by adding MBAR.

[16]:
mbar = MbarManager()

mlip_mbar = LinearPotential(descriptor, weight=mbar)
# Dummy states since sampling has already been done.
states = list(LammpsState(temperature, pressure, nsteps=1) for i in range(5))
dyn = OtfMlacs(at,
               states,
               calc,
               mlip_mbar,
               workdir='Replay_Trajectory',
               neq=0)
dyn.run(10)
===============================================================================
            On-the-fly Machine-Learning Assisted Canonical Sampling
            *******************************************************

                      Copyright (C) 2022-2024 MLACS group.
                    MLACS comes with ABSOLUTELY NO WARRANTY.
               This package is distributed under the terms of the
                   GNU General Public License, see LICENSE.md
                    or http://www.gnu.org.copyleft/gpl.txt.

                      MLACS is common project of the CEA,
           Université de Liège, Université du Québec à Trois-Rivières
                 and other collaborators, see CONTRIBUTORS.md.
                  Please read ACKNOWLEDGMENTS.md for suggested
                      acknowledgments of the MLACS effort.
===============================================================================

version 0.0.13

date: 31-10-2024 13:45:22



===============================================================================
                       Recap of the simulation parameters

Recap of the states
*******************
State 1/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       1
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 2/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       1
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 3/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       1
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 4/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       1
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)



State 5/5 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 400
A Langevin thermostat is used
Pressure (GPa)                          50
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       1
Timestep (in fs) :                      1.5
Themostat damping parameter (in fs) :   $(100*dt)
Barostat damping parameter (in fs) :    $(1000*dt)




Recap of the calculator
***********************
True potential parameters:



Recap of the MLIP
*****************
Linear potential
Parameters:
-----------
Fit method :            ols

Descriptor used in the potential:
SNAP descriptor
---------------
Elements :
Cu
Parameters :
rcut                5.0
chemflag            0
twojmax             6
rfac0               0.99363
rmin0               0.0
switchflag          1
bzeroflag           1
wselfallflag        0
dimension           31


===============================================================================
                            Starting the simulation
===============================================================================
Step 0
Running initial step
There are 1 unique configuration in the states
Computation done, creating trajectories

Computing energy with true potential on training configurations

===============================================================================
Step 1

Production step for state 1, configurations 1 for this state
Production step for state 2, configurations 1 for this state
Production step for state 3, configurations 1 for this state
Production step for state 4, configurations 1 for this state
Production step for state 5, configurations 1 for this state

Training new MLIP

Number of configurations for training: 2
Number of atomic environments for training: 512

Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0092 eV/angs
Weighted MAE Forces     0.0050 eV/angs
Weighted RMSE Stress    0.0084 GPa
Weighted MAE Stress     0.0051 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 1.39842e+01 Ha
        - Value for state 2 : 1.39754e+01 Ha
        - Value for state 3 : 1.39274e+01 Ha
        - Value for state 4 : 1.38794e+01 Ha
        - Value for state 5 : 1.38074e+01 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 7.57132e-01 Ha
        - Value for state 2 : 7.29888e-01 Ha
        - Value for state 3 : 7.26248e-01 Ha
        - Value for state 4 : 7.33199e-01 Ha
        - Value for state 5 : 7.10597e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 1.32271e+01 Ha
        - Value for state 2 : 1.32455e+01 Ha
        - Value for state 3 : 1.32012e+01 Ha
        - Value for state 4 : 1.31462e+01 Ha
        - Value for state 5 : 1.30968e+01 Ha
Routine computation of the temperature
        - Value for state 1 : 6.22613e+02 K
        - Value for state 2 : 6.00209e+02 K
        - Value for state 3 : 5.97216e+02 K
        - Value for state 4 : 6.02932e+02 K
        - Value for state 5 : 5.84346e+02 K
Routine computation of the volume
        - Value for state 1 : 1.27180e+04 Bohr^3
        - Value for state 2 : 1.27214e+04 Bohr^3
        - Value for state 3 : 1.27296e+04 Bohr^3
        - Value for state 4 : 1.27331e+04 Bohr^3
        - Value for state 5 : 1.27519e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 5.11184e-03 Ha/Bohr^3
        - Value for state 2 : 5.11149e-03 Ha/Bohr^3
        - Value for state 3 : 5.09782e-03 Ha/Bohr^3
        - Value for state 4 : 5.08663e-03 Ha/Bohr^3
        - Value for state 5 : 5.06297e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 2

Production step for state 1, configurations 2 for this state
Production step for state 2, configurations 2 for this state
Production step for state 3, configurations 2 for this state
Production step for state 4, configurations 2 for this state
Production step for state 5, configurations 2 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 2.65e-08

Number of configurations for training: 7
Number of atomic environments for training: 1792

Using MBAR weighting
Effective number of configurations:    5.00000
Number of uncorrelated snapshots for each k state:
[2 5]
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0542 eV/angs
Weighted MAE Forces     0.0381 eV/angs
Weighted RMSE Stress    0.1734 GPa
Weighted MAE Stress     0.1158 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 2.79915e+00 Ha
        - Value for state 2 : 2.83337e+00 Ha
        - Value for state 3 : 2.74663e+00 Ha
        - Value for state 4 : 2.72594e+00 Ha
        - Value for state 5 : 2.78908e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.18419e-01 Ha
        - Value for state 2 : 4.39932e-01 Ha
        - Value for state 3 : 4.37053e-01 Ha
        - Value for state 4 : 3.84189e-01 Ha
        - Value for state 5 : 4.41711e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.38073e+00 Ha
        - Value for state 2 : 2.39344e+00 Ha
        - Value for state 3 : 2.30957e+00 Ha
        - Value for state 4 : 2.34175e+00 Ha
        - Value for state 5 : 2.34737e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.44079e+02 K
        - Value for state 2 : 3.61770e+02 K
        - Value for state 3 : 3.59403e+02 K
        - Value for state 4 : 3.15930e+02 K
        - Value for state 5 : 3.63233e+02 K
Routine computation of the volume
        - Value for state 1 : 1.64942e+04 Bohr^3
        - Value for state 2 : 1.65228e+04 Bohr^3
        - Value for state 3 : 1.65200e+04 Bohr^3
        - Value for state 4 : 1.65133e+04 Bohr^3
        - Value for state 5 : 1.65322e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.36221e-03 Ha/Bohr^3
        - Value for state 2 : 1.35356e-03 Ha/Bohr^3
        - Value for state 3 : 1.34170e-03 Ha/Bohr^3
        - Value for state 4 : 1.34879e-03 Ha/Bohr^3
        - Value for state 5 : 1.34336e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 3

Production step for state 1, configurations 3 for this state
Production step for state 2, configurations 3 for this state
Production step for state 3, configurations 3 for this state
Production step for state 4, configurations 3 for this state
Production step for state 5, configurations 3 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 5.72e-13

Number of configurations for training: 12
Number of atomic environments for training: 3072

Using MBAR weighting
Effective number of configurations:    5.00000
Number of uncorrelated snapshots for each k state:
[2 5 5]
Weighted RMSE Energy    0.0026 eV/at
Weighted MAE Energy     0.0026 eV/at
Weighted RMSE Forces    0.0645 eV/angs
Weighted MAE Forces     0.0510 eV/angs
Weighted RMSE Stress    0.4846 GPa
Weighted MAE Stress     0.3470 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.79373e+00 Ha
        - Value for state 2 : 3.95270e+00 Ha
        - Value for state 3 : 3.91424e+00 Ha
        - Value for state 4 : 3.70509e+00 Ha
        - Value for state 5 : 3.94378e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.48296e-01 Ha
        - Value for state 2 : 5.16633e-01 Ha
        - Value for state 3 : 5.20096e-01 Ha
        - Value for state 4 : 5.17658e-01 Ha
        - Value for state 5 : 4.94423e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.34543e+00 Ha
        - Value for state 2 : 3.43607e+00 Ha
        - Value for state 3 : 3.39414e+00 Ha
        - Value for state 4 : 3.18743e+00 Ha
        - Value for state 5 : 3.44936e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.68648e+02 K
        - Value for state 2 : 4.24843e+02 K
        - Value for state 3 : 4.27691e+02 K
        - Value for state 4 : 4.25686e+02 K
        - Value for state 5 : 4.06579e+02 K
Routine computation of the volume
        - Value for state 1 : 1.58075e+04 Bohr^3
        - Value for state 2 : 1.57623e+04 Bohr^3
        - Value for state 3 : 1.57869e+04 Bohr^3
        - Value for state 4 : 1.58809e+04 Bohr^3
        - Value for state 5 : 1.57748e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.78121e-03 Ha/Bohr^3
        - Value for state 2 : 1.81459e-03 Ha/Bohr^3
        - Value for state 3 : 1.79785e-03 Ha/Bohr^3
        - Value for state 4 : 1.72642e-03 Ha/Bohr^3
        - Value for state 5 : 1.81199e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 4

Production step for state 1, configurations 4 for this state
Production step for state 2, configurations 4 for this state
Production step for state 3, configurations 4 for this state
Production step for state 4, configurations 4 for this state
Production step for state 5, configurations 4 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 1.92e-07

Number of configurations for training: 17
Number of atomic environments for training: 4352

Using MBAR weighting
Effective number of configurations:    5.00285
Number of uncorrelated snapshots for each k state:
[2 5 5 5]
Weighted RMSE Energy    0.0002 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0341 eV/angs
Weighted MAE Forces     0.0267 eV/angs
Weighted RMSE Stress    0.0507 GPa
Weighted MAE Stress     0.0379 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.29857e+00 Ha
        - Value for state 2 : 3.27371e+00 Ha
        - Value for state 3 : 3.23278e+00 Ha
        - Value for state 4 : 3.38498e+00 Ha
        - Value for state 5 : 3.23249e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.66364e-01 Ha
        - Value for state 2 : 4.98863e-01 Ha
        - Value for state 3 : 4.88353e-01 Ha
        - Value for state 4 : 4.77784e-01 Ha
        - Value for state 5 : 4.58372e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.83220e+00 Ha
        - Value for state 2 : 2.77485e+00 Ha
        - Value for state 3 : 2.74443e+00 Ha
        - Value for state 4 : 2.90719e+00 Ha
        - Value for state 5 : 2.77412e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.83505e+02 K
        - Value for state 2 : 4.10230e+02 K
        - Value for state 3 : 4.01587e+02 K
        - Value for state 4 : 3.92897e+02 K
        - Value for state 5 : 3.76934e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60956e+04 Bohr^3
        - Value for state 2 : 1.61839e+04 Bohr^3
        - Value for state 3 : 1.61660e+04 Bohr^3
        - Value for state 4 : 1.60777e+04 Bohr^3
        - Value for state 5 : 1.61647e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.58337e-03 Ha/Bohr^3
        - Value for state 2 : 1.53979e-03 Ha/Bohr^3
        - Value for state 3 : 1.54199e-03 Ha/Bohr^3
        - Value for state 4 : 1.60249e-03 Ha/Bohr^3
        - Value for state 5 : 1.54773e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 5

Production step for state 1, configurations 5 for this state
Production step for state 2, configurations 5 for this state
Production step for state 3, configurations 5 for this state
Production step for state 4, configurations 5 for this state
Production step for state 5, configurations 5 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 0.000234

Number of configurations for training: 22
Number of atomic environments for training: 5632

Using MBAR weighting
Effective number of configurations:    9.92527
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0313 eV/angs
Weighted MAE Forces     0.0242 eV/angs
Weighted RMSE Stress    0.0557 GPa
Weighted MAE Stress     0.0404 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.62593e+00 Ha
        - Value for state 2 : 3.77419e+00 Ha
        - Value for state 3 : 3.71656e+00 Ha
        - Value for state 4 : 3.66704e+00 Ha
        - Value for state 5 : 3.75591e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.88833e-01 Ha
        - Value for state 2 : 5.16620e-01 Ha
        - Value for state 3 : 4.98656e-01 Ha
        - Value for state 4 : 5.24063e-01 Ha
        - Value for state 5 : 5.24520e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.13710e+00 Ha
        - Value for state 2 : 3.25757e+00 Ha
        - Value for state 3 : 3.21791e+00 Ha
        - Value for state 4 : 3.14298e+00 Ha
        - Value for state 5 : 3.23139e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.01982e+02 K
        - Value for state 2 : 4.24832e+02 K
        - Value for state 3 : 4.10061e+02 K
        - Value for state 4 : 4.30953e+02 K
        - Value for state 5 : 4.31329e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59105e+04 Bohr^3
        - Value for state 2 : 1.58514e+04 Bohr^3
        - Value for state 3 : 1.58679e+04 Bohr^3
        - Value for state 4 : 1.59243e+04 Bohr^3
        - Value for state 5 : 1.58912e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.70629e-03 Ha/Bohr^3
        - Value for state 2 : 1.74982e-03 Ha/Bohr^3
        - Value for state 3 : 1.73634e-03 Ha/Bohr^3
        - Value for state 4 : 1.70153e-03 Ha/Bohr^3
        - Value for state 5 : 1.72846e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 6

Production step for state 1, configurations 6 for this state
Production step for state 2, configurations 6 for this state
Production step for state 3, configurations 6 for this state
Production step for state 4, configurations 6 for this state
Production step for state 5, configurations 6 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 4.12e-06

Number of configurations for training: 27
Number of atomic environments for training: 6912

Using MBAR weighting
Effective number of configurations:   14.91349
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0309 eV/angs
Weighted MAE Forces     0.0239 eV/angs
Weighted RMSE Stress    0.0590 GPa
Weighted MAE Stress     0.0414 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.43506e+00 Ha
        - Value for state 2 : 3.34217e+00 Ha
        - Value for state 3 : 3.41185e+00 Ha
        - Value for state 4 : 3.52054e+00 Ha
        - Value for state 5 : 3.44760e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.84171e-01 Ha
        - Value for state 2 : 4.91922e-01 Ha
        - Value for state 3 : 4.78790e-01 Ha
        - Value for state 4 : 5.00867e-01 Ha
        - Value for state 5 : 5.04986e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.95089e+00 Ha
        - Value for state 2 : 2.85025e+00 Ha
        - Value for state 3 : 2.93306e+00 Ha
        - Value for state 4 : 3.01967e+00 Ha
        - Value for state 5 : 2.94261e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 3.98149e+02 K
        - Value for state 2 : 4.04523e+02 K
        - Value for state 3 : 3.93724e+02 K
        - Value for state 4 : 4.11878e+02 K
        - Value for state 5 : 4.15266e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60266e+04 Bohr^3
        - Value for state 2 : 1.60875e+04 Bohr^3
        - Value for state 3 : 1.60626e+04 Bohr^3
        - Value for state 4 : 1.60363e+04 Bohr^3
        - Value for state 5 : 1.60616e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.63004e-03 Ha/Bohr^3
        - Value for state 2 : 1.59018e-03 Ha/Bohr^3
        - Value for state 3 : 1.61265e-03 Ha/Bohr^3
        - Value for state 4 : 1.63691e-03 Ha/Bohr^3
        - Value for state 5 : 1.61417e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 7

Production step for state 1, configurations 7 for this state
Production step for state 2, configurations 7 for this state
Production step for state 3, configurations 7 for this state
Production step for state 4, configurations 7 for this state
Production step for state 5, configurations 7 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 0.000429

Number of configurations for training: 32
Number of atomic environments for training: 8192

Using MBAR weighting
Effective number of configurations:   19.88339
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0306 eV/angs
Weighted MAE Forces     0.0237 eV/angs
Weighted RMSE Stress    0.0556 GPa
Weighted MAE Stress     0.0393 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.63576e+00 Ha
        - Value for state 2 : 3.65111e+00 Ha
        - Value for state 3 : 3.64668e+00 Ha
        - Value for state 4 : 3.57697e+00 Ha
        - Value for state 5 : 3.62532e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.30790e-01 Ha
        - Value for state 2 : 4.92530e-01 Ha
        - Value for state 3 : 5.02517e-01 Ha
        - Value for state 4 : 4.92508e-01 Ha
        - Value for state 5 : 4.81202e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.10497e+00 Ha
        - Value for state 2 : 3.15858e+00 Ha
        - Value for state 3 : 3.14416e+00 Ha
        - Value for state 4 : 3.08447e+00 Ha
        - Value for state 5 : 3.14412e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.36485e+02 K
        - Value for state 2 : 4.05023e+02 K
        - Value for state 3 : 4.13236e+02 K
        - Value for state 4 : 4.05004e+02 K
        - Value for state 5 : 3.95707e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59517e+04 Bohr^3
        - Value for state 2 : 1.58894e+04 Bohr^3
        - Value for state 3 : 1.59219e+04 Bohr^3
        - Value for state 4 : 1.59427e+04 Bohr^3
        - Value for state 5 : 1.59143e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.68383e-03 Ha/Bohr^3
        - Value for state 2 : 1.71824e-03 Ha/Bohr^3
        - Value for state 3 : 1.70241e-03 Ha/Bohr^3
        - Value for state 4 : 1.68539e-03 Ha/Bohr^3
        - Value for state 5 : 1.70565e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 8

Production step for state 1, configurations 8 for this state
Production step for state 2, configurations 8 for this state
Production step for state 3, configurations 8 for this state
Production step for state 4, configurations 8 for this state
Production step for state 5, configurations 8 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 5.72e-06

Number of configurations for training: 37
Number of atomic environments for training: 9472

Using MBAR weighting
Effective number of configurations:   25.03684
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0302 eV/angs
Weighted MAE Forces     0.0233 eV/angs
Weighted RMSE Stress    0.0547 GPa
Weighted MAE Stress     0.0399 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.53015e+00 Ha
        - Value for state 2 : 3.44439e+00 Ha
        - Value for state 3 : 3.49950e+00 Ha
        - Value for state 4 : 3.49375e+00 Ha
        - Value for state 5 : 3.42078e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.05665e-01 Ha
        - Value for state 2 : 4.65399e-01 Ha
        - Value for state 3 : 4.96948e-01 Ha
        - Value for state 4 : 4.81830e-01 Ha
        - Value for state 5 : 4.82481e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.02449e+00 Ha
        - Value for state 2 : 2.97900e+00 Ha
        - Value for state 3 : 3.00255e+00 Ha
        - Value for state 4 : 3.01192e+00 Ha
        - Value for state 5 : 2.93829e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.15824e+02 K
        - Value for state 2 : 3.82712e+02 K
        - Value for state 3 : 4.08656e+02 K
        - Value for state 4 : 3.96224e+02 K
        - Value for state 5 : 3.96759e+02 K
Routine computation of the volume
        - Value for state 1 : 1.60134e+04 Bohr^3
        - Value for state 2 : 1.60347e+04 Bohr^3
        - Value for state 3 : 1.60214e+04 Bohr^3
        - Value for state 4 : 1.60033e+04 Bohr^3
        - Value for state 5 : 1.60077e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.64617e-03 Ha/Bohr^3
        - Value for state 2 : 1.63084e-03 Ha/Bohr^3
        - Value for state 3 : 1.63978e-03 Ha/Bohr^3
        - Value for state 4 : 1.64871e-03 Ha/Bohr^3
        - Value for state 5 : 1.63605e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00

===============================================================================
Step 9

Production step for state 1, configurations 9 for this state
Production step for state 2, configurations 9 for this state
Production step for state 3, configurations 9 for this state
Production step for state 4, configurations 9 for this state
Production step for state 5, configurations 9 for this state

Training new MLIP
Reached a solution to within tolerance with L-BFGS-B
Solution found within tolerance!
Final gradient norm: 1.86e-05

Number of configurations for training: 42
Number of atomic environments for training: 10752

Using MBAR weighting
Effective number of configurations:   30.08039
Number of uncorrelated snapshots for each k state:
[2 5 5 5 5 5 5 5 5]
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0301 eV/angs
Weighted MAE Forces     0.0232 eV/angs
Weighted RMSE Stress    0.0533 GPa
Weighted MAE Stress     0.0386 GPa

Running MLMD
State 1/5 has been launched
State 2/5 has been launched
State 3/5 has been launched
State 4/5 has been launched
State 5/5 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 3.60717e+00 Ha
        - Value for state 2 : 3.57400e+00 Ha
        - Value for state 3 : 3.63585e+00 Ha
        - Value for state 4 : 3.53697e+00 Ha
        - Value for state 5 : 3.57663e+00 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.31634e-01 Ha
        - Value for state 2 : 4.57514e-01 Ha
        - Value for state 3 : 4.95774e-01 Ha
        - Value for state 4 : 4.60311e-01 Ha
        - Value for state 5 : 4.73722e-01 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.07553e+00 Ha
        - Value for state 2 : 3.11648e+00 Ha
        - Value for state 3 : 3.14007e+00 Ha
        - Value for state 4 : 3.07666e+00 Ha
        - Value for state 5 : 3.10291e+00 Ha
Routine computation of the temperature
        - Value for state 1 : 4.37179e+02 K
        - Value for state 2 : 3.76228e+02 K
        - Value for state 3 : 4.07691e+02 K
        - Value for state 4 : 3.78528e+02 K
        - Value for state 5 : 3.89556e+02 K
Routine computation of the volume
        - Value for state 1 : 1.59654e+04 Bohr^3
        - Value for state 2 : 1.59230e+04 Bohr^3
        - Value for state 3 : 1.59304e+04 Bohr^3
        - Value for state 4 : 1.59534e+04 Bohr^3
        - Value for state 5 : 1.59445e+04 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.67401e-03 Ha/Bohr^3
        - Value for state 2 : 1.69829e-03 Ha/Bohr^3
        - Value for state 3 : 1.69793e-03 Ha/Bohr^3
        - Value for state 4 : 1.67955e-03 Ha/Bohr^3
        - Value for state 5 : 1.68705e-03 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00
        - Value for state 2 : 0.00000e+00
        - Value for state 3 : 0.00000e+00
        - Value for state 4 : 0.00000e+00
        - Value for state 5 : 0.00000e+00


===============================================================================
               Max number of step reached, stoping the simulation
===============================================================================

===============================================================================
                      Copyright (C) 2022-2024 MLACS group.
                    MLACS comes with ABSOLUTELY NO WARRANTY.
               This package is distributed under the terms of the
                   GNU General Public License, see LICENSE.md
                    or http://www.gnu.org.copyleft/gpl.txt.

                      MLACS is common project of the CEA,
           Université de Liège, Université du Québec à Trois-Rivières
                 and other collaborators, see CONTRIBUTORS.md.
===============================================================================

===============================================================================
                  Suggested acknowledgments of the MLACS usage
                  ********************************************

The MLACS theory and algorithm
A. Castellano, F. Bottin, J. Bouchet, A. Levitt, G. Stoltz
Phys. Rev. B 106, L161110 (2022)

The MLACS package
A. Castellano, R. Béjaud, P. Richard, O. Nadeau, G. Geneste,
G. Antonius, J. Bouchet, A. Levitt, G. Stoltz, F. Bottin
(To be submitted (2024))
===============================================================================

We can also plot the weight obtained from the uniform sampling trajectory.

[17]:
import numpy as np
import matplotlib.pyplot as plt
from mlacs.utilities.plots import plot_weights, init_rcParams

plt.rcParams.update({'figure.figsize': (20,10)})
fig, ax0 = plt.subplots()
init_rcParams()
w = mbar.weight*mbar.get_effective_conf()
w /= max(w)                                  # Just to have weights from 0 to 1
ax0 = plot_weights(ax0, w)
plt.show()
../_images/tutorials_mlacs_tuto2_39_0.png

You can see that the weight from the first configurations are zero, meaning that they are very far away from the equilibrium sampled state.

A new MLIP can be fitted using the MBAR weights obtained from the uniform sampling database.

[18]:
from mlacs.utilities.plots import plot_correlation

e_data = np.loadtxt('Replay_Trajectory/MLIP-Energy_comparison.dat')
f_data = np.loadtxt('Replay_Trajectory/MLIP-Forces_comparison.dat')
s_data = np.loadtxt('Replay_Trajectory/MLIP-Stress_comparison.dat')

plt.rcParams.update({'figure.figsize': (30,15)})
fig, (ax0, ax1, ax2) = plt.subplots(1,3)
ax0 = plot_correlation(ax0, e_data, weight=mbar.weight)
ax1 = plot_correlation(ax1, f_data, weight=mbar.weight)
ax2 = plot_correlation(ax2, s_data, weight=mbar.weight)
plt.show()

error3 = mlip_mbar.fit_res
../_images/tutorials_mlacs_tuto2_42_0.png

At the end we can compare the errors from the three different situations:

[19]:
def results_errors(results):
    txt = f"RMSE Energy       {results[0, 0]*1000:.3f} meV/at\n"
    txt += f"MAE Energy        {results[1, 0]*1000:.3f} meV/at\n"
    txt += f"RMSE Forces       {results[0, 1]*1000:.3f} meV/angs\n"
    txt += f"MAE Forces        {results[1, 1]*1000:.3f} meV/angs\n"
    txt += f"RMSE Stress       {results[0, 2]*1000:.3f} MPa\n"
    txt += f"MAE Stress        {results[1, 2]*1000:.3f} MPa\n"
    return txt

txt = 'MLACS sampling with MBAR weights:\n'
txt += '------------------------------------------------\n'
txt += results_errors(error1)
txt += '\n'
txt += 'MLACS sampling with uniform weights:\n'
txt += '------------------------------------------------\n'
txt += results_errors(error2)
txt += '\n'
txt += 'MLACS uniform sampling with MBAR weights:\n'
txt += '------------------------------------------------\n'
txt += results_errors(error3)
print(txt)
MLACS sampling with MBAR weights:
------------------------------------------------
RMSE Energy       0.100 meV/at
MAE Energy        0.080 meV/at
RMSE Forces       29.439 meV/angs
MAE Forces        22.791 meV/angs
RMSE Stress       54.339 MPa
MAE Stress        41.477 MPa

MLACS sampling with uniform weights:
------------------------------------------------
RMSE Energy       3.630 meV/at
MAE Energy        2.333 meV/at
RMSE Forces       58.527 meV/angs
MAE Forces        42.513 meV/angs
RMSE Stress       287.413 MPa
MAE Stress        189.444 MPa

MLACS uniform sampling with MBAR weights:
------------------------------------------------
RMSE Energy       0.091 meV/at
MAE Energy        0.073 meV/at
RMSE Forces       30.107 meV/angs
MAE Forces        23.225 meV/angs
RMSE Stress       53.280 MPa
MAE Stress        38.634 MPa