forked from lammpstutorials/lammpstutorials.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial04.html
More file actions
304 lines (262 loc) · 18.1 KB
/
Copy pathtutorial04.html
File metadata and controls
304 lines (262 loc) · 18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no">
<link href="favicon-32x32.png" rel="icon" />
<title>Graphene under deformation</title>
<meta name="description" content="Graphene under deformation">
<meta name="author" content="Simon Gravelle">
<link rel="stylesheet" type="text/css" href="assets_tutorials/vendor/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="assets_tutorials/vendor/font-awesome/css/all.min.css" /> <!-- Font Awesome Icon -->
<link rel="stylesheet" type="text/css" href="assets_tutorials/css/stylesheet.css" />
<script async src="https://www.googletagmanager.com/gtag/js?id=G-W1WGEC5GQ8"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-W1WGEC5GQ8');
</script>
<!-- Latex formula -->
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body data-spy="scroll" data-target=".idocs-navigation" data-offset="125">
<div id="main-wrapper">
<header id="header" class="sticky-top">
<nav class="primary-menu navbar navbar-expand-lg navbar-dropdown-dark">
<div class="container-fluid">
<a class="logo ml-md-3" href="index.html" title="LAMMPS tutorials"> <img src="Figures/logo.png" alt="LAMMPS tutorials" height="60"/> </a>
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#header-nav"><span></span><span></span><span></span></button>
<div id="header-nav" class="collapse navbar-collapse justify-content-end">
<ul class="navbar-nav">
<li class="dropdown"> <a class="dropdown-toggle" href="#">All tutorials</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="tutorial01.html">Tutorial 01</a></li>
<li><a class="dropdown-item" href="tutorial02.html">Tutorial 02</a></li>
<li><a class="dropdown-item" href="tutorial03.html">Tutorial 03</a></li>
<li><a class="dropdown-item" href="tutorial04.html">Tutorial 04</a></li>
<li><a class="dropdown-item" href="tutorial05.html">Tutorial 05</a></li>
</ul>
</li>
<li><a target="_blank" href="https://simongravelle.github.io/">About me</a></li>
<li><a target="_blank" href="https://www.patreon.com/molecularsimulations">Get help with your script</a></li>
</ul>
</div>
<ul class="social-icons social-icons-sm ml-lg-2 mr-2">
<li class="social-icons-twitter"><a data-toggle="tooltip" href="https://twitter.com/GravelleSimon" target="_blank" title="" data-original-title="Twitter"><i class="fab fa-twitter"></i></a></li>
<li class="social-icons-twitter"><a data-toggle="tooltip" href="https://gitlab.com/sgravelle" target="_blank" title="" data-original-title="Gitlab"><i class="fab fa-gitlab"></i></i></a></li>
<li class="social-icons-twitter"><a data-toggle="tooltip" href="https://github.com/simongravelle" target="_blank" title="" data-original-title="Github"><i class="fab fa-github"></i></i></a></li>
<li class="social-icons-twitter"><a data-toggle="tooltip" href="https://www.youtube.com/channel/UCLmK_9wpyLVpcP7BPgN6BIw?view_as=subscriber" target="_blank" title="" data-original-title="Youtube"><i class="fab fa-youtube"></i></i></a></li>
</ul>
</div>
</nav>
</header>
<div class="idocs-navigation bg-light">
<ul class="nav flex-column ">
<li class="nav-item"><a class="nav-link active" href="#intro">Getting Started</a></li>
<li class="nav-item"><a class="nav-link active" href="#Generation">System generation</a></li>
<li class="nav-item"><a class="nav-link" href="#input">LAMMPS input</a></li>
<li class="nav-item"><a class="nav-link" href="#further">Going further</a></li>
</ul>
</div>
<div class="idocs-content">
<div class="container">
<section id="intro">
<h1>Graphene under deformation</h1>
<h3>Generation of a graphene sheet with VMD, and imposed deformation using LAMMPS.</h3>
<br>
<p><img src="Figures/tutorial04/3_graphene.png" class="img-fluid" alt="Responsive image"></p>
<br>
<p><b>The objective of this tutorial</b> is to use molecular dynamics and simulate the deformation of a single layer of graphene. There are two main parts to this tutorial:
<ul>
<li> <a href="#Generation">System generation - </a> First, a graphene sheet will be genetated using VMD and topotool.</li>
<li> <a href="#input">Input file - </a>Seconds, input file for LAMMPS will be written in order to impose the deformation of the sheet.</li>
</ul>
</p>
<p class="alert alert-info">Support the creation of material for LAMMPS by subscribing to my <a href="https://www.youtube.com/channel/UCLmK_9wpyLVpcP7BPgN6BIw?view_as=subscriber" target="_blank">youtube</a> channel, or making a small <a href="https://en.tipeee.com/lammps-tutorials" target="_blank">donation here</a>, any amount would be really appreciated and would highly encourage me to improve this page.</p>
<p>If you are new to LAMMPS, I recommend you to follow <a href="tutorial01.html">this simpler tutorial</a> first.
If you have any suggestion about these tutorials, please contact me by email at simon.gravelle at live.fr.</p>
</section>
<br><br><br>
<section id="Generation">
<h2>Generation of the graphene sheet</h2>
<p>
The initial configuration (atoms positions, bonds, angles, etc) is generated using <a href="https://www.ks.uiuc.edu/Research/vmd/" target="_blank" class="removelinkdefault">VMD</a>. Open VMD, and go to Extensions, Modeling, Nanotube Builder. A window named Carbon Nanostructures opens, and from this window it is possible to generate a sheet of graphene or BN, as well as a nanotube. For this tutorial, we are going to generate a 4 nm per nm sheet of graphene. Simply change the values of "Edge length along x" and "Edge length along y" to 4, and click on "Generate Sheet(s)". You shoud see this:<br> <br>
<img src="Figures/tutorial04/generatedgraphene.png" class="img-fluid" alt="Responsive image">
<br> <br>
At this point, you don't have a molecular dynamics simulations, but a cloud of dots that looks like graphene. In order to generate the initial LAMMPS data file, let us use Topotool and estimate which dots must be connected by bonds using a distance criteria. In the VMD terminal, enter the following command:
<pre><code>topo writelammpsdata data.lammps full
</code></pre></p><p>
More details about this command can be found on the personal page of <a href="https://sites.google.com/site/akohlmey/software/topotools" target="_blank">Axel Kohlmeyer</a>. In short, Topotool deduces the location of bonds, angles, dihedrals, and impropers from the positions of the atoms, and generates a file that can be read by LAMMPS. The keyword "full" corresponds to the LAMMPS atom full style (other possibilities include atomic, bond, charge, etc). The parameters of the constraints (bond length, dihedral coefficients, etc.) will be given later. A new file named "data.lammps" has been created, alternatively you can download the file <a href="Inputs/tutorial04.zip" target="_blank" class="removelinkdefault">here</a>. It starts like that:
<pre><code>LAMMPS data file. CGCMM style. atom_style full generated by VMD/TopoTools v1.7 on Tue Jan 12 19:39:40 GMT 2021
680 atoms
983 bonds
1894 angles
3665 dihedrals
608 impropers
1 atom types
1 bond types
1 angle types
1 dihedral types
1 improper types
-0.5 0.5 xlo xhi
-0.5 0.5 ylo yhi
-0.5 0.5 zlo zhi
# Pair Coeffs
#
# 1 CA
</code></pre></p><p>
As you can see, the data.lammps file contains information about the positions of the carbons atoms, as well as the identity of the atoms linked by bonds, angles, dihedrals, and impropers constraints.
<br><br>
Currently, there is one small issue with the file as generated with Topotool: the box coordinates are "-0.5 0.5". If we use LAMMPS system of units named 'real', it means that the box goes from -0.5 Angstrom to 0.5 Angstrom in X, Y, and Z, which is of course too short. Let us change it to:
<pre><code> -20 60 xlo xhi
-20 60 ylo yhi
-20 60 zlo zhi
</code></pre></p><p>
Save the "data.lammps" file in the same folder as your future LAMMPS input script. We are done with the system generation, we can start the molecular dynamics simulations.
</p>
</div>
</section>
<br><br><br>
<section id="input">
<div class="container">
<h2>LAMMPS input script</h2>
<p>
Create a new text file and name it "input.lammps". Copy the following lines:
<pre><code># Initialisation
variable T equal 300
units real
atom_style full
boundary p p p
pair_style lj/cut 14
bond_style harmonic
angle_style harmonic
dihedral_style opls
improper_style harmonic
special_bonds lj 0.0 0.0 0.5
# System definition
read_data data.lammps
</code></pre></p><p>
Most of these command lines have been seen already in previous tutorials (see <a href="tutorial01.html">tutorial 01</a> and <a href="tutorial03.html">tutorial 03</a>), with a few differences: first, the pair style here is lj/cut with parameter 14, which means that the atoms closer than 14 Angstroms from each others interact through a Lennard-Jones potential. Notice that there is no Coulombic interaction, because all the atoms in pure graphene have a charge of 0. The bond, angle, dihedral, and improper styles specify the different potentials used to restrain the positions of the atoms, you can refer to the LAMMPS website (see for example the <a href="https://lammps.sandia.gov/doc/dihedral_opls.html" class="removelinkdefault">OPLS dihedral style</a>). The three numbers of the special bonds command are weighting factors for the Lennard-Jones interaction between atoms connected by bond (respectively directly bounded, separated by two bonds, etc.). For instance, the first weighting factor, with a value of 0, imposes that two atoms connected by a bond do not interact through a LJ potential. Then the read data command opens the data.lammps file previously generated with VMD, which contains the information about the box size, atoms positions, etc.
<br><br>
What we need now is a force field. Create a new text file and name it "PARM.lammps". Copy the following lines in it:
<pre><code>pair_coeff 1 1 0.066047 3.4
bond_coeff 1 469 1.4
angle_coeff 1 63 120
dihedral_coeff 1 0 7.25 0 0
improper_coeff 1 5 180
</code></pre></p><p>
The pair_coeff indicates the Lennard-jones parameters for the only type of atom of the simulation, carbon (of index 1). The bond_coeff (respectively angle_coeff, dihedral_coeff, improper_coeff) indicates the energy and equilibrium distance of the only type of bond (respectively angle, dihedral, improper) in the simulation: C-C (or 1-1). The file PARM.file can be included in the simulation by adding the following line to input.lammps:
<pre><code>include PARM.lammps
</code></pre></p><p>
The goal of the present simulation is to impose a deformation to the sheet. To do so, add the following lines to the input script :
<pre><code># Simulation settings
group gcar type 1
variable xmax equal bound(gcar,xmax)-0.5
variable xmin equal bound(gcar,xmin)+0.5
region rtop block ${xmax} INF INF INF INF INF
region rbot block INF ${xmin} INF INF INF INF
region rmid block ${xmin} ${xmax} INF INF INF INF
</code></pre></p><p>
The first command includes all of the atoms of type one (i.e. all of our atoms here) in a group named gcar. Then, two variables are defined: \(x_\mathrm{max}\) corresponds to the coordinate of the last atoms along \(x\) minus 0.5 Angstroms, and \(x_\mathrm{min}\) to the coordinate of the first atoms along \(x\) plus 0.5 Angstroms. Then, 3 regions are defined , and correspond respectively to \(x < x_\mathrm{min}\), \(x_\mathrm{min} > x > x_\mathrm{max} \) and \(x > x_\mathrm{max}\). Then groups of atoms corresponding to the atoms located in each regions respectively can be defined:
<pre><code>group gtop region rtop
group gbot region rbot
group gmid region rmid
</code></pre></p><p>
When running the simulation, the number of atoms in each group is printed in the terminal, you can control there that you did not make any mistake:
<pre><code>680 atoms in group gcar
20 atoms in group gtop
20 atoms in group gbot
640 atoms in group gmid
</code></pre>
Let us specify the thermalisation and the dynamics of the system. Add the following lines to input.lammps:
<pre><code>velocity gmid create ${T} 48455 mom yes rot yes
fix mynve all nve
compute Tmid gmid temp
fix myber gmid temp/berendsen ${T} ${T} 100
fix_modify myber temp Tmid
</code></pre></p><p>
The "velocity create" command gives initial velocities to the atoms of the group gmid, assuring an initial temperature of \(300\,\)K for these atoms. NVE integration is applied to all atoms, and a Berendsen thermostat is applied to the atoms of the group gmid only. The "fix modify" ensures that the fix Berendsten use the temperature of the group gmid as an input, instead of the temperature of whole system. The atoms of the edges are not thermalised because their motion will be restrained.
<br><br>
To restrain the motion of the atoms at the edges, add the following commands:
<pre><code>fix mysf1 gtop setforce 0 NULL 0
fix mysf2 gbot setforce 0 NULL 0
velocity gtop set 0 NULL 0
velocity gbot set 0 NULL 0
</code></pre></p><p>
The setforce commands cancel the forces applied on the atoms of both edges during the whole simulation along \(x\) and \(z\), and the velocity commands cancel the initial velocities along \(x\) and \(z\). Therefore, the atoms of the edges will remain immobile during the simulation (if no other command is applied to them).
<br><br>
All the important commands have been written. In order to measure the strain and stress in the graphene sheet, let us extract the distance \(L\) between the two edges as well as the force applied on the edges. Let us also create a lammpstrj file containing the trajectories.
<pre><code>variable L equal xcm(gtop,x)-xcm(gbot,x)
fix at1 all ave/time 10 100 1000 v_L file length.dat
fix at2 all ave/time 10 100 1000 f_mysf1[1] f_mysf2[1] file force.dat
dump mydmp all atom 1000 dump.lammpstrj
</code></pre></p><p>
Notice that the values of the forces on each edge are extracted from the fixes mysf1 and mysf2. These fixes cancel all the forces on a group of atoms every timestep, but allow one to extract the values of the force before its cancellation. This is what we are doing here. Let us run a small equilibration step.
<pre><code>thermo 100
thermo_modify temp Tmid
# Run
timestep 1.0
run 5000
</code></pre></p><p>
When using the thermo_modify command, we specify to LAMMPS that we want the temperature \(T_\mathrm{mid}\) to be printed in the terminal, not the total temperature. Then, we perform a loop. At each step of the loop, the edges are slightly displaced, and the simulation runs for a short time.
<pre><code>variable var loop 10
label loop
displace_atoms gtop move 0.1 0 0
displace_atoms gbot move -0.1 0 0
run 1000
next var
jump input.lammps loop
</code></pre></p><p>
What you observe should resemble <a href="https://www.youtube.com/embed/o5IoCVWpPKg" target="_blank">this video</a>.
<p class="alert alert-info">Always remember that what you measure and observe is only as good as your force field.</p>
</div>
</section>
<br><br><br>
<section id="further">
<h2>Going further</h2>
<p>
<b>Carbon nanotube.</b> Using a similar procedure, you can generate a carbon nanotube (CNT) using VMD.
</p>
<p>
<b>Graphite.</b> Graphite is made of multiple layers of graphene separated by a distance of about 0.34 nm. You can use LAMMPS to replicate a graphene layer multiple times, and then impose deformation on a graphite. Deformations can be imposed both in the direction of the sheets, and normal to the sheets. You can then explore how the staking affects the mechanical properties of the graphene.
</p>
<p>
<b>Compression.</b> Simulating graphene under compression is a bit tricky because it bends, but it is still doable. You may have to use a few tricks to ensure that the graphene sheet remains aligned with the direction of the deformation, which is good training.
</p>
<p>
<b>Amorphous carbon.</b> Using the liquid quench method, you can generate nice amorphous structure of carbon. For that, a different force field allowing for the formation and breaking of bonds must be used.
</p>
<p class="alert alert-info">Support the creation of material for LAMMPS by subscribing to my <a href="https://www.youtube.com/channel/UCLmK_9wpyLVpcP7BPgN6BIw?view_as=subscriber" target="_blank">youtube</a> channel, or making a small <a href="https://en.tipeee.com/lammps-tutorials" target="_blank">donation here</a>, any amount would be really appreciated and would highly encourage me to improve this page.</p>
</section>
</div>
</div>
</div>
<!-- Content end -->
<!-- Footer
============================ -->
<footer id="footer" class="section">
<div class="container">
<p class="text-2 text-center mb-0">This template has been adapted from <a class="btn-link" target="_blank" href="http://www.harnishdesign.net/">HarnishDesign</a>.</p>
</div>
</footer>
<!-- Footer end -->
</div>
<!-- Document Wrapper end -->
<!-- Back To Top -->
<a id="back-to-top" data-toggle="tooltip" title="Back to Top" href="javascript:void(0)"><i class="fa fa-chevron-up"></i></a>
<!-- JavaScript
============================ -->
<script src="assets_tutorials/vendor/jquery/jquery.min.js"></script>
<script src="assets_tutorials/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Highlight JS -->
<script src="assets_tutorials/vendor/highlight.js/highlight.min.js"></script>
<!-- Easing -->
<script src="assets_tutorials/vendor/jquery.easing/jquery.easing.min.js"></script>
<!-- Magnific Popup -->
<script src="assets_tutorials/vendor/magnific-popup/jquery.magnific-popup.min.js"></script>
<!-- Custom Script -->
<script src="assets_tutorials/js/theme.js"></script>
</body>
</html>