Skip to content

Commit 341501c

Browse files
committed
improved tutorial 4
1 parent 068f067 commit 341501c

2 files changed

Lines changed: 100 additions & 86 deletions

File tree

journal-article.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,3 +724,14 @@ @article{ewald1921berechnung
724724
year={1921},
725725
publisher={Wiley Online Library}
726726
}
727+
728+
@article{kadaoluwa2021systematic,
729+
title={Systematic comparison of the structural and dynamic properties of commonly used water models for molecular dynamics simulations},
730+
author={Kadaoluwa Pathirannahalage, Sachini P and Meftahi, Nastaran and Elbourne, Aaron and Weiss, Alessia CG and McConville, Chris F and Padua, Agilio and Winkler, David A and Costa Gomes, Margarida and Greaves, Tamar L and Le, Tu C and others},
731+
journal={Journal of Chemical Information and Modeling},
732+
volume={61},
733+
number={9},
734+
pages={4521--4536},
735+
year={2021},
736+
publisher={ACS Publications}
737+
}

lammps-tutorials.tex

Lines changed: 89 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ \subsubsection{Preparing the water reservoir}
17981798
\end{lstlisting}
17991799
When LAMMPS fails to create the desired number of molecules, a WARNING appears.
18001800
The molecule template called \href{\filepath tutorial3/water.mol}{\dwlcmd{water.mol}}
1801-
must be downloaded and saved next to \lmpcmd{water.lmp}. This template contains
1801+
must be downloaded and saved next to \flecmd{water.lmp}. This template contains
18021802
the necessary structural information of a water molecule, such as the number of
18031803
atoms, or the IDs of the atoms that are connected by bonds and angles.
18041804

@@ -1880,8 +1880,10 @@ \subsubsection{Preparing the water reservoir}
18801880

18811881
\begin{note}
18821882
The binary file created by the \lmpcmdnote{write\_restart} command contains the
1883-
complete state of the simulation, including atomic positions, velocities, and box dimensions (similar to \lmpcmdnote{write\_data}), but also the groups,
1884-
the compute, or the \lmpcmdnote{atom\_style}. Use the \guicmd{Inspect Restart} option of the LAMMPS-GUI to vizualize the content saved in \flecmd{water.restart}.
1883+
complete state of the simulation, including atomic positions, velocities, and
1884+
box dimensions (similar to \lmpcmdnote{write\_data}), but also the groups,
1885+
the compute, or the \lmpcmdnote{atom\_style}. Use the \guicmd{Inspect Restart}
1886+
option of the LAMMPS-GUI to vizualize the content saved in \flecmd{water.restart}.
18851887
\end{note}
18861888

18871889
\begin{figure}
@@ -1910,14 +1912,14 @@ \subsubsection{Solvating the PEG in water}
19101912
\end{figure}
19111913

19121914
Open the file named \flecmd{merge.lmp} that was downloaded
1913-
alongside \lmpcmd{water.lmp} during the tutorial setup. It only contain one line:
1915+
alongside \flecmd{water.lmp} during the tutorial setup. It only contain one line:
19141916
\begin{lstlisting}
19151917
read_restart water.restart
19161918
\end{lstlisting}
1917-
Most of the commands that were initially present in \lmpcmd{water.lmp}, such as
1919+
Most of the commands that were initially present in \flecmd{water.lmp}, such as
19181920
the \lmpcmd{units} of the \lmpcmd{atom\_style} commands do not need to be repeated,
19191921
as they were saved within the \flecmd{.restart} file. There is also no need to
1920-
re-include the parameters from the \lmpcmd{.inc} file. The \lmpcmd{kspace\_style}
1922+
re-include the parameters from the \flecmd{.inc} file. The \lmpcmd{kspace\_style}
19211923
command, however, is not saved by the \lmpcmd{write\_restart} command and must be
19221924
repeated. Since Ewald summation is not the most efficient choice for such dense
19231925
system, let us use PPPM (for particle-particle particle-mesh) for the rest
@@ -2123,152 +2125,151 @@ \subsection{Tutorial 4: Nanosheared electrolyte}
21232125
\centering
21242126
\includegraphics[width=0.55\linewidth]{NANOSHEAR}
21252127
\caption{The electrolyte confined in a nanometer slit pore as simulated during
2126-
\hyperref[sheared-confined-label]{Tutorial 4}. $\text{Na}^+$ ions are represented
2128+
\hyperref[sheared-confined-label]{Tutorial 4}. $\text{Na}^+$ ions are represented
21272129
as purple spheres, $\text{Cl}^-$ ions as cyan spheres, water molecules are colored
2128-
in red and white, and the walls are colored in gray. The arrows indicate the
2130+
in red and white, and the walls are colored in gray. The arrows indicate the
21292131
imposed lateral motion of the walls.}
21302132
\label{fig:NANOSHEAR}
21312133
\end{figure}
21322134

21332135
\noindent The objective of this tutorial is to simulate an electrolyte
2134-
nanoconfined and sheared by two walls (Fig.\,\ref{fig:NANOSHEAR}). The density
2136+
nanoconfined and sheared between two walls (Fig.\,\ref{fig:NANOSHEAR}). The density
21352137
and velocity profiles of the fluid in the direction normal to the walls are
21362138
extracted to highlight the effect of confining a fluid on its local properties.
2137-
This tutorial illustrates some key aspects of combining a fluid and a solid in
2138-
the same simulation. A major difference from the previous tutorial,
2139+
This tutorial demonstrates key concepts of combining a fluid and a solid in
2140+
the same simulation. A major difference from the previous tutorial,
21392141
\hyperref[all-atoms-label]{Polymer in water}, is that here a rigid four-point
2140-
water model named TIP4P is used \cite{abascal2005general}. TIP4P is one of
2141-
the most common water models due to its high accuracy.
2142+
water model named TIP4P/2005 is used \cite{abascal2005general}.
2143+
2144+
\begin{note}
2145+
Four-point water models such as TIP4P/2005 are widely used as they offer a
2146+
good compromise between accuracy and computational cost \cite{kadaoluwa2021systematic}.
2147+
\end{note}
21422148

21432149
\subsubsection{System preparation}
2144-
The fluid and walls must first be generated and then equilibrated at a reasonable
2145-
temperature and pressure.
2150+
2151+
The fluid and walls must first be generated, followed by equilibration at the
2152+
desired temperature and pressure.
21462153

21472154
\paragraph{System generation}
2148-
Create a new folder called \flrcmd{systemcreation/}. Within
2149-
\flrcmd{systemcreation/}, open a blank file called \flecmd{input.lmp}, and
2150-
copy the following lines into it:
2155+
2156+
To set up this tutorial, select \guicmd{Start Tutorial 4} from the
2157+
\guicmd{Tutorials} menu of LAMMPS--GUI and follow the instructions.
2158+
The editor should display the following content corresponding to \flecmd{create.lmp}:
21512159
\begin{lstlisting}
21522160
boundary p p f
21532161
units real
21542162
atom_style full
21552163
bond_style harmonic
21562164
angle_style harmonic
2157-
pair_style lj/cut/tip4p/long O H O-H H-O-H &
2158-
0.1546 12.0
2159-
kspace_style pppm/tip4p 1.0e-4
2165+
pair_style lj/cut/tip4p/long O H O-H H-O-H 0.1546 12.0
2166+
kspace_style pppm/tip4p 1.0e-5
21602167
kspace_modify slab 3.0
21612168
\end{lstlisting}
2162-
21632169
These lines are used to define the most basic parameters, including the
2164-
\textit{atom}, \textit{bond}, and \textit{angle} styles, as well as interaction
2165-
potential. Here, \textit{lj/cut/tip4p/long} imposes a Lennard-Jones potential with
2170+
\lmpcmd{atom}, \lmpcmd{bond}, and \lmpcmd{angle} styles, as well as interaction
2171+
potential. Here, \lmpcmd{lj/cut/tip4p/long} imposes a Lennard-Jones potential with
21662172
a cut-off at $12\,\text{$\text{\AA{}}$}$ and a long-range Coulomb potential.
21672173

2168-
% S.G. To fix, this was removed from tutorial 3 : The \textit{pppm} style refers to particle-particle particle-mesh . \cite{luty1996calculating}
21692174
So far, the commands are relatively similar to those in the previous tutorial,
21702175
\hyperref[all-atoms-label]{Polymer in water}, with two major differences: the use
2171-
of \textit{lj/cut/tip4p/long} instead of \textit{lj/cut/coul/long}, and \textit{pppm/tip4p}
2172-
instead of \textit{pppm}. When using \textit{lj/cut/tip4p/long} and \textit{pppm/tip4p},
2176+
of \lmpcmd{lj/cut/tip4p/long} instead of \lmpcmd{lj/cut/coul/long}, and \lmpcmd{pppm/tip4p}
2177+
instead of \lmpcmd{pppm}. When using \lmpcmd{lj/cut/tip4p/long} and \lmpcmd{pppm/tip4p},
21732178
the interactions resemble the conventional Lennard-Jones and Coulomb interactions,
2174-
except that they are specifically designed for the four-point water model. Therefore,
2175-
LAMMPS automatically creates a four-point water molecule using atoms of type O as
2176-
oxygen and atoms of type H as hydrogen. The fourth massless atom (\textit{M}) of the
2179+
except that they are specifically designed for the four-point water model. As a result,
2180+
LAMMPS automatically creates a four-point water molecule, assigning type O
2181+
atoms as oxygen and type H atoms as hydrogen. The fourth massless atom (M) of the
21772182
TIP4P water molecule does not have to be defined explicitly, and the value of
2178-
$0.1546\,\text{$\text{\AA{}}$}$ corresponds to the \textit{O-M} distance of the
2179-
TIP4P-2005 water model \cite{abascal2005general}. All the other atoms in the simulation
2180-
are treated normally with long-range Coulomb interactions. Another novelty, here, is
2181-
the use of \textit{kspace\_modify slab 3.0} that is combined with the non-periodic
2182-
boundaries along the $z$ coordinate: \textit{boundary p p f}. With the \textit{slab}
2183+
$0.1546\,\text{$\text{\AA{}}$}$ corresponds to the O-M distance of the
2184+
TIP4P-2005 water model \cite{abascal2005general}. All other atoms in the simulation
2185+
are treated as usual, with long-range Coulomb interactions. Another novelty, here, is
2186+
the use of \lmpcmd{kspace\_modify slab 3.0} that is combined with the non-periodic
2187+
boundaries along the $z$ coordinate: \lmpcmd{boundary p p f}. With the \lmpcmd{slab}
21832188
option, the system is treated as periodical along $z$, but with an empty volume inserted
21842189
between the periodic images of the slab, and the interactions along $z$ effectively turned off.
21852190

2186-
Let us create the box by adding the following lines to \flecmd{input.lmp}:
2187-
2191+
Let us create the box and the label maps by adding the following lines to \flecmd{create.lmp}:
21882192
\begin{lstlisting}
21892193
lattice fcc 4.04
21902194
region box block -3 3 -3 3 -5 5
2191-
create_box 5 box &
2192-
bond/types 1 &
2193-
angle/types 1 &
2194-
extra/bond/per/atom 2 &
2195-
extra/angle/per/atom 1 &
2196-
extra/special/per/atom 2
2195+
create_box 5 box bond/types 1 angle/types 1 &
2196+
extra/bond/per/atom 2 extra/angle/per/atom 1 &
2197+
extra/special/per/atom 2
21972198
labelmap atom 1 O 2 H 3 Na+ 4 Cl- 5 WALL
21982199
labelmap bond 1 O-H
21992200
labelmap angle 1 H-O-H
22002201
\end{lstlisting}
2201-
The \textit{lattice} command defines the unit cell. Here, the face-centered cubic (fcc) lattice
2202+
The \lmpcmd{lattice} command defines the unit cell. Here, the face-centered cubic (fcc) lattice
22022203
with a scale factor of 4.04 has been chosen for the future positioning of the atoms
2203-
of the walls. The \textit{region} command defines a geometric region of space. By choosing
2204-
\textit{xlo=-3} and \textit{xhi=3}, and because we have previously chosen a lattice with a scale
2204+
of the walls. The \lmpcmd{region} command defines a geometric region of space. By choosing
2205+
$\text{xlo}=-3$ and $\text{xlo}=3$, and because we have previously chosen a lattice with a scale
22052206
factor of 4.04, the region box extends from $-12.12~\text{\AA{}}$ to $12.12~\text{\AA{}}$
2206-
along the $x$ direction. The \textit{create\_box} command creates a simulation box with
2207+
along the $x$ direction. The \lmpcmd{create\_box} command creates a simulation box with
22072208
5 types of atoms: the oxygen and hydrogen of the water molecules, the two ions ($\text{Na}^+$,
2208-
$\text{Cl}^-$), and the atom of the walls. The \textit{create\_box} command extends over 6
2209-
lines thanks to the $\&$ character. The second and third lines are used to indicate that the
2209+
$\text{Cl}^-$), and the atom of the walls. The \lmpcmd{create\_box} command extends over 6
2210+
lines thanks to the $\&$ character. The second and third lines are used to indicate that the
22102211
simulation contains 1 type of bond and 1 type of angle (both required by the water molecule).
2211-
The parameters for these bond and angle constraints will be given later. The three last
2212-
lines are for memory allocation. The \textit{labelmap} command assigns alphanumeric type labels
2212+
The parameters for these bond and angle constraints will be given later. The three last
2213+
lines are for memory allocation. The \lmpcmd{labelmap} command assigns alphanumeric type labels
22132214
to each numeric atom type, bond type, and angle type.
22142215

2215-
Now, we can add atoms to the system. First, let us create two sub-regions corresponding
2216+
Now, we can add atoms to the system. First, let us create two sub-regions corresponding
22162217
respectively to the two solid walls, and create a larger region from the union of the
2217-
two regions. Then, let us create atoms of type WALL within the two regions. Add the
2218-
following lines to \flecmd{input.lmp}:
2218+
two regions. Then, let us create atoms of type WALL within the two regions. Add the
2219+
following lines to \flecmd{create.lmp}:
22192220
\begin{lstlisting}
22202221
region rbotwall block -3 3 -3 3 -4 -3
22212222
region rtopwall block -3 3 -3 3 3 4
22222223
region rwall union 2 rbotwall rtopwall
22232224
create_atoms WALL region rwall
22242225
\end{lstlisting}
22252226
Atoms will be placed in the positions of the previously defined lattice, thus
2226-
forming fcc solids. To add the water molecules, first download the molecule
2227-
template called \href{\filepath tutorial4/RigidH2O.txt}{\dwlcmd{RigidH2O.txt}}
2228-
and place it within \flrcmd{systemcreation/}. The template contains all the
2227+
forming fcc solids.
2228+
2229+
To add the water molecules, the molecule
2230+
template called \href{\filepath water.mol}{\dwlcmd{water.mol}}
2231+
must be located next to \flecmd{}. The template contains all the
22292232
necessary information concerning the water molecule, such as atom positions,
2230-
bonds, and angles. Add the following lines to \flecmd{input.lmp}:
2233+
bonds, and angles. Add the following lines to \flecmd{create.lmp}:
22312234
\begin{lstlisting}
22322235
region rliquid block INF INF INF INF -2 2
2233-
molecule h2omol RigidH2O.txt
2236+
molecule h2omol water.mol
22342237
create_atoms 0 region rliquid mol h2omol 482793
22352238
\end{lstlisting}
2236-
Within the last three lines, a \textit{region} named \textit{rliquid} is
2237-
created based on the last defined lattice, \textit{fcc 4.04}. \textit{rliquid}
2238-
will be used for depositing the water molecules. The \textit{molecule} command
2239-
opens up the molecule template called \flecmd{RigidH2O.txt}, and names the
2240-
associated molecule \textit{h2omol}. The new molecules are placed on the
2241-
\textit{fcc 4.04} lattice by the \textit{create\_atoms} command. The first
2242-
parameter is 0, meaning that the atom IDs from the \flecmd{RigidH2O.txt} file
2243-
will be used. The number \textit{482793} is a seed that is required by LAMMPS,
2239+
Within the last three lines, a \lmpcmd{region} named \lmpcmd{rliquid} is
2240+
created based on the last defined lattice, \lmpcmd{fcc 4.04}. \lmpcmd{rliquid}
2241+
will be used for depositing the water molecules. The \lmpcmd{molecule} command
2242+
opens up the molecule template called \flecmd{water.mol}, and names the
2243+
associated molecule \lmpcmd{h2omol}. The new molecules are placed on the
2244+
\lmpcmd{fcc 4.04} lattice by the \lmpcmd{create\_atoms} command. The first
2245+
parameter is 0, meaning that the atom IDs from the \flecmd{water.mol} file
2246+
will be used. The number \lmpcmd{482793} is a seed that is required by LAMMPS,
22442247
it can be any positive integer.
22452248

22462249
Finally, let us create 30 ions (15 $\text{Na}^+$ and 15 $\text{Cl}^-$) in between
2247-
the water molecules, by adding the following commands to \flecmd{input.lmp}:
2250+
the water molecules, by adding the following commands to \flecmd{create.lmp}:
22482251
\begin{lstlisting}
2249-
create_atoms Na+ random 15 52802 rliquid &
2250-
overlap 0.3 maxtry 500
2251-
create_atoms Cl- random 15 90182 rliquid &
2252-
overlap 0.3 maxtry 500
2252+
create_atoms Na+ random 15 5802 rliquid overlap 0.3 maxtry 500
2253+
create_atoms Cl- random 15 9012 rliquid overlap 0.3 maxtry 500
22532254
set type Na+ charge 1
22542255
set type Cl- charge -1
22552256
\end{lstlisting}
2256-
Each \textit{create\_atoms} command will add 15 ions at random positions
2257-
within the \textit{rliquid} region, ensuring that there is no \textit{overlap}
2257+
Each \lmpcmd{create\_atoms} command will add 15 ions at random positions
2258+
within the \lmpcmd{rliquid} region, ensuring that there is no \lmpcmd{overlap}
22582259
with existing molecules. Feel free to increase or decrease the salt concentration
22592260
by changing the number of desired ions. To keep the system charge neutral,
22602261
always insert the same number of $\text{Na}^+$ and $\text{Cl}^-$, unless there
22612262
are other charges in the system. The charges of the newly added ions are specified
2262-
by the two \textit{set} commands.
2263+
by the two \lmpcmd{set} commands.
22632264

22642265
Before starting the simulation, we still need to define the parameters of the
22652266
simulation: the mass of the 5 atom types (O, H, $\text{Na}^+$, $\text{Cl}^-$,
22662267
and wall), the pairwise interaction parameters (here, the parameters for the
22672268
Lennard-Jones potential), and the bond and angle parameters. Copy the following
2268-
lines into \flecmd{input.lmp}:
2269+
lines into \flecmd{create.lmp}:
22692270
\begin{lstlisting}
2270-
include ../PARM.lmp
2271-
include ../GROUP.lmp
2271+
include parameters.inc
2272+
include groups.inc
22722273
\end{lstlisting}
22732274
Create a new text file called \flecmd{PARM.lmp} next to the \flrcmd{systemcreation/}
22742275
folder. Copy the following lines into \flecmd{PARM.lmp}:
@@ -2285,6 +2286,9 @@ \subsubsection{System preparation}
22852286
pair_coeff Cl- Cl- 0.1500 4.04470
22862287
pair_coeff WALL WALL 11.697 2.574
22872288
pair_coeff O WALL 0.4 2.86645
2289+
2290+
bond_coeff O-H 0 0.9572
2291+
angle_coeff H-O-H 0 104.52
22882292
\end{lstlisting}
22892293
Each \textit{mass} command assigns a mass in grams/mole to an atom type.
22902294
Each \textit{pair\_coeff} assigns respectively the depth of the LJ potential
@@ -2384,7 +2388,7 @@ \subsubsection{System preparation}
23842388
angle_style harmonic
23852389
pair_style lj/cut/tip4p/long O H O-H H-O-H &
23862390
0.1546 12.0
2387-
kspace_style pppm/tip4p 1.0e-4
2391+
kspace_style pppm/tip4p 1.0e-5
23882392
kspace_modify slab 3.0
23892393

23902394
read_data ../systemcreation/system.data
@@ -2402,7 +2406,7 @@ \subsubsection{System preparation}
24022406
\begin{lstlisting}
24032407
fix mynve fluid nve/limit 0.1
24042408
fix myber fluid temp/berendsen 1 1 100
2405-
fix myshk H2O shake 1.0e-4 200 0 b O-H a H-O-H
2409+
fix myshk H2O shake 1.0e-5 200 0 b O-H a H-O-H
24062410
timestep 0.5
24072411
\end{lstlisting}
24082412
Just like \textit{fix nve}, the \textit{fix nve/limit} command performs constant
@@ -2483,7 +2487,7 @@ \subsubsection{System preparation}
24832487
angle_style harmonic
24842488
pair_style lj/cut/tip4p/long O H O-H H-O-H &
24852489
0.1546 12.0
2486-
kspace_style pppm/tip4p 1.0e-4
2490+
kspace_style pppm/tip4p 1.0e-5
24872491
kspace_modify slab 3.0
24882492

24892493
read_data ../minimization/system.data
@@ -2493,7 +2497,7 @@ \subsubsection{System preparation}
24932497

24942498
fix mynve all nve
24952499
fix myber all temp/berendsen 300 300 100
2496-
fix myshk H2O shake 1.0e-4 200 0 b O-H a H-O-H
2500+
fix myshk H2O shake 1.0e-5 200 0 b O-H a H-O-H
24972501
fix myrct all recenter NULL NULL 0
24982502
timestep 1.0
24992503
\end{lstlisting}
@@ -2555,9 +2559,8 @@ \subsubsection{Imposed shearing}
25552559
atom_style full
25562560
bond_style harmonic
25572561
angle_style harmonic
2558-
pair_style lj/cut/tip4p/long O H O-H H-O-H &
2559-
0.1546 12.0
2560-
kspace_style pppm/tip4p 1.0e-4
2562+
pair_style lj/cut/tip4p/long O H O-H H-O-H 0.1546 12.0
2563+
kspace_style pppm/tip4p 1.0e-5
25612564
kspace_modify slab 3.0
25622565
\end{lstlisting}
25632566
Let us import the previously equilibrated data, include the parameter and group
@@ -2575,7 +2578,7 @@ \subsubsection{Imposed shearing}
25752578
compute Twall wall temp/partial 0 1 1
25762579
fix myber2 wall temp/berendsen 300 300 100
25772580
fix_modify myber2 temp Twall
2578-
fix myshk H2O shake 1.0e-4 200 0 b O-H a H-O-H
2581+
fix myshk H2O shake 1.0e-5 200 0 b O-H a H-O-H
25792582
fix myrct all recenter NULL NULL 0
25802583
\end{lstlisting}
25812584
One difference with the previous input is that, here, two thermostats are used,

0 commit comments

Comments
 (0)