Skip to content

Commit 7f31b87

Browse files
Merge pull request #22 from lammpstutorials/improve-GUI-in-tutoria3
added more GUI-compatible options in tutorial 3
2 parents 4f50add + 075f880 commit 7f31b87

1 file changed

Lines changed: 52 additions & 52 deletions

File tree

lammps-tutorials.tex

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,15 +1810,15 @@ \subsubsection{Preparing the water reservoir}
18101810
Create a folder called \textit{pureH2O/}. Inside this folder, create an empty text
18111811
file called \textit{input.lmp}. Copy the following lines into it:
18121812
{\normalsize \begin{verbatim}
1813-
units real
1814-
atom_style full
1815-
bond_style harmonic
1816-
angle_style harmonic
1817-
dihedral_style harmonic
1818-
pair_style lj/cut/coul/long 10
1819-
kspace_style pppm 1e-5
1820-
special_bonds lj 0.0 0.0 0.5 &
1821-
coul 0.0 0.0 1.0 angle yes
1813+
units real
1814+
atom_style full
1815+
bond_style harmonic
1816+
angle_style harmonic
1817+
dihedral_style harmonic
1818+
pair_style lj/cut/coul/long 10
1819+
kspace_style pppm 1e-5
1820+
special_bonds lj 0.0 0.0 0.5 &
1821+
coul 0.0 0.0 1.0 angle yes
18221822
\end{verbatim}}
18231823
With the unit style \textit{real}, masses are in grams per mole, distances in
18241824
Ångstroms, 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},
@@ -1837,22 +1837,22 @@ \subsubsection{Preparing the water reservoir}
18371837
(1 for the water, 6 for the polymer), 8 angle types (1 for the water, 7 for the polymer),
18381838
and 4 dihedral types (only for the polymer). Copy the following lines into \textit{input.lmp}:
18391839
{\normalsize \begin{verbatim}
1840-
region box block -45 45 -15 15 -15 15
1841-
create_box 8 box &
1842-
bond/types 7 &
1843-
angle/types 8 &
1844-
dihedral/types 4 &
1845-
extra/bond/per/atom 3 &
1846-
extra/angle/per/atom 6 &
1847-
extra/dihedral/per/atom 10 &
1848-
extra/special/per/atom 14
1840+
region box block -45 45 -15 15 -15 15
1841+
create_box 8 box &
1842+
bond/types 7 &
1843+
angle/types 8 &
1844+
dihedral/types 4 &
1845+
extra/bond/per/atom 3 &
1846+
extra/angle/per/atom 6 &
1847+
extra/dihedral/per/atom 10 &
1848+
extra/special/per/atom 14
18491849
\end{verbatim}}
18501850
The \textit{extra/x/per/atom} commands are here for
18511851
memory allocation. We will use a file named \textit{PARM.lmp} that contains
18521852
all the parameters (masses, interaction energies, bond equilibrium
18531853
distances, etc). In \textit{input.lmp}, add the following line:
18541854
{\normalsize \begin{verbatim}
1855-
include ../PARM.lmp
1855+
include ../PARM.lmp
18561856
\end{verbatim}}
18571857

18581858
Download and save the
@@ -1871,9 +1871,9 @@ \subsubsection{Preparing the water reservoir}
18711871
\textit{H2O-SPCFw.mol} and then randomly create 1050 molecules. Add the following
18721872
lines into \textit{input.lmp}:
18731873
{\normalsize \begin{verbatim}
1874-
molecule h2omol H2O-SPCFw.mol
1875-
create_atoms 0 random 1050 87910 NULL mol &
1876-
h2omol 454756 overlap 1.0 maxtry 50
1874+
molecule h2omol H2O-SPCFw.mol
1875+
create_atoms 0 random 1050 87910 NULL mol &
1876+
h2omol 454756 overlap 1.0 maxtry 50
18771877
\end{verbatim}}
18781878
The \textit{overlap 1} option of the \textit{create\_atoms} command ensures
18791879
that no atoms are placed exactly in the same position, as this would cause the
@@ -1884,7 +1884,7 @@ \subsubsection{Preparing the water reservoir}
18841884
of molecules. Always check the number of created atoms in the \textit{log} file
18851885
after starting the simulation:
18861886
{\normalsize \begin{verbatim}
1887-
Created 3150 atoms
1887+
Created 3150 atoms
18881888
\end{verbatim}}
18891889
When LAMMPS fails to create the desired number of molecules, a WARNING appears
18901890
in the \textit{log} file. The molecule template called
@@ -1898,9 +1898,9 @@ \subsubsection{Preparing the water reservoir}
18981898
minimization is mandatory here given the small \textit{overlap} value of 1 Ångstrom
18991899
chosen in the \textit{create\_atoms} command. Add the following lines into \textit{input.lmp}:
19001900
{\normalsize \begin{verbatim}
1901-
group H2O type OW HW
1902-
minimize 1.0e-4 1.0e-6 100 1000
1903-
reset_timestep 0
1901+
group H2O type OW HW
1902+
minimize 1.0e-4 1.0e-6 100 1000
1903+
reset_timestep 0
19041904
\end{verbatim}}
19051905
In general, resetting the step of the simulation to 0 using the
19061906
\textit{reset\_timestep} command is optional.
@@ -1911,47 +1911,47 @@ \subsubsection{Preparing the water reservoir}
19111911
a Nosé-Hoover barostat \cite{nose1984unified, hoover1985canonical, martyna1994constant},
19121912
by adding the following line into \textit{input.lmp}:
19131913
{\normalsize \begin{verbatim}
1914-
fix mynpt all npt temp 300 300 100 &
1915-
iso 1 1 1000
1914+
fix mynpt all npt temp 300 300 100 &
1915+
iso 1 1 1000
19161916
\end{verbatim}}
19171917
The \textit{fix npt} allows us to impose both a temperature of $300\,\text{K}$
19181918
(with a damping constant of $100\,\text{fs}$), and a pressure of 1 atmosphere
19191919
(with a damping constant of $1000\,\text{fs}$). With the \textit{iso} keyword,
19201920
the three dimensions of the box will be re-scaled simultaneously.
19211921

1922-
Let us print the atom positions in a \textit{.lammpstrj} file every 1000 steps
1923-
(i.e. 1 ps), print the temperature volume, and density every 100 steps in 3
1924-
separate data files, and print the information in the terminal every 1000 steps:
1922+
Let us output the system into images by adding the following commands to \textit{input.lmp}:
19251923
{\normalsize \begin{verbatim}
1926-
dump mydmp all atom 1000 dump.lammpstrj
1927-
variable mytemp equal temp
1928-
variable myvol equal vol
1929-
fix myat1 all ave/time 10 10 100 v_mytemp &
1930-
file temperature.dat
1931-
fix myat2 all ave/time 10 10 100 v_myvol &
1932-
file volume.dat
1933-
variable myoxy equal count(H2O)/3
1934-
variable mydensity equal ${myoxy}/v_myvol
1935-
fix myat3 all ave/time 10 10 100 v_mydensity &
1936-
file density.dat
1937-
thermo 1000
1924+
dump mydmp all image 1000 dump.*.ppn type type &
1925+
shiny 0.1 box no 0.01 view 0 90 zoom 1.8
1926+
dump_modify mydmp backcolor white &
1927+
acolor OW red acolor HW white &
1928+
adiam OW 3 adiam HW 1.5
1929+
\end{verbatim}}
1930+
Let us also extract the volume and density in the terminal every 1000 steps:
1931+
{\normalsize \begin{verbatim}
1932+
variable myvol equal vol
1933+
variable myoxy equal count(H2O)/3
1934+
variable myrho equal ${myoxy}/v_myvol
1935+
thermo 1000
1936+
thermo_style custom step temp etotal v_myvol v_myrho
19381937
\end{verbatim}}
19391938
The variable \textit{myoxy} corresponds to the number of atoms divided by 3, i.e.
1940-
the number of molecules.
1939+
the number of molecules, and the variable \textit{myrho} is the number of molecules
1940+
divided by the volume of the simulation box, i.e. the density (in $\mathrm{\AA{}}^{-3}$).
19411941

19421942
Finally, let us set the timestep to 1.0 fs, and run the simulation for 20 ps by
19431943
adding the following lines into \textit{input.lmp}:
19441944
{\normalsize \begin{verbatim}
1945-
timestep 1.0
1946-
run 20000
1945+
timestep 1.0
1946+
run 20000
19471947
1948-
write_data H2O.data
1948+
write_data H2O.data
19491949
\end{verbatim}}
1950-
The final state is written into \textit{H2O.data}. If you open the \textit{dump.lammpstrj}
1951-
file using VMD, you should see the system quickly reaching its equilibrium volume
1952-
and density (see a snapshot of the equilibrated system in Fig.\,\ref{fig:PEG-water}).
1953-
You can also open the \textit{density.dat} file to ensure that the system converged
1954-
toward the density of liquid water during the 20 ps of simulation (Fig.\,\ref{fig:PEG-density}).
1950+
% S.G. may be a binary restart file could be used here to illustrate the new functionalities of the GUI?
1951+
The final state is written into \textit{H2O.data}. From the value of \textit{myrho},
1952+
it should be clear that the system is quickly reaching its equilibrium
1953+
density (see a snapshot of the equilibrated system in Fig.\,\ref{fig:PEG-water},
1954+
and the evolution of the density in Fig.\,\ref{fig:PEG-density}).
19551955

19561956
\begin{figure}
19571957
\centering

0 commit comments

Comments
 (0)