Skip to main content
Version: Next

LINEAR Tutorial

LINEAR Tutorial

This tutorial uses the MatPL [source root/example/SiC] example to demonstrate training, testing, LAMMPS simulation, and other operations for a Linear model. The example directory is organized as follows.

SiC
├── 1_300_MOVEMENT
├── 2_300_MOVEMENT
├── atom.config
├── linear_test.json
├── linear_train.json
├── train.job
├── linear_lmps
└── MD
└── MOVEMENT
  • linear_train.json is the input file for training the Linear force field.
  • linear_test.json is the input file for testing the Linear force field.
  • train.job is an example Slurm job script for training.
  • The linear_lmps directory contains a LAMMPS MD example for the Linear force field:
    • Force-field file: forcefield.ff
    • Initial structure: lmp.config
    • Control file: in.lammps
    • Example Slurm script: runcpu.job

train

Run the following command in the SiC directory to start training: Example etot.input input file:

MatPL train linear_train.json
# Alternatively, update the environment variables and submit the training job through Slurm: sbatch train.job

Input file description

The contents of linear_train.json are shown below. For descriptions of the Linear parameters, see the Parameter Reference:

{   
"train_data":["./1_300_MOVEMENT", "./2_300_MOVEMENT"],
"valid_data":["./1_300_MOVEMENT"],
"format":"pwmat/movement",
"model_type": "Linear",
"atom_type":[14, 6]
}

After the program runs, it creates a forcefield directory in the working directory:

forcefield
├── forcefield.ff
├── fread_dfeat
│ ├── energyL*
│ ├── forceL*
│ ├── linear*
│ ├── weight_feat.*
│ ├── energyL*
│ ├── ...
│ ├── feat*
│ ├── weight_feat.*
│ └── linear_fitB.ntype
├── input
│ └── *feature.in
└── (output)
└── grid* # Used for features 1 and 2

test

MatPL test linear_test.json

The contents of test.json are shown below. For parameter descriptions, see the Parameter Reference.

{   
"test_movement_file":["./MD/MOVEMENT"],
"format": "pwmat/movement",
"model_type": "Linear",
"atom_type":[14, 6]
}

Note that the MOVEMENT file must be placed in a directory named MD; otherwise, it cannot be detected. After testing, the test_result force-field directory contains the following files:

lammps MD

For installation and usage of the LAMMPS interface for Linear models, see lammps-fortran.

Use the trained *.ff force-field file for the LAMMPS simulation. Add the following settings to the LAMMPS input file:

pair_style      matpl
pair_coeff * * 1 1 forcefield.ff 14 6

The first 1 selects a force field generated by the Linear model, and the second 1 specifies that one force-field file is read. forcefield.ff is the force-field file generated by MatPL, while 14 and 6 are the atomic numbers of Si and C, respectively.