Example Usage

Codes can be downloaded from the examples folder.
Usage in lammps is based on commands of the form fix <label> <atom_tag> mlmod <xml_parameter_file>
.
Parameters
<label>
: name to give the instance of mlmod (multiple mlmod models can be used at the same time)<atom_tag>
: type of atoms the mlmod model will be applied.<xml_parameter_file>
: xml file specifying the mlmod model data.
For example, lines in a lammps script or in command calls are of the form:
fix ml_mobility1 all mlmod Main.mlmod_params
Parameter files <xml_parameter_file>
are of the form:
<?xml version="1.0" encoding="UTF-8"?>
<MLMOD>
<model_data type="dX_MF_ML1">
<M_ii_filename value="M_ii_oseen1.pt"/>
<M_ij_filename value="M_ij_oseen1.pt"/>
</model_data> </MLMOD>
The type
specifies the particular mlmod
mode for modeling interactions, dynamics, or quantities-of-interest.
Exporting a PyTorch machine learning model to a .pt
file is done using:
model = M_ii_Model(); # PyTorch ml model
x = torch.zeros((1,3));
traced_model = torch.jit.trace(model, (x));
torch_filename = 'M_ii_oseen1.pt';
traced_model.save(torch_filename);
For more details on generating the .pt
machine learning models
using PyTorch
and for setting up full mlmod simulations,
see the examples folder.
Below is a summary of the mlmod
methods available for interfacing the
machine learning approaches with simulations.
Name |
Tag / Mode |
Role |
Description |
---|---|---|---|
General ML Force-Law |
F_ML1 |
force |
General force law for groups of particles \(X=\{X_i\}_{i\in\mathcal{G}}\) based on a specified machine learning model, \(F(X,V,F,I_T,t)\). |
General ML Dynamics |
Dyn_ML1 |
dynamics |
General dynamics based on specified machine learning model, \([X^{n+1},V^{n+1}] = \Gamma[X^n,V^n]\). |
Quantity-of-Interest ML Methods |
QoI_ML1 |
quantity of interest |
For computing a Quantity-of-Interest (QoI) as defined by a specified machine learning model, \(A(X,V,F,I_T,t)\). Available for use in subsequent calculations within simulations. |
General Mobility ML Model |
dX_MF_ML1 |
dynamics |
Mobility based on specified machine learning model, \({dX}/{dt} = M(X)F\). |
Pairwise Mobility ML Model |
dX_MF_Q1_ML1_Pair |
dynamics |
Mobility with pairwise-structure and specified machine learning model, \({dX}/{dt} = M(X)F + F_{thm}\). |
Collective N-to-N Mobility ML Model |
dX_MF_Q1_ML1_N2N |
dynamics |
Mobility with general structure and specified machine learning model, \({dX}/{dt} = M(X)F + F_{thm}\). |
Mobility Test |
dX_MF |
dynamics |
For testing mobility calculations, \({dX}/{dt} = M(X)F\). |
Particle ML Force-Law |
F_X_ML1 |
force |
Force law for individual particles \(X_i\) based on specified machine learning model, \(F_i(X_i,V_i,F_i,{I_T}_i,t)\). |
Pairwise ML Force-Law |
F_Pair_ML1 |
force |
Force law for pairs of particles based on specified machine learning model, \(F_{ij}(X_{ij},V_{ij},\) \(F_{ij},{I_T}_{ij},t)\). |