1 "Previous Section"_Section_accelerate.html - "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc - "Next Section"_Section_example.html :c
3 :link(lws,http://lammps.sandia.gov)
5 :link(lc,Section_commands.html#comm)
9 6. How-to discussions :h3
11 This section describes how to perform common tasks using LAMMPS.
13 6.1 "Restarting a simulation"_#howto_1
14 6.2 "2d simulations"_#howto_2
15 6.3 "CHARMM, AMBER, and DREIDING force fields"_#howto_3
16 6.4 "Running multiple simulations from one input script"_#howto_4
17 6.5 "Multi-replica simulations"_#howto_5
18 6.6 "Granular models"_#howto_6
19 6.7 "TIP3P water model"_#howto_7
20 6.8 "TIP4P water model"_#howto_8
21 6.9 "SPC water model"_#howto_9
22 6.10 "Coupling LAMMPS to other codes"_#howto_10
23 6.11 "Visualizing LAMMPS snapshots"_#howto_11
24 6.12 "Triclinic (non-orthogonal) simulation boxes"_#howto_12
25 6.13 "NEMD simulations"_#howto_13
26 6.14 "Finite-size spherical and aspherical particles"_#howto_14
27 6.15 "Output from LAMMPS (thermo, dumps, computes, fixes, variables)"_#howto_15
28 6.16 "Thermostatting, barostatting and computing temperature"_#howto_16
29 6.17 "Walls"_#howto_17
30 6.18 "Elastic constants"_#howto_18
31 6.19 "Library interface to LAMMPS"_#howto_19
32 6.20 "Calculating thermal conductivity"_#howto_20
33 6.21 "Calculating viscosity"_#howto_21
34 6.22 "Calculating a diffusion coefficient"_#howto_22
35 6.23 "Using chunks to calculate system properties"_#howto_23
36 6.24 "Setting parameters for the kspace_style pppm/disp command"_#howto_24
37 6.25 "Polarizable models"_#howto_25
38 6.26 "Adiabatic core/shell model"_#howto_26
39 6.27 "Drude induced dipoles"_#howto_27 :all(b)
41 The example input scripts included in the LAMMPS distribution and
42 highlighted in "Section 7"_Section_example.html also show how to
43 setup and run various kinds of simulations.
48 6.1 Restarting a simulation :link(howto_1),h4
50 There are 3 ways to continue a long LAMMPS simulation. Multiple
51 "run"_run.html commands can be used in the same input script. Each
52 run will continue from where the previous run left off. Or binary
53 restart files can be saved to disk using the "restart"_restart.html
54 command. At a later time, these binary files can be read via a
55 "read_restart"_read_restart.html command in a new script. Or they can
56 be converted to text data files using the "-r command-line
57 switch"_Section_start.html#start_7 and read by a
58 "read_data"_read_data.html command in a new script.
60 Here we give examples of 2 scripts that read either a binary restart
61 file or a converted data file and then issue a new run command to
62 continue where the previous run left off. They illustrate what
63 settings must be made in the new script. Details are discussed in the
64 documentation for the "read_restart"_read_restart.html and
65 "read_data"_read_data.html commands.
67 Look at the {in.chain} input script provided in the {bench} directory
68 of the LAMMPS distribution to see the original script that these 2
69 scripts are based on. If that script had the line
71 restart 50 tmp.restart :pre
73 added to it, it would produce 2 binary restart files (tmp.restart.50
74 and tmp.restart.100) as it ran.
76 This script could be used to read the 1st restart file and re-run the
79 read_restart tmp.restart.50 :pre
82 neigh_modify every 1 delay 1 :pre
85 fix 2 all langevin 1.0 1.0 10.0 904297 :pre
91 Note that the following commands do not need to be repeated because
92 their settings are included in the restart file: {units, atom_style,
93 special_bonds, pair_style, bond_style}. However these commands do
94 need to be used, since their settings are not in the restart file:
95 {neighbor, fix, timestep}.
97 If you actually use this script to perform a restarted run, you will
98 notice that the thermodynamic data match at step 50 (if you also put a
99 "thermo 50" command in the original script), but do not match at step
100 100. This is because the "fix langevin"_fix_langevin.html command
101 uses random numbers in a way that does not allow for perfect restarts.
103 As an alternate approach, the restart file could be converted to a data
106 lmp_g++ -r tmp.restart.50 tmp.restart.data :pre
108 Then, this script could be used to re-run the last 50 steps:
112 pair_style lj/cut 1.12
113 pair_modify shift yes
115 special_bonds 0.0 1.0 1.0 :pre
117 read_data tmp.restart.data :pre
120 neigh_modify every 1 delay 1 :pre
123 fix 2 all langevin 1.0 1.0 10.0 904297 :pre
130 Note that nearly all the settings specified in the original {in.chain}
131 script must be repeated, except the {pair_coeff} and {bond_coeff}
132 commands since the new data file lists the force field coefficients.
133 Also, the "reset_timestep"_reset_timestep.html command is used to tell
134 LAMMPS the current timestep. This value is stored in restart files,
135 but not in data files.
139 6.2 2d simulations :link(howto_2),h4
141 Use the "dimension"_dimension.html command to specify a 2d simulation.
143 Make the simulation box periodic in z via the "boundary"_boundary.html
144 command. This is the default.
146 If using the "create box"_create_box.html command to define a
147 simulation box, set the z dimensions narrow, but finite, so that the
148 create_atoms command will tile the 3d simulation box with a single z
149 plane of atoms - e.g.
151 "create box"_create_box.html 1 -10 10 -10 10 -0.25 0.25 :pre
153 If using the "read data"_read_data.html command to read in a file of
154 atom coordinates, set the "zlo zhi" values to be finite but narrow,
155 similar to the create_box command settings just described. For each
156 atom in the file, assign a z coordinate so it falls inside the
157 z-boundaries of the box - e.g. 0.0.
159 Use the "fix enforce2d"_fix_enforce2d.html command as the last
160 defined fix to insure that the z-components of velocities and forces
161 are zeroed out every timestep. The reason to make it the last fix is
162 so that any forces induced by other fixes will be zeroed out.
164 Many of the example input scripts included in the LAMMPS distribution
167 NOTE: Some models in LAMMPS treat particles as finite-size spheres, as
168 opposed to point particles. In 2d, the particles will still be
169 spheres, not disks, meaning their moment of inertia will be the same
174 6.3 CHARMM, AMBER, and DREIDING force fields :link(howto_3),h4
176 A force field has 2 parts: the formulas that define it and the
177 coefficients used for a particular system. Here we only discuss
178 formulas implemented in LAMMPS that correspond to formulas commonly
179 used in the CHARMM, AMBER, and DREIDING force fields. Setting
180 coefficients is done in the input data file via the
181 "read_data"_read_data.html command or in the input script with
182 commands like "pair_coeff"_pair_coeff.html or
183 "bond_coeff"_bond_coeff.html. See "Section 9"_Section_tools.html
184 for additional tools that can use CHARMM or AMBER to assign force
185 field coefficients and convert their output into LAMMPS input.
187 See "(MacKerell)"_#howto-MacKerell for a description of the CHARMM force
188 field. See "(Cornell)"_#howto-Cornell for a description of the AMBER force
191 :link(charmm,http://www.scripps.edu/brooks)
192 :link(amber,http://amber.scripps.edu)
194 These style choices compute force field formulas that are consistent
195 with common options in CHARMM or AMBER. See each command's
196 documentation for the formula it computes.
198 "bond_style"_bond_harmonic.html harmonic
199 "angle_style"_angle_charmm.html charmm
200 "dihedral_style"_dihedral_charmm.html charmm
201 "pair_style"_pair_charmm.html lj/charmm/coul/charmm
202 "pair_style"_pair_charmm.html lj/charmm/coul/charmm/implicit
203 "pair_style"_pair_charmm.html lj/charmm/coul/long :ul
205 "special_bonds"_special_bonds.html charmm
206 "special_bonds"_special_bonds.html amber :ul
208 DREIDING is a generic force field developed by the "Goddard
209 group"_http://www.wag.caltech.edu at Caltech and is useful for
210 predicting structures and dynamics of organic, biological and
211 main-group inorganic molecules. The philosophy in DREIDING is to use
212 general force constants and geometry parameters based on simple
213 hybridization considerations, rather than individual force constants
214 and geometric parameters that depend on the particular combinations of
215 atoms involved in the bond, angle, or torsion terms. DREIDING has an
216 "explicit hydrogen bond term"_pair_hbond_dreiding.html to describe
217 interactions involving a hydrogen atom on very electronegative atoms
220 See "(Mayo)"_#howto-Mayo for a description of the DREIDING force field
222 These style choices compute force field formulas that are consistent
223 with the DREIDING force field. See each command's
224 documentation for the formula it computes.
226 "bond_style"_bond_harmonic.html harmonic
227 "bond_style"_bond_morse.html morse :ul
229 "angle_style"_angle_harmonic.html harmonic
230 "angle_style"_angle_cosine.html cosine
231 "angle_style"_angle_cosine_periodic.html cosine/periodic :ul
233 "dihedral_style"_dihedral_charmm.html charmm
234 "improper_style"_improper_umbrella.html umbrella :ul
236 "pair_style"_pair_buck.html buck
237 "pair_style"_pair_buck.html buck/coul/cut
238 "pair_style"_pair_buck.html buck/coul/long
239 "pair_style"_pair_lj.html lj/cut
240 "pair_style"_pair_lj.html lj/cut/coul/cut
241 "pair_style"_pair_lj.html lj/cut/coul/long :ul
243 "pair_style"_pair_hbond_dreiding.html hbond/dreiding/lj
244 "pair_style"_pair_hbond_dreiding.html hbond/dreiding/morse :ul
246 "special_bonds"_special_bonds.html dreiding :ul
250 6.4 Running multiple simulations from one input script :link(howto_4),h4
252 This can be done in several ways. See the documentation for
253 individual commands for more details on how these examples work.
255 If "multiple simulations" means continue a previous simulation for
256 more timesteps, then you simply use the "run"_run.html command
257 multiple times. For example, this script
268 would run 5 successive simulations of the same system for a total of
271 If you wish to run totally different simulations, one after the other,
272 the "clear"_clear.html command can be used in between them to
273 re-initialize LAMMPS. For example, this script
282 read_data data.lj.new
285 would run 2 independent simulations, one after the other.
287 For large numbers of independent simulations, you can use
288 "variables"_variable.html and the "next"_next.html and
289 "jump"_jump.html commands to loop over the same input script
290 multiple times with different settings. For example, this
291 script, named in.polymer
293 variable d index run1 run2 run3 run4 run5 run6 run7 run8
295 read_data data.polymer
302 would run 8 simulations in different directories, using a data.polymer
303 file in each directory. The same concept could be used to run the
304 same system at 8 different temperatures, using a temperature variable
305 and storing the output in different log and dump files, for example
308 variable t index 0.8 0.85 0.9 0.95 1.0 1.05 1.1 1.15
311 velocity all create $t 352839
312 fix 1 all nvt $t $t 100.0
313 dump 1 all atom 1000 dump.$a
320 All of the above examples work whether you are running on 1 or
321 multiple processors, but assumed you are running LAMMPS on a single
322 partition of processors. LAMMPS can be run on multiple partitions via
323 the "-partition" command-line switch as described in "this
324 section"_Section_start.html#start_7 of the manual.
326 In the last 2 examples, if LAMMPS were run on 3 partitions, the same
327 scripts could be used if the "index" and "loop" variables were
328 replaced with {universe}-style variables, as described in the
329 "variable"_variable.html command. Also, the "next t" and "next a"
330 commands would need to be replaced with a single "next a t" command.
331 With these modifications, the 8 simulations of each script would run
332 on the 3 partitions one after the other until all were finished.
333 Initially, 3 simulations would be started simultaneously, one on each
334 partition. When one finished, that partition would then start
335 the 4th simulation, and so forth, until all 8 were completed.
339 6.5 Multi-replica simulations :link(howto_5),h4
341 Several commands in LAMMPS run mutli-replica simulations, meaning
342 that multiple instances (replicas) of your simulation are run
343 simultaneously, with small amounts of data exchanged between replicas
346 These are the relevant commands:
348 "neb"_neb.html for nudged elastic band calculations
349 "prd"_prd.html for parallel replica dynamics
350 "tad"_tad.html for temperature accelerated dynamics
351 "temper"_temper.html for parallel tempering
352 "fix pimd"_fix_pimd.html for path-integral molecular dynamics (PIMD) :ul
354 NEB is a method for finding transition states and barrier energies.
355 PRD and TAD are methods for performing accelerated dynamics to find
356 and perform infrequent events. Parallel tempering or replica exchange
357 runs different replicas at a series of temperature to facilitate
360 These commands can only be used if LAMMPS was built with the REPLICA
361 package. See the "Making LAMMPS"_Section_start.html#start_3 section
362 for more info on packages.
364 PIMD runs different replicas whose individual particles are coupled
365 together by springs to model a system or ring-polymers.
367 This commands can only be used if LAMMPS was built with the USER-MISC
368 package. See the "Making LAMMPS"_Section_start.html#start_3 section
369 for more info on packages.
371 In all these cases, you must run with one or more processors per
372 replica. The processors assigned to each replica are determined at
373 run-time by using the "-partition command-line
374 switch"_Section_start.html#start_7 to launch LAMMPS on multiple
375 partitions, which in this context are the same as replicas. E.g.
378 mpirun -np 16 lmp_linux -partition 8x2 -in in.temper
379 mpirun -np 8 lmp_linux -partition 8x1 -in in.neb :pre
381 would each run 8 replicas, on either 16 or 8 processors. Note the use
382 of the "-in command-line switch"_Section_start.html#start_7 to specify
383 the input script which is required when running in multi-replica mode.
385 Also note that with MPI installed on a machine (e.g. your desktop),
386 you can run on more (virtual) processors than you have physical
387 processors. Thus the above commands could be run on a
388 single-processor (or few-processor) desktop so that you can run
389 a multi-replica simulation on more replicas than you have
394 6.6 Granular models :link(howto_6),h4
396 Granular system are composed of spherical particles with a diameter,
397 as opposed to point particles. This means they have an angular
398 velocity and torque can be imparted to them to cause them to rotate.
400 To run a simulation of a granular model, you will want to use
401 the following commands:
403 "atom_style sphere"_atom_style.html
404 "fix nve/sphere"_fix_nve_sphere.html
405 "fix gravity"_fix_gravity.html :ul
409 "compute erotate/sphere"_compute_erotate_sphere.html :ul
411 calculates rotational kinetic energy which can be "output with
412 thermodynamic info"_Section_howto.html#howto_15.
414 Use one of these 3 pair potentials, which compute forces and torques
415 between interacting pairs of particles:
417 "pair_style"_pair_style.html gran/history
418 "pair_style"_pair_style.html gran/no_history
419 "pair_style"_pair_style.html gran/hertzian :ul
421 These commands implement fix options specific to granular systems:
423 "fix freeze"_fix_freeze.html
424 "fix pour"_fix_pour.html
425 "fix viscous"_fix_viscous.html
426 "fix wall/gran"_fix_wall_gran.html :ul
428 The fix style {freeze} zeroes both the force and torque of frozen
429 atoms, and should be used for granular system instead of the fix style
432 For computational efficiency, you can eliminate needless pairwise
433 computations between frozen atoms by using this command:
435 "neigh_modify"_neigh_modify.html exclude :ul
439 6.7 TIP3P water model :link(howto_7),h4
441 The TIP3P water model as implemented in CHARMM
442 "(MacKerell)"_#howto-MacKerell specifies a 3-site rigid water molecule with
443 charges and Lennard-Jones parameters assigned to each of the 3 atoms.
444 In LAMMPS the "fix shake"_fix_shake.html command can be used to hold
445 the two O-H bonds and the H-O-H angle rigid. A bond style of
446 {harmonic} and an angle style of {harmonic} or {charmm} should also be
449 These are the additional parameters (in real units) to set for O and H
450 atoms and the water molecule to run a rigid TIP3P-CHARMM model with a
451 cutoff. The K values can be used if a flexible TIP3P model (without
452 fix shake) is desired. If the LJ epsilon and sigma for HH and OH are
453 set to 0.0, it corresponds to the original 1983 TIP3P model
454 "(Jorgensen)"_#Jorgensen.
460 LJ epsilon of OO = 0.1521
461 LJ sigma of OO = 3.1507
462 LJ epsilon of HH = 0.0460
463 LJ sigma of HH = 0.4000
464 LJ epsilon of OH = 0.0836
465 LJ sigma of OH = 1.7753
467 r0 of OH bond = 0.9572
469 theta of HOH angle = 104.52 :all(b),p
471 These are the parameters to use for TIP3P with a long-range Coulombic
472 solver (e.g. Ewald or PPPM in LAMMPS), see "(Price)"_#Price for
479 LJ epsilon of OO = 0.102
480 LJ sigma of OO = 3.188
481 LJ epsilon, sigma of OH, HH = 0.0
483 r0 of OH bond = 0.9572
485 theta of HOH angle = 104.52 :all(b),p
487 Wikipedia also has a nice article on "water
488 models"_http://en.wikipedia.org/wiki/Water_model.
492 6.8 TIP4P water model :link(howto_8),h4
494 The four-point TIP4P rigid water model extends the traditional
495 three-point TIP3P model by adding an additional site, usually
496 massless, where the charge associated with the oxygen atom is placed.
497 This site M is located at a fixed distance away from the oxygen along
498 the bisector of the HOH bond angle. A bond style of {harmonic} and an
499 angle style of {harmonic} or {charmm} should also be used.
501 A TIP4P model is run with LAMMPS using either this command
504 "pair_style lj/cut/tip4p/cut"_pair_lj.html
506 or these two commands for a long-range model:
508 "pair_style lj/cut/tip4p/long"_pair_lj.html
509 "kspace_style pppm/tip4p"_kspace_style.html :ul
511 For both models, the bond lengths and bond angles should be held fixed
512 using the "fix shake"_fix_shake.html command.
514 These are the additional parameters (in real units) to set for O and H
515 atoms and the water molecule to run a rigid TIP4P model with a cutoff
516 "(Jorgensen)"_#Jorgensen. Note that the OM distance is specified in
517 the "pair_style"_pair_style.html command, not as part of the pair
524 r0 of OH bond = 0.9572
525 theta of HOH angle = 104.52
527 LJ epsilon of O-O = 0.1550
528 LJ sigma of O-O = 3.1536
529 LJ epsilon, sigma of OH, HH = 0.0
530 Coulombic cutoff = 8.5 :all(b),p
532 For the TIP4/Ice model (J Chem Phys, 122, 234511 (2005);
533 http://dx.doi.org/10.1063/1.1931662) these values can be used:
539 r0 of OH bond = 0.9572
540 theta of HOH angle = 104.52
542 LJ epsilon of O-O = 0.21084
543 LJ sigma of O-O = 3.1668
544 LJ epsilon, sigma of OH, HH = 0.0
545 Coulombic cutoff = 8.5 :all(b),p
547 For the TIP4P/2005 model (J Chem Phys, 123, 234505 (2005);
548 http://dx.doi.org/10.1063/1.2121687), these values can be used:
554 r0 of OH bond = 0.9572
555 theta of HOH angle = 104.52
557 LJ epsilon of O-O = 0.1852
558 LJ sigma of O-O = 3.1589
559 LJ epsilon, sigma of OH, HH = 0.0
560 Coulombic cutoff = 8.5 :all(b),p
562 These are the parameters to use for TIP4P with a long-range Coulombic
563 solver (e.g. Ewald or PPPM in LAMMPS):
569 r0 of OH bond = 0.9572
570 theta of HOH angle = 104.52
572 LJ epsilon of O-O = 0.16275
573 LJ sigma of O-O = 3.16435
574 LJ epsilon, sigma of OH, HH = 0.0 :all(b),p
576 Note that the when using the TIP4P pair style, the neighobr list
577 cutoff for Coulomb interactions is effectively extended by a distance
578 2 * (OM distance), to account for the offset distance of the
579 fictitious charges on O atoms in water molecules. Thus it is
580 typically best in an efficiency sense to use a LJ cutoff >= Coulomb
581 cutoff + 2*(OM distance), to shrink the size of the neighbor list.
582 This leads to slightly larger cost for the long-range calculation, so
583 you can test the trade-off for your model. The OM distance and the LJ
584 and Coulombic cutoffs are set in the "pair_style
585 lj/cut/tip4p/long"_pair_lj.html command.
587 Wikipedia also has a nice article on "water
588 models"_http://en.wikipedia.org/wiki/Water_model.
592 6.9 SPC water model :link(howto_9),h4
594 The SPC water model specifies a 3-site rigid water molecule with
595 charges and Lennard-Jones parameters assigned to each of the 3 atoms.
596 In LAMMPS the "fix shake"_fix_shake.html command can be used to hold
597 the two O-H bonds and the H-O-H angle rigid. A bond style of
598 {harmonic} and an angle style of {harmonic} or {charmm} should also be
601 These are the additional parameters (in real units) to set for O and H
602 atoms and the water molecule to run a rigid SPC model.
608 LJ epsilon of OO = 0.1553
609 LJ sigma of OO = 3.166
610 LJ epsilon, sigma of OH, HH = 0.0
612 theta of HOH angle = 109.47 :all(b),p
614 Note that as originally proposed, the SPC model was run with a 9
615 Angstrom cutoff for both LJ and Coulommbic terms. It can also be used
616 with long-range Coulombics (Ewald or PPPM in LAMMPS), without changing
617 any of the parameters above, though it becomes a different model in
620 The SPC/E (extended) water model is the same, except
621 the partial charge assignemnts change:
624 H charge = 0.4238 :all(b),p
626 See the "(Berendsen)"_#howto-Berendsen reference for more details on both
627 the SPC and SPC/E models.
629 Wikipedia also has a nice article on "water
630 models"_http://en.wikipedia.org/wiki/Water_model.
634 6.10 Coupling LAMMPS to other codes :link(howto_10),h4
636 LAMMPS is designed to allow it to be coupled to other codes. For
637 example, a quantum mechanics code might compute forces on a subset of
638 atoms and pass those forces to LAMMPS. Or a continuum finite element
639 (FE) simulation might use atom positions as boundary conditions on FE
640 nodal points, compute a FE solution, and return interpolated forces on
643 LAMMPS can be coupled to other codes in at least 3 ways. Each has
644 advantages and disadvantages, which you'll have to think about in the
645 context of your application.
647 (1) Define a new "fix"_fix.html command that calls the other code. In
648 this scenario, LAMMPS is the driver code. During its timestepping,
649 the fix is invoked, and can make library calls to the other code,
650 which has been linked to LAMMPS as a library. This is the way the
651 "POEMS"_poems package that performs constrained rigid-body motion on
652 groups of atoms is hooked to LAMMPS. See the
653 "fix poems"_fix_poems.html command for more details. See "this
654 section"_Section_modify.html of the documentation for info on how to add
657 :link(poems,http://www.rpi.edu/~anderk5/lab)
659 (2) Define a new LAMMPS command that calls the other code. This is
660 conceptually similar to method (1), but in this case LAMMPS and the
661 other code are on a more equal footing. Note that now the other code
662 is not called during the timestepping of a LAMMPS run, but between
663 runs. The LAMMPS input script can be used to alternate LAMMPS runs
664 with calls to the other code, invoked via the new command. The
665 "run"_run.html command facilitates this with its {every} option, which
666 makes it easy to run a few steps, invoke the command, run a few steps,
667 invoke the command, etc.
669 In this scenario, the other code can be called as a library, as in
670 (1), or it could be a stand-alone code, invoked by a system() call
671 made by the command (assuming your parallel machine allows one or more
672 processors to start up another program). In the latter case the
673 stand-alone code could communicate with LAMMPS thru files that the
674 command writes and reads.
676 See "Section 10"_Section_modify.html of the documentation for how
677 to add a new command to LAMMPS.
679 (3) Use LAMMPS as a library called by another code. In this case the
680 other code is the driver and calls LAMMPS as needed. Or a wrapper
681 code could link and call both LAMMPS and another code as libraries.
682 Again, the "run"_run.html command has options that allow it to be
683 invoked with minimal overhead (no setup or clean-up) if you wish to do
684 multiple short runs, driven by another program.
686 Examples of driver codes that call LAMMPS as a library are included in
687 the examples/COUPLE directory of the LAMMPS distribution; see
688 examples/COUPLE/README for more details:
690 simple: simple driver programs in C++ and C which invoke LAMMPS as a
693 lammps_quest: coupling of LAMMPS and "Quest"_quest, to run classical
694 MD with quantum forces calculated by a density functional code :l
696 lammps_spparks: coupling of LAMMPS and "SPPARKS"_spparks, to couple
697 a kinetic Monte Carlo model for grain growth using MD to calculate
698 strain induced across grain boundaries :l
701 :link(quest,http://dft.sandia.gov/Quest)
702 :link(spparks,http://www.sandia.gov/~sjplimp/spparks.html)
704 "This section"_Section_start.html#start_5 of the documentation
705 describes how to build LAMMPS as a library. Once this is done, you
706 can interface with LAMMPS either via C++, C, Fortran, or Python (or
707 any other language that supports a vanilla C-like interface). For
708 example, from C++ you could create one (or more) "instances" of
709 LAMMPS, pass it an input script to process, or execute individual
710 commands, all by invoking the correct class methods in LAMMPS. From C
711 or Fortran you can make function calls to do the same things. See
712 "Section 11"_Section_python.html of the manual for a description
713 of the Python wrapper provided with LAMMPS that operates through the
714 LAMMPS library interface.
716 The files src/library.cpp and library.h contain the C-style interface
717 to LAMMPS. See "Section 6.19"_Section_howto.html#howto_19 of the
718 manual for a description of the interface and how to extend it for
721 Note that the lammps_open() function that creates an instance of
722 LAMMPS takes an MPI communicator as an argument. This means that
723 instance of LAMMPS will run on the set of processors in the
724 communicator. Thus the calling code can run LAMMPS on all or a subset
725 of processors. For example, a wrapper script might decide to
726 alternate between LAMMPS and another code, allowing them both to run
727 on all the processors. Or it might allocate half the processors to
728 LAMMPS and half to the other code and run both codes simultaneously
729 before syncing them up periodically. Or it might instantiate multiple
730 instances of LAMMPS to perform different calculations.
734 6.11 Visualizing LAMMPS snapshots :link(howto_11),h4
736 LAMMPS itself does not do visualization, but snapshots from LAMMPS
737 simulations can be visualized (and analyzed) in a variety of ways.
739 LAMMPS snapshots are created by the "dump"_dump.html command which can
740 create files in several formats. The native LAMMPS dump format is a
741 text file (see "dump atom" or "dump custom") which can be visualized
742 by the "xmovie"_Section_tools.html#xmovie program, included with the
743 LAMMPS package. This produces simple, fast 2d projections of 3d
744 systems, and can be useful for rapid debugging of simulation geometry
745 and atom trajectories.
747 Several programs included with LAMMPS as auxiliary tools can convert
748 native LAMMPS dump files to other formats. See the
749 "Section 9"_Section_tools.html doc page for details. The first is
750 the "ch2lmp tool"_Section_tools.html#charmm, which contains a
751 lammps2pdb Perl script which converts LAMMPS dump files into PDB
752 files. The second is the "lmp2arc tool"_Section_tools.html#arc which
753 converts LAMMPS dump files into Accelrys' Insight MD program files.
754 The third is the "lmp2cfg tool"_Section_tools.html#cfg which converts
755 LAMMPS dump files into CFG files which can be read into the
756 "AtomEye"_atomeye visualizer.
758 A Python-based toolkit distributed by our group can read native LAMMPS
759 dump files, including custom dump files with additional columns of
760 user-specified atom information, and convert them to various formats
761 or pipe them into visualization software directly. See the "Pizza.py
762 WWW site"_pizza for details. Specifically, Pizza.py can convert
763 LAMMPS dump files into PDB, XYZ, "Ensight"_ensight, and VTK formats.
764 Pizza.py can pipe LAMMPS dump files directly into the Raster3d and
765 RasMol visualization programs. Pizza.py has tools that do interactive
766 3d OpenGL visualization and one that creates SVG images of dump file
769 LAMMPS can create XYZ files directly (via "dump xyz") which is a
770 simple text-based file format used by many visualization programs
773 LAMMPS can create DCD files directly (via "dump dcd") which can be
774 read by "VMD"_vmd in conjunction with a CHARMM PSF file. Using this
775 form of output avoids the need to convert LAMMPS snapshots to PDB
776 files. See the "dump"_dump.html command for more information on DCD
779 LAMMPS can create XTC files directly (via "dump xtc") which is GROMACS
780 file format which can also be read by "VMD"_vmd for visualization.
781 See the "dump"_dump.html command for more information on XTC files.
783 :link(pizza,http://www.sandia.gov/~sjplimp/pizza.html)
784 :link(vmd,http://www.ks.uiuc.edu/Research/vmd)
785 :link(ensight,http://www.ensight.com)
786 :link(atomeye,http://mt.seas.upenn.edu/Archive/Graphics/A)
790 6.12 Triclinic (non-orthogonal) simulation boxes :link(howto_12),h4
792 By default, LAMMPS uses an orthogonal simulation box to encompass the
793 particles. The "boundary"_boundary.html command sets the boundary
794 conditions of the box (periodic, non-periodic, etc). The orthogonal
795 box has its "origin" at (xlo,ylo,zlo) and is defined by 3 edge vectors
796 starting from the origin given by [a] = (xhi-xlo,0,0); [b] =
797 (0,yhi-ylo,0); [c] = (0,0,zhi-zlo). The 6 parameters
798 (xlo,xhi,ylo,yhi,zlo,zhi) are defined at the time the simulation box
799 is created, e.g. by the "create_box"_create_box.html or
800 "read_data"_read_data.html or "read_restart"_read_restart.html
801 commands. Additionally, LAMMPS defines box size parameters lx,ly,lz
802 where lx = xhi-xlo, and similarly in the y and z dimensions. The 6
803 parameters, as well as lx,ly,lz, can be output via the "thermo_style
804 custom"_thermo_style.html command.
806 LAMMPS also allows simulations to be performed in triclinic
807 (non-orthogonal) simulation boxes shaped as a parallelepiped with
808 triclinic symmetry. The parallelepiped has its "origin" at
809 (xlo,ylo,zlo) and is defined by 3 edge vectors starting from the
810 origin given by [a] = (xhi-xlo,0,0); [b] = (xy,yhi-ylo,0); [c] =
811 (xz,yz,zhi-zlo). {xy,xz,yz} can be 0.0 or positive or negative values
812 and are called "tilt factors" because they are the amount of
813 displacement applied to faces of an originally orthogonal box to
814 transform it into the parallelepiped. In LAMMPS the triclinic
815 simulation box edge vectors [a], [b], and [c] cannot be arbitrary
816 vectors. As indicated, [a] must lie on the positive x axis. [b] must
817 lie in the xy plane, with strictly positive y component. [c] may have
818 any orientation with strictly positive z component. The requirement
819 that [a], [b], and [c] have strictly positive x, y, and z components,
820 respectively, ensures that [a], [b], and [c] form a complete
821 right-handed basis. These restrictions impose no loss of generality,
822 since it is possible to rotate/invert any set of 3 crystal basis
823 vectors so that they conform to the restrictions.
825 For example, assume that the 3 vectors [A],[B],[C] are the edge
826 vectors of a general parallelepiped, where there is no restriction on
827 [A],[B],[C] other than they form a complete right-handed basis i.e.
828 [A] x [B] . [C] > 0. The equivalent LAMMPS [a],[b],[c] are a linear
829 rotation of [A], [B], and [C] and can be computed as follows:
831 :c,image(Eqs/transform.jpg)
833 where A = | [A] | indicates the scalar length of [A]. The hat symbol (^)
834 indicates the corresponding unit vector. {beta} and {gamma} are angles
835 between the vectors described below. Note that by construction,
836 [a], [b], and [c] have strictly positive x, y, and z components, respectively.
837 If it should happen that
838 [A], [B], and [C] form a left-handed basis, then the above equations
839 are not valid for [c]. In this case, it is necessary
840 to first apply an inversion. This can be achieved
841 by interchanging two basis vectors or by changing the sign of one of them.
843 For consistency, the same rotation/inversion applied to the basis vectors
844 must also be applied to atom positions, velocities,
845 and any other vector quantities.
846 This can be conveniently achieved by first converting to
847 fractional coordinates in the
848 old basis and then converting to distance coordinates in the new basis.
849 The transformation is given by the following equation:
851 :c,image(Eqs/rotate.jpg)
853 where {V} is the volume of the box, [X] is the original vector quantity and
854 [x] is the vector in the LAMMPS basis.
856 There is no requirement that a triclinic box be periodic in any
857 dimension, though it typically should be in at least the 2nd dimension
858 of the tilt (y in xy) if you want to enforce a shift in periodic
859 boundary conditions across that boundary. Some commands that work
860 with triclinic boxes, e.g. the "fix deform"_fix_deform.html and "fix
861 npt"_fix_nh.html commands, require periodicity or non-shrink-wrap
862 boundary conditions in specific dimensions. See the command doc pages
865 The 9 parameters (xlo,xhi,ylo,yhi,zlo,zhi,xy,xz,yz) are defined at the
866 time the simluation box is created. This happens in one of 3 ways.
867 If the "create_box"_create_box.html command is used with a region of
868 style {prism}, then a triclinic box is setup. See the
869 "region"_region.html command for details. If the
870 "read_data"_read_data.html command is used to define the simulation
871 box, and the header of the data file contains a line with the "xy xz
872 yz" keyword, then a triclinic box is setup. See the
873 "read_data"_read_data.html command for details. Finally, if the
874 "read_restart"_read_restart.html command reads a restart file which
875 was written from a simulation using a triclinic box, then a triclinic
876 box will be setup for the restarted simulation.
878 Note that you can define a triclinic box with all 3 tilt factors =
879 0.0, so that it is initially orthogonal. This is necessary if the box
880 will become non-orthogonal, e.g. due to the "fix npt"_fix_nh.html or
881 "fix deform"_fix_deform.html commands. Alternatively, you can use the
882 "change_box"_change_box.html command to convert a simulation box from
883 orthogonal to triclinic and vice versa.
885 As with orthogonal boxes, LAMMPS defines triclinic box size parameters
886 lx,ly,lz where lx = xhi-xlo, and similarly in the y and z dimensions.
887 The 9 parameters, as well as lx,ly,lz, can be output via the
888 "thermo_style custom"_thermo_style.html command.
890 To avoid extremely tilted boxes (which would be computationally
891 inefficient), LAMMPS normally requires that no tilt factor can skew
892 the box more than half the distance of the parallel box length, which
893 is the 1st dimension in the tilt factor (x for xz). This is required
894 both when the simulation box is created, e.g. via the
895 "create_box"_create_box.html or "read_data"_read_data.html commands,
896 as well as when the box shape changes dynamically during a simulation,
897 e.g. via the "fix deform"_fix_deform.html or "fix npt"_fix_nh.html
900 For example, if xlo = 2 and xhi = 12, then the x box length is 10 and
901 the xy tilt factor must be between -5 and 5. Similarly, both xz and
902 yz must be between -(xhi-xlo)/2 and +(yhi-ylo)/2. Note that this is
903 not a limitation, since if the maximum tilt factor is 5 (as in this
904 example), then configurations with tilt = ..., -15, -5, 5, 15, 25,
905 ... are geometrically all equivalent. If the box tilt exceeds this
906 limit during a dynamics run (e.g. via the "fix deform"_fix_deform.html
907 command), then the box is "flipped" to an equivalent shape with a tilt
908 factor within the bounds, so the run can continue. See the "fix
909 deform"_fix_deform.html doc page for further details.
911 One exception to this rule is if the 1st dimension in the tilt
912 factor (x for xy) is non-periodic. In that case, the limits on the
913 tilt factor are not enforced, since flipping the box in that dimension
914 does not change the atom positions due to non-periodicity. In this
915 mode, if you tilt the system to extreme angles, the simulation will
916 simply become inefficient, due to the highly skewed simulation box.
918 The limitation on not creating a simulation box with a tilt factor
919 skewing the box more than half the distance of the parallel box length
920 can be overridden via the "box"_box.html command. Setting the {tilt}
921 keyword to {large} allows any tilt factors to be specified.
923 Box flips that may occur using the "fix deform"_fix_deform.html or
924 "fix npt"_fix_nh.html commands can be turned off using the {flip no}
925 option with either of the commands.
927 Note that if a simulation box has a large tilt factor, LAMMPS will run
928 less efficiently, due to the large volume of communication needed to
929 acquire ghost atoms around a processor's irregular-shaped sub-domain.
930 For extreme values of tilt, LAMMPS may also lose atoms and generate an
933 Triclinic crystal structures are often defined using three lattice
934 constants {a}, {b}, and {c}, and three angles {alpha}, {beta} and
935 {gamma}. Note that in this nomenclature, the a, b, and c lattice
936 constants are the scalar lengths of the edge vectors [a], [b], and [c]
937 defined above. The relationship between these 6 quantities
938 (a,b,c,alpha,beta,gamma) and the LAMMPS box sizes (lx,ly,lz) =
939 (xhi-xlo,yhi-ylo,zhi-zlo) and tilt factors (xy,xz,yz) is as follows:
941 :c,image(Eqs/box.jpg)
943 The inverse relationship can be written as follows:
945 :c,image(Eqs/box_inverse.jpg)
947 The values of {a}, {b}, {c} , {alpha}, {beta} , and {gamma} can be printed
948 out or accessed by computes using the
949 "thermo_style custom"_thermo_style.html keywords
950 {cella}, {cellb}, {cellc}, {cellalpha}, {cellbeta}, {cellgamma},
953 As discussed on the "dump"_dump.html command doc page, when the BOX
954 BOUNDS for a snapshot is written to a dump file for a triclinic box,
955 an orthogonal bounding box which encloses the triclinic simulation box
956 is output, along with the 3 tilt factors (xy, xz, yz) of the triclinic
957 box, formatted as follows:
959 ITEM: BOX BOUNDS xy xz yz
960 xlo_bound xhi_bound xy
961 ylo_bound yhi_bound xz
962 zlo_bound zhi_bound yz :pre
964 This bounding box is convenient for many visualization programs and is
965 calculated from the 9 triclinic box parameters
966 (xlo,xhi,ylo,yhi,zlo,zhi,xy,xz,yz) as follows:
968 xlo_bound = xlo + MIN(0.0,xy,xz,xy+xz)
969 xhi_bound = xhi + MAX(0.0,xy,xz,xy+xz)
970 ylo_bound = ylo + MIN(0.0,yz)
971 yhi_bound = yhi + MAX(0.0,yz)
975 These formulas can be inverted if you need to convert the bounding box
976 back into the triclinic box parameters, e.g. xlo = xlo_bound -
977 MIN(0.0,xy,xz,xy+xz).
979 One use of triclinic simulation boxes is to model solid-state crystals
980 with triclinic symmetry. The "lattice"_lattice.html command can be
981 used with non-orthogonal basis vectors to define a lattice that will
982 tile a triclinic simulation box via the
983 "create_atoms"_create_atoms.html command.
985 A second use is to run Parinello-Rahman dyanamics via the "fix
986 npt"_fix_nh.html command, which will adjust the xy, xz, yz tilt
987 factors to compensate for off-diagonal components of the pressure
988 tensor. The analalog for an "energy minimization"_minimize.html is
989 the "fix box/relax"_fix_box_relax.html command.
991 A third use is to shear a bulk solid to study the response of the
992 material. The "fix deform"_fix_deform.html command can be used for
993 this purpose. It allows dynamic control of the xy, xz, yz tilt
994 factors as a simulation runs. This is discussed in the next section
995 on non-equilibrium MD (NEMD) simulations.
999 6.13 NEMD simulations :link(howto_13),h4
1001 Non-equilibrium molecular dynamics or NEMD simulations are typically
1002 used to measure a fluid's rheological properties such as viscosity.
1003 In LAMMPS, such simulations can be performed by first setting up a
1004 non-orthogonal simulation box (see the preceding Howto section).
1006 A shear strain can be applied to the simulation box at a desired
1007 strain rate by using the "fix deform"_fix_deform.html command. The
1008 "fix nvt/sllod"_fix_nvt_sllod.html command can be used to thermostat
1009 the sheared fluid and integrate the SLLOD equations of motion for the
1010 system. Fix nvt/sllod uses "compute
1011 temp/deform"_compute_temp_deform.html to compute a thermal temperature
1012 by subtracting out the streaming velocity of the shearing atoms. The
1013 velocity profile or other properties of the fluid can be monitored via
1014 the "fix ave/chunk"_fix_ave_chunk.html command.
1016 As discussed in the previous section on non-orthogonal simulation
1017 boxes, the amount of tilt or skew that can be applied is limited by
1018 LAMMPS for computational efficiency to be 1/2 of the parallel box
1019 length. However, "fix deform"_fix_deform.html can continuously strain
1020 a box by an arbitrary amount. As discussed in the "fix
1021 deform"_fix_deform.html command, when the tilt value reaches a limit,
1022 the box is flipped to the opposite limit which is an equivalent tiling
1023 of periodic space. The strain rate can then continue to change as
1024 before. In a long NEMD simulation these box re-shaping events may
1027 In a NEMD simulation, the "remap" option of "fix
1028 deform"_fix_deform.html should be set to "remap v", since that is what
1029 "fix nvt/sllod"_fix_nvt_sllod.html assumes to generate a velocity
1030 profile consistent with the applied shear strain rate.
1032 An alternative method for calculating viscosities is provided via the
1033 "fix viscosity"_fix_viscosity.html command.
1037 6.14 Finite-size spherical and aspherical particles :link(howto_14),h4
1039 Typical MD models treat atoms or particles as point masses. Sometimes
1040 it is desirable to have a model with finite-size particles such as
1041 spheroids or ellipsoids or generalized aspherical bodies. The
1042 difference is that such particles have a moment of inertia, rotational
1043 energy, and angular momentum. Rotation is induced by torque coming
1044 from interactions with other particles.
1046 LAMMPS has several options for running simulations with these kinds of
1047 particles. The following aspects are discussed in turn:
1052 computes, thermodynamics, and dump output
1053 rigid bodies composed of finite-size particles :ul
1055 Example input scripts for these kinds of models are in the body,
1056 colloid, dipole, ellipse, line, peri, pour, and tri directories of the
1057 "examples directory"_Section_example.html in the LAMMPS distribution.
1061 There are several "atom styles"_atom_style.html that allow for
1062 definition of finite-size particles: sphere, dipole, ellipsoid, line,
1063 tri, peri, and body.
1065 The sphere style defines particles that are spheriods and each
1066 particle can have a unique diameter and mass (or density). These
1067 particles store an angular velocity (omega) and can be acted upon by
1068 torque. The "set" command can be used to modify the diameter and mass
1069 of individual particles, after then are created.
1071 The dipole style does not actually define finite-size particles, but
1072 is often used in conjunction with spherical particles, via a command
1075 atom_style hybrid sphere dipole :pre
1077 This is because when dipoles interact with each other, they induce
1078 torques, and a particle must be finite-size (i.e. have a moment of
1079 inertia) in order to respond and rotate. See the "atom_style
1080 dipole"_atom_style.html command for details. The "set" command can be
1081 used to modify the orientation and length of the dipole moment of
1082 individual particles, after then are created.
1084 The ellipsoid style defines particles that are ellipsoids and thus can
1085 be aspherical. Each particle has a shape, specified by 3 diameters,
1086 and mass (or density). These particles store an angular momentum and
1087 their orientation (quaternion), and can be acted upon by torque. They
1088 do not store an angular velocity (omega), which can be in a different
1089 direction than angular momentum, rather they compute it as needed.
1090 The "set" command can be used to modify the diameter, orientation, and
1091 mass of individual particles, after then are created. It also has a
1092 brief explanation of what quaternions are.
1094 The line style defines line segment particles with two end points and
1095 a mass (or density). They can be used in 2d simulations, and they can
1096 be joined together to form rigid bodies which represent arbitrary
1099 The tri style defines triangular particles with three corner points
1100 and a mass (or density). They can be used in 3d simulations, and they
1101 can be joined together to form rigid bodies which represent arbitrary
1102 particles with a triangulated surface.
1104 The peri style is used with "Peridynamic models"_pair_peri.html and
1105 defines particles as having a volume, that is used internally in the
1106 "pair_style peri"_pair_peri.html potentials.
1108 The body style allows for definition of particles which can represent
1109 complex entities, such as surface meshes of discrete points,
1110 collections of sub-particles, deformable objects, etc. The body style
1111 is discussed in more detail on the "body"_body.html doc page.
1113 Note that if one of these atom styles is used (or multiple styles via
1114 the "atom_style hybrid"_atom_style.html command), not all particles in
1115 the system are required to be finite-size or aspherical.
1117 For example, in the ellipsoid style, if the 3 shape parameters are set
1118 to the same value, the particle will be a sphere rather than an
1119 ellipsoid. If the 3 shape parameters are all set to 0.0 or if the
1120 diameter is set to 0.0, it will be a point particle. In the line or
1121 tri style, if the lineflag or triflag is specified as 0, then it
1122 will be a point particle.
1124 Some of the pair styles used to compute pairwise interactions between
1125 finite-size particles also compute the correct interaction with point
1126 particles as well, e.g. the interaction between a point particle and a
1127 finite-size particle or between two point particles. If necessary,
1128 "pair_style hybrid"_pair_hybrid.html can be used to insure the correct
1129 interactions are computed for the appropriate style of interactions.
1130 Likewise, using groups to partition particles (ellipsoids versus
1131 spheres versus point particles) will allow you to use the appropriate
1132 time integrators and temperature computations for each class of
1133 particles. See the doc pages for various commands for details.
1135 Also note that for "2d simulations"_dimension.html, atom styles sphere
1136 and ellipsoid still use 3d particles, rather than as circular disks or
1137 ellipses. This means they have the same moment of inertia as the 3d
1138 object. When temperature is computed, the correct degrees of freedom
1139 are used for rotation in a 2d versus 3d system.
1143 When a system with finite-size particles is defined, the particles
1144 will only rotate and experience torque if the force field computes
1145 such interactions. These are the various "pair
1146 styles"_pair_style.html that generate torque:
1148 "pair_style gran/history"_pair_gran.html
1149 "pair_style gran/hertzian"_pair_gran.html
1150 "pair_style gran/no_history"_pair_gran.html
1151 "pair_style dipole/cut"_pair_dipole.html
1152 "pair_style gayberne"_pair_gayberne.html
1153 "pair_style resquared"_pair_resquared.html
1154 "pair_style brownian"_pair_brownian.html
1155 "pair_style lubricate"_pair_lubricate.html
1156 "pair_style line/lj"_pair_line_lj.html
1157 "pair_style tri/lj"_pair_tri_lj.html
1158 "pair_style body"_pair_body.html :ul
1160 The granular pair styles are used with spherical particles. The
1161 dipole pair style is used with the dipole atom style, which could be
1162 applied to spherical or ellipsoidal particles. The GayBerne and
1163 REsquared potentials require ellipsoidal particles, though they will
1164 also work if the 3 shape parameters are the same (a sphere). The
1165 Brownian and lubrication potentials are used with spherical particles.
1166 The line, tri, and body potentials are used with line segment,
1167 triangular, and body particles respectively.
1169 Time integration :h5
1171 There are several fixes that perform time integration on finite-size
1172 spherical particles, meaning the integrators update the rotational
1173 orientation and angular velocity or angular momentum of the particles:
1175 "fix nve/sphere"_fix_nve_sphere.html
1176 "fix nvt/sphere"_fix_nvt_sphere.html
1177 "fix npt/sphere"_fix_npt_sphere.html :ul
1179 Likewise, there are 3 fixes that perform time integration on
1180 ellipsoidal particles:
1182 "fix nve/asphere"_fix_nve_asphere.html
1183 "fix nvt/asphere"_fix_nvt_asphere.html
1184 "fix npt/asphere"_fix_npt_asphere.html :ul
1186 The advantage of these fixes is that those which thermostat the
1187 particles include the rotational degrees of freedom in the temperature
1188 calculation and thermostatting. The "fix langevin"_fix_langevin
1189 command can also be used with its {omgea} or {angmom} options to
1190 thermostat the rotational degrees of freedom for spherical or
1191 ellipsoidal particles. Other thermostatting fixes only operate on the
1192 translational kinetic energy of finite-size particles.
1194 These fixes perform constant NVE time integration on line segment,
1195 triangular, and body particles:
1197 "fix nve/line"_fix_nve_line.html
1198 "fix nve/tri"_fix_nve_tri.html
1199 "fix nve/body"_fix_nve_body.html :ul
1201 Note that for mixtures of point and finite-size particles, these
1202 integration fixes can only be used with "groups"_group.html which
1203 contain finite-size particles.
1205 Computes, thermodynamics, and dump output :h5
1207 There are several computes that calculate the temperature or
1208 rotational energy of spherical or ellipsoidal particles:
1210 "compute temp/sphere"_compute_temp_sphere.html
1211 "compute temp/asphere"_compute_temp_asphere.html
1212 "compute erotate/sphere"_compute_erotate_sphere.html
1213 "compute erotate/asphere"_compute_erotate_asphere.html :ul
1215 These include rotational degrees of freedom in their computation. If
1216 you wish the thermodynamic output of temperature or pressure to use
1217 one of these computes (e.g. for a system entirely composed of
1218 finite-size particles), then the compute can be defined and the
1219 "thermo_modify"_thermo_modify.html command used. Note that by default
1220 thermodynamic quantities will be calculated with a temperature that
1221 only includes translational degrees of freedom. See the
1222 "thermo_style"_thermo_style.html command for details.
1224 These commands can be used to output various attributes of finite-size
1227 "dump custom"_dump.html
1228 "compute property/atom"_compute_property_atom.html
1229 "dump local"_dump.html
1230 "compute body/local"_compute_body_local.html :ul
1232 Attributes include the dipole moment, the angular velocity, the
1233 angular momentum, the quaternion, the torque, the end-point and
1234 corner-point coordinates (for line and tri particles), and
1235 sub-particle attributes of body particles.
1237 Rigid bodies composed of finite-size particles :h5
1239 The "fix rigid"_fix_rigid.html command treats a collection of
1240 particles as a rigid body, computes its inertia tensor, sums the total
1241 force and torque on the rigid body each timestep due to forces on its
1242 constituent particles, and integrates the motion of the rigid body.
1244 If any of the constituent particles of a rigid body are finite-size
1245 particles (spheres or ellipsoids or line segments or triangles), then
1246 their contribution to the inertia tensor of the body is different than
1247 if they were point particles. This means the rotational dynamics of
1248 the rigid body will be different. Thus a model of a dimer is
1249 different if the dimer consists of two point masses versus two
1250 spheroids, even if the two particles have the same mass. Finite-size
1251 particles that experience torque due to their interaction with other
1252 particles will also impart that torque to a rigid body they are part
1255 See the "fix rigid" command for example of complex rigid-body models
1256 it is possible to define in LAMMPS.
1258 Note that the "fix shake"_fix_shake.html command can also be used to
1259 treat 2, 3, or 4 particles as a rigid body, but it always assumes the
1260 particles are point masses.
1262 Also note that body particles cannot be modeled with the "fix
1263 rigid"_fix_rigid.html command. Body particles are treated by LAMMPS
1264 as single particles, though they can store internal state, such as a
1265 list of sub-particles. Individual body partices are typically treated
1266 as rigid bodies, and their motion integrated with a command like "fix
1267 nve/body"_fix_nve_body.html. Interactions between pairs of body
1268 particles are computed via a command like "pair_style
1269 body"_pair_body.html.
1273 6.15 Output from LAMMPS (thermo, dumps, computes, fixes, variables) :link(howto_15),h4
1275 There are four basic kinds of LAMMPS output:
1277 "Thermodynamic output"_thermo_style.html, which is a list
1278 of quantities printed every few timesteps to the screen and logfile. :ulb,l
1280 "Dump files"_dump.html, which contain snapshots of atoms and various
1281 per-atom values and are written at a specified frequency. :l
1283 Certain fixes can output user-specified quantities to files: "fix
1284 ave/time"_fix_ave_time.html for time averaging, "fix
1285 ave/chunk"_fix_ave_chunk.html for spatial or other averaging, and "fix
1286 print"_fix_print.html for single-line output of
1287 "variables"_variable.html. Fix print can also output to the
1290 "Restart files"_restart.html. :l
1293 A simulation prints one set of thermodynamic output and (optionally)
1294 restart files. It can generate any number of dump files and fix
1295 output files, depending on what "dump"_dump.html and "fix"_fix.html
1296 commands you specify.
1298 As discussed below, LAMMPS gives you a variety of ways to determine
1299 what quantities are computed and printed when the thermodynamics,
1300 dump, or fix commands listed above perform output. Throughout this
1301 discussion, note that users can also "add their own computes and fixes
1302 to LAMMPS"_Section_modify.html which can then generate values that can
1303 then be output with these commands.
1305 The following sub-sections discuss different LAMMPS command related
1306 to output and the kind of data they operate on and produce:
1308 "Global/per-atom/local data"_#global
1309 "Scalar/vector/array data"_#scalar
1310 "Thermodynamic output"_#thermo
1311 "Dump file output"_#dump
1312 "Fixes that write output files"_#fixoutput
1313 "Computes that process output quantities"_#computeoutput
1314 "Fixes that process output quantities"_#fixprocoutput
1315 "Computes that generate values to output"_#compute
1316 "Fixes that generate values to output"_#fix
1317 "Variables that generate values to output"_#variable
1318 "Summary table of output options and data flow between commands"_#table :ul
1320 Global/per-atom/local data :h5,link(global)
1322 Various output-related commands work with three different styles of
1323 data: global, per-atom, or local. A global datum is one or more
1324 system-wide values, e.g. the temperature of the system. A per-atom
1325 datum is one or more values per atom, e.g. the kinetic energy of each
1326 atom. Local datums are calculated by each processor based on the
1327 atoms it owns, but there may be zero or more per atom, e.g. a list of
1330 Scalar/vector/array data :h5,link(scalar)
1332 Global, per-atom, and local datums can each come in three kinds: a
1333 single scalar value, a vector of values, or a 2d array of values. The
1334 doc page for a "compute" or "fix" or "variable" that generates data
1335 will specify both the style and kind of data it produces, e.g. a
1338 When a quantity is accessed, as in many of the output commands
1339 discussed below, it can be referenced via the following bracket
1340 notation, where ID in this case is the ID of a compute. The leading
1341 "c_" would be replaced by "f_" for a fix, or "v_" for a variable:
1343 c_ID | entire scalar, vector, or array
1344 c_ID\[I\] | one element of vector, one column of array
1345 c_ID\[I\]\[J\] | one element of array :tb(s=|)
1347 In other words, using one bracket reduces the dimension of the data
1348 once (vector -> scalar, array -> vector). Using two brackets reduces
1349 the dimension twice (array -> scalar). Thus a command that uses
1350 scalar values as input can typically also process elements of a vector
1353 Thermodynamic output :h5,link(thermo)
1355 The frequency and format of thermodynamic output is set by the
1356 "thermo"_thermo.html, "thermo_style"_thermo_style.html, and
1357 "thermo_modify"_thermo_modify.html commands. The
1358 "thermo_style"_thermo_style.html command also specifies what values
1359 are calculated and written out. Pre-defined keywords can be specified
1360 (e.g. press, etotal, etc). Three additional kinds of keywords can
1361 also be specified (c_ID, f_ID, v_name), where a "compute"_compute.html
1362 or "fix"_fix.html or "variable"_variable.html provides the value to be
1363 output. In each case, the compute, fix, or variable must generate
1364 global values for input to the "thermo_style custom"_dump.html
1367 Note that thermodynamic output values can be "extensive" or
1368 "intensive". The former scale with the number of atoms in the system
1369 (e.g. total energy), the latter do not (e.g. temperature). The
1370 setting for "thermo_modify norm"_thermo_modify.html determines whether
1371 extensive quantities are normalized or not. Computes and fixes
1372 produce either extensive or intensive values; see their individual doc
1373 pages for details. "Equal-style variables"_variable.html produce only
1374 intensive values; you can include a division by "natoms" in the
1375 formula if desired, to make an extensive calculation produce an
1378 Dump file output :h5,link(dump)
1380 Dump file output is specified by the "dump"_dump.html and
1381 "dump_modify"_dump_modify.html commands. There are several
1382 pre-defined formats (dump atom, dump xtc, etc).
1384 There is also a "dump custom"_dump.html format where the user
1385 specifies what values are output with each atom. Pre-defined atom
1386 attributes can be specified (id, x, fx, etc). Three additional kinds
1387 of keywords can also be specified (c_ID, f_ID, v_name), where a
1388 "compute"_compute.html or "fix"_fix.html or "variable"_variable.html
1389 provides the values to be output. In each case, the compute, fix, or
1390 variable must generate per-atom values for input to the "dump
1391 custom"_dump.html command.
1393 There is also a "dump local"_dump.html format where the user specifies
1394 what local values to output. A pre-defined index keyword can be
1395 specified to enumuerate the local values. Two additional kinds of
1396 keywords can also be specified (c_ID, f_ID), where a
1397 "compute"_compute.html or "fix"_fix.html or "variable"_variable.html
1398 provides the values to be output. In each case, the compute or fix
1399 must generate local values for input to the "dump local"_dump.html
1402 Fixes that write output files :h5,link(fixoutput)
1404 Several fixes take various quantities as input and can write output
1405 files: "fix ave/time"_fix_ave_time.html, "fix
1406 ave/chunk"_fix_ave_chunk.html, "fix ave/histo"_fix_ave_histo.html,
1407 "fix ave/correlate"_fix_ave_correlate.html, and "fix
1408 print"_fix_print.html.
1410 The "fix ave/time"_fix_ave_time.html command enables direct output to
1411 a file and/or time-averaging of global scalars or vectors. The user
1412 specifies one or more quantities as input. These can be global
1413 "compute"_compute.html values, global "fix"_fix.html values, or
1414 "variables"_variable.html of any style except the atom style which
1415 produces per-atom values. Since a variable can refer to keywords used
1416 by the "thermo_style custom"_thermo_style.html command (like temp or
1417 press) and individual per-atom values, a wide variety of quantities
1418 can be time averaged and/or output in this way. If the inputs are one
1419 or more scalar values, then the fix generate a global scalar or vector
1420 of output. If the inputs are one or more vector values, then the fix
1421 generates a global vector or array of output. The time-averaged
1422 output of this fix can also be used as input to other output commands.
1424 The "fix ave/chunk"_fix_ave_chunk.html command enables direct output
1425 to a file of chunk-averaged per-atom quantities like those output in
1426 dump files. Chunks can represent spatial bins or other collections of
1427 atoms, e.g. individual molecules. The per-atom quantities can be atom
1428 density (mass or number) or atom attributes such as position,
1429 velocity, force. They can also be per-atom quantities calculated by a
1430 "compute"_compute.html, by a "fix"_fix.html, or by an atom-style
1431 "variable"_variable.html. The chunk-averaged output of this fix can
1432 also be used as input to other output commands.
1434 The "fix ave/histo"_fix_ave_histo.html command enables direct output
1435 to a file of histogrammed quantities, which can be global or per-atom
1436 or local quantities. The histogram output of this fix can also be
1437 used as input to other output commands.
1439 The "fix ave/correlate"_fix_ave_correlate.html command enables direct
1440 output to a file of time-correlated quantities, which can be global
1441 values. The correlation matrix output of this fix can also be used as
1442 input to other output commands.
1444 The "fix print"_fix_print.html command can generate a line of output
1445 written to the screen and log file or to a separate file, periodically
1446 during a running simulation. The line can contain one or more
1447 "variable"_variable.html values for any style variable except the
1448 vector or atom styles). As explained above, variables themselves can
1449 contain references to global values generated by "thermodynamic
1450 keywords"_thermo_style.html, "computes"_compute.html,
1451 "fixes"_fix.html, or other "variables"_variable.html, or to per-atom
1452 values for a specific atom. Thus the "fix print"_fix_print.html
1453 command is a means to output a wide variety of quantities separate
1454 from normal thermodynamic or dump file output.
1456 Computes that process output quantities :h5,link(computeoutput)
1458 The "compute reduce"_compute_reduce.html and "compute
1459 reduce/region"_compute_reduce.html commands take one or more per-atom
1460 or local vector quantities as inputs and "reduce" them (sum, min, max,
1461 ave) to scalar quantities. These are produced as output values which
1462 can be used as input to other output commands.
1464 The "compute slice"_compute_slice.html command take one or more global
1465 vector or array quantities as inputs and extracts a subset of their
1466 values to create a new vector or array. These are produced as output
1467 values which can be used as input to other output commands.
1469 The "compute property/atom"_compute_property_atom.html command takes a
1470 list of one or more pre-defined atom attributes (id, x, fx, etc) and
1471 stores the values in a per-atom vector or array. These are produced
1472 as output values which can be used as input to other output commands.
1473 The list of atom attributes is the same as for the "dump
1474 custom"_dump.html command.
1476 The "compute property/local"_compute_property_local.html command takes
1477 a list of one or more pre-defined local attributes (bond info, angle
1478 info, etc) and stores the values in a local vector or array. These
1479 are produced as output values which can be used as input to other
1482 Fixes that process output quantities :h5,link(fixprocoutput)
1484 The "fix vector"_fix_vector.html command can create global vectors as
1485 output from global scalars as input, accumulating them one element at
1488 The "fix ave/atom"_fix_ave_atom.html command performs time-averaging
1489 of per-atom vectors. The per-atom quantities can be atom attributes
1490 such as position, velocity, force. They can also be per-atom
1491 quantities calculated by a "compute"_compute.html, by a
1492 "fix"_fix.html, or by an atom-style "variable"_variable.html. The
1493 time-averaged per-atom output of this fix can be used as input to
1494 other output commands.
1496 The "fix store/state"_fix_store_state.html command can archive one or
1497 more per-atom attributes at a particular time, so that the old values
1498 can be used in a future calculation or output. The list of atom
1499 attributes is the same as for the "dump custom"_dump.html command,
1500 including per-atom quantities calculated by a "compute"_compute.html,
1501 by a "fix"_fix.html, or by an atom-style "variable"_variable.html.
1502 The output of this fix can be used as input to other output commands.
1504 Computes that generate values to output :h5,link(compute)
1506 Every "compute"_compute.html in LAMMPS produces either global or
1507 per-atom or local values. The values can be scalars or vectors or
1508 arrays of data. These values can be output using the other commands
1509 described in this section. The doc page for each compute command
1510 describes what it produces. Computes that produce per-atom or local
1511 values have the word "atom" or "local" in their style name. Computes
1512 without the word "atom" or "local" produce global values.
1514 Fixes that generate values to output :h5,link(fix)
1516 Some "fixes"_fix.html in LAMMPS produces either global or per-atom or
1517 local values which can be accessed by other commands. The values can
1518 be scalars or vectors or arrays of data. These values can be output
1519 using the other commands described in this section. The doc page for
1520 each fix command tells whether it produces any output quantities and
1523 Variables that generate values to output :h5,link(variable)
1525 "Variables"_variable.html defined in an input script can store one or
1526 more strings. But equal-style, vector-style, and atom-style or
1527 atomfile-style variables generate a global scalar value, global vector
1528 or values, or a per-atom vector, resepctively, when accessed. The
1529 formulas used to define these variables can contain references to the
1530 thermodynamic keywords and to global and per-atom data generated by
1531 computes, fixes, and other variables. The values generated by
1532 variables can be used as input to and thus output by the other
1533 commands described in this section.
1535 Summary table of output options and data flow between commands :h5,link(table)
1537 This table summarizes the various commands that can be used for
1538 generating output from LAMMPS. Each command produces output data of
1539 some kind and/or writes data to a file. Most of the commands can take
1540 data from other commands as input. Thus you can link many of these
1541 commands together in pipeline form, where data produced by one command
1542 is used as input to another command and eventually written to the
1543 screen or to a file. Note that to hook two commands together the
1544 output and input data types must match, e.g. global/per-atom/local
1545 data and scalar/vector/array data.
1547 Also note that, as described above, when a command takes a scalar as
1548 input, that could be an element of a vector or array. Likewise a
1549 vector input could be a column of an array.
1551 Command: Input: Output:
1552 "thermo_style custom"_thermo_style.html: global scalars: screen, log file:
1553 "dump custom"_dump.html: per-atom vectors: dump file:
1554 "dump local"_dump.html: local vectors: dump file:
1555 "fix print"_fix_print.html: global scalar from variable: screen, file:
1556 "print"_print.html: global scalar from variable: screen:
1557 "computes"_compute.html: N/A: global/per-atom/local scalar/vector/array:
1558 "fixes"_fix.html: N/A: global/per-atom/local scalar/vector/array:
1559 "variables"_variable.html: global scalars and vectors, per-atom vectors: global scalar and vector, per-atom vector:
1560 "compute reduce"_compute_reduce.html: per-atom/local vectors: global scalar/vector:
1561 "compute slice"_compute_slice.html: global vectors/arrays: global vector/array:
1562 "compute property/atom"_compute_property_atom.html: per-atom vectors: per-atom vector/array:
1563 "compute property/local"_compute_property_local.html: local vectors: local vector/array:
1564 "fix vector"_fix_vector.html: global scalars: global vector:
1565 "fix ave/atom"_fix_ave_atom.html: per-atom vectors: per-atom vector/array:
1566 "fix ave/time"_fix_ave_time.html: global scalars/vectors: global scalar/vector/array, file:
1567 "fix ave/chunk"_fix_ave_chunk.html: per-atom vectors: global array, file:
1568 "fix ave/histo"_fix_ave_histo.html: global/per-atom/local scalars and vectors: global array, file:
1569 "fix ave/correlate"_fix_ave_correlate.html: global scalars: global array, file:
1570 "fix store/state"_fix_store_state.html: per-atom vectors: per-atom vector/array :tb(c=3,s=:)
1574 6.16 Thermostatting, barostatting, and computing temperature :link(howto_16),h4
1576 Thermostatting means controlling the temperature of particles in an MD
1577 simulation. Barostatting means controlling the pressure. Since the
1578 pressure includes a kinetic component due to particle velocities, both
1579 these operations require calculation of the temperature. Typically a
1580 target temperature (T) and/or pressure (P) is specified by the user,
1581 and the thermostat or barostat attempts to equilibrate the system to
1582 the requested T and/or P.
1584 Temperature is computed as kinetic energy divided by some number of
1585 degrees of freedom (and the Boltzmann constant). Since kinetic energy
1586 is a function of particle velocity, there is often a need to
1587 distinguish between a particle's advection velocity (due to some
1588 aggregate motiion of particles) and its thermal velocity. The sum of
1589 the two is the particle's total velocity, but the latter is often what
1590 is wanted to compute a temperature.
1592 LAMMPS has several options for computing temperatures, any of which
1593 can be used in thermostatting and barostatting. These "compute
1594 commands"_compute.html calculate temperature, and the "compute
1595 pressure"_compute_pressure.html command calculates pressure.
1597 "compute temp"_compute_temp.html
1598 "compute temp/sphere"_compute_temp_sphere.html
1599 "compute temp/asphere"_compute_temp_asphere.html
1600 "compute temp/com"_compute_temp_com.html
1601 "compute temp/deform"_compute_temp_deform.html
1602 "compute temp/partial"_compute_temp_partial.html
1603 "compute temp/profile"_compute_temp_profile.html
1604 "compute temp/ramp"_compute_temp_ramp.html
1605 "compute temp/region"_compute_temp_region.html :ul
1607 All but the first 3 calculate velocity biases directly (e.g. advection
1608 velocities) that are removed when computing the thermal temperature.
1609 "Compute temp/sphere"_compute_temp_sphere.html and "compute
1610 temp/asphere"_compute_temp_asphere.html compute kinetic energy for
1611 finite-size particles that includes rotational degrees of freedom.
1612 They both allow for velocity biases indirectly, via an optional extra
1613 argument, another temperature compute that subtracts a velocity bias.
1614 This allows the translational velocity of spherical or aspherical
1615 particles to be adjusted in prescribed ways.
1617 Thermostatting in LAMMPS is performed by "fixes"_fix.html, or in one
1618 case by a pair style. Several thermostatting fixes are available:
1619 Nose-Hoover (nvt), Berendsen, CSVR, Langevin, and direct rescaling
1620 (temp/rescale). Dissipative particle dynamics (DPD) thermostatting
1621 can be invoked via the {dpd/tstat} pair style:
1623 "fix nvt"_fix_nh.html
1624 "fix nvt/sphere"_fix_nvt_sphere.html
1625 "fix nvt/asphere"_fix_nvt_asphere.html
1626 "fix nvt/sllod"_fix_nvt_sllod.html
1627 "fix temp/berendsen"_fix_temp_berendsen.html
1628 "fix temp/csvr"_fix_temp_csvr.html
1629 "fix langevin"_fix_langevin.html
1630 "fix temp/rescale"_fix_temp_rescale.html
1631 "pair_style dpd/tstat"_pair_dpd.html :ul
1633 "Fix nvt"_fix_nh.html only thermostats the translational velocity of
1634 particles. "Fix nvt/sllod"_fix_nvt_sllod.html also does this, except
1635 that it subtracts out a velocity bias due to a deforming box and
1636 integrates the SLLOD equations of motion. See the "NEMD
1637 simulations"_#howto_13 section of this page for further details. "Fix
1638 nvt/sphere"_fix_nvt_sphere.html and "fix
1639 nvt/asphere"_fix_nvt_asphere.html thermostat not only translation
1640 velocities but also rotational velocities for spherical and aspherical
1643 DPD thermostatting alters pairwise interactions in a manner analagous
1644 to the per-particle thermostatting of "fix
1645 langevin"_fix_langevin.html.
1647 Any of the thermostatting fixes can use temperature computes that
1648 remove bias which has two effects. First, the current calculated
1649 temperature, which is compared to the requested target temperature, is
1650 caluclated with the velocity bias removed. Second, the thermostat
1651 adjusts only the thermal temperature component of the particle's
1652 velocities, which are the velocities with the bias removed. The
1653 removed bias is then added back to the adjusted velocities. See the
1654 doc pages for the individual fixes and for the
1655 "fix_modify"_fix_modify.html command for instructions on how to assign
1656 a temperature compute to a thermostatting fix. For example, you can
1657 apply a thermostat to only the x and z components of velocity by using
1658 it in conjunction with "compute
1659 temp/partial"_compute_temp_partial.html. Of you could thermostat only
1660 the thermal temperature of a streaming flow of particles without
1661 affecting the streaming velocity, by using "compute
1662 temp/profile"_compute_temp_profile.html.
1664 NOTE: Only the nvt fixes perform time integration, meaning they update
1665 the velocities and positions of particles due to forces and velocities
1666 respectively. The other thermostat fixes only adjust velocities; they
1667 do NOT perform time integration updates. Thus they should be used in
1668 conjunction with a constant NVE integration fix such as these:
1670 "fix nve"_fix_nve.html
1671 "fix nve/sphere"_fix_nve_sphere.html
1672 "fix nve/asphere"_fix_nve_asphere.html :ul
1674 Barostatting in LAMMPS is also performed by "fixes"_fix.html. Two
1675 barosttating methods are currently available: Nose-Hoover (npt and
1678 "fix npt"_fix_nh.html
1679 "fix npt/sphere"_fix_npt_sphere.html
1680 "fix npt/asphere"_fix_npt_asphere.html
1681 "fix nph"_fix_nh.html
1682 "fix press/berendsen"_fix_press_berendsen.html :ul
1684 The "fix npt"_fix_nh.html commands include a Nose-Hoover thermostat
1685 and barostat. "Fix nph"_fix_nh.html is just a Nose/Hoover barostat;
1686 it does no thermostatting. Both "fix nph"_fix_nh.html and "fix
1687 press/bernendsen"_fix_press_berendsen.html can be used in conjunction
1688 with any of the thermostatting fixes.
1690 As with the thermostats, "fix npt"_fix_nh.html and "fix
1691 nph"_fix_nh.html only use translational motion of the particles in
1692 computing T and P and performing thermo/barostatting. "Fix
1693 npt/sphere"_fix_npt_sphere.html and "fix
1694 npt/asphere"_fix_npt_asphere.html thermo/barostat using not only
1695 translation velocities but also rotational velocities for spherical
1696 and aspherical particles.
1698 All of the barostatting fixes use the "compute
1699 pressure"_compute_pressure.html compute to calculate a current
1700 pressure. By default, this compute is created with a simple "compute
1701 temp"_compute_temp.html (see the last argument of the "compute
1702 pressure"_compute_pressure.html command), which is used to calculated
1703 the kinetic component of the pressure. The barostatting fixes can
1704 also use temperature computes that remove bias for the purpose of
1705 computing the kinetic component which contributes to the current
1706 pressure. See the doc pages for the individual fixes and for the
1707 "fix_modify"_fix_modify.html command for instructions on how to assign
1708 a temperature or pressure compute to a barostatting fix.
1710 NOTE: As with the thermostats, the Nose/Hoover methods ("fix
1711 npt"_fix_nh.html and "fix nph"_fix_nh.html) perform time integration.
1712 "Fix press/berendsen"_fix_press_berendsen.html does NOT, so it should
1713 be used with one of the constant NVE fixes or with one of the NVT
1716 Finally, thermodynamic output, which can be setup via the
1717 "thermo_style"_thermo_style.html command, often includes temperature
1718 and pressure values. As explained on the doc page for the
1719 "thermo_style"_thermo_style.html command, the default T and P are
1720 setup by the thermo command itself. They are NOT the ones associated
1721 with any thermostatting or barostatting fix you have defined or with
1722 any compute that calculates a temperature or pressure. Thus if you
1723 want to view these values of T and P, you need to specify them
1724 explicitly via a "thermo_style custom"_thermo_style.html command. Or
1725 you can use the "thermo_modify"_thermo_modify.html command to
1726 re-define what temperature or pressure compute is used for default
1727 thermodynamic output.
1731 6.17 Walls :link(howto_17),h4
1733 Walls in an MD simulation are typically used to bound particle motion,
1734 i.e. to serve as a boundary condition.
1736 Walls in LAMMPS can be of rough (made of particles) or idealized
1737 surfaces. Ideal walls can be smooth, generating forces only in the
1738 normal direction, or frictional, generating forces also in the
1739 tangential direction.
1741 Rough walls, built of particles, can be created in various ways. The
1742 particles themselves can be generated like any other particle, via the
1743 "lattice"_lattice.html and "create_atoms"_create_atoms.html commands,
1744 or read in via the "read_data"_read_data.html command.
1746 Their motion can be constrained by many different commands, so that
1747 they do not move at all, move together as a group at constant velocity
1748 or in response to a net force acting on them, move in a prescribed
1749 fashion (e.g. rotate around a point), etc. Note that if a time
1750 integration fix like "fix nve"_fix_nve.html or "fix nvt"_fix_nh.html
1751 is not used with the group that contains wall particles, their
1752 positions and velocities will not be updated.
1754 "fix aveforce"_fix_aveforce.html - set force on particles to average value, so they move together
1755 "fix setforce"_fix_setforce.html - set force on particles to a value, e.g. 0.0
1756 "fix freeze"_fix_freeze.html - freeze particles for use as granular walls
1757 "fix nve/noforce"_fix_nve_noforce.html - advect particles by their velocity, but without force
1758 "fix move"_fix_move.html - prescribe motion of particles by a linear velocity, oscillation, rotation, variable :ul
1760 The "fix move"_fix_move.html command offers the most generality, since
1761 the motion of individual particles can be specified with
1762 "variable"_variable.html formula which depends on time and/or the
1765 For rough walls, it may be useful to turn off pairwise interactions
1766 between wall particles via the "neigh_modify
1767 exclude"_neigh_modify.html command.
1769 Rough walls can also be created by specifying frozen particles that do
1770 not move and do not interact with mobile particles, and then tethering
1771 other particles to the fixed particles, via a "bond"_bond_style.html.
1772 The bonded particles do interact with other mobile particles.
1774 Idealized walls can be specified via several fix commands. "Fix
1775 wall/gran"_fix_wall_gran.html creates frictional walls for use with
1776 granular particles; all the other commands create smooth walls.
1778 "fix wall/reflect"_fix_wall_reflect.html - reflective flat walls
1779 "fix wall/lj93"_fix_wall.html - flat walls, with Lennard-Jones 9/3 potential
1780 "fix wall/lj126"_fix_wall.html - flat walls, with Lennard-Jones 12/6 potential
1781 "fix wall/colloid"_fix_wall.html - flat walls, with "pair_style colloid"_pair_colloid.html potential
1782 "fix wall/harmonic"_fix_wall.html - flat walls, with repulsive harmonic spring potential
1783 "fix wall/region"_fix_wall_region.html - use region surface as wall
1784 "fix wall/gran"_fix_wall_gran.html - flat or curved walls with "pair_style granular"_pair_gran.html potential :ul
1786 The {lj93}, {lj126}, {colloid}, and {harmonic} styles all allow the
1787 flat walls to move with a constant velocity, or oscillate in time.
1788 The "fix wall/region"_fix_wall_region.html command offers the most
1789 generality, since the region surface is treated as a wall, and the
1790 geometry of the region can be a simple primitive volume (e.g. a
1791 sphere, or cube, or plane), or a complex volume made from the union
1792 and intersection of primitive volumes. "Regions"_region.html can also
1793 specify a volume "interior" or "exterior" to the specified primitive
1794 shape or {union} or {intersection}. "Regions"_region.html can also be
1795 "dynamic" meaning they move with constant velocity, oscillate, or
1798 The only frictional idealized walls currently in LAMMPS are flat or
1799 curved surfaces specified by the "fix wall/gran"_fix_wall_gran.html
1800 command. At some point we plan to allow regoin surfaces to be used as
1801 frictional walls, as well as triangulated surfaces.
1805 6.18 Elastic constants :link(howto_18),h4
1807 Elastic constants characterize the stiffness of a material. The formal
1808 definition is provided by the linear relation that holds between the
1809 stress and strain tensors in the limit of infinitesimal deformation.
1810 In tensor notation, this is expressed as s_ij = C_ijkl * e_kl, where
1811 the repeated indices imply summation. s_ij are the elements of the
1812 symmetric stress tensor. e_kl are the elements of the symmetric strain
1813 tensor. C_ijkl are the elements of the fourth rank tensor of elastic
1814 constants. In three dimensions, this tensor has 3^4=81 elements. Using
1815 Voigt notation, the tensor can be written as a 6x6 matrix, where C_ij
1816 is now the derivative of s_i w.r.t. e_j. Because s_i is itself a
1817 derivative w.r.t. e_i, it follows that C_ij is also symmetric, with at
1818 most 7*6/2 = 21 distinct elements.
1820 At zero temperature, it is easy to estimate these derivatives by
1821 deforming the simulation box in one of the six directions using the
1822 "change_box"_change_box.html command and measuring the change in the
1823 stress tensor. A general-purpose script that does this is given in the
1824 examples/elastic directory described in "this
1825 section"_Section_example.html.
1827 Calculating elastic constants at finite temperature is more
1828 challenging, because it is necessary to run a simulation that perfoms
1829 time averages of differential properties. One way to do this is to
1830 measure the change in average stress tensor in an NVT simulations when
1831 the cell volume undergoes a finite deformation. In order to balance
1832 the systematic and statistical errors in this method, the magnitude of
1833 the deformation must be chosen judiciously, and care must be taken to
1834 fully equilibrate the deformed cell before sampling the stress
1835 tensor. Another approach is to sample the triclinic cell fluctuations
1836 that occur in an NPT simulation. This method can also be slow to
1837 converge and requires careful post-processing "(Shinoda)"_#Shinoda
1841 6.19 Library interface to LAMMPS :link(howto_19),h4
1843 As described in "Section 2.5"_Section_start.html#start_5, LAMMPS
1844 can be built as a library, so that it can be called by another code,
1845 used in a "coupled manner"_Section_howto.html#howto_10 with other
1846 codes, or driven through a "Python interface"_Section_python.html.
1848 All of these methodologies use a C-style interface to LAMMPS that is
1849 provided in the files src/library.cpp and src/library.h. The
1850 functions therein have a C-style argument list, but contain C++ code
1851 you could write yourself in a C++ application that was invoking LAMMPS
1852 directly. The C++ code in the functions illustrates how to invoke
1853 internal LAMMPS operations. Note that LAMMPS classes are defined
1854 within a LAMMPS namespace (LAMMPS_NS) if you use them from another C++
1857 Library.cpp contains these functions for creating and destroying an
1858 instance of LAMMPS and sending it commands to execute. See the
1859 documentation in the src/library.cpp file for details:
1861 void lammps_open(int, char **, MPI_Comm, void **)
1862 void lammps_open_no_mpi(int, char **, void **)
1863 void lammps_close(void *)
1864 int lammps_version(void *)
1865 void lammps_file(void *, char *)
1866 char *lammps_command(void *, char *)
1867 void lammps_commands_list(void *, int, char **)
1868 void lammps_commands_string(void *, char *)
1869 void lammps_free(void *) :pre
1871 The lammps_open() function is used to initialize LAMMPS, passing in a
1872 list of strings as if they were "command-line
1873 arguments"_Section_start.html#start_7 when LAMMPS is run in
1874 stand-alone mode from the command line, and a MPI communicator for
1875 LAMMPS to run under. It returns a ptr to the LAMMPS object that is
1876 created, and which is used in subsequent library calls. The
1877 lammps_open() function can be called multiple times, to create
1878 multiple instances of LAMMPS.
1880 LAMMPS will run on the set of processors in the communicator. This
1881 means the calling code can run LAMMPS on all or a subset of
1882 processors. For example, a wrapper script might decide to alternate
1883 between LAMMPS and another code, allowing them both to run on all the
1884 processors. Or it might allocate half the processors to LAMMPS and
1885 half to the other code and run both codes simultaneously before
1886 syncing them up periodically. Or it might instantiate multiple
1887 instances of LAMMPS to perform different calculations.
1889 The lammps_open_no_mpi() function is similar except that no MPI
1890 communicator is passed from the caller. Instead, MPI_COMM_WORLD is
1891 used to instantiate LAMMPS, and MPI is initialzed if necessary.
1893 The lammps_close() function is used to shut down an instance of LAMMPS
1894 and free all its memory.
1896 The lammps_version() function can be used to determined the specific
1897 version of the underlying LAMMPS code. This is particularly useful
1898 when loading LAMMPS as a shared library via dlopen(). The code using
1899 the library interface can than use this information to adapt to
1900 changes to the LAMMPS command syntax between versions. The returned
1901 LAMMPS version code is an integer (e.g. 2 Sep 2015 results in
1902 20150902) that grows with every new LAMMPS version.
1904 The lammps_file(), lammps_command(), lammps_commands_list(), and
1905 lammps_commands_string() functions are used to pass one or more
1906 commands to LAMMPS to execute, the same as if they were coming from an
1909 Via these functions, the calling code can read or generate a series of
1910 LAMMPS commands one or multiple at a time and pass it thru the library
1911 interface to setup a problem and then run it in stages. The caller
1912 can interleave the command function calls with operations it performs,
1913 calls to extract information from or set information within LAMMPS, or
1914 calls to another code's library.
1916 The lammps_file() function passes the filename of an input script.
1917 The lammps_command() function passes a single command as a string.
1918 The lammps_commands_list() function passes multiple commands in a
1919 char** list. In both lammps_command() and lammps_commands_list(),
1920 individual commands may or may not have a trailing newline. The
1921 lammps_commands_string() function passes multiple commands
1922 concatenated into one long string, separated by newline characters.
1923 In both lammps_commands_list() and lammps_commands_string(), a single
1924 command can be spread across multiple lines, if the last printable
1925 character of all but the last line is "&", the same as if the lines
1926 appeared in an input script.
1928 The lammps_free() function is a clean-up function to free memory that
1929 the library allocated previously via other function calls. See
1930 comments in src/library.cpp file for which other functions need this
1933 Library.cpp also contains these functions for extracting information
1934 from LAMMPS and setting value within LAMMPS. Again, see the
1935 documentation in the src/library.cpp file for details, including
1936 which quantities can be queried by name:
1938 void *lammps_extract_global(void *, char *)
1939 void lammps_extract_box(void *, double *, double *,
1940 double *, double *, double *, int *, int *)
1941 void *lammps_extract_atom(void *, char *)
1942 void *lammps_extract_compute(void *, char *, int, int)
1943 void *lammps_extract_fix(void *, char *, int, int, int, int)
1944 void *lammps_extract_variable(void *, char *, char *) :pre
1946 void lammps_reset_box(void *, double *, double *, double, double, double)
1947 int lammps_set_variable(void *, char *, char *) :pre
1949 double lammps_get_thermo(void *, char *)
1950 int lammps_get_natoms(void *)
1951 void lammps_gather_atoms(void *, double *)
1952 void lammps_scatter_atoms(void *, double *) :pre
1953 void lammps_create_atoms(void *, int, tagint *, int *, double *, double *,
1954 imageint *, int) :pre
1956 The extract functions return a pointer to various global or per-atom
1957 quantities stored in LAMMPS or to values calculated by a compute, fix,
1958 or variable. The pointer returned by the extract_global() function
1959 can be used as a permanent reference to a value which may change. For
1960 the other extract functions, the underlying storage may be reallocated
1961 as LAMMPS runs, so you need to re-call the function to assure a
1962 current pointer or returned value(s).
1964 The lammps_reset_box() function resets the size and shape of the
1965 simulation box, e.g. as part of restoring a previously extracted and
1966 saved state of a simulation.
1968 The lammps_set_variable() function can set an existing string-style
1969 variable to a new string value, so that subsequent LAMMPS commands can
1970 access the variable.
1972 The lammps_get_thermo() function returns the current value of a thermo
1973 keyword as a double precision value.
1975 The lammps_get_natoms() function returns the total number of atoms in
1976 the system and can be used by the caller to allocate space for the
1977 lammps_gather_atoms() and lammps_scatter_atoms() functions. The
1978 gather function collects atom info of the requested type (atom coords,
1979 types, forces, etc) from all procsesors, orders them by atom ID, and
1980 returns a full list to each calling processor. The scatter function
1981 does the inverse. It distributes the same kinds of values,
1982 passed by the caller, to each atom owned by individual processors.
1984 The lammps_create_atoms() function takes a list of N atoms as input
1985 with atom types and coords (required), an optionally atom IDs and
1986 velocities and image flags. It uses the coords of each atom to assign
1987 it as a new atom to the processor that owns it. This function is
1988 useful to add atoms to a simulation or (in tandem with
1989 lammps_reset_box()) to restore a previously extracted and saved state
1990 of a simulation. Additional properties for the new atoms can then be
1991 assigned via the lammps_scatter_atoms() or lammps_extract_atom()
1994 The examples/COUPLE and python directories have example C++ and C and
1995 Python codes which show how a driver code can link to LAMMPS as a
1996 library, run LAMMPS on a subset of processors, grab data from LAMMPS,
1997 change it, and put it back into LAMMPS.
1999 NOTE: You can write code for additional functions as needed to define
2000 how your code talks to LAMMPS and add them to src/library.cpp and
2001 src/library.h, as well as to the "Python
2002 interface"_Section_python.html. The added functions can access or
2003 change any LAMMPS data you wish.
2007 6.20 Calculating thermal conductivity :link(howto_20),h4
2009 The thermal conductivity kappa of a material can be measured in at
2010 least 4 ways using various options in LAMMPS. See the examples/KAPPA
2011 directory for scripts that implement the 4 methods discussed here for
2012 a simple Lennard-Jones fluid model. Also, see "this
2013 section"_Section_howto.html#howto_21 of the manual for an analogous
2014 discussion for viscosity.
2016 The thermal conducitivity tensor kappa is a measure of the propensity
2017 of a material to transmit heat energy in a diffusive manner as given
2022 where J is the heat flux in units of energy per area per time and
2023 grad(T) is the spatial gradient of temperature. The thermal
2024 conductivity thus has units of energy per distance per time per degree
2025 K and is often approximated as an isotropic quantity, i.e. as a
2028 The first method is to setup two thermostatted regions at opposite
2029 ends of a simulation box, or one in the middle and one at the end of a
2030 periodic box. By holding the two regions at different temperatures
2031 with a "thermostatting fix"_Section_howto.html#howto_13, the energy
2032 added to the hot region should equal the energy subtracted from the
2033 cold region and be proportional to the heat flux moving between the
2034 regions. See the papers by "Ikeshoji and Hafskjold"_#howto-Ikeshoji
2035 and "Wirnsberger et al"_#howto-Wirnsberger for details of this idea.
2036 Note that thermostatting fixes such as "fix nvt"_fix_nh.html, "fix
2037 langevin"_fix_langevin.html, and "fix
2038 temp/rescale"_fix_temp_rescale.html store the cumulative energy they
2041 Alternatively, as a second method, the "fix heat"_fix_heat.html or
2042 "fix ehex"_fix_ehex.html commands can be used in place of thermostats
2043 on each of two regions to add/subtract specified amounts of energy to
2044 both regions. In both cases, the resulting temperatures of the two
2045 regions can be monitored with the "compute temp/region" command and
2046 the temperature profile of the intermediate region can be monitored
2047 with the "fix ave/chunk"_fix_ave_chunk.html and "compute
2048 ke/atom"_compute_ke_atom.html commands.
2050 The third method is to perform a reverse non-equilibrium MD simulation
2051 using the "fix thermal/conductivity"_fix_thermal_conductivity.html
2052 command which implements the rNEMD algorithm of Muller-Plathe.
2053 Kinetic energy is swapped between atoms in two different layers of the
2054 simulation box. This induces a temperature gradient between the two
2055 layers which can be monitored with the "fix
2056 ave/chunk"_fix_ave_chunk.html and "compute
2057 ke/atom"_compute_ke_atom.html commands. The fix tallies the
2058 cumulative energy transfer that it performs. See the "fix
2059 thermal/conductivity"_fix_thermal_conductivity.html command for
2062 The fourth method is based on the Green-Kubo (GK) formula which
2063 relates the ensemble average of the auto-correlation of the heat flux
2064 to kappa. The heat flux can be calculated from the fluctuations of
2065 per-atom potential and kinetic energies and per-atom stress tensor in
2066 a steady-state equilibrated simulation. This is in contrast to the
2067 two preceding non-equilibrium methods, where energy flows continuously
2068 between hot and cold regions of the simulation box.
2070 The "compute heat/flux"_compute_heat_flux.html command can calculate
2071 the needed heat flux and describes how to implement the Green_Kubo
2072 formalism using additional LAMMPS commands, such as the "fix
2073 ave/correlate"_fix_ave_correlate.html command to calculate the needed
2074 auto-correlation. See the doc page for the "compute
2075 heat/flux"_compute_heat_flux.html command for an example input script
2076 that calculates the thermal conductivity of solid Ar via the GK
2081 6.21 Calculating viscosity :link(howto_21),h4
2083 The shear viscosity eta of a fluid can be measured in at least 5 ways
2084 using various options in LAMMPS. See the examples/VISCOSITY directory
2085 for scripts that implement the 5 methods discussed here for a simple
2086 Lennard-Jones fluid model. Also, see "this
2087 section"_Section_howto.html#howto_20 of the manual for an analogous
2088 discussion for thermal conductivity.
2090 Eta is a measure of the propensity of a fluid to transmit momentum in
2091 a direction perpendicular to the direction of velocity or momentum
2092 flow. Alternatively it is the resistance the fluid has to being
2093 sheared. It is given by
2095 J = -eta grad(Vstream)
2097 where J is the momentum flux in units of momentum per area per time.
2098 and grad(Vstream) is the spatial gradient of the velocity of the fluid
2099 moving in another direction, normal to the area through which the
2100 momentum flows. Viscosity thus has units of pressure-time.
2102 The first method is to perform a non-equlibrium MD (NEMD) simulation
2103 by shearing the simulation box via the "fix deform"_fix_deform.html
2104 command, and using the "fix nvt/sllod"_fix_nvt_sllod.html command to
2105 thermostat the fluid via the SLLOD equations of motion.
2106 Alternatively, as a second method, one or more moving walls can be
2107 used to shear the fluid in between them, again with some kind of
2108 thermostat that modifies only the thermal (non-shearing) components of
2109 velocity to prevent the fluid from heating up.
2111 In both cases, the velocity profile setup in the fluid by this
2112 procedure can be monitored by the "fix
2113 ave/chunk"_fix_ave_chunk.html command, which determines
2114 grad(Vstream) in the equation above. E.g. the derivative in the
2115 y-direction of the Vx component of fluid motion or grad(Vstream) =
2116 dVx/dy. The Pxy off-diagonal component of the pressure or stress
2117 tensor, as calculated by the "compute pressure"_compute_pressure.html
2118 command, can also be monitored, which is the J term in the equation
2119 above. See "this section"_Section_howto.html#howto_13 of the manual
2120 for details on NEMD simulations.
2122 The third method is to perform a reverse non-equilibrium MD simulation
2123 using the "fix viscosity"_fix_viscosity.html command which implements
2124 the rNEMD algorithm of Muller-Plathe. Momentum in one dimension is
2125 swapped between atoms in two different layers of the simulation box in
2126 a different dimension. This induces a velocity gradient which can be
2127 monitored with the "fix ave/chunk"_fix_ave_chunk.html command.
2128 The fix tallies the cummulative momentum transfer that it performs.
2129 See the "fix viscosity"_fix_viscosity.html command for details.
2131 The fourth method is based on the Green-Kubo (GK) formula which
2132 relates the ensemble average of the auto-correlation of the
2133 stress/pressure tensor to eta. This can be done in a fully
2134 equilibrated simulation which is in contrast to the two preceding
2135 non-equilibrium methods, where momentum flows continuously through the
2138 Here is an example input script that calculates the viscosity of
2139 liquid Ar via the GK formalism:
2141 # Sample LAMMPS input script for viscosity of liquid Ar :pre
2144 variable T equal 86.4956
2145 variable V equal vol
2146 variable dt equal 4.0
2147 variable p equal 400 # correlation length
2148 variable s equal 5 # sample interval
2149 variable d equal $p*$s # dump interval :pre
2151 # convert from LAMMPS real units to SI :pre
2153 variable kB equal 1.3806504e-23 # \[J/K/] Boltzmann
2154 variable atm2Pa equal 101325.0
2155 variable A2m equal 1.0e-10
2156 variable fs2s equal 1.0e-15
2157 variable convert equal $\{atm2Pa\}*$\{atm2Pa\}*$\{fs2s\}*$\{A2m\}*$\{A2m\}*$\{A2m\} :pre
2159 # setup problem :pre
2163 lattice fcc 5.376 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
2164 region box block 0 4 0 4 0 4
2168 pair_style lj/cut 13.0
2169 pair_coeff * * 0.2381 3.405
2173 # equilibration and thermalization :pre
2175 velocity all create $T 102486 mom yes rot yes dist gaussian
2176 fix NVT all nvt temp $T $T 10 drag 0.2
2179 # viscosity calculation, switch to NVE if desired :pre
2182 #fix NVE all nve :pre
2185 variable pxy equal pxy
2186 variable pxz equal pxz
2187 variable pyz equal pyz
2188 fix SS all ave/correlate $s $p $d &
2189 v_pxy v_pxz v_pyz type auto file S0St.dat ave running
2190 variable scale equal $\{convert\}/($\{kB\}*$T)*$V*$s*$\{dt\}
2191 variable v11 equal trap(f_SS\[3\])*$\{scale\}
2192 variable v22 equal trap(f_SS\[4\])*$\{scale\}
2193 variable v33 equal trap(f_SS\[5\])*$\{scale\}
2194 thermo_style custom step temp press v_pxy v_pxz v_pyz v_v11 v_v22 v_v33
2196 variable v equal (v_v11+v_v22+v_v33)/3.0
2197 variable ndens equal count(all)/vol
2198 print "average viscosity: $v \[Pa.s\] @ $T K, $\{ndens\} /A^3" :pre
2200 The fifth method is related to the above Green-Kubo method,
2201 but uses the Einstein formulation, analogous to the Einstein
2202 mean-square-displacement formulation for self-diffusivity. The
2203 time-integrated momentum fluxes play the role of Cartesian
2204 coordinates, whose mean-square displacement increases linearly
2205 with time at sufficiently long times.
2209 6.22 Calculating a diffusion coefficient :link(howto_22),h4
2211 The diffusion coefficient D of a material can be measured in at least
2212 2 ways using various options in LAMMPS. See the examples/DIFFUSE
2213 directory for scripts that implement the 2 methods discussed here for
2214 a simple Lennard-Jones fluid model.
2216 The first method is to measure the mean-squared displacement (MSD) of
2217 the system, via the "compute msd"_compute_msd.html command. The slope
2218 of the MSD versus time is proportional to the diffusion coefficient.
2219 The instantaneous MSD values can be accumulated in a vector via the
2220 "fix vector"_fix_vector.html command, and a line fit to the vector to
2221 compute its slope via the "variable slope"_variable.html function, and
2224 The second method is to measure the velocity auto-correlation function
2225 (VACF) of the system, via the "compute vacf"_compute_vacf.html
2226 command. The time-integral of the VACF is proportional to the
2227 diffusion coefficient. The instantaneous VACF values can be
2228 accumulated in a vector via the "fix vector"_fix_vector.html command,
2229 and time integrated via the "variable trap"_variable.html function,
2234 6.23 Using chunks to calculate system properties :link(howto_23),h4
2236 In LAMMS, "chunks" are collections of atoms, as defined by the
2237 "compute chunk/atom"_compute_chunk_atom.html command, which assigns
2238 each atom to a chunk ID (or to no chunk at all). The number of chunks
2239 and the assignment of chunk IDs to atoms can be static or change over
2240 time. Examples of "chunks" are molecules or spatial bins or atoms
2241 with similar values (e.g. coordination number or potential energy).
2243 The per-atom chunk IDs can be used as input to two other kinds of
2244 commands, to calculate various properties of a system:
2246 "fix ave/chunk"_fix_ave_chunk.html
2247 any of the "compute */chunk"_compute.html commands :ul
2249 Here, each of the 3 kinds of chunk-related commands is briefly
2250 overviewed. Then some examples are given of how to compute different
2251 properties with chunk commands.
2253 Compute chunk/atom command: :h5
2255 This compute can assign atoms to chunks of various styles. Only atoms
2256 in the specified group and optional specified region are assigned to a
2257 chunk. Here are some possible chunk definitions:
2259 atoms in same molecule | chunk ID = molecule ID |
2260 atoms of same atom type | chunk ID = atom type |
2261 all atoms with same atom property (charge, radius, etc) | chunk ID = output of compute property/atom |
2262 atoms in same cluster | chunk ID = output of "compute cluster/atom"_compute_cluster_atom.html command |
2263 atoms in same spatial bin | chunk ID = bin ID |
2264 atoms in same rigid body | chunk ID = molecule ID used to define rigid bodies |
2265 atoms with similar potential energy | chunk ID = output of "compute pe/atom"_compute_pe_atom.html |
2266 atoms with same local defect structure | chunk ID = output of "compute centro/atom"_compute_centro_atom.html or "compute coord/atom"_compute_coord_atom.html command :tb(s=|,c=2)
2268 Note that chunk IDs are integer values, so for atom properties or
2269 computes that produce a floating point value, they will be truncated
2270 to an integer. You could also use the compute in a variable that
2271 scales the floating point value to spread it across multiple intergers.
2273 Spatial bins can be of various kinds, e.g. 1d bins = slabs, 2d bins =
2274 pencils, 3d bins = boxes, spherical bins, cylindrical bins.
2276 This compute also calculates the number of chunks {Nchunk}, which is
2277 used by other commands to tally per-chunk data. {Nchunk} can be a
2278 static value or change over time (e.g. the number of clusters). The
2279 chunk ID for an individual atom can also be static (e.g. a molecule
2280 ID), or dynamic (e.g. what spatial bin an atom is in as it moves).
2282 Note that this compute allows the per-atom output of other
2283 "computes"_compute.html, "fixes"_fix.html, and
2284 "variables"_variable.html to be used to define chunk IDs for each
2285 atom. This means you can write your own compute or fix to output a
2286 per-atom quantity to use as chunk ID. See
2287 "Section 10"_Section_modify.html of the documentation for how to
2288 do this. You can also define a "per-atom variable"_variable.html in
2289 the input script that uses a formula to generate a chunk ID for each
2292 Fix ave/chunk command: :h5
2294 This fix takes the ID of a "compute
2295 chunk/atom"_compute_chunk_atom.html command as input. For each chunk,
2296 it then sums one or more specified per-atom values over the atoms in
2297 each chunk. The per-atom values can be any atom property, such as
2298 velocity, force, charge, potential energy, kinetic energy, stress,
2299 etc. Additional keywords are defined for per-chunk properties like
2300 density and temperature. More generally any per-atom value generated
2301 by other "computes"_compute.html, "fixes"_fix.html, and "per-atom
2302 variables"_variable.html, can be summed over atoms in each chunk.
2304 Similar to other averaging fixes, this fix allows the summed per-chunk
2305 values to be time-averaged in various ways, and output to a file. The
2306 fix produces a global array as output with one row of values per
2309 Compute */chunk commands: :h5
2311 Currently the following computes operate on chunks of atoms to produce
2314 "compute com/chunk"_compute_com_chunk.html
2315 "compute gyration/chunk"_compute_gyration_chunk.html
2316 "compute inertia/chunk"_compute_inertia_chunk.html
2317 "compute msd/chunk"_compute_msd_chunk.html
2318 "compute property/chunk"_compute_property_chunk.html
2319 "compute temp/chunk"_compute_temp_chunk.html
2320 "compute torque/chunk"_compute_vcm_chunk.html
2321 "compute vcm/chunk"_compute_vcm_chunk.html :ul
2323 They each take the ID of a "compute
2324 chunk/atom"_compute_chunk_atom.html command as input. As their names
2325 indicate, they calculate the center-of-mass, radius of gyration,
2326 moments of inertia, mean-squared displacement, temperature, torque,
2327 and velocity of center-of-mass for each chunk of atoms. The "compute
2328 property/chunk"_compute_property_chunk.html command can tally the
2329 count of atoms in each chunk and extract other per-chunk properties.
2331 The reason these various calculations are not part of the "fix
2332 ave/chunk command"_fix_ave_chunk.html, is that each requires a more
2333 complicated operation than simply summing and averaging over per-atom
2334 values in each chunk. For example, many of them require calculation
2335 of a center of mass, which requires summing mass*position over the
2336 atoms and then dividing by summed mass.
2338 All of these computes produce a global vector or global array as
2339 output, wih one or more values per chunk. They can be used
2342 As input to the "fix ave/time"_fix_ave_time.html command, which can
2343 write the values to a file and optionally time average them. :ulb,l
2345 As input to the "fix ave/histo"_fix_ave_histo.html command to
2346 histogram values across chunks. E.g. a histogram of cluster sizes or
2347 molecule diffusion rates. :l
2349 As input to special functions of "equal-style
2350 variables"_variable.html, like sum() and max(). E.g. to find the
2351 largest cluster or fastest diffusing molecule. :l
2354 Example calculations with chunks :h5
2356 Here are eaxmples using chunk commands to calculate various
2359 (1) Average velocity in each of 1000 2d spatial bins:
2361 compute cc1 all chunk/atom bin/2d x 0.0 0.1 y lower 0.01 units reduced
2362 fix 1 all ave/chunk 100 10 1000 cc1 vx vy file tmp.out :pre
2364 (2) Temperature in each spatial bin, after subtracting a flow
2367 compute cc1 all chunk/atom bin/2d x 0.0 0.1 y lower 0.1 units reduced
2368 compute vbias all temp/profile 1 0 0 y 10
2369 fix 1 all ave/chunk 100 10 1000 cc1 temp bias vbias file tmp.out :pre
2371 (3) Center of mass of each molecule:
2373 compute cc1 all chunk/atom molecule
2374 compute myChunk all com/chunk cc1
2375 fix 1 all ave/time 100 1 100 c_myChunk\[*\] file tmp.out mode vector :pre
2377 (4) Total force on each molecule and ave/max across all molecules:
2379 compute cc1 all chunk/atom molecule
2380 fix 1 all ave/chunk 1000 1 1000 cc1 fx fy fz file tmp.out
2381 variable xave equal ave(f_1\[2\])
2382 variable xmax equal max(f_1\[2\])
2384 thermo_style custom step temp v_xave v_xmax :pre
2386 (5) Histogram of cluster sizes:
2388 compute cluster all cluster/atom 1.0
2389 compute cc1 all chunk/atom c_cluster compress yes
2390 compute size all property/chunk cc1 count
2391 fix 1 all ave/histo 100 1 100 0 20 20 c_size mode vector ave running beyond ignore file tmp.histo :pre
2395 6.24 Setting parameters for the "kspace_style pppm/disp"_kspace_style.html command :link(howto_24),h4
2397 The PPPM method computes interactions by splitting the pair potential
2398 into two parts, one of which is computed in a normal pairwise fashion,
2399 the so-called real-space part, and one of which is computed using the
2400 Fourier transform, the so called reciprocal-space or kspace part. For
2401 both parts, the potential is not computed exactly but is approximated.
2402 Thus, there is an error in both parts of the computation, the
2403 real-space and the kspace error. The just mentioned facts are true
2404 both for the PPPM for Coulomb as well as dispersion interactions. The
2405 deciding difference - and also the reason why the parameters for
2406 pppm/disp have to be selected with more care - is the impact of the
2407 errors on the results: The kspace error of the PPPM for Coulomb and
2408 dispersion interaction and the real-space error of the PPPM for
2409 Coulomb interaction have the character of noise. In contrast, the
2410 real-space error of the PPPM for dispersion has a clear physical
2411 interpretation: the underprediction of cohesion. As a consequence, the
2412 real-space error has a much stronger effect than the kspace error on
2413 simulation results for pppm/disp. Parameters must thus be chosen in a
2414 way that this error is much smaller than the kspace error.
2416 When using pppm/disp and not making any specifications on the PPPM
2417 parameters via the kspace modify command, parameters will be tuned
2418 such that the real-space error and the kspace error are equal. This
2419 will result in simulations that are either inaccurate or slow, both of
2420 which is not desirable. For selecting parameters for the pppm/disp
2421 that provide fast and accurate simulations, there are two approaches,
2422 which both have their up- and downsides.
2424 The first approach is to set desired real-space an kspace accuracies
2425 via the {kspace_modify force/disp/real} and {kspace_modify
2426 force/disp/kspace} commands. Note that the accuracies have to be
2427 specified in force units and are thus dependend on the chosen unit
2428 settings. For real units, 0.0001 and 0.002 seem to provide reasonable
2429 accurate and efficient computations for the real-space and kspace
2430 accuracies. 0.002 and 0.05 work well for most systems using lj
2431 units. PPPM parameters will be generated based on the desired
2432 accuracies. The upside of this approach is that it usually provides a
2433 good set of parameters and will work for both the {kspace_modify diff
2434 ad} and {kspace_modify diff ik} options. The downside of the method
2435 is that setting the PPPM parameters will take some time during the
2436 initialization of the simulation.
2438 The second approach is to set the parameters for the pppm/disp
2439 explicitly using the {kspace_modify mesh/disp}, {kspace_modify
2440 order/disp}, and {kspace_modify gewald/disp} commands. This approach
2441 requires a more experienced user who understands well the impact of
2442 the choice of parameters on the simulation accuracy and
2443 performance. This approach provides a fast initialization of the
2444 simulation. However, it is sensitive to errors: A combination of
2445 parameters that will perform well for one system might result in
2446 far-from-optimal conditions for other simulations. For example,
2447 parametes that provide accurate and fast computations for
2448 all-atomistic force fields can provide insufficient accuracy or
2449 united-atomistic force fields (which is related to that the latter
2450 typically have larger dispersion coefficients).
2452 To avoid inaccurate or inefficient simulations, the pppm/disp stops
2453 simulations with an error message if no action is taken to control the
2454 PPPM parameters. If the automatic parameter generation is desired and
2455 real-space and kspace accuracies are desired to be equal, this error
2456 message can be suppressed using the {kspace_modify disp/auto yes}
2459 A reasonable approach that combines the upsides of both methods is to
2460 make the first run using the {kspace_modify force/disp/real} and
2461 {kspace_modify force/disp/kspace} commands, write down the PPPM
2462 parameters from the outut, and specify these parameters using the
2463 second approach in subsequent runs (which have the same composition,
2464 force field, and approximately the same volume).
2466 Concerning the performance of the pppm/disp there are two more things
2467 to consider. The first is that when using the pppm/disp, the cutoff
2468 parameter does no longer affect the accuracy of the simulation
2469 (subject to that gewald/disp is adjusted when changing the cutoff).
2470 The performance can thus be increased by examining different values
2471 for the cutoff parameter. A lower bound for the cutoff is only set by
2472 the truncation error of the repulsive term of pair potentials.
2474 The second is that the mixing rule of the pair style has an impact on
2475 the computation time when using the pppm/disp. Fastest computations
2476 are achieved when using the geometric mixing rule. Using the
2477 arithmetic mixing rule substantially increases the computational cost.
2478 The computational overhead can be reduced using the {kspace_modify
2479 mix/disp geom} and {kspace_modify splittol} commands. The first
2480 command simply enforces geometric mixing of the dispersion
2481 coeffiecients in kspace computations. This introduces some error in
2482 the computations but will also significantly speed-up the
2483 simulations. The second keyword sets the accuracy with which the
2484 dispersion coefficients are approximated using a matrix factorization
2485 approach. This may result in better accuracy then using the first
2486 command, but will usually also not provide an equally good increase of
2489 Finally, pppm/disp can also be used when no mixing rules apply.
2490 This can be achieved using the {kspace_modify mix/disp none} command.
2491 Note that the code does not check automatically whether any mixing
2492 rule is fulfilled. If mixing rules do not apply, the user will have
2493 to specify this command explicitly.
2497 6.25 Polarizable models :link(howto_25),h4
2499 In polarizable force fields the charge distributions in molecules and
2500 materials respond to their electrostatic environements. Polarizable
2501 systems can be simulated in LAMMPS using three methods:
2503 the fluctuating charge method, implemented in the "QEQ"_fix_qeq.html
2505 the adiabatic core-shell method, implemented in the
2506 "CORESHELL"_#howto_26 package, :l
2507 the thermalized Drude dipole method, implemented in the
2508 "USER-DRUDE"_#howto_27 package. :l
2511 The fluctuating charge method calculates instantaneous charges on
2512 interacting atoms based on the electronegativity equalization
2513 principle. It is implemented in the "fix qeq"_fix_qeq.html which is
2514 available in several variants. It is a relatively efficient technique
2515 since no additional particles are introduced. This method allows for
2516 charge transfer between molecules or atom groups. However, because the
2517 charges are located at the interaction sites, off-plane components of
2518 polarization cannot be represented in planar molecules or atom groups.
2520 The two other methods share the same basic idea: polarizable atoms are
2521 split into one core atom and one satellite particle (called shell or
2522 Drude particle) attached to it by a harmonic spring. Both atoms bear
2523 a charge and they represent collectively an induced electric dipole.
2524 These techniques are computationally more expensive than the QEq
2525 method because of additional particles and bonds. These two
2526 charge-on-spring methods differ in certain features, with the
2527 core-shell model being normally used for ionic/crystalline materials,
2528 whereas the so-called Drude model is normally used for molecular
2529 systems and fluid states.
2531 The core-shell model is applicable to crystalline materials where the
2532 high symmetry around each site leads to stable trajectories of the
2533 core-shell pairs. However, bonded atoms in molecules can be so close
2534 that a core would interact too strongly or even capture the Drude
2535 particle of a neighbor. The Drude dipole model is relatively more
2536 complex in order to remediate this and other issues. Specifically, the
2537 Drude model includes specific thermostating of the core-Drude pairs
2538 and short-range damping of the induced dipoles.
2540 The three polarization methods can be implemented through a
2541 self-consistent calculation of charges or induced dipoles at each
2542 timestep. In the fluctuating charge scheme this is done by the matrix
2543 inversion method in "fix qeq/point"_fix_qeq.html, but for core-shell
2544 or Drude-dipoles the relaxed-dipoles technique would require an slow
2545 iterative procedure. These self-consistent solutions yield accurate
2546 trajectories since the additional degrees of freedom representing
2547 polarization are massless. An alternative is to attribute a mass to
2548 the additional degrees of freedom and perform time integration using
2549 an extended Lagrangian technique. For the fluctuating charge scheme
2550 this is done by "fix qeq/dynamic"_fix_qeq.html, and for the
2551 charge-on-spring models by the methods outlined in the next two
2552 sections. The assignment of masses to the additional degrees of
2553 freedom can lead to unphysical trajectories if care is not exerted in
2554 choosing the parameters of the poarizable models and the simulation
2557 In the core-shell model the vibration of the shells is kept faster
2558 than the ionic vibrations to mimic the fast response of the
2559 polarizable electrons. But in molecular systems thermalizing the
2560 core-Drude pairs at temperatures comparable to the rest of the
2561 simulation leads to several problems (kinetic energy transfer, too
2562 short a timestep, etc.) In order to avoid these problems the relative
2563 motion of the Drude particles with respect to their cores is kept
2564 "cold" so the vibration of the core-Drude pairs is very slow,
2565 approaching the self-consistent regime. In both models the
2566 temperature is regulated using the velocities of the center of mass of
2567 core+shell (or Drude) pairs, but in the Drude model the actual
2568 relative core-Drude particle motion is thermostated separately as
2573 6.26 Adiabatic core/shell model :link(howto_26),h4
2575 The adiabatic core-shell model by "Mitchell and
2576 Finchham"_#MitchellFinchham is a simple method for adding
2577 polarizability to a system. In order to mimic the electron shell of
2578 an ion, a satellite particle is attached to it. This way the ions are
2579 split into a core and a shell where the latter is meant to react to
2580 the electrostatic environment inducing polarizability.
2582 Technically, shells are attached to the cores by a spring force f =
2583 k*r where k is a parametrized spring constant and r is the distance
2584 between the core and the shell. The charges of the core and the shell
2585 add up to the ion charge, thus q(ion) = q(core) + q(shell). This
2586 setup introduces the ion polarizability (alpha) given by
2587 alpha = q(shell)^2 / k. In a
2588 similar fashion the mass of the ion is distributed on the core and the
2589 shell with the core having the larger mass.
2591 To run this model in LAMMPS, "atom_style"_atom_style.html {full} can
2592 be used since atom charge and bonds are needed. Each kind of
2593 core/shell pair requires two atom types and a bond type. The core and
2594 shell of a core/shell pair should be bonded to each other with a
2595 harmonic bond that provides the spring force. For example, a data file
2596 for NaCl, as found in examples/coreshell, has this format:
2598 432 atoms # core and shell atoms
2599 216 bonds # number of core/shell springs :pre
2601 4 atom types # 2 cores and 2 shells for Na and Cl
2604 0.0 24.09597 xlo xhi
2605 0.0 24.09597 ylo yhi
2606 0.0 24.09597 zlo zhi :pre
2608 Masses # core/shell mass ratio = 0.1 :pre
2610 1 20.690784 # Na core
2611 2 31.90500 # Cl core
2612 3 2.298976 # Na shell
2613 4 3.54500 # Cl shell :pre
2617 1 1 2 1.5005 0.00000000 0.00000000 0.00000000 # core of core/shell pair 1
2618 2 1 4 -2.5005 0.00000000 0.00000000 0.00000000 # shell of core/shell pair 1
2619 3 2 1 1.5056 4.01599500 4.01599500 4.01599500 # core of core/shell pair 2
2620 4 2 3 -0.5056 4.01599500 4.01599500 4.01599500 # shell of core/shell pair 2
2623 Bonds # Bond topology for spring forces :pre
2625 1 2 1 2 # spring for core/shell pair 1
2626 2 2 3 4 # spring for core/shell pair 2
2629 Non-Coulombic (e.g. Lennard-Jones) pairwise interactions are only
2630 defined between the shells. Coulombic interactions are defined
2631 between all cores and shells. If desired, additional bonds can be
2632 specified between cores.
2634 The "special_bonds"_special_bonds.html command should be used to
2635 turn-off the Coulombic interaction within core/shell pairs, since that
2636 interaction is set by the bond spring. This is done using the
2637 "special_bonds"_special_bonds.html command with a 1-2 weight = 0.0,
2638 which is the default value. It needs to be considered whether one has
2639 to adjust the "special_bonds"_special_bonds.html weighting according
2640 to the molecular topology since the interactions of the shells are
2641 bypassed over an extra bond.
2643 Note that this core/shell implementation does not require all ions to
2644 be polarized. One can mix core/shell pairs and ions without a
2645 satellite particle if desired.
2647 Since the core/shell model permits distances of r = 0.0 between the
2648 core and shell, a pair style with a "cs" suffix needs to be used to
2649 implement a valid long-range Coulombic correction. Several such pair
2650 styles are provided in the CORESHELL package. See "this doc
2651 page"_pair_cs.html for details. All of the core/shell enabled pair
2652 styles require the use of a long-range Coulombic solver, as specified
2653 by the "kspace_style"_kspace_style.html command. Either the PPPM or
2654 Ewald solvers can be used.
2656 For the NaCL example problem, these pair style and bond style settings
2659 pair_style born/coul/long/cs 20.0 20.0
2660 pair_coeff * * 0.0 1.000 0.00 0.00 0.00
2661 pair_coeff 3 3 487.0 0.23768 0.00 1.05 0.50 #Na-Na
2662 pair_coeff 3 4 145134.0 0.23768 0.00 6.99 8.70 #Na-Cl
2663 pair_coeff 4 4 405774.0 0.23768 0.00 72.40 145.40 #Cl-Cl :pre
2666 bond_coeff 1 63.014 0.0
2667 bond_coeff 2 25.724 0.0 :pre
2669 When running dynamics with the adiabatic core/shell model, the
2670 following issues should be considered. Since the relative motion of
2671 the core and shell particles corresponds to the polarization, typical
2672 thermostats can alter the polarization behaviour, meaning the shell
2673 will not react freely to its electrostatic environment. This is
2674 critical during the equilibration of the system. Therefore
2675 it's typically desirable to decouple the relative motion of the
2676 core/shell pair, which is an imaginary degree of freedom, from the
2677 real physical system. To do that, the "compute
2678 temp/cs"_compute_temp_cs.html command can be used, in conjunction with
2679 any of the thermostat fixes, such as "fix nvt"_fix_nh.html or "fix
2680 langevin"_fix_langevin. This compute uses the center-of-mass velocity
2681 of the core/shell pairs to calculate a temperature, and insures that
2682 velocity is what is rescaled for thermostatting purposes. This
2683 compute also works for a system with both core/shell pairs and
2684 non-polarized ions (ions without an attached satellite particle). The
2685 "compute temp/cs"_compute_temp_cs.html command requires input of two
2686 groups, one for the core atoms, another for the shell atoms.
2687 Non-polarized ions which might also be included in the treated system
2688 should not be included into either of these groups, they are taken
2689 into account by the {group-ID} (2nd argument) of the compute. The
2690 groups can be defined using the "group {type}"_group.html command.
2691 Note that to perform thermostatting using this definition of
2692 temperature, the "fix modify temp"_fix_modify.html command should be
2693 used to assign the compute to the thermostat fix. Likewise the
2694 "thermo_modify temp"_thermo_modify.html command can be used to make
2695 this temperature be output for the overall system.
2697 For the NaCl example, this can be done as follows:
2699 group cores type 1 2
2700 group shells type 3 4
2701 compute CSequ all temp/cs cores shells
2702 fix thermoberendsen all temp/berendsen 1427 1427 0.4 # thermostat for the true physical system
2703 fix thermostatequ all nve # integrator as needed for the berendsen thermostat
2704 fix_modify thermoberendsen temp CSequ
2705 thermo_modify temp CSequ # output of center-of-mass derived temperature :pre
2707 If "compute temp/cs"_compute_temp_cs.html is used, the decoupled
2708 relative motion of the core and the shell should in theory be
2709 stable. However numerical fluctuation can introduce a small
2710 momentum to the system, which is noticable over long trajectories.
2711 Therefore it is recomendable to use the "fix
2712 momentum"_fix_momentum.html command in combination with "compute
2713 temp/cs"_compute_temp_cs.html when equilibrating the system to
2716 When intializing the velocities of a system with core/shell pairs, it
2717 is also desirable to not introduce energy into the relative motion of
2718 the core/shell particles, but only assign a center-of-mass velocity to
2719 the pairs. This can be done by using the {bias} keyword of the
2720 "velocity create"_velocity.html command and assigning the "compute
2721 temp/cs"_compute_temp_cs.html command to the {temp} keyword of the
2722 "velocity"_velocity.html commmand, e.g.
2724 velocity all create 1427 134 bias yes temp CSequ
2725 velocity all scale 1427 temp CSequ :pre
2727 It is important to note that the polarizability of the core/shell
2728 pairs is based on their relative motion. Therefore the choice of
2729 spring force and mass ratio need to ensure much faster relative motion
2730 of the 2 atoms within the core/shell pair than their center-of-mass
2731 velocity. This allow the shells to effectively react instantaneously
2732 to the electrostatic environment. This fast movement also limits the
2733 timestep size that can be used.
2735 The primary literature of the adiabatic core/shell model suggests that
2736 the fast relative motion of the core/shell pairs only allows negligible
2737 energy transfer to the environment. Therefore it is not intended to
2738 decouple the core/shell degree of freedom from the physical system
2739 during production runs. In other words, the "compute
2740 temp/cs"_compute_temp_cs.html command should not be used during
2741 production runs and is only required during equilibration. This way one
2742 is consistent with literature (based on the code packages DL_POLY or
2745 The mentioned energy transfer will typically lead to a small drift
2746 in total energy over time. This internal energy can be monitored
2747 using the "compute chunk/atom"_compute_chunk_atom.html and "compute
2748 temp/chunk"_compute_temp_chunk.html commands. The internal kinetic
2749 energies of each core/shell pair can then be summed using the sum()
2750 special function of the "variable"_variable.html command. Or they can
2751 be time/averaged and output using the "fix ave/time"_fix_ave_time.html
2752 command. To use these commands, each core/shell pair must be defined
2753 as a "chunk". If each core/shell pair is defined as its own molecule,
2754 the molecule ID can be used to define the chunks. If cores are bonded
2755 to each other to form larger molecules, the chunks can be identified
2756 by the "fix property/atom"_fix_property_atom.html via assigning a
2757 core/shell ID to each atom using a special field in the data file read
2758 by the "read_data"_read_data.html command. This field can then be
2759 accessed by the "compute property/atom"_compute_property_atom.html
2760 command, to use as input to the "compute
2761 chunk/atom"_compute_chunk_atom.html command to define the core/shell
2766 fix csinfo all property/atom i_CSID # property/atom command
2767 read_data NaCl_CS_x0.1_prop.data fix csinfo NULL CS-Info # atom property added in the data-file
2768 compute prop all property/atom i_CSID
2769 compute cs_chunk all chunk/atom c_prop
2770 compute cstherm all temp/chunk cs_chunk temp internal com yes cdof 3.0 # note the chosen degrees of freedom for the core/shell pairs
2771 fix ave_chunk all ave/time 10 1 10 c_cstherm file chunk.dump mode vector :pre
2773 The additional section in the date file would be formatted like this:
2775 CS-Info # header of additional section :pre
2777 1 1 # column 1 = atom ID, column 2 = core/shell ID
2789 6.27 Drude induced dipoles :link(howto_27),h4
2791 The thermalized Drude model, similarly to the "core-shell"_#howto_26
2792 model, representes induced dipoles by a pair of charges (the core atom
2793 and the Drude particle) connected by a harmonic spring. The Drude
2794 model has a number of features aimed at its use in molecular systems
2795 ("Lamoureux and Roux"_#howto-Lamoureux):
2797 Thermostating of the additional degrees of freedom associated with the
2798 induced dipoles at very low temperature, in terms of the reduced
2799 coordinates of the Drude particles with respect to their cores. This
2800 makes the trajectory close to that of relaxed induced dipoles. :ulb,l
2802 Consistent definition of 1-2 to 1-4 neighbors. A core-Drude particle
2803 pair represents a single (polarizable) atom, so the special screening
2804 factors in a covalent structure should be the same for the core and
2805 the Drude particle. Drude particles have to inherit the 1-2, 1-3, 1-4
2806 special neighbor relations from their respective cores. :l
2808 Stabilization of the interactions between induced dipoles. Drude
2809 dipoles on covalently bonded atoms interact too strongly due to the
2810 short distances, so an atom may capture the Drude particle of a
2811 neighbor, or the induced dipoles within the same molecule may align
2812 too much. To avoid this, damping at short range can be done by Thole
2813 functions (for which there are physical grounds). This Thole damping
2814 is applied to the point charges composing the induced dipole (the
2815 charge of the Drude particle and the opposite charge on the core, not
2816 to the total charge of the core atom). :l
2819 A detailed tutorial covering the usage of Drude induced dipoles in
2820 LAMMPS is "available here"_tutorial_drude.html.
2822 As with the core-shell model, the cores and Drude particles should
2823 appear in the data file as standard atoms. The same holds for the
2824 springs between them, which are described by standard harmonic bonds.
2825 The nature of the atoms (core, Drude particle or non-polarizable) is
2826 specified via the "fix drude"_fix_drude.html command. The special
2827 list of neighbors is automatically refactored to account for the
2828 equivalence of core and Drude particles as regards special 1-2 to 1-4
2829 screening. It may be necessary to use the {extra} keyword of the
2830 "special_bonds"_special_bonds.html command. If using "fix
2831 shake"_fix_shake.html, make sure no Drude particle is in this fix
2834 There are two ways to thermostat the Drude particles at a low
2835 temperature: use either "fix langevin/drude"_fix_langevin_drude.html
2836 for a Langevin thermostat, or "fix
2837 drude/transform/*"_fix_drude_transform.html for a Nose-Hoover
2838 thermostat. The former requires use of the command "comm_modify vel
2839 yes"_comm_modify.html. The latter requires two separate integration
2840 fixes like {nvt} or {npt}. The correct temperatures of the reduced
2841 degrees of freedom can be calculated using the "compute
2842 temp/drude"_compute_temp_drude.html. This requires also to use the
2843 command {comm_modify vel yes}.
2845 Short-range damping of the induced dipole interactions can be achieved
2846 using Thole functions through the "pair style
2847 thole"_pair_thole.html in "pair_style hybrid/overlay"_pair_hybrid.html
2848 with a Coulomb pair style. It may be useful to use {coul/long/cs} or
2849 similar from the CORESHELL package if the core and Drude particle come
2850 too close, which can cause numerical issues.
2855 :link(howto-Berendsen)
2856 [(Berendsen)] Berendsen, Grigera, Straatsma, J Phys Chem, 91,
2859 :link(howto-Cornell)
2860 [(Cornell)] Cornell, Cieplak, Bayly, Gould, Merz, Ferguson,
2861 Spellmeyer, Fox, Caldwell, Kollman, JACS 117, 5179-5197 (1995).
2864 [(Horn)] Horn, Swope, Pitera, Madura, Dick, Hura, and Head-Gordon,
2865 J Chem Phys, 120, 9665 (2004).
2867 :link(howto-Ikeshoji)
2868 [(Ikeshoji)] Ikeshoji and Hafskjold, Molecular Physics, 81, 251-261
2871 :link(howto-Wirnsberger)
2872 [(Wirnsberger)] Wirnsberger, Frenkel, and Dellago, J Chem Phys, 143, 124104
2875 :link(howto-MacKerell)
2876 [(MacKerell)] MacKerell, Bashford, Bellott, Dunbrack, Evanseck, Field,
2877 Fischer, Gao, Guo, Ha, et al, J Phys Chem, 102, 3586 (1998).
2880 [(Mayo)] Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909
2884 [(Jorgensen)] Jorgensen, Chandrasekhar, Madura, Impey, Klein, J Chem
2885 Phys, 79, 926 (1983).
2888 [(Price)] Price and Brooks, J Chem Phys, 121, 10096 (2004).
2891 [(Shinoda)] Shinoda, Shiga, and Mikami, Phys Rev B, 69, 134103 (2004).
2893 :link(MitchellFinchham)
2894 [(Mitchell and Finchham)] Mitchell, Finchham, J Phys Condensed Matter,
2895 5, 1031-1038 (1993).
2897 :link(howto-Lamoureux)
2898 [(Lamoureux and Roux)] G. Lamoureux, B. Roux, J. Chem. Phys 119, 3025 (2003)