Skip to content

Commit 3821c63

Browse files
committed
improved the merge section of tutorial 3
1 parent 18763bc commit 3821c63

1 file changed

Lines changed: 66 additions & 65 deletions

File tree

lammps-tutorials.tex

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,14 +1880,15 @@ \subsubsection{Preparing the water reservoir}
18801880
\begin{note}
18811881
The binary file created by the \lmpcmdnote{write\_restart} command contains the
18821882
complete state of the simulation, including atomic positions, velocities, and box dimensions (similar to \lmpcmdnote{write\_data}), but also the groups,
1883-
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+
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}.
18841884
\end{note}
18851885

18861886
\subsubsection{Solvating the PEG in water}
1887-
Now that the water reservoir is equilibrated, we can safely include the PEG polymer
1888-
in the water. The PEG molecule topology was downloaded from the ATB repository
1889-
\cite{malde2011automated, oostenbrink2004biomolecular}. It has a formula
1890-
$\text{C}_{28}\text{H}_{58}\text{O}_{15}$, and the parameters are taken from
1887+
1888+
Now that the water reservoir is equilibrated, we can safely add the PEG polymer
1889+
to the water. The PEG molecule topology was downloaded from the ATB repository
1890+
\cite{malde2011automated, oostenbrink2004biomolecular}. It has a formula
1891+
$\text{C}_{16}\text{H}_{34}\text{O}_{9}$, and the parameters are taken from
18911892
the GROMOS 54A7 force field \cite{schmid2011definition}.
18921893

18931894
\begin{figure}
@@ -1898,84 +1899,84 @@ \subsubsection{Solvating the PEG in water}
18981899
\label{fig:PEG-in-vacuum}
18991900
\end{figure}
19001901

1901-
Create a second folder alongside \flrcmd{pureH2O/} and call it \flrcmd{mergePEGH2O/}.
1902-
Create a new blank file in it, call it \flecmd{input.lmp}. Within \flecmd{input.lmp},
1903-
copy the same first lines as previously:
1902+
Open the file named \flecmd{merge.lmp} that was downloaded
1903+
alongside \lmpcmd{water.lmp} during the tutorial setup. It only contains two lines:
19041904
\begin{lstlisting}
1905-
units real
1906-
atom_style full
1907-
bond_style harmonic
1908-
angle_style harmonic
1909-
dihedral_style harmonic
1910-
pair_style lj/cut/coul/long 10
1911-
kspace_style pppm 1e-5
1912-
special_bonds lj 0.0 0.0 0.5 coul 0.0 0.0 1.0 &
1913-
angle yes dihedral yes
1914-
\end{lstlisting}
1915-
Then, import the previously generated data file \flecmd{H2O.data} as well as the \flecmd{PARM.lmp} file:
1916-
\begin{lstlisting}
1917-
read_data ../pureH2O/H2O.data &
1918-
extra/bond/per/atom 3 &
1919-
extra/angle/per/atom 6 &
1920-
extra/dihedral/per/atom 10 &
1921-
extra/special/per/atom 14
1922-
include ../PARM.lmp
1905+
kspace_style ewald 1e-5
1906+
read_restart water.restart
19231907
\end{lstlisting}
1924-
Download the template called
1925-
\href{\filepath tutorial3/mergePEGH2O/PEG-GROMOS.mol}{\dwlcmd{PEG-GROMOS.mol}}
1926-
for the PEG molecule, and then create a single molecule in the middle of the box:
1908+
Most of the commands that were initially present in \lmpcmd{water.lmp}, such as
1909+
the \lmpcmd{units} of the \lmpcmd{atom\_style} commands do not need to be repeated,
1910+
as they were saved within the \flecmd{.restart} file. There is also no need to re-include the parameters from the \lmpcmd{.inc} file. The \lmpcmd{kspace\_style}
1911+
command, however, is not saved by the \lmpcmd{write\_restart} command and must be
1912+
repeated.
1913+
1914+
Using the molecule template for the polymer called
1915+
\href{\filepath tutorial3/peg.mol}{\dwlcmd{peg.mol}},
1916+
let us create a single molecule in the middle of the box by adding the following
1917+
commands to \flecmd{merge.lmp}:
19271918
\begin{lstlisting}
1928-
molecule pegmol PEG-GROMOS.mol
1929-
create_atoms 0 single 0 0 0 mol pegmol 454756
1919+
molecule pegmol mol.mol
1920+
create_atoms 0 single 0 0 0 mol pegmol 454756
19301921
\end{lstlisting}
1931-
Let us create 2 groups to differentiate the PEG from the H2O, by adding the following
1932-
lines into \flecmd{input.lmp}:
1922+
Let us create a group for the atoms of the PEG (the previously created
1923+
group H2O was saved by the restart and can be omitted):
19331924
\begin{lstlisting}
1934-
group H2O type OW HW
1935-
group PEG type C CPos H HC OAlc OE
1925+
group PEG type C CPos H HC OAlc OE
19361926
\end{lstlisting}
19371927
Water molecules that are overlapping with the PEG must be deleted to avoid future crashing.
19381928
Add the following line into \flecmd{input.lmp}:
19391929
\begin{lstlisting}
1940-
delete_atoms overlap 2.0 H2O PEG mol yes
1930+
delete_atoms overlap 2.0 H2O PEG mol yes
19411931
\end{lstlisting}
1942-
Here the value of 2 Ångströms for the overlap cutoff was fixed arbitrarily and can
1932+
Here the value of 2.0~Ångströms for the overlap cutoff was fixed arbitrarily and can
19431933
be chosen through trial and error. If the cutoff is too small, the simulation will
1944-
crash. If the cutoff is too large, too many water molecules will unnecessarily be
1945-
deleted.
1934+
crash because atoms that are too close to each other undergo forces
1935+
that can be extremely large. If the cutoff is too large, too many water
1936+
molecules will unnecessarily be deleted.
19461937

1947-
Finally, let us use the \textit{fix npt} to control the temperature, as
1948-
well as the pressure by allowing the box size to be rescaled along the \textit{x} axis:
1938+
Let us use the \lmpcmd{fix npt} to control the temperature, as
1939+
well as the pressure by allowing the box size to be rescaled along the $x$ axis:
19491940
\begin{lstlisting}
1950-
fix mynpt all npt temp 300 300 100 x 1 1 1000
1951-
timestep 1.0
1941+
fix mynpt all npt temp 300 300 100 x 1 1 1000
19521942
\end{lstlisting}
1953-
Once more, let us create images of the systems:
1943+
Let us also use the \lmpcmd{recenter} command to always keep the PEG at
1944+
the position $0 0 0$:
19541945
\begin{lstlisting}
1955-
dump mydmp all image 1000 dump.*.ppm type &
1956-
type shiny 0.1 box no 0.01 &
1957-
view 0 90 zoom 1.8 fsaa yes bond atom 0.8
1958-
dump_modify mydmp backcolor white &
1959-
acolor OW red acolor HW white &
1960-
acolor OE red acolor OAlc red &
1961-
acolor C gray acolor CPos gray &
1962-
acolor H white acolor HC white &
1963-
adiam OW 0.2 adiam HW 0.2 &
1964-
adiam C 3 adiam CPos 3 adiam OAlc 2.8 &
1965-
adiam H 1 adiam HC 1 adiam OE 2.8
1966-
thermo 1000
1946+
fix myrct PEG recenter 0 0 0 shift all
19671947
\end{lstlisting}
1968-
Finally, let us perform a short equilibration and print the
1969-
final state in a data file. Add the following lines to the data file:
1948+
Note that the \lmpcmd{recenter} command has no impact on the dynamics,
1949+
it simply ensures that the system does not drift, which can be more practical for visualizing and analyzing the system
1950+
1951+
Let us create images of the systems:
19701952
\begin{lstlisting}
1971-
run 30000
1972-
write_data mix.data
1953+
dump viz all image 250 myimage-*.ppm type &
1954+
type shiny 0.1 box no 0.01 &
1955+
view 0 90 zoom 3 fsaa yes bond atom 0.8 size 1000 500
1956+
dump_modify viz backcolor white &
1957+
acolor OW red acolor HW white &
1958+
acolor OE darkred acolor OAlc darkred &
1959+
acolor C gray acolor CPos gray &
1960+
acolor H white acolor HC white &
1961+
adiam OW 0.2 adiam HW 0.2 &
1962+
adiam C 2.8 adiam CPos 2.8 adiam OAlc 2.6 &
1963+
adiam H 1.4 adiam HC 1.4 adiam OE 2.6
1964+
thermo 500
1965+
\end{lstlisting}
1966+
Finally, let us perform a short equilibration and save the
1967+
final state to a \lmpcmd{.restart} file. Add the following lines to the data file:
1968+
\begin{lstlisting}
1969+
timestep 1.0
1970+
run 10000
1971+
1972+
write_restart mix.restart
19731973
\end{lstlisting}
1974-
From the outputs, you can make sure that the temperature remains close to the
1975-
target value of $300~\text{K}$ throughout the entire simulation, and the that
1976-
the volume and total energy are almost constant, suggesting
1977-
that the system was close to equilibrium from the start. See a snapshot of the
1978-
system in Fig.\,\ref{fig:PEG-solvated}.
1974+
Run the simulation using LAMMPS. From the outputs, you can make
1975+
sure that the temperature remains close to the
1976+
target value of $300~\text{K}$ throughout the entire simulation, and that
1977+
the volume and total energy are almost constant, indicating
1978+
that the system was in a reasonable configuration from the start.
1979+
See a snapshot of the system in Fig.\,\ref{fig:PEG-solvated}.
19791980

19801981
\begin{figure}
19811982
\centering

0 commit comments

Comments
 (0)