LAMMPS-Molecular-Dynamics-Simulator/C2/Simulation-of-Lennard-Jones-Bulk-Liquid/English

From Script | Spoken-Tutorial
Revision as of 11:45, 9 July 2025 by Snehalathak (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Title of script: Simulation of Lennard-Jones Bulk Liquid


Author: Dr.Snehalatha Kaliappan, Prasad Baddi


Keywords: LAMMPS, Simulation, Lennard-Jones bulk liquid, input file, video tutorial

Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this tutorial on Simulation of Lennard-Jones Bulk Liquid.
Slide Number 2

Learning Objectives

In this tutorial, we will learn to,
  • Understand the structure of the input script to simulate Lennard-Jones bulk liquid.
Slide Number 3

Learning Objectives

In this tutorial, we will learn to,


  • Initialize, setup simulation box, create atoms, minimize energy and equilibration.
  • Run the simulation.
Slide Number 4

System Requirement

To record this tutorial, I am using,

Ubuntu Linux OS version 22.04

Latest stable version of LAMMPS (LAMMPS Stable Release 29 Aug 2024)

Slide Number 5

Prerequisite

To follow this tutorial learner must be familiar with,

basic computer operations on Linux OS.


Slide number 6

Code file

The following input file is required to practice this tutorial:


LJBulk.txt


This file is provided in the Code files link of this tutorial page.

Slide Number 7


LJ Bulk Liquid simulations

Here are some specific reasons for choosing the Lennard-jones simulations.

Simplicity and Computational Efficiency

Benchmarking and Model Testing

Risk-Free Exploration of Scenarios

Compatibility with Broader Systems


For detailed explanation please refer to the Additional Reading material provided along with this tutorial.

Open the input file LJBulk.txt in gedit texttext editor. Running simulations in LAMMPS require an input file.

Download the input file provided along with this tutorial and save it on your system.

Here I have opened the input file in a text editor.

Cursor on each section and highlight. The input script is divided into four sections: 


  1. Initialization
  2. System definition
  3. Simulation settings
  4. Running a simulation
Cursor on the input file. Now let us look at what needs to be defined in each section:
Cursor on Initialization section.

Line 3: units lj



Initialization

The units command sets the style of the units for the quantities specified in the input script, data file, and output.

Here we have specified as lj.

Line 4: dimension 3 The dimension command sets the dimension of the simulation.

Here we have 3, since we require the simulation in 3D.

You can set it as 2, if you require a 2D simulation.

Line 5: boundary p p p The boundary command sets the boundary conditions of the simulation box.

here, p refers periodic

Line 6: atom_style atomic The atom_style command defines necessary per-atom attributes for simulation models and data handling.
Cursor on System definition section.


Line 12: region box block 0 20 0 20 0 20 units box

region liquid block 1 19 1 19 1 10

create_atoms1 random 1754 12345 liquid


mass 1 1.0

System definition:


Here we define a geometric region of space in x, y and z direction.


We specified number 20 here.


This number can be small or big, depending on the requirement of the simulation box.


Line 13: It is on line 14create_box 1 box Defining simulation box

Here 1 indicates the number of atom types present in the system.


For example, if the system consists of 3 types of particles, then 1 should be replaced with 3 and so on.

Line 16: region liquid block 1 19 1 19 1 10 Defining a geometric region to place the liquid atoms.


Here, liquid is a group ID, the numbers are positioned low and high in X, Y and Z directions.


We have defined 1 as low and 19 as high.


Based on this number we have to calculate the number of type 1 atoms as defined in the next line.

Line 17: create_atoms1 random 1926 12345 liquid Creation of liquid atoms in the defined region “liquid”. 

Example: create_atoms 1 random 1926 12345 liquid


Here, 1926 is the number of type 1 atoms.


Please see the Additional Reading material for details of calculating this number.


12345 is the random number to put the type 1 particles randomly in the defined region liquid.

Line 18:It is on line 19 mass 1 1.0 Defining the mass of the particle.

Here, 1 and 1.0 represents type “1” particle and mass of the particle respectively

Line 24: pair_style lj/cut 2.5 Next in Simulation Settings:

cutoff calculates the pairwise distances within the mentioned cutoff.


Line 30: group liq type 1 Here we enter the numbers that describe how atom pairs interact.

Here, all type 1 particles are grouped with a group ID liq.

Line 34: minimize 1e-6 1e-6 10000 10000 Running a simulation:

Minimization of the system to remove the overlap between the particles.

These numbers indicate tolerance, force tolerance, max iteration, max evaluations.

Line 38: neighbor 0.3 bin

Line 39: neigh_modify every 1 delay 0 check yes page 100000 one 5000

Building of pairwise neighbor lists.

This command sets parameters that affect the building of pairwise neighbor lists.

Line 44: dump 1 liq atom 5 output.atom Storing the position of all the coordinates to the file.

Here 5 is the frequency of printing the output file and in the end gives the name for the output file.


Here we are naming it output.atom.

Line 46: thermo_style custom step etotal Logging the desired data during the simulation.

Here, other parameters can also be printed, and will be discussed in the upcoming tutorials.


Line 48: timestep 0.005

Line 49: thermo 5

The timestep command sets the timestep size for the simulation.

The thermo command computes and prints the desired thermodynamic information like:

temperature, energy, pressure at the mentioned interval of time.

Number 5 here indicates the frequency of printing output.

Line 53: fix 1 liq npt temp 0.8 0.8 100 iso 1 1 100 In LAMMPS, a fix is any operation that is applied to the system during timestepping or minimization

The npt command performs the time integration using equations of motion to generate positions and velocities for atoms.

In an npt ensemble:


the number of particles, pressure of the system and temperature of the system are held constant.

Line 55: run 10 Here 10 indicates timesteps_number.

The large number will make the simulation more clear to visualize .

The time taken to complete the simulation will also increase.


For the sake of simplicity we have indicated 10 timesteps

Cursor on the input file.

Close the text editor.

Now let me demonstrate how to run this input file.

Close the text editor.

Go to the folder where input file is located.

Open the folder and show the input file.

I have saved the input file in a folder in my home directory.

Navigate to the input file location.

Right click on the folder containing the input file.

From the context menu choose Open in Terminal option.

As LAMMPS is already installed in your computer.

Right click on the folder containing the input file.

From the context menu choose Open in Terminal option.

Cursor on the terminal. Alternatively you can open the terminal and navigate to the path leading to the input file.
At the prompt type “ lmp_serial -in Ljbulk.txt


Press enter

Type the following command at the prompt to run the input file.


lmp_serial -in LJbulk.txt

Windows users can open the command prompt, type the command and proceed as shown.

Press enter

Cursor on the terminal.


Open the folder containing the input file to show log.lammps and output.atom..

The output is seen on the terminal.

Two output files are generated, log.lammps and output.atom.

These files will be saved in the same folder where your input file is located.


Cursor on the folder. The analysis and visualization of the output file will be covered in the upcoming tutorial.
This brings us to the end of this tutorial.
Slide Number 8


Summary

Let's summarize.


Slide Number 9

Assignment

Edit the line in the System Definition section as follows

region liquid block 1 25 1 25 1 15


As an assignment,


Edit the line in the System Definition section as follows


Calculate the number of atoms and replace the number in the subsequent line.


Save and run the input file.


Slide Number 10

Thank you

Thank you

Contributors and Content Editors

Madhurig, Snehalathak