Introduction to Machine-Learning Assisted Sampling

In this tutorial, we will show how to setup a simulation to sample the NPT ensemble of Aluminium. To keep the example simple, we will use the EMT potential as reference.

Setting up the simulation

A MLACS simulations contains 3 ingredients - The system, which consist in an atomic system and it’s associated potential - A state to be sampled - A machine-learning interatomic potential

We will start this tutorial by demonstrating the simplest way to set up all these components

Setting up the system

The first component is the actual system to be simulated. In this tutorial, we will simulate bulk aluminium with a EMT potential.

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

[1]:
from ase.build import bulk
at = bulk("Al", cubic=True).repeat(2)  # This create a 2x2x2 supercell of aluminium

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

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

Setting up the state

The second ingredient for a MLACS simulation is the state to be sampled. Usually, the state is defined by the thermostat/barostat used in the molecular dynamics simulation

We will start by setting up some parameters

[3]:
temperature = 300  # The temperature, in K
pressure = 0.0  # The pressure, in GPa
nsteps = 500  # The number of steps

We also have to provide the path to the LAMMPS binary. This can be set up using a bash command

export ASE_LAMMPSRUN_COMMAND=~/.local/bin/lmp

or directly in python as we will do here

[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.

[5]:
from mlacs.state import LammpsState
state = LammpsState(temperature,
                    pressure,
                    nsteps=nsteps)

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 from the reference data gathered.

In this example, we will use a SNAP potential with a parameter \(2J_{\mathrm{max}}\) of 4 to speed up the simulation. The setting up of a SNAP potential is done in two steps: * define the descriptor

[6]:
from mlacs.mlip import SnapDescriptor
parameters = {"twojmax": 4}
descriptor = SnapDescriptor(at,
                            parameters=parameters)
  • Define the model

[7]:
from mlacs.mlip import LinearPotential
mlip = LinearPotential(descriptor)

Gathering everything and launching the simulation

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

[8]:
from mlacs import OtfMlacs
dyn = OtfMlacs(at,
               state,
               calc,
               mlip)
===============================================================================
            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:38:44



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

Recap of the states
*******************
State 1/1 :
NPT dynamics as implemented in LAMMPS
Temperature (in Kelvin)                 300
A Langevin thermostat is used
Pressure (GPa)                          0.0
Number of MLMD equilibration steps :    100
Number of MLMD production steps :       500
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 :
Al
Parameters :
rcut                5.0
chemflag            0
twojmax             4
rfac0               0.99363
rmin0               0.0
switchflag          1
bzeroflag           1
wselfallflag        0
dimension           15


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

and launch the simulation for 20 steps

[9]:
dyn.run(20)
===============================================================================
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

Equilibration step for state 1, configurations 1 for this state

Training new MLIP

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

Using Uniform weighting
Weighted RMSE Energy    0.0000 eV/at
Weighted MAE Energy     0.0000 eV/at
Weighted RMSE Forces    0.0035 eV/angs
Weighted MAE Forces     0.0020 eV/angs
Weighted RMSE Stress    0.0170 GPa
Weighted MAE Stress     0.0138 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 7.68429e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.47091e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.21338e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.94125e+02 K
Routine computation of the volume
        - Value for state 1 : 3.44051e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 2.02232e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 2 for this state

Training new MLIP

Number of configurations for training: 3
Number of atomic environments for training: 96

Using Uniform weighting
Weighted RMSE Energy    0.0001 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0125 eV/angs
Weighted MAE Forces     0.0074 eV/angs
Weighted RMSE Stress    0.1245 GPa
Weighted MAE Stress     0.0823 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 7.51895e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.01544e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.50351e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.64162e+02 K
Routine computation of the volume
        - Value for state 1 : 3.53891e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -1.30829e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 3 for this state

Training new MLIP

Number of configurations for training: 4
Number of atomic environments for training: 128

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0188 eV/angs
Weighted MAE Forces     0.0114 eV/angs
Weighted RMSE Stress    0.1341 GPa
Weighted MAE Stress     0.0880 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.92550e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.82081e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 4.10469e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.17144e+02 K
Routine computation of the volume
        - Value for state 1 : 3.48508e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 4.42581e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 4 for this state

Training new MLIP

Number of configurations for training: 5
Number of atomic environments for training: 160

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0202 eV/angs
Weighted MAE Forces     0.0126 eV/angs
Weighted RMSE Stress    0.1716 GPa
Weighted MAE Stress     0.1079 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 7.09998e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.36191e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.73807e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.86955e+02 K
Routine computation of the volume
        - Value for state 1 : 3.48911e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 1.78788e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 5 for this state

Training new MLIP

Number of configurations for training: 6
Number of atomic environments for training: 192

Using Uniform weighting
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0002 eV/at
Weighted RMSE Forces    0.0195 eV/angs
Weighted MAE Forces     0.0123 eV/angs
Weighted RMSE Stress    0.1810 GPa
Weighted MAE Stress     0.1267 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 6.04409e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 3.54180e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.50229e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.33003e+02 K
Routine computation of the volume
        - Value for state 1 : 3.43050e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : 2.17810e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 6 for this state

Training new MLIP

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

Using Uniform weighting
Weighted RMSE Energy    0.0002 eV/at
Weighted MAE Energy     0.0002 eV/at
Weighted RMSE Forces    0.0195 eV/angs
Weighted MAE Forces     0.0128 eV/angs
Weighted RMSE Stress    0.1851 GPa
Weighted MAE Stress     0.1353 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.21424e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.30238e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.91187e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.48825e+02 K
Routine computation of the volume
        - Value for state 1 : 3.49549e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -3.21325e-08 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 7 for this state

Training new MLIP

Number of configurations for training: 8
Number of atomic environments for training: 256

Using Uniform weighting
Weighted RMSE Energy    0.0002 eV/at
Weighted MAE Energy     0.0001 eV/at
Weighted RMSE Forces    0.0194 eV/angs
Weighted MAE Forces     0.0128 eV/angs
Weighted RMSE Stress    0.1997 GPa
Weighted MAE Stress     0.1459 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 7.00850e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 3.37559e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.63291e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.22068e+02 K
Routine computation of the volume
        - Value for state 1 : 3.51074e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -3.02819e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 8 for this state

Training new MLIP

Number of configurations for training: 9
Number of atomic environments for training: 288

Using Uniform weighting
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0002 eV/at
Weighted RMSE Forces    0.0194 eV/angs
Weighted MAE Forces     0.0131 eV/angs
Weighted RMSE Stress    0.1922 GPa
Weighted MAE Stress     0.1372 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 7.31496e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 3.91157e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.40339e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.57328e+02 K
Routine computation of the volume
        - Value for state 1 : 3.51779e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -6.11640e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

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

Equilibration step for state 1, configurations 9 for this state

Training new MLIP

Number of configurations for training: 10
Number of atomic environments for training: 320

Using Uniform weighting
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0002 eV/at
Weighted RMSE Forces    0.0192 eV/angs
Weighted MAE Forces     0.0132 eV/angs
Weighted RMSE Stress    0.1931 GPa
Weighted MAE Stress     0.1365 GPa

Running MLMD
 -> Starting from first atomic configuration
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 6.90249e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 3.64433e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.25816e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.39748e+02 K
Routine computation of the volume
        - Value for state 1 : 3.50794e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -4.96663e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 10

Production step for state 1, configurations 10 for this state

Training new MLIP

Number of configurations for training: 11
Number of atomic environments for training: 352

Using Uniform weighting
Weighted RMSE Energy    0.0003 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0190 eV/angs
Weighted MAE Forces     0.0132 eV/angs
Weighted RMSE Stress    0.1918 GPa
Weighted MAE Stress     0.1324 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.14422e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.34175e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.80246e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.85629e+02 K
Routine computation of the volume
        - Value for state 1 : 3.52346e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -7.28961e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 11

Production step for state 1, configurations 11 for this state

Training new MLIP

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

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0190 eV/angs
Weighted MAE Forces     0.0133 eV/angs
Weighted RMSE Stress    0.1914 GPa
Weighted MAE Stress     0.1286 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 9.51763e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.87913e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 4.63850e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.20981e+02 K
Routine computation of the volume
        - Value for state 1 : 3.63446e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -4.39279e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 12

Production step for state 1, configurations 12 for this state

Training new MLIP

Number of configurations for training: 13
Number of atomic environments for training: 416

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0206 eV/angs
Weighted MAE Forces     0.0147 eV/angs
Weighted RMSE Stress    0.2114 GPa
Weighted MAE Stress     0.1311 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.38517e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.59127e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.79391e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.02043e+02 K
Routine computation of the volume
        - Value for state 1 : 3.54475e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -1.74758e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 13

Production step for state 1, configurations 13 for this state

Training new MLIP

Number of configurations for training: 14
Number of atomic environments for training: 448

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0208 eV/angs
Weighted MAE Forces     0.0148 eV/angs
Weighted RMSE Stress    0.2111 GPa
Weighted MAE Stress     0.1286 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 1.04656e-01 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 5.90609e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 4.55948e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.88541e+02 K
Routine computation of the volume
        - Value for state 1 : 3.58442e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -2.43101e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 14

Production step for state 1, configurations 14 for this state

Training new MLIP

Number of configurations for training: 15
Number of atomic environments for training: 480

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0211 eV/angs
Weighted MAE Forces     0.0152 eV/angs
Weighted RMSE Stress    0.2046 GPa
Weighted MAE Stress     0.1284 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 9.23745e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.77713e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 4.46032e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.14271e+02 K
Routine computation of the volume
        - Value for state 1 : 3.59610e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -3.14392e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 15

Production step for state 1, configurations 15 for this state

Training new MLIP

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

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0217 eV/angs
Weighted MAE Forces     0.0158 eV/angs
Weighted RMSE Stress    0.2061 GPa
Weighted MAE Stress     0.1308 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.58132e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.80848e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.77284e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.16333e+02 K
Routine computation of the volume
        - Value for state 1 : 3.56108e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -2.05210e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 16

Production step for state 1, configurations 16 for this state

Training new MLIP

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

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0219 eV/angs
Weighted MAE Forces     0.0159 eV/angs
Weighted RMSE Stress    0.2028 GPa
Weighted MAE Stress     0.1281 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.84921e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.24236e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 4.60685e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 2.79090e+02 K
Routine computation of the volume
        - Value for state 1 : 3.52652e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -6.51746e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 17

Production step for state 1, configurations 17 for this state

Training new MLIP

Number of configurations for training: 18
Number of atomic environments for training: 576

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0221 eV/angs
Weighted MAE Forces     0.0161 eV/angs
Weighted RMSE Stress    0.2062 GPa
Weighted MAE Stress     0.1279 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 7.41702e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.58043e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 2.83659e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.01330e+02 K
Routine computation of the volume
        - Value for state 1 : 3.53478e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -1.63964e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 18

Production step for state 1, configurations 18 for this state

Training new MLIP

Number of configurations for training: 19
Number of atomic environments for training: 608

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0003 eV/at
Weighted RMSE Forces    0.0218 eV/angs
Weighted MAE Forces     0.0160 eV/angs
Weighted RMSE Stress    0.2037 GPa
Weighted MAE Stress     0.1256 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.66103e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.79717e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.86385e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.15589e+02 K
Routine computation of the volume
        - Value for state 1 : 3.54225e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -1.09127e-05 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 0.00000e+00

===============================================================================
Step 19

Production step for state 1, configurations 19 for this state

Training new MLIP

Number of configurations for training: 20
Number of atomic environments for training: 640

Using Uniform weighting
Weighted RMSE Energy    0.0004 eV/at
Weighted MAE Energy     0.0004 eV/at
Weighted RMSE Forces    0.0216 eV/angs
Weighted MAE Forces     0.0159 eV/angs
Weighted RMSE Stress    0.2110 GPa
Weighted MAE Stress     0.1273 GPa

Running MLMD
State 1/1 has been launched
Computing energy with the True potential
Routine computation of the total energy
        - Value for state 1 : 8.27002e-02 Ha
Routine computation of the kinetic energy
        - Value for state 1 : 4.93988e-02 Ha
Routine computation of the potential energy
        - Value for state 1 : 3.33014e-02 Ha
Routine computation of the temperature
        - Value for state 1 : 3.24977e+02 K
Routine computation of the volume
        - Value for state 1 : 3.52177e+03 Bohr^3
Routine computation of the pressure
        - Value for state 1 : -7.00638e-06 Ha/Bohr^3
Routine computation of the electronic entropy
        - Value for state 1 : 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 !

The simulations, computed with the reference potential, can be found in the Trajectory.traj file

[10]:
from ase.io import read
confs = read("Trajectory.traj", index=":")

And we can plot for example the energy along the trajectory

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

x = np.arange(len(confs))
energies = np.array([a.get_potential_energy() for a in confs])

fig = plt.figure(figsize=(20, 10), constrained_layout=True)
init_rcParams()
ax0 = fig.add_subplot()
ax0.set_xlabel("Iteration")
ax0.set_ylabel("Potential energy [meV]")
ax0.plot(x, energies)
plt.show()
../_images/tutorials_mlacs_tuto1_23_0.png