Skip to content

Commit c6c0f60

Browse files
committed
updated coloring experiments
1 parent 667f62d commit c6c0f60

4 files changed

Lines changed: 50 additions & 47 deletions

File tree

figures/LJ-coords.png

-29.4 KB
Loading

figures/LJ-evolution.png

117 KB
Loading

files/tutorial1/.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ solution/improved.min.png
2323
solution/improved.md.lmp
2424
solution/improved.md.log
2525
solution/improved.md.dat
26-
solution/minimized_coordinates.data
26+
solution/min_coords.data
2727

2828
# 3) folders not known to LAMMPS GUI will be skipped

lammps-tutorials.tex

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ \subsection{Scope}
261261

262262
In \hyperref[carbon-nanotube-label]{tutorial 2}, a more complex system
263263
is introduced where atoms are connected by bonds: a small carbon
264-
nanotube. The use of both classical and reactive force fields (here,
264+
nanotube. The use of both classical and reactive force fields (here,
265265
AIREBO) is illustrated. An external deformation is applied to the CNT,
266266
and its deformation is measured. This tutorial also illustrates the use
267267
of an external visualization tool to visualize breaking bonds, and
@@ -271,7 +271,7 @@ \subsection{Scope}
271271
In \hyperref[all-atoms-label]{tutorial 3}, two components, liquid water
272272
and a polymer molecule, are merged and equilibrated. A long-range
273273
solver is used to handle the electrostatic interactions accurately, and
274-
the system is equilibrated in the isothermal-isobaric (NPT) ensemble. A
274+
the system is equilibrated in the isothermal-isobaric (NPT) ensemble. A
275275
stretching force is then applied to the polymer. This tutorial also
276276
demonstrates the use of molecule files and type labels
277277
\cite{typelabel_paper} to make molecule files more generic.
@@ -344,7 +344,7 @@ \subsection{Software/system requirements}
344344
Select a package with `GUI' in the file name, which includes
345345
both LAMMPS--GUI and a LAMMPS console executable. These
346346
precompiled packages are designed to be portable, and therefore omit support for
347-
running in parallel with MPI. \hyperref[using-lammps-gui-label]{Appendix
347+
running in parallel with MPI. \hyperref[using-lammps-gui-label]{Appendix
348348
\ref{using-lammps-gui-label}} has instructions for installing
349349
LAMMPS--GUI and using its most relevant features for the tutorials.
350350

@@ -532,7 +532,7 @@ \subsubsection{My first input}
532532
editor buffer, the documentation can be accessed by
533533
right-clicking the line with a command, such as \lmpcmd{units lj}, and
534534
selecting \guicmd{View documentation for (\dots)}\,. LAMMPS--GUI will
535-
prompt your web browser to open the corresponding URL of the online manual. See
535+
prompt your web browser to open the corresponding URL of the online manual. See
536536
figure~\ref{fig:GUI-1} for a screenshot of this context menu.
537537

538538
\paragraph{System definition}
@@ -563,7 +563,7 @@ \subsubsection{My first input}
563563
point on, any command referencing an atom type larger than \textit{2}
564564
will trigger an error. You may specify more atom types than
565565
necessary, but for each type you must set the mass and provide
566-
force field parameters. Failing to do so will cause LAMMPS to abort with an
566+
force field parameters. Failing to do so will cause LAMMPS to abort with an
567567
error at the beginning of a minimization or MD run.
568568

569569
The third line, \lmpcmd{create\_atoms (\dots)}, creates 1500 atoms of type
@@ -624,7 +624,7 @@ \subsubsection{My first input}
624624
\includegraphics[width=0.55\linewidth]{LJ}
625625
\caption{The binary mixture simulated during \hyperref[lennard-jones-label]{Tutorial 1}.
626626
The atoms of type 1 are represented as small red spheres, the atoms of type 2 as large
627-
green spheres, and the edges of the simulation box are represented a blue sticks}
627+
green spheres, and the edges of the simulation box are represented as blue sticks.}
628628
\label{fig:LJ}
629629
\end{figure}
630630

@@ -660,7 +660,7 @@ \subsubsection{My first input}
660660

661661
At this point, you can create a snapshot image of the
662662
current system using the \guicmd{Image Viewer} window, which can be
663-
accessed by clicking the \guicmd{Create Image} button in the \guicmd{Run} menu.
663+
accessed by clicking the \guicmd{Create Image} button in the \guicmd{Run} menu.
664664
The image viewer works by instructing LAMMPS to render an image of the current system using
665665
its internal rendering library via the \lmpcmd{dump image} command. The
666666
resulting image is then displayed, and various buttons allow you to adjust
@@ -808,9 +808,9 @@ \subsubsection{My first input}
808808
starts from 0 but rapidly reaches the requested value and
809809
stabilizes itself near $T=1$ temperature units. One can also see that
810810
the potential energy, $p_\text{e}$, rapidly decreases during energy
811-
minimization (see also figure~\ref{fig:evolution-energy}\,a). After
811+
minimization (see also figure~\ref{fig:evolution-energy}\,a). After
812812
the molecular dynamics simulation starts, $p_\text{e}$ increases until
813-
it reaches a plateau value of about -0.25. The kinetic energy,
813+
it reaches a plateau value of about -0.25. The kinetic energy,
814814
$k_\text{e}$, is equal to zero during energy minimization and then
815815
increases during molecular dynamics until it reaches a plateau value of
816816
about 1.5 (Figure~\ref{fig:evolution-energy}\,b).
@@ -819,7 +819,8 @@ \subsubsection{My first input}
819819
\centering
820820
\includegraphics[width=\linewidth]{LJ-energy}
821821
\caption{a)~Potential ($p_\text{e}$) and kinetic energy ($k_\text{e}$) of the
822-
binary mixture as functions of the step during energy minimization.
822+
binary mixture simulated during \hyperref[lennard-jones-label]{Tutorial 1} as
823+
functions of the step during energy minimization.
823824
b)~$p_\text{e}$ and $k_\text{e}$ as functions of time $t$ during
824825
molecular dynamics in the NVT ensemble.}
825826
\label{fig:evolution-energy}
@@ -837,7 +838,7 @@ \subsubsection{My first input}
837838
by either using the \guicmd{Ctrl-D} keyboard shortcut or selecting
838839
\guicmd{Copy dump image command} from the \guicmd{File} menu. This text
839840
can be pasted into the into the \lmpcmd{Visualization} section of
840-
\lmpcmd{PART B} of the \flecmd{initial.lmp} file. This may look like the following:
841+
\lmpcmd{PART B} of the \flecmd{initial.lmp} file. This may look like the following:
841842

842843
\begin{lstlisting}
843844
dump viz all image 100 myimage-*.ppm type type &
@@ -848,7 +849,7 @@ \subsubsection{My first input}
848849
backcolor white adiam 1 1.6 adiam 2 4.8
849850
\end{lstlisting}
850851
This command tells LAMMPS to generate NetPBM format images every 100
851-
steps. The two \lmpcmd{type} keywords are for \lmpcmd{color} and
852+
steps. The two \lmpcmd{type} keywords are for \lmpcmd{color} and
852853
\lmpcmd{diameter}, respectively. Run the \flecmd{initial.lmp} using
853854
LAMMPS again, and a new window named \guicmd{Slide Show} will pop up.
854855
It will show each image created by the \lmpcmd{dump image} as it is
@@ -920,10 +921,10 @@ \subsubsection{Improving the script}
920921
restart the simulation, such as the number of atoms, the box size, the
921922
masses, and the pair coefficients. The
922923
\flecmd{.data} file also contains the final
923-
positions of the atoms within the \lmpcmd{Atoms} section. The first five
924+
positions of the atoms within the \lmpcmd{Atoms} section. The first five
924925
columns of the \lmpcmd{Atoms} section correspond (from left to right) to
925926
the atom indexes (from 1 to the total number of atoms, 1150), the atom
926-
types (1 or 2 here), and the positions of the atoms $x$, $y$, $z$. The
927+
types (1 or 2 here), and the positions of the atoms $x$, $y$, $z$. The
927928
last three columns are image flags that keep track of which atoms
928929
crossed the periodic boundary. The exact format of each line in the
929930
\textit{Atoms} section depends on the choice of \textit{atom\_style}, which
@@ -948,7 +949,10 @@ \subsubsection{Improving the script}
948949
\begin{figure}
949950
\centering
950951
\includegraphics[width=0.55\linewidth]{LJ-cylinder}
951-
\caption{Visualization of the improved system after minimization}
952+
\caption{Improved visualization of the binary mixture simulated
953+
during \hyperref[lennard-jones-label]{Tutorial 1}. The atoms of type 1 are
954+
represented as small red spheres, the atoms of type 2 as large green spheres,
955+
and the edges of the simulation box are represented as blue sticks.}
952956
\label{fig:improved-min}
953957
\end{figure}
954958

@@ -1028,7 +1032,7 @@ \subsubsection{Improving the script}
10281032
as a good indicator of the degree of mixing in a binary mixture. This
10291033
is done using two \lmpcmd{compute} commands: the first counts the
10301034
coordinated atoms, and the second calculates the average over all type 1
1031-
atoms. Add the following lines to \flecmd{improved.md.lmp}:
1035+
atoms. Add the following lines to \flecmd{improved.md.lmp}:
10321036
\begin{lstlisting}
10331037
compute coor12 grp_t1 coord/atom cutoff 2 &
10341038
group grp_t2
@@ -1044,9 +1048,11 @@ \subsubsection{Improving the script}
10441048
\begin{figure}
10451049
\centering
10461050
\includegraphics[width=\linewidth]{LJ-evolution}
1047-
\caption{Evolution of the system during mixing. The three snapshots show
1048-
respectively the system at $t=0$ (left panel), $t=75$ (middle panel), and $t=1500$
1049-
(right panel).}
1051+
\caption{Evolution of the system from \hyperref[lennard-jones-label]{Tutorial 1}
1052+
during mixing. The three snapshots show respectively the system
1053+
at $t=0$ (left panel), $t=75$ (middle panel), and $t=1500$ (right panel). The
1054+
atoms of type 1 are represented as small turquoise spheres and the atoms of type 2
1055+
as large blue spheres.}
10501056
\label{fig:evolution-population}
10511057
\end{figure}
10521058

@@ -1084,7 +1090,7 @@ \subsubsection{Improving the script}
10841090
\includegraphics[width=\linewidth]{LJ-mixing}
10851091
\caption{a)~Evolution of the numbers $N_\text{1, in}$ and $N_\text{2, in}$ of atoms
10861092
of types 1 and 2, respectively, within the \lmpcmd{cyl\_in} region as functions
1087-
of time $t$. b)~Evolution of the coordination number $C_{1-2}$ between atoms of types 1 and 2.}
1093+
of time $t$. b)~Evolution of the coordination number $C_{1-2}$ between atoms of types 1 and 2.}
10881094
\label{fig:mixing}
10891095
\end{figure}
10901096

@@ -1094,19 +1100,19 @@ \subsubsection{Improving the script}
10941100
temperature is equal to 1.0 temperature units. The additional keywords
10951101
ensure that no linear momentum (\lmpcmd{mom yes}) is given to the
10961102
system and that the generated velocities are distributed according to
1097-
a Gaussian distribution. Another improvement is the \lmpcmd{zero yes}
1103+
a Gaussian distribution. Another improvement is the \lmpcmd{zero yes}
10981104
keyword in the Langevin thermostat, which ensures that the total random
10991105
force applied to the atoms is equal to zero.
11001106

11011107
\begin{note}
11021108
The steps to ensure no initial linear momentum and no net random
11031109
force are important to prevent the system from starting to drift or move as a
11041110
whole. For a bulk system with periodic boundary conditions, it is
1105-
expected to remain in place. Thus, when computing the temperature from the
1111+
expected to remain in place. Thus, when computing the temperature from the
11061112
kinetic energy, we use $3N-3$ degrees of freedom since there is no
11071113
global translation. In a drifting system, some of the kinetic energy is
11081114
due to the drift, which means the system itself cools down. In
1109-
extreme cases, it can freeze and drift very fast. This phenomenon is
1115+
extreme cases, it can freeze and drift very fast. This phenomenon is
11101116
sometimes referred to as the ``flying ice cube syndrome'' \cite{wong2016good}.
11111117
\end{note}
11121118

@@ -1128,42 +1134,39 @@ \subsubsection{Improving the script}
11281134
\begin{figure}
11291135
\centering
11301136
\includegraphics[width=0.55\linewidth]{LJ-coords}
1131-
\caption{Snapshot image with atoms colored by the computed 1-2 coordination
1132-
number: turquoise = 0, yellow = 1, red = 2}
1137+
\caption{Snapshot image of the binary mixture simulated
1138+
during \hyperref[lennard-jones-label]{Tutorial 1} with atoms colored by the
1139+
computed $1-2$ coordination number \lmpcmd{c\_coor12}, from
1140+
turquoise (0.0) to blue (2.0).}
11331141
\label{fig:coords-viz}
11341142
\end{figure}
11351143

11361144
\paragraph{Experiments}
11371145

11381146
Here are some suggestions for further experiments with this system that
1139-
may lead to additional insights into how different systems are set up
1140-
and how different features work:
1147+
may lead to additional insights into how different systems are configured
1148+
and how various features function:
11411149
\begin{itemize}
1142-
\item Use Nos\'e--Hoover thermostat (\textit{fix nvt}) instead of Langevin
1143-
(\textit{fix nve} + \textit{fix langevin})
1144-
\item Skip the \textit{minimize} step for both, Nos\'e--Hoover and Langevin
1150+
\item Use Nos\'e--Hoover thermostat (\lmpcmd{fix nvt}) instead of Langevin
1151+
(\lmpcmd{fix nve} + \lmpcmd{fix langevin}).
1152+
\item Omit the energy minimization step for both, Nos\'e--Hoover and Langevin.
11451153
\item Apply the thermostat to only one type of atoms and observe the
1146-
temperature for each type separately
1147-
\item Append an NVE run (i.e.~without any thermostat) and observe the energies
1154+
temperature for each type separately.
1155+
\item Append an NVE run (i.e.~without any thermostat) and observe the energy levels.
11481156
\end{itemize}
11491157

1150-
It is also possible to color the atoms in the \textit{Slide Show}
1151-
according to their coordination number. For that purpose, replace the
1152-
\textit{dump} and \textit{dump\_modify} commands with the following
1153-
commands:
1158+
Another useful experiment to try is to color the atoms in the \guicmd{Slide Show}
1159+
according to their respective coordination numbers. To do this, replace the
1160+
\lmpcmd{dump} and \lmpcmd{dump\_modify} commands with the following lines:
11541161
\begin{lstlisting}
11551162
dump mydmp all image 100 dump.md.*.ppm c_coor12 &
1156-
type shiny 0.1 box no 0.01 view 0 0 zoom 1.8 &
1157-
fsaa yes
1158-
dump_modify mydmp amap 0.0 3.0 ca 1.0 3 &
1159-
min darkturquoise 0.9 yellow max red adiam 1 1 &
1160-
adiam 2 3 backcolor white
1163+
type shiny 0.1 box no 0.01 view 0 0 zoom 1.8 fsaa yes
1164+
dump_modify mydmp amap 0.0 2.0 cf 1.0 2 min darkturquoise &
1165+
max darkblue adiam 1 1 adiam 2 3 backcolor white
11611166
\end{lstlisting}
1162-
1163-
Now atoms of type 2 and atoms of type 1 without type 2 neighbors
1164-
within 2.0 length units are colored in turquoise, atoms of type 1 with
1165-
one type 2 neighbor in yellow, and atoms of type 1 with two type 2
1166-
neighbors in red. Figure \ref{fig:coords-viz} shows an example.
1167+
Now, the atom colors are based on the value of \lmpcmd{c\_coor12}, which is mapped
1168+
continuously from dark turquoise (min) to dark blue (max) for values of
1169+
\lmpcmd{c\_coor12} in the range $0.0$ to $2.0$ (Figure~\ref{fig:coords-viz}).
11671170

11681171
\subsection{Tutorial 2: Pulling on a carbon nanotube}
11691172
\label{carbon-nanotube-label}

0 commit comments

Comments
 (0)