Skip to content

Commit 2b4763e

Browse files
committed
cleaned pull part
1 parent aa6df75 commit 2b4763e

4 files changed

Lines changed: 96 additions & 106 deletions

File tree

files/tutorial3/pull.lmp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22
kspace_style ewald 1e-5
3-
read_restart water.restart
3+
read_restart merge.restart

files/tutorial3/solution/merge.lmp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dump_modify viz backcolor white &
2121
adiam C 2.8 adiam CPos 2.8 adiam OAlc 2.6 &
2222
adiam H 1.4 adiam HC 1.4 adiam OE 2.6
2323

24-
#fix mynpt all npt temp 300 300 100 x 1 1 1000
24+
fix mynpt all npt temp 300 300 100 x 1 1 1000
2525
fix myrct PEG recenter 0 0 0 shift all
2626
timestep 1.0
2727

files/tutorial3/solution/pull.lmp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ variable xcm equal xcm(ends,x)
77
variable oxies atom type==label2type(atom,OAlc)
88
variable end1 atom v_oxies*(x>v_xcm)
99
variable end2 atom v_oxies*(x<v_xcm)
10-
1110
group topull1 variable end1
1211
group topull2 variable end2
1312

@@ -23,6 +22,10 @@ dump_modify viz backcolor white &
2322
adiam C 2.8 adiam CPos 2.8 adiam OAlc 2.6 &
2423
adiam H 1.4 adiam HC 1.4 adiam OE 2.6
2524

25+
timestep 1.0
26+
fix mynvt all nvt temp 300 300 100
27+
fix myrct PEG recenter 0 0 0 shift all
28+
2629
compute rgyr PEG gyration
2730
compute prop PEG property/local dtype
2831
compute dphi PEG dihedral/local phi
@@ -36,10 +39,6 @@ dump mydmp all local 100 pull.dat index c_dphi c_prop
3639
# S.G.: a histogram would be ok if one could select only dihedral 2
3740
# fix myhisto all ave/histo 100 120 15000 0 180 90 c_dphi file pull.dat ave running mode vector
3841

39-
timestep 1.0
40-
fix mynvt all nvt temp 300 300 100
41-
fix myrct PEG recenter 0 0 0 shift all
42-
4342
run 15000
4443

4544
fix myaf1 topull1 addforce 10 0 0

lammps-tutorials.tex

Lines changed: 90 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,109 +1987,100 @@ \subsubsection{Solvating the PEG in water}
19871987

19881988
\subsubsection{Stretching the PEG molecule}
19891989

1990-
Here, a constant forcing is applied to the two ends of the PEG molecule until it
1991-
stretches. Create a new folder next to the previously created folders, call it
1992-
\flrcmd{pullonPEG/}, and create a new input file in it called \flecmd{input.lmp}.
1993-
First, let us create a variable \textit{f0} corresponding to the magnitude of the
1994-
force we are going to apply. Copy the following line into the \flecmd{input.lmp} file:
1995-
\begin{lstlisting}
1996-
variable f0 equal 5
1997-
\end{lstlisting}
1998-
The force magnitude of $1\,\text{kcal/mol/\AA{}}$ corresponds to $67.2\,\text{pN}$
1999-
and was chosen to be large enough to overcome the thermal agitation and the entropic
2000-
contribution from both water and PEG molecules (it was chosen by trial and error).
2001-
Then, copy the same lines as previously:
2002-
\begin{lstlisting}
2003-
units real
2004-
atom_style full
2005-
bond_style harmonic
2006-
angle_style harmonic
2007-
dihedral_style harmonic
2008-
pair_style lj/cut/coul/long 10
2009-
kspace_style pppm 1e-5
2010-
special_bonds lj 0.0 0.0 0.5 &
2011-
coul 0.0 0.0 1.0 &
2012-
angle yes dihedral yes
2013-
\end{lstlisting}
2014-
Start the simulation from the equilibrated PEG-water system and include again the
2015-
parameter file by adding the following lines to the \flecmd{input.lmp}:
2016-
\begin{lstlisting}
2017-
read_data ../mergePEGH2O/mix.data
2018-
include ../PARM.lmp
2019-
\end{lstlisting}
2020-
Next, let us create some useful atom groups, including H2O and PEG (as previously),
2021-
as well as 2 groups containing a single atom each, the oxygen atoms at the ends
2022-
of the chain. Atoms of types OAlc correspond to the hydroxy (alcohol) group oxygen
2023-
atoms located at the ends of the PEG molecule, which we are going to use to pull
2024-
on the PEG molecule. Add the following lines to the \flecmd{input.lmp}:
2025-
\begin{lstlisting}
2026-
group H2O type OW HW
2027-
group PEG type C CPos H HC OAlc OE
2028-
group ends type OAlc
2029-
variable xcm equal xcm(ends,x)
2030-
variable oxies atom type==label2type(atom,OAlc)
2031-
variable end1 atom v_oxies*(x>v_xcm)
2032-
variable end2 atom v_oxies*(x<v_xcm)
2033-
group topull1 variable end1
2034-
group topull2 variable end2
2035-
\end{lstlisting}
2036-
Add the following \textit{dump} command to create images of the system:
2037-
\begin{lstlisting}
2038-
dump mydmp all image 1000 dump.*.ppm type &
2039-
type shiny 0.1 box no 0.01 &
2040-
view 0 90 zoom 1.8 fsaa yes bond atom 0.8
2041-
dump_modify mydmp backcolor white &
2042-
acolor OW red acolor HW white &
2043-
acolor OE red acolor OAlc red &
2044-
acolor C gray acolor CPos gray &
2045-
acolor H white acolor HC white &
2046-
adiam OW 0.2 adiam HW 0.2 &
2047-
adiam C 3 adiam CPos 3 adiam OAlc 2.8 &
2048-
adiam H 1 adiam HC 1 adiam OE 2.8
2049-
\end{lstlisting}
2050-
Let us use a single Nosé-Hoover thermostat applied to all the atoms by adding the
2051-
following lines to \flecmd{input.lmp}:
1990+
Here, a constant force is applied to both ends of the PEG molecule until it
1991+
stretches. Open the file named \flecmd{pull.lmp}. Similar to \flecmd{merge.lmp},
1992+
it only contains two lines:
1993+
\begin{lstlisting}
1994+
kspace_style ewald 1e-5
1995+
read_restart merge.restart
1996+
\end{lstlisting}
1997+
Next, we'll create new atom groups, each containing a single atom: the oxygen
1998+
atoms located at the ends of the chain. The atoms of type \lmpcmd{OAlc}
1999+
correspond to the hydroxy (alcohol) group oxygen atoms located at the ends
2000+
of the PEG molecule, which we will use to apply the force. Add the
2001+
following lines to \flecmd{pull.lmp}:
2002+
\begin{lstlisting}
2003+
group ends type OAlc
2004+
variable xcm equal xcm(ends,x)
2005+
variable oxies atom type==label2type(atom,OAlc)
2006+
variable end1 atom v_oxies*(x>v_xcm)
2007+
variable end2 atom v_oxies*(x<v_xcm)
2008+
group topull1 variable end1
2009+
group topull2 variable end2
2010+
\end{lstlisting}
2011+
These lines identify the oxygen atoms (\lmpcmd{OAlc}) at the ends of the PEG
2012+
molecule and calculates their center of mass along the $x$ axis. It then
2013+
divides these atoms into two groups, \lmpcmd{OAlc} (i.e., the OAlc atom to
2014+
the right of the center) and \lmpcmd{OAlc} (i.e., the OAlc atom to the right
2015+
of the center), for applying force during the stretching process.
2016+
2017+
Add the following \lmpcmd{dump} command to create images of the system:
2018+
\begin{lstlisting}
2019+
dump viz all image 250 myimage-*.ppm type &
2020+
type shiny 0.1 box no 0.01 &
2021+
view 0 90 zoom 3 fsaa yes bond atom 0.8 size 1000 500
2022+
dump_modify viz backcolor white &
2023+
acolor OW red acolor HW white &
2024+
acolor OE darkred acolor OAlc darkred &
2025+
acolor C gray acolor CPos gray &
2026+
acolor H white acolor HC white &
2027+
adiam OW 0.2 adiam HW 0.2 &
2028+
adiam C 2.8 adiam CPos 2.8 adiam OAlc 2.6 &
2029+
adiam H 1.4 adiam HC 1.4 adiam OE 2.6
2030+
\end{lstlisting}
2031+
Let us use a single Nosé-Hoover thermostat applied to all the atoms,
2032+
and let us keep the PEG in the center of the box, by adding
2033+
the following lines to \flecmd{pull.lmp}:
20522034
\begin{lstlisting}
20532035
timestep 1.0
20542036
fix mynvt all nvt temp 300 300 100
2037+
fix myrct PEG recenter 0 0 0 shift all
2038+
\end{lstlisting}
2039+
2040+
To investigate the stretching of the PEG molecule, let us compute its radius of
2041+
gyration \cite{fixmanRadiusGyrationPolymer1962a} and the angles of its dihedral
2042+
constraints using the following conmmands:
2043+
\begin{lstlisting}
2044+
compute rgyr PEG gyration
2045+
compute prop PEG property/local dtype
2046+
compute dphi PEG dihedral/local phi
2047+
\end{lstlisting}
2048+
The radius of gyration can be directly printed with the \lmpcmd{thermo\_style} command:
2049+
\begin{lstlisting}
2050+
thermo_style custom step temp etotal c_rgyr
2051+
thermo 250
2052+
dump mydmp all local 100 pull.dat index c_dphi c_prop
20552053
\end{lstlisting}
2056-
Let us also print the end-to-end distance of the PEG,
2057-
here defined as the distance between the groups \textit{topull1}
2058-
and \textit{topull2}, as well as the gyration
2059-
radius of the molecule \cite{fixmanRadiusGyrationPolymer1962a}
2060-
by adding the following lines to \flecmd{input.lmp}:
2061-
\begin{lstlisting}
2062-
variable x1 equal xcm(topull1,x)
2063-
variable x2 equal xcm(topull2,x)
2064-
variable y1 equal xcm(topull1,y)
2065-
variable y2 equal xcm(topull2,y)
2066-
variable z1 equal xcm(topull1,z)
2067-
variable z2 equal xcm(topull2,z)
2068-
variable delta_r equal &
2069-
sqrt((v_x1-v_x2)^2+(v_y1-v_y2)^2 &
2070-
+(v_z1-v_z2)^2)
2071-
compute rgyr PEG gyration
2072-
thermo_style custom step temp etotal v_delta_r c_rgyr
2073-
thermo 1000
2074-
\end{lstlisting}
2075-
Finally, let us simulate 30 picoseconds without any external forcing:
2076-
\begin{lstlisting}
2077-
run 30000
2078-
\end{lstlisting}
2079-
This first run will serve as a benchmark to quantify later the changes induced
2080-
by the forcing. Then, let us apply a forcing on the 2 selected oxygen atoms using two
2081-
\textit{add\_force} commands, and run for an extra 30 ps:
2082-
\begin{lstlisting}
2083-
fix myaf1 topull1 addforce ${f0} 0 0
2084-
fix myaf2 topull2 addforce -${f0} 0 0
2085-
run 30000
2086-
\end{lstlisting}
2087-
Run the \flecmd{input.lmp} file using LAMMPS. From the generated images of the system,
2088-
you should see that the PEG molecule eventually aligns
2089-
in the direction of the force (as seen in Fig.\,\ref{fig:PEG-in-water}).
2090-
The evolutions of the end-to-end distance and of the gyration radius over
2091-
time show that the PEG is adjusting to the external forcing in less than
2092-
$10~\text{ps}$ (Fig.\,\ref{fig:PEG-distance}).
2054+
Since the dihedral angle $\phi$ is returned as a vector by the compute
2055+
\lmpcmd{dihedral/local} command, it needs to be printed to a file using
2056+
the \lmpcmd{dump} command.
2057+
2058+
Finally, let us simulate 15 picoseconds without any external force:
2059+
\begin{lstlisting}
2060+
run 15000
2061+
\end{lstlisting}
2062+
This initial run will serve as a benchmark to quantify the changes caused by
2063+
the applied force in later steps. Next, let us apply a force to the two selected
2064+
oxygen atoms using two \lmpcmd{add\_force} commands, and then run the simulation
2065+
for an extra 15~ps:
2066+
\begin{lstlisting}
2067+
fix myaf1 topull1 addforce 10 0 0
2068+
fix myaf2 topull2 addforce -10 0 0
2069+
run 15000
2070+
\end{lstlisting}
2071+
The force magnitude of $10\,\text{kcal/mol/\AA{}}$ corresponds to $0.67\,\text{nN}$
2072+
and was selected to be sufficiently large to overcome both thermal agitation and
2073+
the entropic contributions from both the water and PEG molecules.
2074+
2075+
Run the \flecmd{pull.lmp} file using LAMMPS. From the generated images of the system,
2076+
you should observe that the PEG molecule eventually aligns
2077+
in the direction of the applied force (as seen in Fig.\,\ref{fig:PEG-in-water}).
2078+
The evolutions of the radius of gyration over
2079+
time indicates that the PEG quickly adjusts to the external force
2080+
(Fig.\,\ref{fig:PEG-distance}\,a). Additionally, from the values of the dihedral angles
2081+
printed in the \flecmd{pull.dat} file, you can create a histogram
2082+
of dihedral angles for a specific type. For example, the angle $\phi$ for dihedrals
2083+
of type 1 (C-C-OE-C) is shown in Fig.\,\ref{fig:PEG-distance}\,b.
20932084

20942085
\begin{figure}
20952086
\centering

0 commit comments

Comments
 (0)