Skip to content

Commit f5b7d4c

Browse files
committed
started refining tutorial 3 tex
1 parent 199984c commit f5b7d4c

4 files changed

Lines changed: 82 additions & 58 deletions

File tree

files/tutorial3/.manifest

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
peg.mol
88
water.mol
99
parameters.inc
10+
water.lmp
11+
merge.lmp
12+
pull.lmp
1013

1114
# 2) solution files
1215
# only downloaded on request

files/tutorial3/water.lmp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
units real
3+
atom_style full
4+
bond_style harmonic
5+
angle_style harmonic
6+
dihedral_style harmonic
7+
pair_style lj/cut/coul/long 10
8+
kspace_style ewald 1e-5
9+
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 1.0 angle yes

journal-article.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,3 +713,14 @@ @article{gissinger2024molecular
713713
year={2024},
714714
publisher={Elsevier}
715715
}
716+
717+
@article{ewald1921berechnung,
718+
title={Die Berechnung optischer und elektrostatischer Gitterpotentiale},
719+
author={Ewald, Paul P},
720+
journal={Annalen der physik},
721+
volume={369},
722+
number={3},
723+
pages={253--287},
724+
year={1921},
725+
publisher={Wiley Online Library}
726+
}

lammps-tutorials.tex

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,39 +1710,40 @@ \subsubsection{Preparing the water reservoir}
17101710

17111711
In this tutorial, the water reservoir is first prepared in the absence of the polymer.
17121712
A rectangular box of water is created and equilibrated at ambient temperature and
1713-
ambient pressure. The SPC/Fw water model is used \cite{wu2006flexible}, which is
1713+
pressure. The SPC/Fw water model is used \cite{wu2006flexible}, which is
17141714
a flexible variant of the rigid SPC (simple point charge) model \cite{berendsen1981interaction}.
1715-
Create a folder called \flrcmd{pureH2O/}. Inside this folder, create an empty text
1716-
file called \flecmd{input.lmp}. Copy the following lines into it:
1715+
To set up this tutorial, select \guicmd{Start Tutorial 3} from the
1716+
\guicmd{Tutorials} menu of LAMMPS--GUI and follow the instructions.
1717+
The editor should display the following content corresponding to \flecmd{water.lmp}:
17171718
\begin{lstlisting}
1718-
units real
1719-
atom_style full
1720-
bond_style harmonic
1721-
angle_style harmonic
1722-
dihedral_style harmonic
1723-
pair_style lj/cut/coul/long 10
1724-
kspace_style pppm 1e-5
1725-
special_bonds lj 0.0 0.0 0.5 &
1726-
coul 0.0 0.0 1.0 angle yes
1727-
\end{lstlisting}
1728-
With the unit style \textit{real}, masses are in grams per mole, distances in
1729-
Ångströms, time in femtoseconds, and energies in kcal/mole. With the \textit{atom\_style full}, each atom is a dot with a mass and a charge that can be linked by bonds, angles, dihedrals, and/or impropers. The \textit{bond\_style},
1730-
\textit{angle\_style}, and \textit{dihedral\_style} commands define the potentials
1731-
for the bonds, angles, and dihedrals used in the simulation, here \textit{harmonic}.
1732-
Finally, the \textit{special\_bonds} command, which was already seen in
1719+
units real
1720+
atom_style full
1721+
bond_style harmonic
1722+
angle_style harmonic
1723+
dihedral_style harmonic
1724+
pair_style lj/cut/coul/long 10
1725+
kspace_style ewald 1e-5
1726+
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 1.0 angle yes
1727+
\end{lstlisting}
1728+
With the unit style \lmpcmd{real}, masses are in grams per mole, distances in
1729+
Ångströms, time in femtoseconds, and energies in kcal/mole. With the \lmpcmd{atom\_style full},
1730+
each atom is a dot with a mass and a charge that can be linked by bonds, angles,
1731+
dihedrals, and/or impropers. The \lmpcmd{bond\_style},
1732+
\lmpcmd{angle\_style}, and \lmpcmd{dihedral\_style} commands define the potentials
1733+
for the bonds, angles, and dihedrals used in the simulation, here \lmpcmd{harmonic}.
1734+
With the \lmpcmd{pair\_style} named \lmpcmd{lj/cut/coul/long}, atoms interact through
1735+
both a Lennard-Jones (LJ) potential and Coulomb interactions. The value of $10\,\text{\AA{}}$ is the cutoff,
1736+
and the \lmpcmd{ewald} command defines the long-range solver for the Coulomb
1737+
interactions \cite{ewald1921berechnung}. Finally, the \lmpcmd{special\_bonds} command, which was already seen in
17331738
\hyperref[carbon-nanotube-label]{tutorial 2}, sets the LJ and Coulomb weighting
1734-
factors for the interaction between neighboring atoms. With the \textit{pair\_style}
1735-
named \textit{lj/cut/coul/long}, atoms interact through both a Lennard-Jones (LJ)
1736-
potential and Coulomb interactions. The value of $10\,\text{\AA{}}$ is the cutoff.
1737-
Finally, the \textit{kspace} command defines the long-range solver for the Coulomb
1738-
interactions. The \textit{pppm} style refers to particle-particle particle-mesh \cite{luty1996calculating}.
1739+
factors for the interaction between neighboring atoms.
17391740

1740-
Then, let us create a 3D simulation box of dimensions $9 \times 3 \times 3 \; \text{nm}^3$,
1741+
Let us create a 3D simulation box of dimensions $6 \times 3 \times 3 \; \text{nm}^3$,
17411742
and make space for 8 atom types (2 for the water, 6 for the polymer), 7 bond types
17421743
(1 for the water, 6 for the polymer), 8 angle types (1 for the water, 7 for the polymer),
1743-
and 4 dihedral types (only for the polymer). Copy the following lines into \flecmd{input.lmp}:
1744+
and 4 dihedral types (only for the polymer). Copy the following lines into \flecmd{water.lmp}:
17441745
\begin{lstlisting}
1745-
region box block -45 45 -15 15 -15 15
1746+
region box block -30 30 -15 15 -15 15
17461747
create_box 8 box &
17471748
bond/types 7 &
17481749
angle/types 8 &
@@ -1752,51 +1753,50 @@ \subsubsection{Preparing the water reservoir}
17521753
extra/dihedral/per/atom 10 &
17531754
extra/special/per/atom 14
17541755
\end{lstlisting}
1755-
The \textit{extra/x/per/atom} commands are here for
1756-
memory allocation. We will use a file named \flecmd{PARM.lmp} that contains
1756+
The \lmpcmd{extra/x/per/atom} commands are here for
1757+
memory allocation. We will use a file named
1758+
\href{\filepath tutorial3/parameters.inc}{\dwlcmd{parameters.inc}} that contains
17571759
all the parameters (masses, interaction energies, bond equilibrium
1758-
distances, etc). In \flecmd{input.lmp}, add the following line:
1760+
distances, etc). In \flecmd{water.lmp}, add the following line:
17591761
\begin{lstlisting}
1760-
include ../PARM.lmp
1762+
include parameters.inc
17611763
\end{lstlisting}
17621764

1763-
Download and save the
1764-
\href{\filepath tutorial3/PARM.lmp}{\dwlcmd{PARM.lmp}}
1765-
file next to the \textit{pureH2O/} folder. This example uses type labels, which
1766-
are strings that map to each of the numeric atom types, bond types, angles types,
1767-
etc. in the simulation. Type labels can be any string defined by the user, and we
1768-
will use the atom types from the GROMOS 54A7 force field. In this example, the atom
1769-
types are defined in \flecmd{PARM.lmp}, within which the \textit{mass}
1770-
and \textit{pair\_coeff} of atoms of types OW and HW are for water and the remaining
1771-
atom types are for the polymer molecule. Similarly, the \textit{bond\_coeff OW-HW}
1772-
and \textit{angle\_coeff HW-OW-HW} are for water, while all the other parameters
1773-
are for the polymer.
1765+
\begin{note}
1766+
This tutorial uses type labels \cite{typelabel_paper} to map each of the
1767+
numeric atom types with a string (see the \flecmd{parameters.inc} file):
1768+
\begin{lstlisting}
1769+
labelmap atom 1 OE 2 C 3 HC 4 H 5 CPos 6 OAlc 7 OW 8 HW
1770+
\end{lstlisting}
1771+
Therefore, the oxygen and hydrogen atoms of water (respectively types 7 and 8)
1772+
can be referred to as `OW' and `HW', respectively. Similar maps are used for
1773+
the bond types, angle types, and dihedral types.
1774+
\end{note}
17741775

17751776
Let us create water molecules. To do so, let us import a molecule template called
1776-
\flecmd{H2O-SPCFw.mol} and then randomly create 1050 molecules. Add the following
1777-
lines into \flecmd{input.lmp}:
1777+
\flecmd{water.mol} and then randomly create 700 molecules. Add the following
1778+
lines into \flecmd{water.lmp}:
17781779
\begin{lstlisting}
1779-
molecule h2omol H2O-SPCFw.mol
1780-
create_atoms 0 random 1050 87910 NULL mol &
1781-
h2omol 454756 overlap 1.0 maxtry 50
1780+
molecule h2omol water.mol
1781+
create_atoms 0 random 700 87910 NULL mol h2omol 454756 &
1782+
overlap 1.0 maxtry 50
17821783
\end{lstlisting}
1783-
The \textit{overlap 1} option of the \textit{create\_atoms} command ensures
1784+
The \lmpcmd{overlap 1.0} option of the \lmpcmd{create\_atoms} command ensures
17841785
that no atoms are placed exactly in the same position, as this would cause the
1785-
simulation to crash. The \textit{maxtry 50} asks LAMMPS to try at most 50 times
1786+
simulation to crash. The \lmpcmd{maxtry 50} asks LAMMPS to try at most 50 times
17861787
to insert the molecules, which is useful in case some insertion attempts are
1787-
rejected due to overlap. In some cases, depending on the system and the values
1788-
of \textit{overlap} and \textit{maxtry}, LAMMPS may not create the desired number
1789-
of molecules. Always check the number of created atoms in the \textit{log} file
1790-
after starting the simulation:
1788+
rejected due to overlap. In some cases, depending on the system and the values
1789+
of \lmpcmd{overlap} and \lmpcmd{maxtry}, LAMMPS may not create the desired number
1790+
of molecules. Always check the number of created atoms in the \lmpcmd{log} file
1791+
(or in the \guicmd{Output} window), where you should see:
17911792
\begin{lstlisting}
1792-
Created 3150 atoms
1793+
Created 2100 atoms
17931794
\end{lstlisting}
1794-
When LAMMPS fails to create the desired number of molecules, a WARNING appears
1795-
in the \textit{log} file. The molecule template called
1796-
\href{\filepath tutorial3/pureH2O/H2O-SPCFw.mol}{\dwlcmd{H2O-SPCFw.mol}}
1797-
must be downloaded and saved in the \flrcmd{pureH2O/} folder. This template contains
1795+
When LAMMPS fails to create the desired number of molecules, a WARNING appears.
1796+
The molecule template called \href{\filepath tutorial3/water.mol}{\dwlcmd{water.mol}}
1797+
must be downloaded and saved next to \lmpcmd{water.lmp}. This template contains
17981798
the necessary structural information of a water molecule, such as the number of
1799-
atoms, or the IDs of the atoms that are connected by bonds, angles, etc.
1799+
atoms, or the IDs of the atoms that are connected by bonds and angles.
18001800

18011801
Then, let us organize the atoms of types OW and HW of the water molecules in a
18021802
group named \textit{H2O} and perform a small energy minimization. The energy
@@ -2149,6 +2149,7 @@ \subsubsection{System preparation}
21492149
potential. Here, \textit{lj/cut/tip4p/long} imposes a Lennard-Jones potential with
21502150
a cut-off at $12\,\text{$\text{\AA{}}$}$ and a long-range Coulomb potential.
21512151

2152+
% S.G. To fix, this was removed from tutorial 3 : The \textit{pppm} style refers to particle-particle particle-mesh . \cite{luty1996calculating}
21522153
So far, the commands are relatively similar to those in the previous tutorial,
21532154
\hyperref[all-atoms-label]{Polymer in water}, with two major differences: the use
21542155
of \textit{lj/cut/tip4p/long} instead of \textit{lj/cut/coul/long}, and \textit{pppm/tip4p}

0 commit comments

Comments
 (0)