@@ -140,15 +140,15 @@ Creating the GRO file
140
140
141
141
.. container :: justify
142
142
143
- Here we first define the basic parameters, such as
144
- the number of residues we want, or the box size, and
145
- initialize some lists and counters.
143
+ Here, we define some of the basic parameters of the simulation, such as
144
+ the number of residues and the box size.
145
+
146
+ .. container :: justify
146
147
147
148
Next to *molecule.py *, create a new Python file called
148
149
*generategro.py *, and copy the following lines into it:
149
150
150
151
.. code-block :: python
151
- :caption: * to be copied in generategro.py*
152
152
153
153
import numpy as np
154
154
from molecules import SO4_ion , Na_ion, H20_molecule
@@ -159,15 +159,18 @@ Creating the GRO file
159
159
160
160
.. container :: justify
161
161
162
- Here box is an array containing the box size along all 3 coordinates of space,
163
- respectively Lx, Ly, and Lz. Here a cubic box of lateral dimension 3.6 nm is used.
162
+ Here, *box * is an array containing the box size along all 3 coordinates of space,
163
+ respectively *Lx *, *Ly *, and *Lz *. A cubic box of lateral dimension
164
+ :math: `3.6 ~ \text {nm}` is used.
165
+
166
+ .. container :: justify
164
167
165
- Now, let us choose a salt concentration, and calculate the number of
168
+ Let us choose a salt concentration, and calculate the number of
166
169
ions and water molecules accordingly, while also choosing the total
167
- number of residues (here I call residue either a molecule or an ion):
170
+ number of residues (here I call residue either a molecule or an ion).
171
+ Add the following to *generategro.py *:
168
172
169
173
.. code-block :: python
170
- :caption: * to be copied in generategro.py*
171
174
172
175
Mh2o = 0.018053 # kg/mol - water
173
176
ntotal = 720 # total number of molecule
@@ -177,24 +180,22 @@ Creating the GRO file
177
180
178
181
.. container :: justify
179
182
180
- Let us also choose typical cutoff distances (in nanometer) for each species. These
181
- cutoffs will be used to ensure that no species are inserted too close
182
- from one another:
183
+ Let us also choose typical cutoff distances (in nanometer) for each
184
+ species. These cutoffs will be used to ensure that no species are inserted
185
+ too close from one another, as it would make the simulation crashed later :
183
186
184
187
.. code-block :: python
185
- :caption: * to be copied in generategro.py*
186
188
187
189
dSO4 = 0.45
188
190
dNa = 0.28
189
191
dSol = 0.28
190
192
191
193
.. container :: justify
192
194
193
- Let us initialized counters and lists for storing
194
- all the necessary data:
195
+ Let us initialized several counters and several lists. The lists will be
196
+ used for storing all the data about the atoms :
195
197
196
198
.. code-block :: python
197
- :caption: * to be copied in generategro.py*
198
199
199
200
cpt_residue = 0
200
201
cpt_atoms = 0
@@ -209,12 +210,11 @@ Creating the GRO file
209
210
210
211
.. container :: justify
211
212
212
- Let us add a number *nion * of :math: `\text {SO}_4 ^{2 -}` ions at random locations.
213
+ Let us first add a number *nion * of :math: `\text {SO}_4 ^{2 -}` ions at random locations.
213
214
To avoid overlap, let us only insert ion if no other ions is already located at
214
215
a distance closer than *dSO4 *:
215
216
216
217
.. code-block :: python
217
- :caption: * to be copied in generategro.py*
218
218
219
219
# add SO4 randomly
220
220
atpositions, attypes, resname, atnames = SO4_ion()
@@ -244,7 +244,6 @@ Creating the GRO file
244
244
and copy the following lines in it:
245
245
246
246
.. code-block :: python
247
- :caption: * to be copied in utils.py*
248
247
249
248
import numpy as np
250
249
from numpy.linalg import norm
@@ -274,10 +273,12 @@ Creating the GRO file
274
273
within the box. The *search_closest_neighbor * looks for the minimum distance
275
274
between existing atoms (if any) and the new residue.
276
275
277
- Let us do the same for the :math: `\text {Na}^{+}` ion :
276
+ .. container :: justify
277
+
278
+ Let us do the same for the :math: `\text {Na}^{+}`
279
+ ion :
278
280
279
281
.. code-block :: python
280
- :caption: * to be copied in generategro.py*
281
282
282
283
# Import the functions from the utils file
283
284
from utils import generate_random_location, search_closest_neighbor
@@ -309,7 +310,6 @@ Creating the GRO file
309
310
spacing of *dSol * (only if no overlap exists):
310
311
311
312
.. code-block :: python
312
- :caption: * to be copied in generategro.py*
313
313
314
314
# add water randomly
315
315
atpositions, attypes, resname, atnames = H20_molecule()
@@ -342,7 +342,6 @@ Creating the GRO file
342
342
actual concentration:
343
343
344
344
.. code-block :: python
345
- :caption: * to be copied in generategro.py*
346
345
347
346
print (' Lx = ' + str (Lx)+ ' nm, Ly = ' + str (Ly)+ ' nm, Lz = ' + str (Lz)+ ' nm' )
348
347
print (str (cpt_Na)+ ' Na ions' )
@@ -382,15 +381,13 @@ Creating the GRO file
382
381
f.write(" \n " )
383
382
f.close()
384
383
385
- .. include :: ../contact/supportme.rst
386
-
387
384
Final system
388
385
------------
389
386
390
387
.. container :: justify
391
388
392
389
Run the *generategro.py * file using Python.
393
- This is what I in the terminal:
390
+ This is what appear in the terminal:
394
391
395
392
.. code-block :: bw
396
393
@@ -403,8 +400,7 @@ Final system
403
400
404
401
.. container :: justify
405
402
406
- You can look at the final system using vmd (or any other MD visualization software)
407
- by typing in a terminal:
403
+ You can check the final system using VMD by typing in a terminal:
408
404
409
405
.. code-block :: bash
410
406
@@ -418,16 +414,15 @@ Final system
418
414
:alt: Gromacs tutorial - generated topology
419
415
:class: only-dark
420
416
417
+ .. container :: figurelegend
418
+
421
419
The primary system is located within the blue box. The replicated periodic
422
420
images are also represented.
423
421
424
422
.. container :: justify
425
423
426
- There is some vacuum left in the box. It is not a big problem and
427
- the initial configuration we created is good enough.
428
- The topology file *conf.gro * will be used as the initial
429
- configuration for the :ref: `bulk-solution-label ` tutorial.
430
-
424
+ There is some vacuum left in the box. It is not an issue as energy
425
+ minimization and molecular dynamics will help equilibrate the system.
431
426
432
427
Creating the TOP file
433
428
=====================
@@ -443,7 +438,6 @@ Creating the TOP file
443
438
Within the same Python script, write:
444
439
445
440
.. code-block :: python
446
- :caption: * to be copied in generategro.py*
447
441
448
442
# write topol.top
449
443
f = open (' topol.top' , ' w' )
@@ -459,31 +453,12 @@ Creating the TOP file
459
453
f.write(' SOL ' + str (cpt_Sol)+ ' \n ' )
460
454
f.close()
461
455
462
- .. container :: justify
463
-
464
- All the parameter files located in the *ff * folder
465
- will be written in the :ref: `create-topol-label ` tutorial.
466
-
467
- .. include :: ../contact/contactme.rst
468
-
469
456
Write parameters
470
457
----------------
471
458
472
- .. container :: hatnote
473
-
474
- Writing the topology file for GROMACS.
475
-
476
459
.. container :: justify
477
460
478
- The objective of this tutorial is to write
479
- the force field parameters (.itp files) for a simple system.
480
- If follows directly the writing of the gro file in :ref: `create-conf-label ` tutorial.
481
-
482
- The parameter files created here will be used in :ref: `bulk-solution-label `.
483
- If you are only interested in running GROMACS, jump directly
484
- to :ref: `bulk-solution-label `.
485
-
486
- .. include :: ../contact/needhelp.rst
461
+ Here, the force field parameters (i.e. the *.itp * files) are written.
487
462
488
463
Default parameters
489
464
------------------
@@ -494,7 +469,6 @@ Default parameters
494
469
*forcefield.itp *, and copy the following in it:
495
470
496
471
.. code-block :: bw
497
- :caption: *to be copied in ff/forcefield.itp*
498
472
499
473
[ defaults ]
500
474
; nbfunc comb-rule gen-pairs fudgeLJ fudgeQQ
@@ -522,18 +496,32 @@ Default parameters
522
496
The |forcefield.itp | file is used to define basic combination rules, as well as
523
497
atom types, bond types, and angle types.
524
498
499
+ .. |forcefield.itp | raw :: html
500
+
501
+ <a href="../../../../inputs/bulksolution/ff/forcefield.itp" target="_blank">forcefield.itp</a>
502
+
503
+ .. container :: justify
504
+
525
505
With comb-rule = 2, the mixing rule is calculated as
526
506
:math: `\epsilon _{ij} = \sqrt {\epsilon _{ii} \epsilon _{jj}}`,
527
507
:math: `\sigma _{ij} = (\sigma _{ii}+\sigma _{jj})/2 `.
528
508
FudgeLJ and fudgeQQ are the factors by which to multiply Lennard-Jones
529
509
and Coulomb 1-4 interactions, respectively.
530
510
You can refer to the |gromacs-manual | for more information.
531
511
512
+ .. |gromacs-manual | raw :: html
513
+
514
+ <a href="https://manual.gromacs.org/current/reference-manual/topologies/parameter-files.html" target="_blank">GROMACS manual</a>
515
+
516
+ .. container :: justify
517
+
532
518
The |forcefield.itp | file also contains information about the atoms,
533
519
such their masses and Lennard-Jones parameters sigma and epsilon,
534
520
as well as some parameters for the bond and angle constraints that will be
535
521
necessary for the SO4 ions.
536
522
523
+ .. container :: justify
524
+
537
525
Notice that the particle with name MW is of type 'D' when all the other particles
538
526
are of type 'A' for atoms. This is because MW is the virtual massless site of our 4 points
539
527
rigid water model, see this |tip4p-wiki | page for details.
@@ -542,19 +530,18 @@ Default parameters
542
530
543
531
<a href="http://www.sklogwiki.org/SklogWiki/index.php/TIP4P_model_of_water" target="_blank">wiki</a>
544
532
545
- .. |gromacs-manual | raw :: html
546
-
547
- <a href="https://manual.gromacs.org/current/reference-manual/topologies/parameter-files.html" target="_blank">GROMACS manual</a>
548
-
549
533
Sodium ion
550
534
----------
551
535
552
536
.. container :: justify
553
537
554
- Let us create a file named *na.itp * for the Sodium ion:
538
+ Let us create a file named *na.itp * for the Sodium ion (|na.itp |):
539
+
540
+ .. |na.itp | raw :: html
541
+
542
+ <a href="../../../../inputs/bulksolution/ff/na.itp" target="_blank">na.itp</a>
555
543
556
544
.. code-block :: bw
557
- :caption: *to be copied in ff/na.itp*
558
545
559
546
[ moleculetype ]
560
547
; molname nrexcl
@@ -574,15 +561,20 @@ Sulfate ion
574
561
575
562
.. container :: justify
576
563
577
- The file *so4.itp * for the sulfate ion is more complicated ,
564
+ The file *so4.itp * for the sulfate ion is more complex than the one for the sodium ion ,
578
565
as the residue is made of 5 atoms that are bonded together
579
- and maintained by angular constrained.
566
+ and maintained by angular constrained (|so4.itp |).
567
+
568
+ .. |so4.itp | raw :: html
569
+
570
+ <a href="../../../../inputs/bulksolution/ff/so4.itp" target="_blank">so4.itp</a>
571
+
572
+ .. container :: justify
580
573
581
574
The *exclusions * ensures that atoms from the same residue do not
582
575
interact through LJ and Coulomb interactions.
583
576
584
577
.. code-block :: bw
585
- :caption: *to be copied in ff/so4.itp*
586
578
587
579
[moleculetype]
588
580
; name nrexcl
@@ -619,19 +611,20 @@ Sulfate ion
619
611
4 1 2 3 5
620
612
5 1 2 3 4
621
613
622
- .. include :: ../contact/supportme.rst
623
-
624
614
Water molecule
625
615
--------------
626
616
627
617
.. container :: justify
628
618
629
- Finally, create a file named *h2o.itp * for the water molecule.
630
- Settle parameters are added to ensure that the residue remains
619
+ Finally, create a file named *h2o.itp * for the water molecule (| h2o.itp |) .
620
+ Settle parameters are added to ensure that the water molecule remains
631
621
rigid:
632
622
623
+ .. |h2o.itp | raw :: html
624
+
625
+ <a href="../../../../inputs/bulksolution/ff/h2o.itp" target="_blank">h2o.itp</a>
626
+
633
627
.. code-block :: bw
634
- :caption: *to be copied in ff/h2o.itp*
635
628
636
629
[ moleculetype ]
637
630
; molname nrexcl
@@ -658,25 +651,7 @@ Water molecule
658
651
3 1 2 4
659
652
4 1 2 3
660
653
661
- .. |forcefield.itp | raw :: html
662
-
663
- <a href="../../../../inputs/bulksolution/ff/forcefield.itp" target="_blank">forcefield.itp</a>
664
-
665
- .. |h2o.itp | raw :: html
666
-
667
- <a href="../../../../inputs/bulksolution/ff/h2o.itp" target="_blank">h2o.itp</a>
668
-
669
- .. |na.itp | raw :: html
670
-
671
- <a href="../../../../inputs/bulksolution/ff/na.itp" target="_blank">na.itp</a>
672
-
673
- .. |so4.itp | raw :: html
674
-
675
- <a href="../../../../inputs/bulksolution/ff/so4.itp" target="_blank">so4.itp</a>
676
-
677
654
.. container :: justify
678
655
679
656
To continue and use those files for running a molecular dynamics simulation
680
657
with GROMACS, go to :ref: `bulk-solution-label `.
681
-
682
- .. include :: ../contact/contactme.rst
0 commit comments