diff --git a/doc/src/Eqs/fix_mvv_dpd.jpg b/doc/src/Eqs/fix_mvv_dpd.jpg new file mode 100644 index 000000000..f62ae28bc Binary files /dev/null and b/doc/src/Eqs/fix_mvv_dpd.jpg differ diff --git a/doc/src/Eqs/fix_mvv_dpd.tex b/doc/src/Eqs/fix_mvv_dpd.tex new file mode 100644 index 000000000..4652d54b7 --- /dev/null +++ b/doc/src/Eqs/fix_mvv_dpd.tex @@ -0,0 +1,21 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + v(t+\frac{\Delta t}{2}) = v(t) + \frac{\Delta t}{2}\cdot a(t), +$$ + +$$ + r(t+\Delta t) = r(t) + \Delta t\cdot v(t+\frac{\Delta t}{2}), +$$ + +$$ + a(t+\Delta t) = \frac{1}{m}\cdot F\left[ r(t+\Delta t), v(t) +\lambda \cdot \Delta t\cdot a(t)\right], +$$ + +$$ + v(t+\Delta t) = v(t+\frac{\Delta t}{2}) + \frac{\Delta t}{2}\cdot a(t++\Delta t), +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_edpd_force.jpg b/doc/src/Eqs/pair_edpd_force.jpg new file mode 100644 index 000000000..fabb6f772 Binary files /dev/null and b/doc/src/Eqs/pair_edpd_force.jpg differ diff --git a/doc/src/Eqs/pair_edpd_force.tex b/doc/src/Eqs/pair_edpd_force.tex new file mode 100644 index 000000000..f6a0ca0d3 --- /dev/null +++ b/doc/src/Eqs/pair_edpd_force.tex @@ -0,0 +1,33 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + \mathbf{F}_{ij}^{C} = \alpha_{ij}{\omega_{C}}(r_{ij})\mathbf{e}_{ij}, +$$ + +$$ + \mathbf{F}_{ij}^{D} = -\gamma {\omega_{D}}(r_{ij})(\mathbf{e}_{ij} \cdot \mathbf{v}_{ij})\mathbf{e}_{ij}, +$$ + +$$ + \mathbf{F}_{ij}^{R} = \sigma {\omega_{R}}(r_{ij}){\xi_{ij}}\Delta t^{-1/2} \mathbf{e}_{ij}, +$$ + +$$ + \omega_{C}(r) = 1 - r/r_c, +$$ + +$$ + \alpha_{ij} = A\cdot k_B(T_i + T_j)/2, +$$ + +$$ + \omega_{D}(r) = \omega^2_{R}(r) = (1-r/r_c)^s, +$$ + +$$ + \sigma_{ij}^2 = 4\gamma k_B T_i T_j/(T_i + T_j), +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_edpd_gov.jpg b/doc/src/Eqs/pair_edpd_gov.jpg new file mode 100644 index 000000000..10b303a21 Binary files /dev/null and b/doc/src/Eqs/pair_edpd_gov.jpg differ diff --git a/doc/src/Eqs/pair_edpd_gov.tex b/doc/src/Eqs/pair_edpd_gov.tex new file mode 100644 index 000000000..782cdec99 --- /dev/null +++ b/doc/src/Eqs/pair_edpd_gov.tex @@ -0,0 +1,15 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + \frac{\mathrm{d}^2 \mathbf{r}_i}{\mathrm{d} t^2}= + \frac{\mathrm{d} \mathbf{v}_i}{\mathrm{d} t} + =\mathbf{F}_{i}=\sum_{i\neq j}(\mathbf{F}_{ij}^{C}+\mathbf{F}_{ij}^{D}+\mathbf{F}_{ij}^{R}), +$$ + +$$ + C_v\frac{\mathrm{d} T_i}{\mathrm{d} t}= q_{i} = \sum_{i\neq j}(q_{ij}^{C}+q_{ij}^{V}+q_{ij}^{R}), +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_edpd_heat.jpg b/doc/src/Eqs/pair_edpd_heat.jpg new file mode 100644 index 000000000..b9256a1d1 Binary files /dev/null and b/doc/src/Eqs/pair_edpd_heat.jpg differ diff --git a/doc/src/Eqs/pair_edpd_heat.tex b/doc/src/Eqs/pair_edpd_heat.tex new file mode 100644 index 000000000..241a1bad6 --- /dev/null +++ b/doc/src/Eqs/pair_edpd_heat.tex @@ -0,0 +1,29 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + q_i^C = \sum_{j \ne i} k_{ij} \omega_{CT}(r_{ij}) \left( \frac{1}{T_i} - \frac{1}{T_j} \right), +$$ + +$$ + q_i^V = \frac{1}{2 C_v}\sum_{j \ne i}{ \left\{ \omega_D(r_{ij})\left[\gamma_{ij} \left( \mathbf{e}_{ij} \cdot \mathbf{v}_{ij} \right)^2 - \frac{\left( \sigma _{ij} \right)^2}{m}\right] - \sigma _{ij} \omega_R(r_{ij})\left( \mathbf{e}_{ij} \cdot \mathbf{v}_{ij} \right){\xi_{ij}} \right\} }, +$$ + +$$ + q_i^R = \sum_{j \ne i} \beta _{ij} \omega_{RT}(r_{ij}) d {t^{ - 1/2}} \xi_{ij}^e, +$$ + +$$ + \omega_{CT}(r)=\omega_{RT}^2(r)=\left(1-r/r_{ct}\right)^{s_T}, +$$ + +$$ + k_{ij}=C_v^2\kappa(T_i + T_j)^2/4k_B, +$$ + +$$ + \beta_{ij}^2=2k_Bk_{ij}, +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_edpd_kappa.jpg b/doc/src/Eqs/pair_edpd_kappa.jpg new file mode 100644 index 000000000..158974d37 Binary files /dev/null and b/doc/src/Eqs/pair_edpd_kappa.jpg differ diff --git a/doc/src/Eqs/pair_edpd_kappa.tex b/doc/src/Eqs/pair_edpd_kappa.tex new file mode 100644 index 000000000..ac5ca9f74 --- /dev/null +++ b/doc/src/Eqs/pair_edpd_kappa.tex @@ -0,0 +1,9 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + \kappa = \frac{315k_B\upsilon }{2\pi \rho C_v r_{ct}^5}\frac{1}{Pr}, +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_mdpd_force.jpg b/doc/src/Eqs/pair_mdpd_force.jpg new file mode 100644 index 000000000..9b0e573b7 Binary files /dev/null and b/doc/src/Eqs/pair_mdpd_force.jpg differ diff --git a/doc/src/Eqs/pair_mdpd_force.tex b/doc/src/Eqs/pair_mdpd_force.tex new file mode 100644 index 000000000..b5c8d9be4 --- /dev/null +++ b/doc/src/Eqs/pair_mdpd_force.tex @@ -0,0 +1,17 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + \mathbf{F}_{ij}^C = Aw_c(r_{ij})\mathbf{e}_{ij} + B(\rho_i+\rho_j)w_d(r_{ij})\mathbf{e}_{ij}, +$$ + +$$ + \mathbf{F}_{ij}^{D} = -\gamma {\omega_{D}}(r_{ij})(\mathbf{e}_{ij} \cdot \mathbf{v}_{ij})\mathbf{e}_{ij}, +$$ + +$$ + \mathbf{F}_{ij}^{R} = \sigma {\omega_{R}}(r_{ij}){\xi_{ij}}\Delta t^{-1/2} \mathbf{e}_{ij}, +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_tdpd_flux.jpg b/doc/src/Eqs/pair_tdpd_flux.jpg new file mode 100644 index 000000000..9da788ae9 Binary files /dev/null and b/doc/src/Eqs/pair_tdpd_flux.jpg differ diff --git a/doc/src/Eqs/pair_tdpd_flux.tex b/doc/src/Eqs/pair_tdpd_flux.tex new file mode 100644 index 000000000..f753f16ac --- /dev/null +++ b/doc/src/Eqs/pair_tdpd_flux.tex @@ -0,0 +1,21 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + Q_{ij}^D = -\kappa_{ij} w_{DC}(r_{ij}) \left( C_i - C_j \right), +$$ + +$$ + Q_{ij}^R = \epsilon_{ij}\left( C_i + C_j \right) w_{RC}(r_{ij}) \xi_{ij}, +$$ + +$$ + w_{DC}(r_{ij})=w^2_{RC}(r_{ij}) = (1 - r/r_{cc})^{\rm power\_{cc}}, +$$ + +$$ + \epsilon_{ij}^2 = m_s^2\kappa_{ij}\rho, +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_tdpd_force.jpg b/doc/src/Eqs/pair_tdpd_force.jpg new file mode 100644 index 000000000..f6feb3539 Binary files /dev/null and b/doc/src/Eqs/pair_tdpd_force.jpg differ diff --git a/doc/src/Eqs/pair_tdpd_force.tex b/doc/src/Eqs/pair_tdpd_force.tex new file mode 100644 index 000000000..49edff970 --- /dev/null +++ b/doc/src/Eqs/pair_tdpd_force.tex @@ -0,0 +1,29 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + \mathbf{F}_{ij}^{C} = A{\omega_{C}}(r_{ij})\mathbf{e}_{ij}, +$$ + +$$ + \mathbf{F}_{ij}^{D} = -\gamma {\omega_{D}}(r_{ij})(\mathbf{e}_{ij} \cdot \mathbf{v}_{ij})\mathbf{e}_{ij}, +$$ + +$$ + \mathbf{F}_{ij}^{R} = \sigma {\omega_{R}}(r_{ij}){\xi_{ij}}\Delta t^{-1/2} \mathbf{e}_{ij}, +$$ + +$$ + \omega_{C}(r) = 1 - r/r_c, +$$ + +$$ + \omega_{D}(r) = \omega^2_{R}(r) = (1-r/r_c)^{\rm power\_f}, +$$ + +$$ + \sigma^2 = 2\gamma k_B T, +$$ + +\end{document} diff --git a/doc/src/Eqs/pair_tdpd_gov.jpg b/doc/src/Eqs/pair_tdpd_gov.jpg new file mode 100644 index 000000000..0ed793a13 Binary files /dev/null and b/doc/src/Eqs/pair_tdpd_gov.jpg differ diff --git a/doc/src/Eqs/pair_tdpd_gov.tex b/doc/src/Eqs/pair_tdpd_gov.tex new file mode 100644 index 000000000..e4b5f5790 --- /dev/null +++ b/doc/src/Eqs/pair_tdpd_gov.tex @@ -0,0 +1,13 @@ +\documentclass[12pt]{article} + +\begin{document} + +$$ + \frac{\mathrm{d}^2 \mathbf{r}_i}{\mathrm{d} t^2} = \frac{\mathrm{d} \mathbf{v}_i}{\mathrm{d} t}=\mathbf{F}_{i}=\sum_{i\neq j}(\mathbf{F}_{ij}^{C}+\mathbf{F}_{ij}^{D}+\mathbf{F}_{ij}^{R}), +$$ + +$$ + \frac{\mathrm{d} C_{i}}{\mathrm{d} t}= Q_{i} = \sum_{i\neq j}(Q_{ij}^{D}+Q_{ij}^{R}) + Q_{i}^{S}, +$$ + +\end{document} diff --git a/doc/src/JPG/examples_edpd.jpg b/doc/src/JPG/examples_edpd.jpg new file mode 100644 index 000000000..4d0cde637 Binary files /dev/null and b/doc/src/JPG/examples_edpd.jpg differ diff --git a/doc/src/JPG/examples_mdpd.gif b/doc/src/JPG/examples_mdpd.gif new file mode 100644 index 000000000..29ace1a0b Binary files /dev/null and b/doc/src/JPG/examples_mdpd.gif differ diff --git a/doc/src/JPG/examples_mdpd_first.jpg b/doc/src/JPG/examples_mdpd_first.jpg new file mode 100644 index 000000000..958912e66 Binary files /dev/null and b/doc/src/JPG/examples_mdpd_first.jpg differ diff --git a/doc/src/JPG/examples_mdpd_last.jpg b/doc/src/JPG/examples_mdpd_last.jpg new file mode 100644 index 000000000..1bf8b9ac8 Binary files /dev/null and b/doc/src/JPG/examples_mdpd_last.jpg differ diff --git a/doc/src/JPG/examples_tdpd.jpg b/doc/src/JPG/examples_tdpd.jpg new file mode 100644 index 000000000..c00e83e00 Binary files /dev/null and b/doc/src/JPG/examples_tdpd.jpg differ diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index 571c6c492..fda727ec0 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -1,1234 +1,1245 @@ "Previous Section"_Section_start.html - "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc - "Next Section"_Section_packages.html :c :link(lws,http://lammps.sandia.gov) :link(ld,Manual.html) :link(lc,Section_commands.html#comm) :line 3. Commands :h3 This section describes how a LAMMPS input script is formatted and the input script commands used to define a LAMMPS simulation. 3.1 "LAMMPS input script"_#cmd_1 3.2 "Parsing rules"_#cmd_2 3.3 "Input script structure"_#cmd_3 3.4 "Commands listed by category"_#cmd_4 3.5 "Commands listed alphabetically"_#cmd_5 :all(b) :line :line 3.1 LAMMPS input script :link(cmd_1),h4 LAMMPS executes by reading commands from a input script (text file), one line at a time. When the input script ends, LAMMPS exits. Each command causes LAMMPS to take some action. It may set an internal variable, read in a file, or run a simulation. Most commands have default settings, which means you only need to use the command if you wish to change the default. In many cases, the ordering of commands in an input script is not important. However the following rules apply: (1) LAMMPS does not read your entire input script and then perform a simulation with all the settings. Rather, the input script is read one line at a time and each command takes effect when it is read. Thus this sequence of commands: timestep 0.5 run 100 run 100 :pre does something different than this sequence: run 100 timestep 0.5 run 100 :pre In the first case, the specified timestep (0.5 fmsec) is used for two simulations of 100 timesteps each. In the 2nd case, the default timestep (1.0 fmsec) is used for the 1st 100 step simulation and a 0.5 fmsec timestep is used for the 2nd one. (2) Some commands are only valid when they follow other commands. For example you cannot set the temperature of a group of atoms until atoms have been defined and a group command is used to define which atoms belong to the group. (3) Sometimes command B will use values that can be set by command A. This means command A must precede command B in the input script if it is to have the desired effect. For example, the "read_data"_read_data.html command initializes the system by setting up the simulation box and assigning atoms to processors. If default values are not desired, the "processors"_processors.html and "boundary"_boundary.html commands need to be used before read_data to tell LAMMPS how to map processors to the simulation box. Many input script errors are detected by LAMMPS and an ERROR or WARNING message is printed. "This section"_Section_errors.html gives more information on what errors mean. The documentation for each command lists restrictions on how the command can be used. :line 3.2 Parsing rules :link(cmd_2),h4 Each non-blank line in the input script is treated as a command. LAMMPS commands are case sensitive. Command names are lower-case, as are specified command arguments. Upper case letters may be used in file names or user-chosen ID strings. Here is how each line in the input script is parsed by LAMMPS: (1) If the last printable character on the line is a "&" character, the command is assumed to continue on the next line. The next line is concatenated to the previous line by removing the "&" character and line break. This allows long commands to be continued across two or more lines. See the discussion of triple quotes in (6) for how to continue a command across multiple line without using "&" characters. (2) All characters from the first "#" character onward are treated as comment and discarded. See an exception in (6). Note that a comment after a trailing "&" character will prevent the command from continuing on the next line. Also note that for multi-line commands a single leading "#" will comment out the entire command. (3) The line is searched repeatedly for $ characters, which indicate variables that are replaced with a text string. See an exception in (6). If the $ is followed by curly brackets, then the variable name is the text inside the curly brackets. If no curly brackets follow the $, then the variable name is the single character immediately following the $. Thus $\{myTemp\} and $x refer to variable names "myTemp" and "x". How the variable is converted to a text string depends on what style of variable it is; see the "variable"_variable.html doc page for details. It can be a variable that stores multiple text strings, and return one of them. The returned text string can be multiple "words" (space separated) which will then be interpreted as multiple arguments in the input command. The variable can also store a numeric formula which will be evaluated and its numeric result returned as a string. As a special case, if the $ is followed by parenthesis, then the text inside the parenthesis is treated as an "immediate" variable and evaluated as an "equal-style variable"_variable.html. This is a way to use numeric formulas in an input script without having to assign them to variable names. For example, these 3 input script lines: variable X equal (xlo+xhi)/2+sqrt(v_area) region 1 block $X 2 INF INF EDGE EDGE variable X delete :pre can be replaced by region 1 block $((xlo+xhi)/2+sqrt(v_area)) 2 INF INF EDGE EDGE :pre so that you do not have to define (or discard) a temporary variable X. Note that neither the curly-bracket or immediate form of variables can contain nested $ characters for other variables to substitute for. Thus you cannot do this: variable a equal 2 variable b2 equal 4 print "B2 = $\{b$a\}" :pre Nor can you specify this $($x-1.0) for an immediate variable, but you could use $(v_x-1.0), since the latter is valid syntax for an "equal-style variable"_variable.html. See the "variable"_variable.html command for more details of how strings are assigned to variables and evaluated, and how they can be used in input script commands. (4) The line is broken into "words" separated by whitespace (tabs, spaces). Note that words can thus contain letters, digits, underscores, or punctuation characters. (5) The first word is the command name. All successive words in the line are arguments. (6) If you want text with spaces to be treated as a single argument, it can be enclosed in either single or double or triple quotes. A long single argument enclosed in single or double quotes can span multiple lines if the "&" character is used, as described above. When the lines are concatenated together (and the "&" characters and line breaks removed), the text will become a single line. If you want multiple lines of an argument to retain their line breaks, the text can be enclosed in triple quotes, in which case "&" characters are not needed. For example: print "Volume = $v" print 'Volume = $v' if "$\{steps\} > 1000" then quit variable a string "red green blue & purple orange cyan" print """ System volume = $v System temperature = $t """ :pre In each case, the single, double, or triple quotes are removed when the single argument they enclose is stored internally. See the "dump modify format"_dump_modify.html, "print"_print.html, "if"_if.html, and "python"_python.html commands for examples. A "#" or "$" character that is between quotes will not be treated as a comment indicator in (2) or substituted for as a variable in (3). NOTE: If the argument is itself a command that requires a quoted argument (e.g. using a "print"_print.html command as part of an "if"_if.html or "run every"_run.html command), then single, double, or triple quotes can be nested in the usual manner. See the doc pages for those commands for examples. Only one of level of nesting is allowed, but that should be sufficient for most use cases. :line 3.3 Input script structure :h4,link(cmd_3) This section describes the structure of a typical LAMMPS input script. The "examples" directory in the LAMMPS distribution contains many sample input scripts; the corresponding problems are discussed in "Section 7"_Section_example.html, and animated on the "LAMMPS WWW Site"_lws. A LAMMPS input script typically has 4 parts: Initialization Atom definition Settings Run a simulation :ol The last 2 parts can be repeated as many times as desired. I.e. run a simulation, change some settings, run some more, etc. Each of the 4 parts is now described in more detail. Remember that almost all the commands need only be used if a non-default value is desired. (1) Initialization Set parameters that need to be defined before atoms are created or read-in from a file. The relevant commands are "units"_units.html, "dimension"_dimension.html, "newton"_newton.html, "processors"_processors.html, "boundary"_boundary.html, "atom_style"_atom_style.html, "atom_modify"_atom_modify.html. If force-field parameters appear in the files that will be read, these commands tell LAMMPS what kinds of force fields are being used: "pair_style"_pair_style.html, "bond_style"_bond_style.html, "angle_style"_angle_style.html, "dihedral_style"_dihedral_style.html, "improper_style"_improper_style.html. (2) Atom definition There are 3 ways to define atoms in LAMMPS. Read them in from a data or restart file via the "read_data"_read_data.html or "read_restart"_read_restart.html commands. These files can contain molecular topology information. Or create atoms on a lattice (with no molecular topology), using these commands: "lattice"_lattice.html, "region"_region.html, "create_box"_create_box.html, "create_atoms"_create_atoms.html. The entire set of atoms can be duplicated to make a larger simulation using the "replicate"_replicate.html command. (3) Settings Once atoms and molecular topology are defined, a variety of settings can be specified: force field coefficients, simulation parameters, output options, etc. Force field coefficients are set by these commands (they can also be set in the read-in files): "pair_coeff"_pair_coeff.html, "bond_coeff"_bond_coeff.html, "angle_coeff"_angle_coeff.html, "dihedral_coeff"_dihedral_coeff.html, "improper_coeff"_improper_coeff.html, "kspace_style"_kspace_style.html, "dielectric"_dielectric.html, "special_bonds"_special_bonds.html. Various simulation parameters are set by these commands: "neighbor"_neighbor.html, "neigh_modify"_neigh_modify.html, "group"_group.html, "timestep"_timestep.html, "reset_timestep"_reset_timestep.html, "run_style"_run_style.html, "min_style"_min_style.html, "min_modify"_min_modify.html. Fixes impose a variety of boundary conditions, time integration, and diagnostic options. The "fix"_fix.html command comes in many flavors. Various computations can be specified for execution during a simulation using the "compute"_compute.html, "compute_modify"_compute_modify.html, and "variable"_variable.html commands. Output options are set by the "thermo"_thermo.html, "dump"_dump.html, and "restart"_restart.html commands. (4) Run a simulation A molecular dynamics simulation is run using the "run"_run.html command. Energy minimization (molecular statics) is performed using the "minimize"_minimize.html command. A parallel tempering (replica-exchange) simulation can be run using the "temper"_temper.html command. :line 3.4 Commands listed by category :link(cmd_4),h4 This section lists core LAMMPS commands, grouped by category. The "next section"_#cmd_5 lists all commands alphabetically. The next section also includes (long) lists of style options for entries that appear in the following categories as a single command (fix, compute, pair, etc). Commands that are added by user packages are not included in the categories here, but they are in the next section. Initialization: "newton"_newton.html, "package"_package.html, "processors"_processors.html, "suffix"_suffix.html, "units"_units.html Setup simulation box: "boundary"_boundary.html, "box"_box.html, "change_box"_change_box.html, "create_box"_create_box.html, "dimension"_dimension.html, "lattice"_lattice.html, "region"_region.html Setup atoms: "atom_modify"_atom_modify.html, "atom_style"_atom_style.html, "balance"_balance.html, "create_atoms"_create_atoms.html, "create_bonds"_create_bonds.html, "delete_atoms"_delete_atoms.html, "delete_bonds"_delete_bonds.html, "displace_atoms"_displace_atoms.html, "group"_group.html, "mass"_mass.html, "molecule"_molecule.html, "read_data"_read_data.html, "read_dump"_read_dump.html, "read_restart"_read_restart.html, "replicate"_replicate.html, "set"_set.html, "velocity"_velocity.html Force fields: "angle_coeff"_angle_coeff.html, "angle_style"_angle_style.html, "bond_coeff"_bond_coeff.html, "bond_style"_bond_style.html, "bond_write"_bond_write.html, "dielectric"_dielectric.html, "dihedral_coeff"_dihedral_coeff.html, "dihedral_style"_dihedral_style.html, "improper_coeff"_improper_coeff.html, "improper_style"_improper_style.html, "kspace_modify"_kspace_modify.html, "kspace_style"_kspace_style.html, "pair_coeff"_pair_coeff.html, "pair_modify"_pair_modify.html, "pair_style"_pair_style.html, "pair_write"_pair_write.html, "special_bonds"_special_bonds.html Settings: "comm_modify"_comm_modify.html, "comm_style"_comm_style.html, "info"_info.html, "min_modify"_min_modify.html, "min_style"_min_style.html, "neigh_modify"_neigh_modify.html, "neighbor"_neighbor.html, "partition"_partition.html, "reset_timestep"_reset_timestep.html, "run_style"_run_style.html, "timer"_timer.html, "timestep"_timestep.html Operations within timestepping (fixes) and diagnostics (computes): "compute"_compute.html, "compute_modify"_compute_modify.html, "fix"_fix.html, "fix_modify"_fix_modify.html, "uncompute"_uncompute.html, "unfix"_unfix.html Output: "dump image"_dump_image.html, "dump movie"_dump_image.html, "dump"_dump.html, "dump_modify"_dump_modify.html, "restart"_restart.html, "thermo"_thermo.html, "thermo_modify"_thermo_modify.html, "thermo_style"_thermo_style.html, "undump"_undump.html, "write_coeff"_write_coeff.html, "write_data"_write_data.html, "write_dump"_write_dump.html, "write_restart"_write_restart.html Actions: "minimize"_minimize.html, "neb"_neb.html, "prd"_prd.html, "rerun"_rerun.html, "run"_run.html, "tad"_tad.html, "temper"_temper.html Input script control: "clear"_clear.html, "echo"_echo.html, "if"_if.html, "include"_include.html, "jump"_jump.html, "label"_label.html, "log"_log.html, "next"_next.html, "print"_print.html, "python"_python.html, "quit"_quit.html, "shell"_shell.html, "variable"_variable.html :line 3.5 Individual commands :h4,link(cmd_5),link(comm) This section lists all LAMMPS commands alphabetically, with a separate listing below of styles within certain commands. The "previous section"_#cmd_4 lists the same commands, grouped by category. Note that some style options for some commands are part of specific LAMMPS packages, which means they cannot be used unless the package was included when LAMMPS was built. Not all packages are included in a default LAMMPS build. These dependencies are listed as Restrictions in the command's documentation. "angle_coeff"_angle_coeff.html, "angle_style"_angle_style.html, "atom_modify"_atom_modify.html, "atom_style"_atom_style.html, "balance"_balance.html, "bond_coeff"_bond_coeff.html, "bond_style"_bond_style.html, "bond_write"_bond_write.html, "boundary"_boundary.html, "box"_box.html, "change_box"_change_box.html, "clear"_clear.html, "comm_modify"_comm_modify.html, "comm_style"_comm_style.html, "compute"_compute.html, "compute_modify"_compute_modify.html, "create_atoms"_create_atoms.html, "create_bonds"_create_bonds.html, "create_box"_create_box.html, "delete_atoms"_delete_atoms.html, "delete_bonds"_delete_bonds.html, "dielectric"_dielectric.html, "dihedral_coeff"_dihedral_coeff.html, "dihedral_style"_dihedral_style.html, "dimension"_dimension.html, "displace_atoms"_displace_atoms.html, "dump"_dump.html, "dump image"_dump_image.html, "dump_modify"_dump_modify.html, "dump movie"_dump_image.html, "echo"_echo.html, "fix"_fix.html, "fix_modify"_fix_modify.html, "group"_group.html, "if"_if.html, "info"_info.html, "improper_coeff"_improper_coeff.html, "improper_style"_improper_style.html, "include"_include.html, "jump"_jump.html, "kspace_modify"_kspace_modify.html, "kspace_style"_kspace_style.html, "label"_label.html, "lattice"_lattice.html, "log"_log.html, "mass"_mass.html, "minimize"_minimize.html, "min_modify"_min_modify.html, "min_style"_min_style.html, "molecule"_molecule.html, "neb"_neb.html, "neigh_modify"_neigh_modify.html, "neighbor"_neighbor.html, "newton"_newton.html, "next"_next.html, "package"_package.html, "pair_coeff"_pair_coeff.html, "pair_modify"_pair_modify.html, "pair_style"_pair_style.html, "pair_write"_pair_write.html, "partition"_partition.html, "prd"_prd.html, "print"_print.html, "processors"_processors.html, "python"_python.html, "quit"_quit.html, "read_data"_read_data.html, "read_dump"_read_dump.html, "read_restart"_read_restart.html, "region"_region.html, "replicate"_replicate.html, "rerun"_rerun.html, "reset_timestep"_reset_timestep.html, "restart"_restart.html, "run"_run.html, "run_style"_run_style.html, "set"_set.html, "shell"_shell.html, "special_bonds"_special_bonds.html, "suffix"_suffix.html, "tad"_tad.html, "temper"_temper.html, "thermo"_thermo.html, "thermo_modify"_thermo_modify.html, "thermo_style"_thermo_style.html, "timer"_timer.html, "timestep"_timestep.html, "uncompute"_uncompute.html, "undump"_undump.html, "unfix"_unfix.html, "units"_units.html, "variable"_variable.html, "velocity"_velocity.html, "write_coeff"_write_coeff.html, "write_data"_write_data.html, "write_dump"_write_dump.html, "write_restart"_write_restart.html :tb(c=6,ea=c) These are additional commands in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "dump netcdf"_dump_netcdf.html, "dump netcdf/mpiio"_dump_netcdf.html, "dump vtk"_dump_vtk.html, "group2ndx"_group2ndx.html, "ndx2group"_group2ndx.html, "temper/grem"_temper_grem.html :tb(c=3,ea=c) :line Fix styles :h4 See the "fix"_fix.html command for one-line descriptions of each style or click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "adapt"_fix_adapt.html, "addforce"_fix_addforce.html, "append/atoms"_fix_append_atoms.html, "atom/swap"_fix_atom_swap.html, "aveforce"_fix_aveforce.html, "ave/atom"_fix_ave_atom.html, "ave/chunk"_fix_ave_chunk.html, "ave/correlate"_fix_ave_correlate.html, "ave/histo"_fix_ave_histo.html, "ave/histo/weight"_fix_ave_histo.html, "ave/time"_fix_ave_time.html, "balance"_fix_balance.html, "bond/break"_fix_bond_break.html, "bond/create"_fix_bond_create.html, "bond/swap"_fix_bond_swap.html, "box/relax"_fix_box_relax.html, "cmap"_fix_cmap.html, "controller"_fix_controller.html, "deform (k)"_fix_deform.html, "deposit"_fix_deposit.html, "drag"_fix_drag.html, "dt/reset"_fix_dt_reset.html, "efield"_fix_efield.html, "ehex"_fix_ehex.html, "enforce2d"_fix_enforce2d.html, "evaporate"_fix_evaporate.html, "external"_fix_external.html, "freeze"_fix_freeze.html, "gcmc"_fix_gcmc.html, "gld"_fix_gld.html, "gravity (o)"_fix_gravity.html, "halt"_fix_halt.html, "heat"_fix_heat.html, "indent"_fix_indent.html, "langevin (k)"_fix_langevin.html, "lineforce"_fix_lineforce.html, "momentum (k)"_fix_momentum.html, "move"_fix_move.html, "mscg"_fix_mscg.html, "msst"_fix_msst.html, "neb"_fix_neb.html, "nph (ko)"_fix_nh.html, "nphug (o)"_fix_nphug.html, "nph/asphere (o)"_fix_nph_asphere.html, "nph/body"_fix_nph_body.html, "nph/sphere (o)"_fix_nph_sphere.html, "npt (kio)"_fix_nh.html, "npt/asphere (o)"_fix_npt_asphere.html, "npt/body"_fix_npt_body.html, "npt/sphere (o)"_fix_npt_sphere.html, "nve (kio)"_fix_nve.html, "nve/asphere (i)"_fix_nve_asphere.html, "nve/asphere/noforce"_fix_nve_asphere_noforce.html, "nve/body"_fix_nve_body.html, "nve/limit"_fix_nve_limit.html, "nve/line"_fix_nve_line.html, "nve/noforce"_fix_nve_noforce.html, "nve/sphere (o)"_fix_nve_sphere.html, "nve/tri"_fix_nve_tri.html, "nvt (iko)"_fix_nh.html, "nvt/asphere (o)"_fix_nvt_asphere.html, "nvt/body"_fix_nvt_body.html, "nvt/sllod (io)"_fix_nvt_sllod.html, "nvt/sphere (o)"_fix_nvt_sphere.html, "oneway"_fix_oneway.html, "orient/bcc"_fix_orient.html, "orient/fcc"_fix_orient.html, "planeforce"_fix_planeforce.html, "poems"_fix_poems.html, "pour"_fix_pour.html, "press/berendsen"_fix_press_berendsen.html, "print"_fix_print.html, "property/atom"_fix_property_atom.html, "python"_fix_python.html, "qeq/comb (o)"_fix_qeq_comb.html, "qeq/dynamic"_fix_qeq.html, "qeq/fire"_fix_qeq.html, "qeq/point"_fix_qeq.html, "qeq/shielded"_fix_qeq.html, "qeq/slater"_fix_qeq.html, "rattle"_fix_shake.html, "reax/bonds"_fix_reax_bonds.html, "recenter"_fix_recenter.html, "restrain"_fix_restrain.html, "rigid (o)"_fix_rigid.html, "rigid/nph (o)"_fix_rigid.html, "rigid/npt (o)"_fix_rigid.html, "rigid/nve (o)"_fix_rigid.html, "rigid/nvt (o)"_fix_rigid.html, "rigid/small (o)"_fix_rigid.html, "rigid/small/nph (o)"_fix_rigid.html, "rigid/small/npt (o)"_fix_rigid.html, "rigid/small/nve (o)"_fix_rigid.html, "rigid/small/nvt (o)"_fix_rigid.html, "setforce (k)"_fix_setforce.html, "shake"_fix_shake.html, "spring"_fix_spring.html, "spring/chunk"_fix_spring_chunk.html, "spring/rg"_fix_spring_rg.html, "spring/self"_fix_spring_self.html, "srd"_fix_srd.html, "store/force"_fix_store_force.html, "store/state"_fix_store_state.html, "temp/berendsen"_fix_temp_berendsen.html, "temp/csld"_fix_temp_csvr.html, "temp/csvr"_fix_temp_csvr.html, "temp/rescale"_fix_temp_rescale.html, "tfmc"_fix_tfmc.html, "thermal/conductivity"_fix_thermal_conductivity.html, "tmd"_fix_tmd.html, "ttm"_fix_ttm.html, "tune/kspace"_fix_tune_kspace.html, "vector"_fix_vector.html, "viscosity"_fix_viscosity.html, "viscous"_fix_viscous.html, "wall/colloid"_fix_wall.html, "wall/gran"_fix_wall_gran.html, "wall/gran/region"_fix_wall_gran_region.html, "wall/harmonic"_fix_wall.html, "wall/lj1043"_fix_wall.html, "wall/lj126"_fix_wall.html, "wall/lj93"_fix_wall.html, "wall/piston"_fix_wall_piston.html, "wall/reflect (k)"_fix_wall_reflect.html, "wall/region"_fix_wall_region.html, "wall/srd"_fix_wall_srd.html :tb(c=8,ea=c) These are additional fix styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "adapt/fep"_fix_adapt_fep.html, "addtorque"_fix_addtorque.html, "atc"_fix_atc.html, "ave/correlate/long"_fix_ave_correlate_long.html, "colvars"_fix_colvars.html, "dpd/energy"_fix_dpd_energy.html, "drude"_fix_drude.html, "drude/transform/direct"_fix_drude_transform.html, "drude/transform/reverse"_fix_drude_transform.html, +"edpd/source"_fix_dpd_source.html, "eos/cv"_fix_eos_cv.html, "eos/table"_fix_eos_table.html, "eos/table/rx"_fix_eos_table_rx.html, "filter/corotate"_fix_filter_corotate.html, "flow/gauss"_fix_flow_gauss.html, "gle"_fix_gle.html, "grem"_fix_grem.html, "imd"_fix_imd.html, "ipi"_fix_ipi.html, "langevin/drude"_fix_langevin_drude.html, "langevin/eff"_fix_langevin_eff.html, "lb/fluid"_fix_lb_fluid.html, "lb/momentum"_fix_lb_momentum.html, "lb/pc"_fix_lb_pc.html, "lb/rigid/pc/sphere"_fix_lb_rigid_pc_sphere.html, "lb/viscous"_fix_lb_viscous.html, "meso"_fix_meso.html, "manifoldforce"_fix_manifoldforce.html, "meso/stationary"_fix_meso_stationary.html, +"mvv/dpd"_fix_mvv_dpd.html, +"mvv/edpd"_fix_mvv_dpd.html, +"mvv/tdpd"_fix_mvv_dpd.html, "nve/dot"_fix_nve_dot.html, "nve/dotc/langevin"_fix_nve_dotc_langevin.html, "nve/manifold/rattle"_fix_nve_manifold_rattle.html, "nvk"_fix_nvk.html, "nvt/manifold/rattle"_fix_nvt_manifold_rattle.html, "nph/eff"_fix_nh_eff.html, "npt/eff"_fix_nh_eff.html, "nve/eff"_fix_nve_eff.html, "nvt/eff"_fix_nh_eff.html, "nvt/sllod/eff"_fix_nvt_sllod_eff.html, "phonon"_fix_phonon.html, "pimd"_fix_pimd.html, "qbmsst"_fix_qbmsst.html, "qeq/reax (ko)"_fix_qeq_reax.html, "qmmm"_fix_qmmm.html, "qtb"_fix_qtb.html, "reax/c/bonds"_fix_reax_bonds.html, "reax/c/species"_fix_reaxc_species.html, "rx"_fix_rx.html, "saed/vtk"_fix_saed_vtk.html, "shardlow"_fix_shardlow.html, "smd"_fix_smd.html, "smd/adjust/dt"_fix_smd_adjust_dt.html, "smd/integrate/tlsph"_fix_smd_integrate_tlsph.html, "smd/integrate/ulsph"_fix_smd_integrate_ulsph.html, "smd/move/triangulated/surface"_fix_smd_move_triangulated_surface.html, "smd/setvel"_fix_smd_setvel.html, "smd/wall/surface"_fix_smd_wall_surface.html, +"tdpd/source"_fix_dpd_source.html, "temp/rescale/eff"_fix_temp_rescale_eff.html, "ti/spring"_fix_ti_spring.html, "ttm/mod"_fix_ttm.html, "wall/ees"_fix_wall_ees.html, "wall/region/ees"_fix_wall_ees.html :tb(c=6,ea=c) :line Compute styles :h4 See the "compute"_compute.html command for one-line descriptions of each style or click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "angle"_compute_angle.html, "angle/local"_compute_angle_local.html, "angmom/chunk"_compute_angmom_chunk.html, "body/local"_compute_body_local.html, "bond"_compute_bond.html, "bond/local"_compute_bond_local.html, "centro/atom"_compute_centro_atom.html, "chunk/atom"_compute_chunk_atom.html, "cluster/atom"_compute_cluster_atom.html, "cna/atom"_compute_cna_atom.html, "com"_compute_com.html, "com/chunk"_compute_com_chunk.html, "contact/atom"_compute_contact_atom.html, "coord/atom"_compute_coord_atom.html, "damage/atom"_compute_damage_atom.html, "dihedral"_compute_dihedral.html, "dihedral/local"_compute_dihedral_local.html, "dilatation/atom"_compute_dilatation_atom.html, "dipole/chunk"_compute_dipole_chunk.html, "displace/atom"_compute_displace_atom.html, "erotate/asphere"_compute_erotate_asphere.html, "erotate/rigid"_compute_erotate_rigid.html, "erotate/sphere"_compute_erotate_sphere.html, "erotate/sphere/atom"_compute_erotate_sphere_atom.html, "event/displace"_compute_event_displace.html, "global/atom"_compute_global_atom.html, "group/group"_compute_group_group.html, "gyration"_compute_gyration.html, "gyration/chunk"_compute_gyration_chunk.html, "heat/flux"_compute_heat_flux.html, "hexorder/atom"_compute_hexorder_atom.html, "improper"_compute_improper.html, "improper/local"_compute_improper_local.html, "inertia/chunk"_compute_inertia_chunk.html, "ke"_compute_ke.html, "ke/atom"_compute_ke_atom.html, "ke/rigid"_compute_ke_rigid.html, "msd"_compute_msd.html, "msd/chunk"_compute_msd_chunk.html, "msd/nongauss"_compute_msd_nongauss.html, "omega/chunk"_compute_omega_chunk.html, "orientorder/atom"_compute_orientorder_atom.html, "pair"_compute_pair.html, "pair/local"_compute_pair_local.html, "pe"_compute_pe.html, "pe/atom"_compute_pe_atom.html, "plasticity/atom"_compute_plasticity_atom.html, "pressure"_compute_pressure.html, "property/atom"_compute_property_atom.html, "property/local"_compute_property_local.html, "property/chunk"_compute_property_chunk.html, "rdf"_compute_rdf.html, "reduce"_compute_reduce.html, "reduce/region"_compute_reduce.html, "rigid/local"_compute_rigid_local.html, "slice"_compute_slice.html, "sna/atom"_compute_sna_atom.html, "snad/atom"_compute_sna_atom.html, "snav/atom"_compute_sna_atom.html, "stress/atom"_compute_stress_atom.html, "temp (k)"_compute_temp.html, "temp/asphere"_compute_temp_asphere.html, "temp/body"_compute_temp_body.html, "temp/chunk"_compute_temp_chunk.html, "temp/com"_compute_temp_com.html, "temp/deform"_compute_temp_deform.html, "temp/partial"_compute_temp_partial.html, "temp/profile"_compute_temp_profile.html, "temp/ramp"_compute_temp_ramp.html, "temp/region"_compute_temp_region.html, "temp/sphere"_compute_temp_sphere.html, "ti"_compute_ti.html, "torque/chunk"_compute_torque_chunk.html, "vacf"_compute_vacf.html, "vcm/chunk"_compute_vcm_chunk.html, "voronoi/atom"_compute_voronoi_atom.html :tb(c=6,ea=c) These are additional compute styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "ackland/atom"_compute_ackland_atom.html, "basal/atom"_compute_basal_atom.html, "cnp/atom"_compute_cnp_atom.html, "dpd"_compute_dpd.html, "dpd/atom"_compute_dpd_atom.html, +"edpd/temp/atom"_compute_edpd_temp_atom.html, "fep"_compute_fep.html, "force/tally"_compute_tally.html, "heat/flux/tally"_compute_tally.html, "ke/eff"_compute_ke_eff.html, "ke/atom/eff"_compute_ke_atom_eff.html, "meso/e/atom"_compute_meso_e_atom.html, "meso/rho/atom"_compute_meso_rho_atom.html, "meso/t/atom"_compute_meso_t_atom.html, "pe/tally"_compute_tally.html, "pe/mol/tally"_compute_tally.html, "saed"_compute_saed.html, "smd/contact/radius"_compute_smd_contact_radius.html, "smd/damage"_compute_smd_damage.html, "smd/hourglass/error"_compute_smd_hourglass_error.html, "smd/internal/energy"_compute_smd_internal_energy.html, "smd/plastic/strain"_compute_smd_plastic_strain.html, "smd/plastic/strain/rate"_compute_smd_plastic_strain_rate.html, "smd/rho"_compute_smd_rho.html, "smd/tlsph/defgrad"_compute_smd_tlsph_defgrad.html, "smd/tlsph/dt"_compute_smd_tlsph_dt.html, "smd/tlsph/num/neighs"_compute_smd_tlsph_num_neighs.html, "smd/tlsph/shape"_compute_smd_tlsph_shape.html, "smd/tlsph/strain"_compute_smd_tlsph_strain.html, "smd/tlsph/strain/rate"_compute_smd_tlsph_strain_rate.html, "smd/tlsph/stress"_compute_smd_tlsph_stress.html, "smd/triangle/mesh/vertices"_compute_smd_triangle_mesh_vertices.html, "smd/ulsph/num/neighs"_compute_smd_ulsph_num_neighs.html, "smd/ulsph/strain"_compute_smd_ulsph_strain.html, "smd/ulsph/strain/rate"_compute_smd_ulsph_strain_rate.html, "smd/ulsph/stress"_compute_smd_ulsph_stress.html, "smd/vol"_compute_smd_vol.html, "stress/tally"_compute_tally.html, +"tdpd/cc/atom"_compute_tdpd_cc_atom.html, "temp/drude"_compute_temp_drude.html, "temp/eff"_compute_temp_eff.html, "temp/deform/eff"_compute_temp_deform_eff.html, "temp/region/eff"_compute_temp_region_eff.html, "temp/rotate"_compute_temp_rotate.html, "xrd"_compute_xrd.html :tb(c=6,ea=c) :line Pair_style potentials :h4 See the "pair_style"_pair_style.html command for an overview of pair potentials. Click on the style itself for a full description. Many of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "none"_pair_none.html, "zero"_pair_zero.html, "hybrid"_pair_hybrid.html, "hybrid/overlay"_pair_hybrid.html, "adp (o)"_pair_adp.html, "airebo (oi)"_pair_airebo.html, "airebo/morse (oi)"_pair_airebo.html, "beck (go)"_pair_beck.html, "body"_pair_body.html, "bop"_pair_bop.html, "born (go)"_pair_born.html, "born/coul/dsf"_pair_born.html, "born/coul/dsf/cs"_pair_born.html, "born/coul/long (go)"_pair_born.html, "born/coul/long/cs"_pair_born.html, "born/coul/msm (o)"_pair_born.html, "born/coul/wolf (go)"_pair_born.html, "brownian (o)"_pair_brownian.html, "brownian/poly (o)"_pair_brownian.html, "buck (gkio)"_pair_buck.html, "buck/coul/cut (gkio)"_pair_buck.html, "buck/coul/long (gkio)"_pair_buck.html, "buck/coul/long/cs"_pair_buck.html, "buck/coul/msm (o)"_pair_buck.html, "buck/long/coul/long (o)"_pair_buck_long.html, "colloid (go)"_pair_colloid.html, "comb (o)"_pair_comb.html, "comb3"_pair_comb.html, "coul/cut (gko)"_pair_coul.html, "coul/debye (gko)"_pair_coul.html, "coul/dsf (gko)"_pair_coul.html, "coul/long (gko)"_pair_coul.html, "coul/long/cs"_pair_coul.html, "coul/msm"_pair_coul.html, "coul/streitz"_pair_coul.html, "coul/wolf (ko)"_pair_coul.html, "dpd (go)"_pair_dpd.html, "dpd/tstat (go)"_pair_dpd.html, "dsmc"_pair_dsmc.html, "eam (gkiot)"_pair_eam.html, "eam/alloy (gkiot)"_pair_eam.html, "eam/fs (gkiot)"_pair_eam.html, "eim (o)"_pair_eim.html, "gauss (go)"_pair_gauss.html, "gayberne (gio)"_pair_gayberne.html, "gran/hertz/history (o)"_pair_gran.html, "gran/hooke (o)"_pair_gran.html, "gran/hooke/history (o)"_pair_gran.html, "gw"_pair_gw.html, "gw/zbl"_pair_gw.html, "hbond/dreiding/lj (o)"_pair_hbond_dreiding.html, "hbond/dreiding/morse (o)"_pair_hbond_dreiding.html, "kim"_pair_kim.html, "lcbop"_pair_lcbop.html, "line/lj"_pair_line_lj.html, "lj/charmm/coul/charmm (kio)"_pair_charmm.html, "lj/charmm/coul/charmm/implicit (ko)"_pair_charmm.html, "lj/charmm/coul/long (gkio)"_pair_charmm.html, "lj/charmm/coul/msm"_pair_charmm.html, "lj/charmmfsw/coul/charmmfsh"_pair_charmm.html, "lj/charmmfsw/coul/long"_pair_charmm.html, "lj/class2 (gko)"_pair_class2.html, "lj/class2/coul/cut (ko)"_pair_class2.html, "lj/class2/coul/long (gko)"_pair_class2.html, "lj/cubic (go)"_pair_lj_cubic.html, "lj/cut (gikot)"_pair_lj.html, "lj/cut/coul/cut (gko)"_pair_lj.html, "lj/cut/coul/debye (gko)"_pair_lj.html, "lj/cut/coul/dsf (gko)"_pair_lj.html, "lj/cut/coul/long (gikot)"_pair_lj.html, "lj/cut/coul/long/cs"_pair_lj.html, "lj/cut/coul/msm (go)"_pair_lj.html, "lj/cut/dipole/cut (go)"_pair_dipole.html, "lj/cut/dipole/long"_pair_dipole.html, "lj/cut/tip4p/cut (o)"_pair_lj.html, "lj/cut/tip4p/long (ot)"_pair_lj.html, "lj/expand (gko)"_pair_lj_expand.html, "lj/gromacs (gko)"_pair_gromacs.html, "lj/gromacs/coul/gromacs (ko)"_pair_gromacs.html, "lj/long/coul/long (io)"_pair_lj_long.html, "lj/long/dipole/long"_pair_dipole.html, "lj/long/tip4p/long"_pair_lj_long.html, "lj/smooth (o)"_pair_lj_smooth.html, "lj/smooth/linear (o)"_pair_lj_smooth_linear.html, "lj96/cut (go)"_pair_lj96.html, "lubricate (o)"_pair_lubricate.html, "lubricate/poly (o)"_pair_lubricate.html, "lubricateU"_pair_lubricateU.html, "lubricateU/poly"_pair_lubricateU.html, "meam"_pair_meam.html, "mie/cut (o)"_pair_mie.html, "morse (gkot)"_pair_morse.html, "nb3b/harmonic (o)"_pair_nb3b_harmonic.html, "nm/cut (o)"_pair_nm.html, "nm/cut/coul/cut (o)"_pair_nm.html, "nm/cut/coul/long (o)"_pair_nm.html, "peri/eps"_pair_peri.html, "peri/lps (o)"_pair_peri.html, "peri/pmb (o)"_pair_peri.html, "peri/ves"_pair_peri.html, "polymorphic"_pair_polymorphic.html, "python"_pair_python.html, "reax"_pair_reax.html, "rebo (oi)"_pair_airebo.html, "resquared (go)"_pair_resquared.html, "snap"_pair_snap.html, "soft (go)"_pair_soft.html, "sw (gkio)"_pair_sw.html, "table (gko)"_pair_table.html, "tersoff (gkio)"_pair_tersoff.html, "tersoff/mod (gko)"_pair_tersoff_mod.html, "tersoff/mod/c (o)"_pair_tersoff_mod.html, "tersoff/zbl (gko)"_pair_tersoff_zbl.html, "tip4p/cut (o)"_pair_coul.html, "tip4p/long (o)"_pair_coul.html, "tri/lj"_pair_tri_lj.html, "vashishta (ko)"_pair_vashishta.html, "vashishta/table (o)"_pair_vashishta.html, "yukawa (go)"_pair_yukawa.html, "yukawa/colloid (go)"_pair_yukawa_colloid.html, "zbl (go)"_pair_zbl.html :tb(c=4,ea=c) These are additional pair styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "agni (o)"_pair_agni.html, "awpmd/cut"_pair_awpmd.html, "buck/mdf"_pair_mdf.html, "coul/cut/soft (o)"_pair_lj_soft.html, "coul/diel (o)"_pair_coul_diel.html, "coul/long/soft (o)"_pair_lj_soft.html, "dpd/fdt"_pair_dpd_fdt.html, "dpd/fdt/energy"_pair_dpd_fdt.html, "eam/cd (o)"_pair_eam.html, "edip (o)"_pair_edip.html, "edip/multi"_pair_edip.html, +"edpd"_pair_meso.html, "eff/cut"_pair_eff.html, "exp6/rx"_pair_exp6_rx.html, "gauss/cut"_pair_gauss.html, "kolmogorov/crespi/z"_pair_kolmogorov_crespi_z.html, "lennard/mdf"_pair_mdf.html, "list"_pair_list.html, "lj/charmm/coul/long/soft (o)"_pair_charmm.html, "lj/cut/coul/cut/soft (o)"_pair_lj_soft.html, "lj/cut/coul/long/soft (o)"_pair_lj_soft.html, "lj/cut/dipole/sf (go)"_pair_dipole.html, "lj/cut/soft (o)"_pair_lj_soft.html, "lj/cut/thole/long (o)"_pair_thole.html, "lj/cut/tip4p/long/soft (o)"_pair_lj_soft.html, "lj/mdf"_pair_mdf.html, "lj/sdk (gko)"_pair_sdk.html, "lj/sdk/coul/long (go)"_pair_sdk.html, "lj/sdk/coul/msm (o)"_pair_sdk.html, +"mdpd"_pair_meso.html, +"mdpd/rhosum"_pair_meso.html, "meam/c"_pair_meam.html, "meam/spline (o)"_pair_meam_spline.html, "meam/sw/spline"_pair_meam_sw_spline.html, "mgpt"_pair_mgpt.html, "momb"_pair_momb.html, "morse/smooth/linear"_pair_morse.html, "morse/soft"_pair_morse.html, "multi/lucy"_pair_multi_lucy.html, "multi/lucy/rx"_pair_multi_lucy_rx.html, "oxdna/coaxstk"_pair_oxdna.html, "oxdna/excv"_pair_oxdna.html, "oxdna/hbond"_pair_oxdna.html, "oxdna/stk"_pair_oxdna.html, "oxdna/xstk"_pair_oxdna.html, "oxdna2/coaxstk"_pair_oxdna2.html, "oxdna2/dh"_pair_oxdna2.html, "oxdna2/excv"_pair_oxdna2.html, "oxdna2/stk"_pair_oxdna2.html, "quip"_pair_quip.html, "reax/c (ko)"_pair_reaxc.html, "smd/hertz"_pair_smd_hertz.html, "smd/tlsph"_pair_smd_tlsph.html, "smd/triangulated/surface"_pair_smd_triangulated_surface.html, "smd/ulsph"_pair_smd_ulsph.html, "smtbq"_pair_smtbq.html, "sph/heatconduction"_pair_sph_heatconduction.html, "sph/idealgas"_pair_sph_idealgas.html, "sph/lj"_pair_sph_lj.html, "sph/rhosum"_pair_sph_rhosum.html, "sph/taitwater"_pair_sph_taitwater.html, "sph/taitwater/morris"_pair_sph_taitwater_morris.html, "srp"_pair_srp.html, "table/rx"_pair_table_rx.html, +"tdpd"_pair_meso.html, "tersoff/table (o)"_pair_tersoff.html, "thole"_pair_thole.html, "tip4p/long/soft (o)"_pair_lj_soft.html :tb(c=4,ea=c) :line Bond_style potentials :h4 See the "bond_style"_bond_style.html command for an overview of bond potentials. Click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "none"_bond_none.html, "zero"_bond_zero.html, "hybrid"_bond_hybrid.html, "class2 (ko)"_bond_class2.html, "fene (iko)"_bond_fene.html, "fene/expand (o)"_bond_fene_expand.html, "harmonic (ko)"_bond_harmonic.html, "morse (o)"_bond_morse.html, "nonlinear (o)"_bond_nonlinear.html, "quartic (o)"_bond_quartic.html, "table (o)"_bond_table.html :tb(c=4,ea=c) These are additional bond styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "harmonic/shift (o)"_bond_harmonic_shift.html, "harmonic/shift/cut (o)"_bond_harmonic_shift_cut.html, "oxdna/fene"_bond_oxdna.html, "oxdna2/fene"_bond_oxdna.html :tb(c=4,ea=c) :line Angle_style potentials :h4 See the "angle_style"_angle_style.html command for an overview of angle potentials. Click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "none"_angle_none.html, "zero"_angle_zero.html, "hybrid"_angle_hybrid.html, "charmm (ko)"_angle_charmm.html, "class2 (ko)"_angle_class2.html, "cosine (o)"_angle_cosine.html, "cosine/delta (o)"_angle_cosine_delta.html, "cosine/periodic (o)"_angle_cosine_periodic.html, "cosine/squared (o)"_angle_cosine_squared.html, "harmonic (iko)"_angle_harmonic.html, "table (o)"_angle_table.html :tb(c=4,ea=c) These are additional angle styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "cosine/shift (o)"_angle_cosine_shift.html, "cosine/shift/exp (o)"_angle_cosine_shift_exp.html, "dipole (o)"_angle_dipole.html, "fourier (o)"_angle_fourier.html, "fourier/simple (o)"_angle_fourier_simple.html, "quartic (o)"_angle_quartic.html, "sdk"_angle_sdk.html :tb(c=4,ea=c) :line Dihedral_style potentials :h4 See the "dihedral_style"_dihedral_style.html command for an overview of dihedral potentials. Click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "none"_dihedral_none.html, "zero"_dihedral_zero.html, "hybrid"_dihedral_hybrid.html, "charmm (ko)"_dihedral_charmm.html, "charmmfsw"_dihedral_charmm.html, "class2 (ko)"_dihedral_class2.html, "harmonic (io)"_dihedral_harmonic.html, "helix (o)"_dihedral_helix.html, "multi/harmonic (o)"_dihedral_multi_harmonic.html, "opls (iko)"_dihedral_opls.html :tb(c=4,ea=c) These are additional dihedral styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "cosine/shift/exp (o)"_dihedral_cosine_shift_exp.html, "fourier (o)"_dihedral_fourier.html, "nharmonic (o)"_dihedral_nharmonic.html, "quadratic (o)"_dihedral_quadratic.html, "spherical (o)"_dihedral_spherical.html, "table (o)"_dihedral_table.html :tb(c=4,ea=c) :line Improper_style potentials :h4 See the "improper_style"_improper_style.html command for an overview of improper potentials. Click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "none"_improper_none.html, "zero"_improper_zero.html, "hybrid"_improper_hybrid.html, "class2 (ko)"_improper_class2.html, "cvff (io)"_improper_cvff.html, "harmonic (ko)"_improper_harmonic.html, "umbrella (o)"_improper_umbrella.html :tb(c=4,ea=c) These are additional improper styles in USER packages, which can be used if "LAMMPS is built with the appropriate package"_Section_start.html#start_3. "cossq (o)"_improper_cossq.html, "distance"_improper_distance.html, "fourier (o)"_improper_fourier.html, "ring (o)"_improper_ring.html :tb(c=4,ea=c) :line Kspace solvers :h4 See the "kspace_style"_kspace_style.html command for an overview of Kspace solvers. Click on the style itself for a full description. Some of the styles have accelerated versions, which can be used if LAMMPS is built with the "appropriate accelerated package"_Section_accelerate.html. This is indicated by additional letters in parenthesis: g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "ewald (o)"_kspace_style.html, "ewald/disp"_kspace_style.html, "msm (o)"_kspace_style.html, "msm/cg (o)"_kspace_style.html, "pppm (go)"_kspace_style.html, "pppm/cg (o)"_kspace_style.html, "pppm/disp (i)"_kspace_style.html, "pppm/disp/tip4p"_kspace_style.html, "pppm/stagger"_kspace_style.html, "pppm/tip4p (o)"_kspace_style.html :tb(c=4,ea=c) diff --git a/doc/src/Section_packages.txt b/doc/src/Section_packages.txt index 16864bcdc..6122dfac7 100644 --- a/doc/src/Section_packages.txt +++ b/doc/src/Section_packages.txt @@ -1,2715 +1,2752 @@ "Previous Section"_Section_commands.html - "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc - "Next Section"_Section_accelerate.html :c :link(lws,http://lammps.sandia.gov) :link(ld,Manual.html) :link(lc,Section_commands.html#comm) :line 4. Packages :h3 This section gives an overview of the optional packages that extend LAMMPS functionality with instructions on how to build LAMMPS with each of them. Packages are groups of files that enable a specific set of features. For example, force fields for molecular systems or granular systems are in packages. You can see the list of all packages and "make" commands to manage them by typing "make package" from within the src directory of the LAMMPS distribution. "Section 2.3"_Section_start.html#start_3 gives general info on how to install and un-install packages as part of the LAMMPS build process. There are two kinds of packages in LAMMPS, standard and user packages: "Table of standard packages"_#table_standard "Table of user packages"_#table_user :ul Either of these kinds of packages may work as is, may require some additional code compiled located in the lib folder, or may require an external library to be downloaded, compiled, installed, and LAMMPS configured to know about its location and additional compiler flags. You can often do the build of the internal or external libraries in one step by typing "make lib-name args='...'" from the src dir, with appropriate arguments included in args='...'. If you just type "make lib-name" you should see a help message about supported flags and some examples. For more details about this, please study the tables below and the sections about the individual packages. Standard packages are supported by the LAMMPS developers and are written in a syntax and style consistent with the rest of LAMMPS. This means the developers will answer questions about them, debug and fix them if necessary, and keep them compatible with future changes to LAMMPS. User packages have been contributed by users, and begin with the "user" prefix. If they are a single command (single file), they are typically in the user-misc package. User packages don't necessarily meet the requirements of the standard packages. This means the developers will try to keep things working and usually can answer technical questions about compiling the package. If you have problems using a feature provided in a user package, you may need to contact the contributor directly to get help. Information on how to submit additions you make to LAMMPS as single files or as a standard or user package are given in "this section"_Section_modify.html#mod_15 of the manual. Following the next two tables is a sub-section for each package. It lists authors (if applicable) and summarizes the package contents. It has specific instructions on how to install the package, including (if necessary) downloading or building any extra library it requires. It also gives links to documentation, example scripts, and pictures/movies (if available) that illustrate use of the package. NOTE: To see the complete list of commands a package adds to LAMMPS, just look at the files in its src directory, e.g. "ls src/GRANULAR". Files with names that start with fix, compute, atom, pair, bond, angle, etc correspond to commands with the same style names. In these two tables, the "Example" column is a sub-directory in the examples directory of the distribution which has an input script that uses the package. E.g. "peptide" refers to the examples/peptide directory; USER/atc refers to the examples/USER/atc directory. The "Library" column indicates whether an extra library is needed to build and use the package: dash = no library sys = system library: you likely have it on your machine int = internal library: provided with LAMMPS, but you may need to build it ext = external library: you will need to download and install it on your machine :ul :line :line [Standard packages] :link(table_standard),p Package, Description, Doc page, Example, Library "ASPHERE"_#ASPHERE, aspherical particle models, "Section 6.6.14"_Section_howto.html#howto_14, ellipse, - "BODY"_#BODY, body-style particles, "body"_body.html, body, - "CLASS2"_#CLASS2, class 2 force fields, "pair_style lj/class2"_pair_class2.html, -, - "COLLOID"_#COLLOID, colloidal particles, "atom_style colloid"_atom_style.html, colloid, - "COMPRESS"_#COMPRESS, I/O compression, "dump */gz"_dump.html, -, sys "CORESHELL"_#CORESHELL, adiabatic core/shell model, "Section 6.6.25"_Section_howto.html#howto_25, coreshell, - "DIPOLE"_#DIPOLE, point dipole particles, "pair_style dipole/cut"_pair_dipole.html, dipole, - "GPU"_#GPU, GPU-enabled styles, "Section 5.3.1"_accelerate_gpu.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, int "GRANULAR"_#GRANULAR, granular systems, "Section 6.6.6"_Section_howto.html#howto_6, pour, - "KIM"_#KIM, OpenKIM wrapper, "pair_style kim"_pair_kim.html, kim, ext "KOKKOS"_#KOKKOS, Kokkos-enabled styles, "Section 5.3.3"_accelerate_kokkos.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, - "KSPACE"_#KSPACE, long-range Coulombic solvers, "kspace_style"_kspace_style.html, peptide, - "MANYBODY"_#MANYBODY, many-body potentials, "pair_style tersoff"_pair_tersoff.html, shear, - "MC"_#MC, Monte Carlo options, "fix gcmc"_fix_gcmc.html, -, - "MEAM"_#MEAM, modified EAM potential, "pair_style meam"_pair_meam.html, meam, int "MISC"_#MISC, miscellanous single-file commands, -, -, - "MOLECULE"_#MOLECULE, molecular system force fields, "Section 6.6.3"_Section_howto.html#howto_3, peptide, - "MPIIO"_#MPIIO, MPI parallel I/O dump and restart, "dump"_dump.html, -, - "MSCG"_#MSCG, multi-scale coarse-graining wrapper, "fix mscg"_fix_mscg.html, mscg, ext "OPT"_#OPT, optimized pair styles, "Section 5.3.5"_accelerate_opt.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, - "PERI"_#PERI, Peridynamics models, "pair_style peri"_pair_peri.html, peri, - "POEMS"_#POEMS, coupled rigid body motion, "fix poems"_fix_poems.html, rigid, int "PYTHON"_#PYTHON, embed Python code in an input script, "python"_python.html, python, sys "QEQ"_#QEQ, QEq charge equilibration, "fix qeq"_fix_qeq.html, qeq, - "REAX"_#REAX, ReaxFF potential (Fortran), "pair_style reax"_pair_reax.html, reax, int "REPLICA"_#REPLICA, multi-replica methods, "Section 6.6.5"_Section_howto.html#howto_5, tad, - "RIGID"_#RIGID, rigid bodies and constraints, "fix rigid"_fix_rigid.html, rigid, - "SHOCK"_#SHOCK, shock loading methods, "fix msst"_fix_msst.html, -, - -"SNAP"_#SNAP, quantum-fitted potential, "pair snap"_pair_snap.html, snap, - +"SNAP"_#SNAP, quantum-fitted potential, "pair_style snap"_pair_snap.html, snap, - "SRD"_#SRD, stochastic rotation dynamics, "fix srd"_fix_srd.html, srd, - "VORONOI"_#VORONOI, Voronoi tesselation, "compute voronoi/atom"_compute_voronoi_atom.html, -, ext :tb(ea=c,ca1=l) [USER packages] :link(table_user),p Package, Description, Doc page, Example, Library "USER-ATC"_#USER-ATC, atom-to-continuum coupling, "fix atc"_fix_atc.html, USER/atc, int "USER-AWPMD"_#USER-AWPMD, wave-packet MD, "pair_style awpmd/cut"_pair_awpmd.html, USER/awpmd, int "USER-CGDNA"_#USER-CGDNA, coarse-grained DNA force fields, src/USER-CGDNA/README, USER/cgdna, - "USER-CGSDK"_#USER-CGSDK, SDK coarse-graining model, "pair_style lj/sdk"_pair_sdk.html, USER/cgsdk, - "USER-COLVARS"_#USER-COLVARS, collective variables library, "fix colvars"_fix_colvars.html, USER/colvars, int "USER-DIFFRACTION"_#USER-DIFFRACTION, virtual x-ray and electron diffraction,"compute xrd"_compute_xrd.html, USER/diffraction, - "USER-DPD"_#USER-DPD, reactive dissipative particle dynamics, src/USER-DPD/README, USER/dpd, - "USER-DRUDE"_#USER-DRUDE, Drude oscillators, "tutorial"_tutorial_drude.html, USER/drude, - "USER-EFF"_#USER-EFF, electron force field,"pair_style eff/cut"_pair_eff.html, USER/eff, - "USER-FEP"_#USER-FEP, free energy perturbation,"compute fep"_compute_fep.html, USER/fep, - "USER-H5MD"_#USER-H5MD, dump output via HDF5,"dump h5md"_dump_h5md.html, -, ext "USER-INTEL"_#USER-INTEL, optimized Intel CPU and KNL styles,"Section 5.3.2"_accelerate_intel.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, - "USER-LB"_#USER-LB, Lattice Boltzmann fluid,"fix lb/fluid"_fix_lb_fluid.html, USER/lb, - "USER-MANIFOLD"_#USER-MANIFOLD, motion on 2d surfaces,"fix manifoldforce"_fix_manifoldforce.html, USER/manifold, - "USER-MEAMC"_#USER-MEAMC, modified EAM potential (C++), "pair_style meam/c"_pair_meam.html, meam, - +"USER-MESO"_#USER-MESO, mesoscale DPD models, "pair_style edpd"_pair_meso.html, USER/meso, - "USER-MGPT"_#USER-MGPT, fast MGPT multi-ion potentials, "pair_style mgpt"_pair_mgpt.html, USER/mgpt, - "USER-MISC"_#USER-MISC, single-file contributions, USER-MISC/README, USER/misc, - "USER-MOLFILE"_#USER-MOLFILE, "VMD"_vmd_home molfile plug-ins,"dump molfile"_dump_molfile.html, -, ext "USER-NETCDF"_#USER-NETCDF, dump output via NetCDF,"dump netcdf"_dump_netcdf.html, -, ext "USER-OMP"_#USER-OMP, OpenMP-enabled styles,"Section 5.3.4"_accelerate_omp.html, "Benchmarks"_http://lammps.sandia.gov/bench.html, - "USER-PHONON"_#USER-PHONON, phonon dynamical matrix,"fix phonon"_fix_phonon.html, USER/phonon, - "USER-QMMM"_#USER-QMMM, QM/MM coupling,"fix qmmm"_fix_qmmm.html, USER/qmmm, ext "USER-QTB"_#USER-QTB, quantum nuclear effects,"fix qtb"_fix_qtb.html "fix qbmsst"_fix_qbmsst.html, qtb, - "USER-QUIP"_#USER-QUIP, QUIP/libatoms interface,"pair_style quip"_pair_quip.html, USER/quip, ext "USER-REAXC"_#USER-REAXC, ReaxFF potential (C/C++) ,"pair_style reaxc"_pair_reaxc.html, reax, - "USER-SMD"_#USER-SMD, smoothed Mach dynamics,"SMD User Guide"_PDF/SMD_LAMMPS_userguide.pdf, USER/smd, ext "USER-SMTBQ"_#USER-SMTBQ, second moment tight binding QEq potential,"pair_style smtbq"_pair_smtbq.html, USER/smtbq, - "USER-SPH"_#USER-SPH, smoothed particle hydrodynamics,"SPH User Guide"_PDF/SPH_LAMMPS_userguide.pdf, USER/sph, - "USER-TALLY"_#USER-TALLY, pairwise tally computes,"compute XXX/tally"_compute_tally.html, USER/tally, - "USER-VTK"_#USER-VTK, dump output via VTK, "compute vtk"_dump_vtk.html, -, ext :tb(ea=c,ca1=l) :line :line ASPHERE package :link(ASPHERE),h4 [Contents:] Computes, time-integration fixes, and pair styles for aspherical particle models including ellipsoids, 2d lines, and 3d triangles. [Install or un-install:] make yes-asphere make machine :pre make no-asphere make machine :pre [Supporting info:] src/ASPHERE: filenames -> commands "Section 6.14"_Section_howto.html#howto_14 "pair_style gayberne"_pair_gayberne.html "pair_style resquared"_pair_resquared.html "doc/PDF/pair_gayberne_extra.pdf"_PDF/pair_gayberne_extra.pdf "doc/PDF/pair_resquared_extra.pdf"_PDF/pair_resquared_extra.pdf examples/ASPHERE examples/ellipse http://lammps.sandia.gov/movies.html#line http://lammps.sandia.gov/movies.html#tri :ul :line BODY package :link(BODY),h4 [Contents:] Body-style particles with internal structure. Computes, time-integration fixes, pair styles, as well as the body styles themselves. See the "body"_body.html doc page for an overview. [Install or un-install:] make yes-body make machine :pre make no-body make machine :pre [Supporting info:] src/BODY filenames -> commands "body"_body.html "atom_style body"_atom_style.html "fix nve/body"_fix_nve_body.html "pair_style body"_pair_body.html examples/body :ul :line CLASS2 package :link(CLASS2),h4 [Contents:] Bond, angle, dihedral, improper, and pair styles for the COMPASS CLASS2 molecular force field. [Install or un-install:] make yes-class2 make machine :pre make no-class2 make machine :pre [Supporting info:] src/CLASS2: filenames -> commands "bond_style class2"_bond_class2.html "angle_style class2"_angle_class2.html "dihedral_style class2"_dihedral_class2.html "improper_style class2"_improper_class2.html "pair_style lj/class2"_pair_class2.html :ul :line COLLOID package :link(COLLOID),h4 [Contents:] Coarse-grained finite-size colloidal particles. Pair stayle and fix wall styles for colloidal interactions. Includes the Fast Lubrication Dynamics (FLD) method for hydrodynamic interactions, which is a simplified approximation to Stokesian dynamics. [Authors:] This package includes Fast Lubrication Dynamics pair styles which were created by Amit Kumar and Michael Bybee from Jonathan Higdon's group at UIUC. [Install or un-install:] make yes-colloid make machine :pre make no-colloid make machine :pre [Supporting info:] src/COLLOID: filenames -> commands "fix wall/colloid"_fix_wall.html "pair_style colloid"_pair_colloid.html "pair_style yukawa/colloid"_pair_yukawa_colloid.html "pair_style brownian"_pair_brownian.html "pair_style lubricate"_pair_lubricate.html "pair_style lubricateU"_pair_lubricateU.html examples/colloid examples/srd :ul :line COMPRESS package :link(COMPRESS),h4 [Contents:] Compressed output of dump files via the zlib compression library, using dump styles with a "gz" in their style name. To use this package you must have the zlib compression library available on your system. [Author:] Axel Kohlmeyer (Temple U). [Install or un-install:] Note that building with this package assumes you have the zlib compression library available on your system. The LAMMPS build uses the settings in the lib/compress/Makefile.lammps file in the compile/link process. You should only need to edit this file if the LAMMPS build fails on your system. make yes-compress make machine :pre make no-compress make machine :pre [Supporting info:] src/COMPRESS: filenames -> commands src/COMPRESS/README lib/compress/README "dump atom/gz"_dump.html "dump cfg/gz"_dump.html "dump custom/gz"_dump.html "dump xyz/gz"_dump.html :ul :line CORESHELL package :link(CORESHELL),h4 [Contents:] Compute and pair styles that implement the adiabatic core/shell model for polarizability. The pair styles augment Born, Buckingham, and Lennard-Jones styles with core/shell capabilities. The "compute temp/cs"_compute_temp_cs.html command calculates the temperature of a system with core/shell particles. See "Section 6.26"_Section_howto.html#howto_26 for an overview of how to use this package. [Author:] Hendrik Heenen (Technical U of Munich). [Install or un-install:] make yes-coreshell make machine :pre make no-coreshell make machine :pre [Supporting info:] src/CORESHELL: filenames -> commands "Section 6.26"_Section_howto.html#howto_26 "Section 6.25"_Section_howto.html#howto_25 "compute temp/cs"_compute_temp_cs.html "pair_style born/coul/long/cs"_pair_cs.html "pair_style buck/coul/long/cs"_pair_cs.html "pair_style lj/cut/coul/long/cs"_pair_lj.html examples/coreshell :ul :line DIPOLE package :link(DIPOLE),h4 [Contents:] An atom style and several pair styles for point dipole models with short-range or long-range interactions. [Install or un-install:] make yes-dipole make machine :pre make no-dipole make machine :pre [Supporting info:] src/DIPOLE: filenames -> commands "atom_style dipole"_atom_style.html "pair_style lj/cut/dipole/cut"_pair_dipole.html "pair_style lj/cut/dipole/long"_pair_dipole.html "pair_style lj/long/dipole/long"_pair_dipole.html examples/dipole :ul :line GPU package :link(GPU),h4 [Contents:] Dozens of pair styles and a version of the PPPM long-range Coulombic solver optimized for GPUs. All such styles have a "gpu" as a suffix in their style name. The GPU code can be compiled with either CUDA or OpenCL, however the OpenCL variants are no longer actively maintained and only the CUDA versions are regularly tested. "Section 5.3.1"_accelerate_gpu.html gives details of what hardware and GPU software is required on your system, and details on how to build and use this package. Its styles can be invoked at run time via the "-sf gpu" or "-suffix gpu" "command-line switches"_Section_start.html#start_6. See also the "KOKKOS"_#KOKKOS package, which has GPU-enabled styles. [Authors:] Mike Brown (Intel) while at Sandia and ORNL and Trung Nguyen (Northwestern U) while at ORNL. [Install or un-install:] Before building LAMMPS with this package, you must first build the GPU library in lib/gpu from a set of provided C and CUDA files. You can do this manually if you prefer; follow the instructions in lib/gpu/README. Please note, that the GPU library uses MPI calls, so you have to make certain to use the same MPI library (or the STUBS library) settings as the main LAMMPS code. That same applies to the -DLAMMPS_BIGBIG, -DLAMMPS_SMALLBIG, or -DLAMMPS_SMALLSMALL define. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/gpu/Install.py script with the specified args: make lib-gpu # print help message make lib-gpu args="-b" # build GPU library with default Makefile.linux make lib-gpu args="-m xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision make lib-gpu args="-m mpi -p mixed -b" # build GPU library with mixed precision using settings in Makefile.mpi :pre Note that this procedure through the '-m machine' flag starts with one of the existing Makefile.machine files in lib/gpu. For your convenience, machine makefiles for "mpi" and "serial" are provided, which have the same settings as the corresponding machine makefiles in the main LAMMPS source folder. In addition you can alter 4 important settings in that Makefile, via the -h, -a, -p, -e switches, and also save a copy of the new Makefile, if desired: CUDA_HOME = where NVIDIA CUDA software is installed on your system CUDA_ARCH = what GPU hardware you have (see help message for details) CUDA_PRECISION = precision (double, mixed, single) EXTRAMAKE = which Makefile.lammps.* file to copy to Makefile.lammps :ul If the library build is successful, at least 3 files should be created: lib/gpu/libgpu.a, lib/gpu/nvc_get_devices, and lib/gpu/Makefile.lammps. The latter has settings that enable LAMMPS to link with CUDA libraries. If the settings in Makefile.lammps for your machine are not correct, the LAMMPS build will fail, and lib/gpu/Makefile.lammps may need to be edited. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-gpu make machine :pre make no-gpu make machine :pre NOTE: If you re-build the GPU library in lib/gpu, you should always un-install the GPU package, then re-install it and re-build LAMMPS. This is because the compilation of files in the GPU package use the library settings from the lib/gpu/Makefile.machine used to build the GPU library. [Supporting info:] src/GPU: filenames -> commands src/GPU/README lib/gpu/README "Section 5.3"_Section_accelerate.html#acc_3 "Section 5.3.1"_accelerate_gpu.html "Section 2.6 -sf gpu"_Section_start.html#start_6 "Section 2.6 -pk gpu"_Section_start.html#start_6 "package gpu"_package.html Pair Styles section of "Section 3.5"_Section_commands.html#cmd_5 for pair styles followed by (g) "Benchmarks page"_http://lammps.sandia.gov/bench.html of web site :ul :line GRANULAR package :link(GRANULAR),h4 [Contents:] Pair styles and fixes for finite-size granular particles, which interact with each other and boundaries via frictional and dissipative potentials. [Install or un-install:] make yes-granular make machine :pre make no-granular make machine :pre [Supporting info:] src/GRANULAR: filenames -> commands "Section 6.6"_Section_howto.html#howto_6, "fix pour"_fix_pour.html "fix wall/gran"_fix_wall_gran.html "pair_style gran/hooke"_pair_gran.html "pair_style gran/hertz/history"_pair_gran.html examples/granregion examples/pour bench/in.chute http://lammps.sandia.gov/pictures.html#jamming http://lammps.sandia.gov/movies.html#hopper http://lammps.sandia.gov/movies.html#dem http://lammps.sandia.gov/movies.html#brazil http://lammps.sandia.gov/movies.html#granregion :ul :line KIM package :link(KIM),h4 [Contents:] A "pair_style kim"_pair_kim.html command which is a wrapper on the Knowledge Base for Interatomic Models (KIM) repository of interatomic potentials, enabling any of them to be used in LAMMPS simulations. To use this package you must have the KIM library available on your system. Information about the KIM project can be found at its website: https://openkim.org. The KIM project is led by Ellad Tadmor and Ryan Elliott (U Minnesota) and James Sethna (Cornell U). [Authors:] Ryan Elliott (U Minnesota) is the main developer for the KIM API which the "pair_style kim"_pair_kim.html command uses. He developed the pair style in collaboration with Valeriu Smirichinski (U Minnesota). [Install or un-install:] Before building LAMMPS with this package, you must first download and build the KIM library and include the KIM models that you want to use. You can do this manually if you prefer; follow the instructions in lib/kim/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/kim/Install.py script with the specified args. make lib-kim # print help message make lib-kim args="-b " # (re-)install KIM API lib with only example models make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model make lib-kim args="-b -a everything" # install KIM API lib with all models make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver make lib-kim args="-p /usr/local/kim-api" # use an existing KIM API installation at the provided location make lib-kim args="-p /usr/local/kim-api -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver :pre Note that in LAMMPS lingo, a KIM model driver is a pair style (e.g. EAM or Tersoff). A KIM model is a pair style for a particular element or alloy and set of parameters, e.g. EAM for Cu with a specific EAM potential file. Also note that installing the KIM API library with all its models, may take around 30 min to build. Of course you only need to do that once. See the list of KIM model drivers here: https://openkim.org/kim-items/model-drivers/alphabetical See the list of all KIM models here: https://openkim.org/kim-items/models/by-model-drivers See the list of example KIM models included by default here: https://openkim.org/kim-api in the "What is in the KIM API source package?" section You can then install/un-install the package and build LAMMPS in the usual manner: make yes-kim make machine :pre make no-kim make machine :pre [Supporting info:] src/KIM: filenames -> commands src/KIM/README lib/kim/README "pair_style kim"_pair_kim.html examples/kim :ul :line KOKKOS package :link(KOKKOS),h4 [Contents:] Dozens of atom, pair, bond, angle, dihedral, improper, fix, compute styles adapted to compile using the Kokkos library which can convert them to OpenMP or CUDA code so that they run efficiently on multicore CPUs, KNLs, or GPUs. All the styles have a "kk" as a suffix in their style name. "Section 5.3.3"_accelerate_kokkos.html gives details of what hardware and software is required on your system, and how to build and use this package. Its styles can be invoked at run time via the "-sf kk" or "-suffix kk" "command-line switches"_Section_start.html#start_6. Also see the "GPU"_#GPU, "OPT"_#OPT, "USER-INTEL"_#USER-INTEL, and "USER-OMP"_#USER-OMP packages, which have styles optimized for CPUs, KNLs, and GPUs. You must have a C++11 compatible compiler to use this package. [Authors:] The KOKKOS package was created primarily by Christian Trott and Stan Moore (Sandia), with contributions from other folks as well. It uses the open-source "Kokkos library"_https://github.com/kokkos which was developed by Carter Edwards, Christian Trott, and others at Sandia, and which is included in the LAMMPS distribution in lib/kokkos. [Install or un-install:] For the KOKKOS package, you have 3 choices when building. You can build with either CPU or KNL or GPU support. Each choice requires additional settings in your Makefile.machine for the KOKKOS_DEVICES and KOKKOS_ARCH settings. See the src/MAKE/OPTIONS/Makefile.kokkos* files for examples. For multicore CPUs using OpenMP: KOKKOS_DEVICES = OpenMP KOKKOS_ARCH = HSW # HSW = Haswell, SNB = SandyBridge, BDW = Broadwell, etc :pre For Intel KNLs using OpenMP: KOKKOS_DEVICES = OpenMP KOKKOS_ARCH = KNL :pre For NVIDIA GPUs using CUDA: KOKKOS_DEVICES = Cuda KOKKOS_ARCH = Pascal60,Power8 # P100 hosted by an IBM Power8, etc KOKKOS_ARCH = Kepler37,Power8 # K80 hosted by an IBM Power8, etc :pre For GPUs, you also need these 2 lines in your Makefile.machine before the CC line is defined, in this case for use with OpenMPI mpicxx. The 2 lines define a nvcc wrapper compiler, which will use nvcc for compiling CUDA files or use a C++ compiler for non-Kokkos, non-CUDA files. KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper CC = mpicxx :pre Once you have an appropriate Makefile.machine, you can install/un-install the package and build LAMMPS in the usual manner. Note that you cannot build one executable to run on multiple hardware targets (CPU or KNL or GPU). You need to build LAMMPS once for each hardware target, to produce a separate executable. Also note that we do not recommend building with other acceleration packages installed (GPU, OPT, USER-INTEL, USER-OMP) when also building with KOKKOS. make yes-kokkos make machine :pre make no-kokkos make machine :pre [Supporting info:] src/KOKKOS: filenames -> commands src/KOKKOS/README lib/kokkos/README "Section 5.3"_Section_accelerate.html#acc_3 "Section 5.3.3"_accelerate_kokkos.html "Section 2.6 -k on ..."_Section_start.html#start_6 "Section 2.6 -sf kk"_Section_start.html#start_6 "Section 2.6 -pk kokkos"_Section_start.html#start_6 "package kokkos"_package.html Styles sections of "Section 3.5"_Section_commands.html#cmd_5 for styles followed by (k) "Benchmarks page"_http://lammps.sandia.gov/bench.html of web site :ul :line KSPACE package :link(KSPACE),h4 [Contents:] A variety of long-range Coulombic solvers, as well as pair styles which compute the corresponding short-range pairwise Coulombic interactions. These include Ewald, particle-particle particle-mesh (PPPM), and multilevel summation method (MSM) solvers. [Install or un-install:] Building with this package requires a 1d FFT library be present on your system for use by the PPPM solvers. This can be the KISS FFT library provided with LAMMPS, 3rd party libraries like FFTW, or a vendor-supplied FFT library. See step 6 of "Section 2.2.2"_Section_start.html#start_2_2 of the manual for details on how to select different FFT options in your machine Makefile. make yes-kspace make machine :pre make no-kspace make machine :pre [Supporting info:] src/KSPACE: filenames -> commands "kspace_style"_kspace_style.html "doc/PDF/kspace.pdf"_PDF/kspace.pdf "Section 6.7"_Section_howto.html#howto_7 "Section 6.8"_Section_howto.html#howto_8 "Section 6.9"_Section_howto.html#howto_9 "pair_style coul"_pair_coul.html Pair Styles section of "Section 3.5"_Section_commands.html#cmd_5 with "long" or "msm" in pair style name examples/peptide bench/in.rhodo :ul :line MANYBODY package :link(MANYBODY),h4 [Contents:] A variety of manybody and bond-order potentials. These include (AI)REBO, BOP, EAM, EIM, Stillinger-Weber, and Tersoff potentials. [Install or un-install:] make yes-manybody make machine :pre make no-manybody make machine :pre [Supporting info:] src/MANYBODY: filenames -> commands Pair Styles section of "Section 3.5"_Section_commands.html#cmd_5 examples/comb examples/eim examples/nb3d examples/shear examples/streitz examples/vashishta bench/in.eam :ul :line MC package :link(MC),h4 [Contents:] Several fixes and a pair style that have Monte Carlo (MC) or MC-like attributes. These include fixes for creating, breaking, and swapping bonds, for performing atomic swaps, and performing grand-canonical MC (GCMC) in conjuction with dynamics. [Install or un-install:] make yes-mc make machine :pre make no-mc make machine :pre [Supporting info:] src/MC: filenames -> commands "fix atom/swap"_fix_atom_swap.html "fix bond/break"_fix_bond_break.html "fix bond/create"_fix_bond_create.html "fix bond/swap"_fix_bond_swap.html "fix gcmc"_fix_gcmc.html "pair_style dsmc"_pair_dsmc.html http://lammps.sandia.gov/movies.html#gcmc :ul :line MEAM package :link(MEAM),h4 [Contents:] A pair style for the modified embedded atom (MEAM) potential. Please note that the MEAM package has been superseded by the "USER-MEAMC"_#USER-MEAMC package, which is a direct translation of the MEAM package to C++. USER-MEAMC contains additional optimizations making it run faster than MEAM on most machines, while providing the identical features and USER interface. [Author:] Greg Wagner (Northwestern U) while at Sandia. [Install or un-install:] Before building LAMMPS with this package, you must first build the MEAM library in lib/meam. You can do this manually if you prefer; follow the instructions in lib/meam/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/meam/Install.py script with the specified args: make lib-meam # print help message make lib-meam args="-m mpi" # build with default Fortran compiler compatible with your MPI library make lib-meam args="-m serial" # build with compiler compatible with "make serial" (GNU Fortran) make lib-meam args="-m ifort" # build with Intel Fortran compiler using Makefile.ifort :pre The build should produce two files: lib/meam/libmeam.a and lib/meam/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to link C++ (LAMMPS) with Fortran (MEAM library). Typically the two compilers used for LAMMPS and the MEAM library need to be consistent (e.g. both Intel or both GNU compilers). If necessary, you can edit/create a new lib/meam/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-meam make machine :pre make no-meam make machine :pre NOTE: You should test building the MEAM library with both the Intel and GNU compilers to see if a simulation runs faster with one versus the other on your system. [Supporting info:] src/MEAM: filenames -> commands src/meam/README lib/meam/README "pair_style meam"_pair_meam.html examples/meam :ul :line MISC package :link(MISC),h4 [Contents:] A variety of compute, fix, pair, dump styles with specialized capabilities that don't align with other packages. Do a directory listing, "ls src/MISC", to see the list of commands. NOTE: the MISC package contains styles that require using the -restrict flag, when compiling with Intel compilers. [Install or un-install:] make yes-misc make machine :pre make no-misc make machine :pre [Supporting info:] src/MISC: filenames -> commands "compute ti"_compute_ti.html "fix evaporate"_fix_evaporate.html "fix orient/fcc"_fix_orient.html "fix ttm"_fix_ttm.html "fix thermal/conductivity"_fix_thermal_conductivity.html "fix viscosity"_fix_viscosity.html examples/KAPPA examples/VISCOSITY http://lammps.sandia.gov/pictures.html#ttm http://lammps.sandia.gov/movies.html#evaporation :ul :line MOLECULE package :link(MOLECULE),h4 [Contents:] A large number of atom, pair, bond, angle, dihedral, improper styles that are used to model molecular systems with fixed covalent bonds. The pair styles include the Dreiding (hydrogen-bonding) and CHARMM force fields, and a TIP4P water model. [Install or un-install:] make yes-molecule make machine :pre make no-molecule make machine :pre [Supporting info:] src/MOLECULE: filenames -> commands "atom_style"_atom_style.html "bond_style"_bond_style.html "angle_style"_angle_style.html "dihedral_style"_dihedral_style.html "improper_style"_improper_style.html "pair_style hbond/dreiding/lj"_pair_hbond_dreiding.html "pair_style lj/charmm/coul/charmm"_pair_charmm.html "Section 6.3"_Section_howto.html#howto_3 examples/cmap examples/dreiding examples/micelle, examples/peptide bench/in.chain bench/in.rhodo :ul :line MPIIO package :link(MPIIO),h4 [Contents:] Support for parallel output/input of dump and restart files via the MPIIO library. It adds "dump styles"_dump.html with a "mpiio" in their style name. Restart files with an ".mpiio" suffix are also written and read in parallel. [Install or un-install:] Note that MPIIO is part of the standard message-passing interface (MPI) library, so you should not need any additional compiler or link settings, beyond what LAMMPS normally uses for MPI on your system. make yes-mpiio make machine :pre make no-mpiio make machine :pre [Supporting info:] src/MPIIO: filenames -> commands "dump"_dump.html "restart"_restart.html "write_restart"_write_restart.html "read_restart"_read_restart.html :ul :line MSCG package :link(mscg),h4 [Contents:] A "fix mscg"_fix_mscg.html command which can parameterize a Mulit-Scale Coarse-Graining (MSCG) model using the open-source "MS-CG library"_mscg_home. :link(mscg_home,https://github.com/uchicago-voth/MSCG-release) To use this package you must have the MS-CG library available on your system. [Authors:] The fix was written by Lauren Abbott (Sandia). The MS-CG library was developed by Jacob Wagner in Greg Voth's group at the University of Chicago. [Install or un-install:] Before building LAMMPS with this package, you must first download and build the MS-CG library. Building the MS-CG library and using it from LAMMPS requires a C++11 compatible compiler and that the GSL (GNU Scientific Library) headers and libraries are installed on your machine. See the lib/mscg/README and MSCG/Install files for more details. Assuming these libraries are in place, you can do the download and build of MS-CG manually if you prefer; follow the instructions in lib/mscg/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/mscg/Install.py script with the specified args: make lib-mscg # print help message make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master # with the settings compatible with "make serial" make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master # with the settings compatible with "make mpi" make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release :pre Note that 2 symbolic (soft) links, "includelink" and "liblink", will be created in lib/mscg to point to the MS-CG src/installation dir. When LAMMPS is built in src it will use these links. You should not need to edit the lib/mscg/Makefile.lammps file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-mscg make machine :pre make no-mscg make machine :pre [Supporting info:] src/MSCG: filenames -> commands src/MSCG/README lib/mscg/README examples/mscg :ul :line OPT package :link(OPT),h4 [Contents:] A handful of pair styles which are optimized for improved CPU performance on single or multiple cores. These include EAM, LJ, CHARMM, and Morse potentials. The styles have an "opt" suffix in their style name. "Section 5.3.5"_accelerate_opt.html gives details of how to build and use this package. Its styles can be invoked at run time via the "-sf opt" or "-suffix opt" "command-line switches"_Section_start.html#start_6. See also the "KOKKOS"_#KOKKOS, "USER-INTEL"_#USER-INTEL, and "USER-OMP"_#USER-OMP packages, which have styles optimized for CPU performance. [Authors:] James Fischer (High Performance Technologies), David Richie, and Vincent Natoli (Stone Ridge Technolgy). [Install or un-install:] make yes-opt make machine :pre make no-opt make machine :pre NOTE: The compile flag "-restrict" must be used to build LAMMPS with the OPT package when using Intel compilers. It should be added to the CCFLAGS line of your Makefile.machine. See Makefile.opt in src/MAKE/OPTIONS for an example. CCFLAGS: add -restrict for Intel compilers :ul [Supporting info:] src/OPT: filenames -> commands "Section 5.3"_Section_accelerate.html#acc_3 "Section 5.3.5"_accelerate_opt.html "Section 2.6 -sf opt"_Section_start.html#start_6 Pair Styles section of "Section 3.5"_Section_commands.html#cmd_5 for pair styles followed by (t) "Benchmarks page"_http://lammps.sandia.gov/bench.html of web site :ul :line PERI package :link(PERI),h4 [Contents:] An atom style, several pair styles which implement different Peridynamics materials models, and several computes which calculate diagnostics. Peridynamics is a a particle-based meshless continuum model. [Authors:] The original package was created by Mike Parks (Sandia). Additional Peridynamics models were added by Rezwanur Rahman and John Foster (UTSA). [Install or un-install:] make yes-peri make machine :pre make no-peri make machine :pre [Supporting info:] src/PERI: filenames -> commands "doc/PDF/PDLammps_overview.pdf"_PDF/PDLammps_overview.pdf "doc/PDF/PDLammps_EPS.pdf"_PDF/PDLammps_EPS.pdf "doc/PDF/PDLammps_VES.pdf"_PDF/PDLammps_VES.pdf "atom_style peri"_atom_style.html "pair_style peri/*"_pair_peri.html "compute damage/atom"_compute_damage_atom.html "compute plasticity/atom"_compute_plasticity_atom.html examples/peri http://lammps.sandia.gov/movies.html#peri :ul :line POEMS package :link(POEMS),h4 [Contents:] A fix that wraps the Parallelizable Open source Efficient Multibody Software (POEMS) library, which is able to simulate the dynamics of articulated body systems. These are systems with multiple rigid bodies (collections of particles) whose motion is coupled by connections at hinge points. [Author:] Rudra Mukherjee (JPL) while at RPI. [Install or un-install:] Before building LAMMPS with this package, you must first build the POEMS library in lib/poems. You can do this manually if you prefer; follow the instructions in lib/poems/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/poems/Install.py script with the specified args: make lib-poems # print help message make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial") make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") make lib-poems args="-m icc" # build with Intel icc compiler :pre The build should produce two files: lib/poems/libpoems.a and lib/poems/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to build LAMMPS with the POEMS library (though typically the settings are just blank). If necessary, you can edit/create a new lib/poems/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-poems make machine :pre make no-meam make machine :pre [Supporting info:] src/POEMS: filenames -> commands src/POEMS/README lib/poems/README "fix poems"_fix_poems.html examples/rigid :ul :line PYTHON package :link(PYTHON),h4 [Contents:] A "python"_python.html command which allow you to execute Python code from a LAMMPS input script. The code can be in a separate file or embedded in the input script itself. See "Section 11.2"_Section_python.html#py_2 for an overview of using Python from LAMMPS in this manner and the entire section for other ways to use LAMMPS and Python together. [Install or un-install:] make yes-python make machine :pre make no-python make machine :pre NOTE: Building with the PYTHON package assumes you have a Python shared library available on your system, which needs to be a Python 2 version, 2.6 or later. Python 3 is not yet supported. See the lib/python/README for more details. Note that the build uses the lib/python/Makefile.lammps file in the compile/link process. You should only need to create a new Makefile.lammps.* file (and copy it to Makefile.lammps) if the LAMMPS build fails. [Supporting info:] src/PYTHON: filenames -> commands "Section 11"_Section_python.html lib/python/README examples/python :ul :line QEQ package :link(QEQ),h4 [Contents:] Several fixes for performing charge equilibration (QEq) via different algorithms. These can be used with pair styles that perform QEq as part of their formulation. [Install or un-install:] make yes-qeq make machine :pre make no-qeq make machine :pre [Supporting info:] src/QEQ: filenames -> commands "fix qeq/*"_fix_qeq.html examples/qeq examples/streitz :ul :line REAX package :link(REAX),h4 [Contents:] A pair style which wraps a Fortran library which implements the ReaxFF potential, which is a universal reactive force field. See the "USER-REAXC package"_#USER-REAXC for an alternate implementation in C/C++. Also a "fix reax/bonds"_fix_reax_bonds.html command for monitoring molecules as bonds are created and destroyed. [Author:] Aidan Thompson (Sandia). [Install or un-install:] Before building LAMMPS with this package, you must first build the REAX library in lib/reax. You can do this manually if you prefer; follow the instructions in lib/reax/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/reax/Install.py script with the specified args: make lib-reax # print help message make lib-reax args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") make lib-reax args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") make lib-reax args="-m ifort" # build with Intel ifort compiler :pre The build should produce two files: lib/reax/libreax.a and lib/reax/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to link C++ (LAMMPS) with Fortran (REAX library). Typically the two compilers used for LAMMPS and the REAX library need to be consistent (e.g. both Intel or both GNU compilers). If necessary, you can edit/create a new lib/reax/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-reax make machine :pre make no-reax make machine :pre [Supporting info:] src/REAX: filenames -> commands lib/reax/README "pair_style reax"_pair_reax.html "fix reax/bonds"_fix_reax_bonds.html examples/reax :ul :line REPLICA package :link(REPLICA),h4 [Contents:] A collection of multi-replica methods which can be used when running multiple LAMMPS simulations (replicas). See "Section 6.5"_Section_howto.html#howto_5 for an overview of how to run multi-replica simulations in LAMMPS. Methods in the package include nudged elastic band (NEB), parallel replica dynamics (PRD), temperature accelerated dynamics (TAD), parallel tempering, and a verlet/split algorithm for performing long-range Coulombics on one set of processors, and the remainder of the force field calcalation on another set. [Install or un-install:] make yes-replica make machine :pre make no-replica make machine :pre [Supporting info:] src/REPLICA: filenames -> commands "Section 6.5"_Section_howto.html#howto_5 "neb"_neb.html "prd"_prd.html "tad"_tad.html "temper"_temper.html, "run_style verlet/split"_run_style.html examples/neb examples/prd examples/tad :ul :line RIGID package :link(RIGID),h4 [Contents:] Fixes which enforce rigid constraints on collections of atoms or particles. This includes SHAKE and RATTLE, as well as varous rigid-body integrators for a few large bodies or many small bodies. Also several computes which calculate properties of rigid bodies. To install/build: make yes-rigid make machine :pre To un-install/re-build: make no-rigid make machine :pre [Supporting info:] src/RIGID: filenames -> commands "compute erotate/rigid"_compute_erotate_rigid.html fix shake"_fix_shake.html "fix rattle"_fix_shake.html "fix rigid/*"_fix_rigid.html examples/ASPHERE examples/rigid bench/in.rhodo http://lammps.sandia.gov/movies.html#box http://lammps.sandia.gov/movies.html#star :ul :line SHOCK package :link(SHOCK),h4 [Contents:] Fixes for running impact simulations where a shock-wave passes through a material. [Install or un-install:] make yes-shock make machine :pre make no-shock make machine :pre [Supporting info:] src/SHOCK: filenames -> commands "fix append/atoms"_fix_append_atoms.html "fix msst"_fix_msst.html "fix nphug"_fix_nphug.html "fix wall/piston"_fix_wall_piston.html examples/hugoniostat examples/msst :ul :line SNAP package :link(SNAP),h4 [Contents:] A pair style for the spectral neighbor analysis potential (SNAP). SNAP is methodology for deriving a highly accurate classical potential fit to a large archive of quantum mechanical (DFT) data. Also several computes which analyze attributes of the potential. [Author:] Aidan Thompson (Sandia). [Install or un-install:] make yes-snap make machine :pre make no-snap make machine :pre [Supporting info:] src/SNAP: filenames -> commands -"pair snap"_pair_snap.html +"pair_style snap"_pair_snap.html "compute sna/atom"_compute_sna_atom.html "compute snad/atom"_compute_sna_atom.html "compute snav/atom"_compute_sna_atom.html examples/snap :ul :line SRD package :link(SRD),h4 [Contents:] A pair of fixes which implement the Stochastic Rotation Dynamics (SRD) method for coarse-graining of a solvent, typically around large colloidal particles. To install/build: make yes-srd make machine :pre To un-install/re-build: make no-srd make machine :pre [Supporting info:] src/SRD: filenames -> commands "fix srd"_fix_srd.html "fix wall/srd"_fix_wall_srd.html examples/srd examples/ASPHERE http://lammps.sandia.gov/movies.html#tri http://lammps.sandia.gov/movies.html#line http://lammps.sandia.gov/movies.html#poly :ul :line VORONOI package :link(VORONOI),h4 [Contents:] A compute command which calculates the Voronoi tesselation of a collection of atoms by wrapping the "Voro++ library"_voro_home. This can be used to calculate the local volume or each atoms or its near neighbors. :link(voro_home,http://math.lbl.gov/voro++) To use this package you must have the Voro++ library available on your system. [Author:] Daniel Schwen (INL) while at LANL. The open-source Voro++ library was written by Chris Rycroft (Harvard U) while at UC Berkeley and LBNL. [Install or un-install:] Before building LAMMPS with this package, you must first download and build the Voro++ library. You can do this manually if you prefer; follow the instructions in lib/voronoi/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/voronoi/Install.py script with the specified args: make lib-voronoi # print help message make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++- make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++ make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 :pre Note that 2 symbolic (soft) links, "includelink" and "liblink", are created in lib/voronoi to point to the Voro++ src dir. When LAMMPS builds in src it will use these links. You should not need to edit the lib/voronoi/Makefile.lammps file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-voronoi make machine :pre make no-voronoi make machine :pre [Supporting info:] src/VORONOI: filenames -> commands src/VORONOI/README lib/voronoi/README "compute voronoi/atom"_compute_voronoi_atom.html examples/voronoi :ul :line :line USER-ATC package :link(USER-ATC),h4 [Contents:] ATC stands for atoms-to-continuum. This package implements a "fix atc"_fix_atc.html command to either couple molecular dynamics with continuum finite element equations or perform on-the-fly conversion of atomic information to continuum fields. [Authors:] Reese Jones, Jeremy Templeton, Jon Zimmerman (Sandia). [Install or un-install:] Before building LAMMPS with this package, you must first build the ATC library in lib/atc. You can do this manually if you prefer; follow the instructions in lib/atc/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/atc/Install.py script with the specified args: make lib-atc # print help message make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi") make lib-atc args="-m icc" # build with Intel icc compiler :pre The build should produce two files: lib/atc/libatc.a and lib/atc/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to build LAMMPS with the ATC library. If necessary, you can edit/create a new lib/atc/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. Note that the Makefile.lammps file has settings for the BLAS and LAPACK linear algebra libraries. As explained in lib/atc/README these can either exist on your system, or you can use the files provided in lib/linalg. In the latter case you also need to build the library in lib/linalg with a command like these: make lib-linalg # print help message make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") make lib-linalg args="-m gfortran" # build with GNU Fortran compiler :pre You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-atc make machine :pre make no-user-atc make machine :pre [Supporting info:] src/USER-ATC: filenames -> commands src/USER-ATC/README "fix atc"_fix_atc.html examples/USER/atc http://lammps.sandia.gov/pictures.html#atc :ul :line USER-AWPMD package :link(USER-AWPMD),h4 [Contents:] AWPMD stands for Antisymmetrized Wave Packet Molecular Dynamics. This package implements an atom, pair, and fix style which allows electrons to be treated as explicit particles in a classical molecular dynamics model. [Author:] Ilya Valuev (JIHT, Russia). [Install or un-install:] Before building LAMMPS with this package, you must first build the AWPMD library in lib/awpmd. You can do this manually if you prefer; follow the instructions in lib/awpmd/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/awpmd/Install.py script with the specified args: make lib-awpmd # print help message make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi") make lib-awpmd args="-m icc" # build with Intel icc compiler :pre The build should produce two files: lib/awpmd/libawpmd.a and lib/awpmd/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to build LAMMPS with the AWPMD library. If necessary, you can edit/create a new lib/awpmd/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. Note that the Makefile.lammps file has settings for the BLAS and LAPACK linear algebra libraries. As explained in lib/awpmd/README these can either exist on your system, or you can use the files provided in lib/linalg. In the latter case you also need to build the library in lib/linalg with a command like these: make lib-linalg # print help message make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") make lib-linalg args="-m gfortran" # build with GNU Fortran compiler :pre You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-awpmd make machine :pre make no-user-awpmd make machine :pre [Supporting info:] src/USER-AWPMD: filenames -> commands src/USER-AWPMD/README -"pair awpmd/cut"_pair_awpmd.html +"pair_style awpmd/cut"_pair_awpmd.html examples/USER/awpmd :ul :line USER-CGDNA package :link(USER-CGDNA),h4 [Contents:] Several pair styles, a bond style, and integration fixes for coarse-grained models of single- and double-stranded DNA based on the oxDNA model of Doye, Louis and Ouldridge at the University of Oxford. This includes Langevin-type rigid-body integrators with improved stability. [Author:] Oliver Henrich (University of Strathclyde, Glasgow). [Install or un-install:] make yes-user-cgdna make machine :pre make no-user-cgdna make machine :pre [Supporting info:] src/USER-CGDNA: filenames -> commands /src/USER-CGDNA/README "pair_style oxdna/*"_pair_oxdna.html "pair_style oxdna2/*"_pair_oxdna2.html "bond_style oxdna/*"_bond_oxdna.html "bond_style oxdna2/*"_bond_oxdna.html "fix nve/dotc/langevin"_fix_nve_dotc_langevin.html :ul :line USER-CGSDK package :link(USER-CGSDK),h4 [Contents:] Several pair styles and an angle style which implement the coarse-grained SDK model of Shinoda, DeVane, and Klein which enables simulation of ionic liquids, electrolytes, lipids and charged amino acids. [Author:] Axel Kohlmeyer (Temple U). [Install or un-install:] make yes-user-cgsdk make machine :pre make no-user-cgsdk make machine :pre [Supporting info:] src/USER-CGSDK: filenames -> commands src/USER-CGSDK/README "pair_style lj/sdk/*"_pair_sdk.html "angle_style sdk"_angle_sdk.html examples/USER/cgsdk http://lammps.sandia.gov/pictures.html#cg :ul :line USER-COLVARS package :link(USER-COLVARS),h4 [Contents:] COLVARS stands for collective variables, which can be used to implement various enhanced sampling methods, including Adaptive Biasing Force, Metadynamics, Steered MD, Umbrella Sampling and Restraints. A "fix colvars"_fix_colvars.html command is implemented which wraps a COLVARS library, which implements these methods. simulations. [Authors:] The COLVARS library is written and maintained by Giacomo Fiorin (ICMS, Temple University, Philadelphia, PA, USA) and Jerome Henin (LISM, CNRS, Marseille, France), originally for the NAMD MD code, but with portability in mind. Axel Kohlmeyer (Temple U) provided the interface to LAMMPS. [Install or un-install:] Before building LAMMPS with this package, you must first build the COLVARS library in lib/colvars. You can do this manually if you prefer; follow the instructions in lib/colvars/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/colvars/Install.py script with the specified args: make lib-colvars # print help message make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial") make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi") make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled :pre The build should produce two files: lib/colvars/libcolvars.a and lib/colvars/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to build LAMMPS with the COLVARS library (though typically the settings are just blank). If necessary, you can edit/create a new lib/colvars/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-colvars make machine :pre make no-user-colvars make machine :pre [Supporting info:] src/USER-COLVARS: filenames -> commands "doc/PDF/colvars-refman-lammps.pdf"_PDF/colvars-refman-lammps.pdf src/USER-COLVARS/README lib/colvars/README "fix colvars"_fix_colvars.html examples/USER/colvars :ul :line USER-DIFFRACTION package :link(USER-DIFFRACTION),h4 [Contents:] Two computes and a fix for calculating x-ray and electron diffraction intensities based on kinematic diffraction theory. [Author:] Shawn Coleman while at the U Arkansas. [Install or un-install:] make yes-user-diffraction make machine :pre make no-user-diffraction make machine :pre [Supporting info:] src/USER-DIFFRACTION: filenames -> commands "compute saed"_compute_saed.html "compute xrd"_compute_xrd.html "fix saed/vtk"_fix_saed_vtk.html examples/USER/diffraction :ul :line USER-DPD package :link(USER-DPD),h4 [Contents:] DPD stands for dissipative particle dynamics. This package implements coarse-grained DPD-based models for energetic, reactive molecular crystalline materials. It includes many pair styles specific to these systems, including for reactive DPD, where each particle has internal state for multiple species and a coupled set of chemical reaction ODEs are integrated each timestep. Highly accurate time intergrators for isothermal, isoenergetic, isobaric and isenthalpic conditions are included. These enable long timesteps via the Shardlow splitting algorithm. [Authors:] Jim Larentzos (ARL), Tim Mattox (Engility Corp), and and John Brennan (ARL). [Install or un-install:] make yes-user-dpd make machine :pre make no-user-dpd make machine :pre [Supporting info:] src/USER-DPD: filenames -> commands /src/USER-DPD/README "compute dpd"_compute_dpd.html "compute dpd/atom"_compute_dpd_atom.html "fix eos/cv"_fix_eos_table.html "fix eos/table"_fix_eos_table.html "fix eos/table/rx"_fix_eos_table_rx.html "fix shardlow"_fix_shardlow.html "fix rx"_fix_rx.html -"pair table/rx"_pair_table_rx.html -"pair dpd/fdt"_pair_dpd_fdt.html -"pair dpd/fdt/energy"_pair_dpd_fdt.html -"pair exp6/rx"_pair_exp6_rx.html -"pair multi/lucy"_pair_multi_lucy.html -"pair multi/lucy/rx"_pair_multi_lucy_rx.html +"pair_style table/rx"_pair_table_rx.html +"pair_style dpd/fdt"_pair_dpd_fdt.html +"pair_style dpd/fdt/energy"_pair_dpd_fdt.html +"pair_style exp6/rx"_pair_exp6_rx.html +"pair_style multi/lucy"_pair_multi_lucy.html +"pair_style multi/lucy/rx"_pair_multi_lucy_rx.html examples/USER/dpd :ul :line USER-DRUDE package :link(USER-DRUDE),h4 [Contents:] Fixes, pair styles, and a compute to simulate thermalized Drude oscillators as a model of polarization. See "Section 6.27"_Section_howto.html#howto_27 for an overview of how to use the package. There are auxiliary tools for using this package in tools/drude. [Authors:] Alain Dequidt (U Blaise Pascal Clermont-Ferrand), Julien Devemy (CNRS), and Agilio Padua (U Blaise Pascal). [Install or un-install:] make yes-user-drude make machine :pre make no-user-drude make machine :pre [Supporting info:] src/USER-DRUDE: filenames -> commands "Section 6.27"_Section_howto.html#howto_27 "Section 6.25"_Section_howto.html#howto_25 src/USER-DRUDE/README "fix drude"_fix_drude.html "fix drude/transform/*"_fix_drude_transform.html "compute temp/drude"_compute_temp_drude.html -"pair thole"_pair_thole.html -"pair lj/cut/thole/long"_pair_thole.html +"pair_style thole"_pair_thole.html +"pair_style lj/cut/thole/long"_pair_thole.html examples/USER/drude tools/drude :ul :line USER-EFF package :link(USER-EFF),h4 [Contents:] EFF stands for electron force field which allows a classical MD code to model electrons as particles of variable radius. This package contains atom, pair, fix and compute styles which implement the eFF as described in A. Jaramillo-Botero, J. Su, Q. An, and W.A. Goddard III, JCC, 2010. The eFF potential was first introduced by Su and Goddard, in 2007. There are auxiliary tools for using this package in tools/eff; see its README file. [Author:] Andres Jaramillo-Botero (CalTech). [Install or un-install:] make yes-user-eff make machine :pre make no-user-eff make machine :pre [Supporting info:] src/USER-EFF: filenames -> commands src/USER-EFF/README "atom_style electron"_atom_style.html "fix nve/eff"_fix_nve_eff.html "fix nvt/eff"_fix_nh_eff.html "fix npt/eff"_fix_nh_eff.html "fix langevin/eff"_fix_langevin_eff.html "compute temp/eff"_compute_temp_eff.html -"pair eff/cut"_pair_eff.html -"pair eff/inline"_pair_eff.html +"pair_style eff/cut"_pair_eff.html +"pair_style eff/inline"_pair_eff.html examples/USER/eff tools/eff/README tools/eff http://lammps.sandia.gov/movies.html#eff :ul :line USER-FEP package :link(USER-FEP),h4 [Contents:] FEP stands for free energy perturbation. This package provides methods for performing FEP simulations by using a "fix adapt/fep"_fix_adapt_fep.html command with soft-core pair potentials, which have a "soft" in their style name. There are auxiliary tools for using this package in tools/fep; see its README file. [Author:] Agilio Padua (Universite Blaise Pascal Clermont-Ferrand) [Install or un-install:] make yes-user-fep make machine :pre make no-user-fep make machine :pre [Supporting info:] src/USER-FEP: filenames -> commands src/USER-FEP/README "fix adapt/fep"_fix_adapt_fep.html "compute fep"_compute_fep.html "pair_style */soft"_pair_lj_soft.html examples/USER/fep tools/fep/README tools/fep :ul :line USER-H5MD package :link(USER-H5MD),h4 [Contents:] H5MD stands for HDF5 for MD. "HDF5"_HDF5 is a portable, binary, self-describing file format, used by many scientific simulations. H5MD is a format for molecular simulations, built on top of HDF5. This package implements a "dump h5md"_dump_h5md.html command to output LAMMPS snapshots in this format. :link(HDF5,http://www.hdfgroup.org/HDF5) To use this package you must have the HDF5 library available on your system. [Author:] Pierre de Buyl (KU Leuven) created both the package and the H5MD format. [Install or un-install:] Note that to follow these steps to compile and link to the CH5MD library, you need the standard HDF5 software package installed on your system, which should include the h5cc compiler and the HDF5 library. Before building LAMMPS with this package, you must first build the CH5MD library in lib/h5md. You can do this manually if you prefer; follow the instructions in lib/h5md/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/h5md/Install.py script with the specified args: make lib-h5md # print help message make lib-hm5d args="-m h5cc" # build with h5cc compiler :pre The build should produce two files: lib/h5md/libch5md.a and lib/h5md/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to build LAMMPS with the system HDF5 library. If necessary, you can edit/create a new lib/h5md/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-h5md make machine :pre make no-user-h5md make machine :pre [Supporting info:] src/USER-H5MD: filenames -> commands src/USER-H5MD/README lib/h5md/README "dump h5md"_dump_h5md.html :ul :line USER-INTEL package :link(USER-INTEL),h4 [Contents:] Dozens of pair, fix, bond, angle, dihedral, improper, and kspace styles which are optimized for Intel CPUs and KNLs (Knights Landing). All of them have an "intel" in their style name. "Section 5.3.2"_accelerate_intel.html gives details of what hardware and compilers are required on your system, and how to build and use this package. Its styles can be invoked at run time via the "-sf intel" or "-suffix intel" "command-line switches"_Section_start.html#start_6. Also see the "KOKKOS"_#KOKKOS, "OPT"_#OPT, and "USER-OMP"_#USER-OMP packages, which have styles optimized for CPUs and KNLs. You need to have an Intel compiler, version 14 or higher to take full advantage of this package. While compilation with GNU compilers is supported, performance will be suboptimal. NOTE: the USER-INTEL package contains styles that require using the -restrict flag, when compiling with Intel compilers. [Author:] Mike Brown (Intel). [Install or un-install:] For the USER-INTEL package, you have 2 choices when building. You can build with either CPU or KNL support. Each choice requires additional settings in your Makefile.machine for CCFLAGS and LINKFLAGS and optimized malloc libraries. See the src/MAKE/OPTIONS/Makefile.intel_cpu and src/MAKE/OPTIONS/Makefile.knl files for examples. For CPUs: OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload \ -fno-alias -ansi-alias -restrict $(OPTFLAGS) LINKFLAGS = -g -qopenmp $(OPTFLAGS) LIB = -ltbbmalloc -ltbbmalloc_proxy :pre For KNLs: OPTFLAGS = -xMIC-AVX512 -O2 -fp-model fast=2 -no-prec-div -qoverride-limits CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload \ -fno-alias -ansi-alias -restrict $(OPTFLAGS) LINKFLAGS = -g -qopenmp $(OPTFLAGS) LIB = -ltbbmalloc :pre Once you have an appropriate Makefile.machine, you can install/un-install the package and build LAMMPS in the usual manner. Note that you cannot build one executable to run on multiple hardware targets (Intel CPUs or KNL). You need to build LAMMPS once for each hardware target, to produce a separate executable. You should also typically install the USER-OMP package, as it can be used in tandem with the USER-INTEL package to good effect, as explained in "Section 5.3.2"_accelerate_intel.html. make yes-user-intel yes-user-omp make machine :pre make no-user-intel no-user-omp make machine :pre [Supporting info:] src/USER-INTEL: filenames -> commands src/USER-INTEL/README "Section 5.3"_Section_accelerate.html#acc_3 "Section 5.3.2"_accelerate_gpu.html "Section 2.6 -sf intel"_Section_start.html#start_6 "Section 2.6 -pk intel"_Section_start.html#start_6 "package intel"_package.html Styles sections of "Section 3.5"_Section_commands.html#cmd_5 for styles followed by (i) src/USER-INTEL/TEST "Benchmarks page"_http://lammps.sandia.gov/bench.html of web site :ul :line USER-LB package :link(USER-LB),h4 [Contents:] Fixes which implement a background Lattice-Boltzmann (LB) fluid, which can be used to model MD particles influenced by hydrodynamic forces. [Authors:] Frances Mackay and Colin Denniston (University of Western Ontario). [Install or un-install:] make yes-user-lb make machine :pre make no-user-lb make machine :pre [Supporting info:] src/USER-LB: filenames -> commands src/USER-LB/README "fix lb/fluid"_fix_lb_fluid.html "fix lb/momentum"_fix_lb_momentum.html "fix lb/viscous"_fix_lb_viscous.html examples/USER/lb :ul :line USER-MGPT package :link(USER-MGPT),h4 [Contents:] A pair style which provides a fast implementation of the quantum-based MGPT multi-ion potentials. The MGPT or model GPT method derives from first-principles DFT-based generalized pseudopotential theory (GPT) through a series of systematic approximations valid for mid-period transition metals with nearly half-filled d bands. The MGPT method was originally developed by John Moriarty at LLNL. The pair style in this package calculates forces and energies using an optimized matrix-MGPT algorithm due to Tomas Oppelstrup at LLNL. [Authors:] Tomas Oppelstrup and John Moriarty (LLNL). [Install or un-install:] make yes-user-mgpt make machine :pre make no-user-mgpt make machine :pre [Supporting info:] src/USER-MGPT: filenames -> commands src/USER-MGPT/README "pair_style mgpt"_pair_mgpt.html examples/USER/mgpt :ul :line USER-MISC package :link(USER-MISC),h4 [Contents:] A potpourri of (mostly) unrelated features contributed to LAMMPS by users. Each feature is a single fix, compute, pair, bond, angle, dihedral, improper, or command style. [Authors:] The author for each style in the package is listed in the src/USER-MISC/README file. [Install or un-install:] make yes-user-misc make machine :pre make no-user-misc make machine :pre [Supporting info:] src/USER-MISC: filenames -> commands src/USER-MISC/README one doc page per individual command listed in src/USER-MISC/README examples/USER/misc :ul :line USER-MANIFOLD package :link(USER-MANIFOLD),h4 [Contents:] Several fixes and a "manifold" class which enable simulations of particles constrained to a manifold (a 2D surface within the 3D simulation box). This is done by applying the RATTLE constraint algorithm to formulate single-particle constraint functions g(xi,yi,zi) = 0 and their derivative (i.e. the normal of the manifold) n = grad(g). [Author:] Stefan Paquay (until 2017: Eindhoven University of Technology (TU/e), The Netherlands; since 2017: Brandeis University, Waltham, MA, USA) [Install or un-install:] make yes-user-manifold make machine :pre make no-user-manifold make machine :pre [Supporting info:] src/USER-MANIFOLD: filenames -> commands src/USER-MANIFOLD/README "doc/manifolds"_manifolds.html "fix manifoldforce"_fix_manifoldforce.html "fix nve/manifold/rattle"_fix_nve_manifold_rattle.html "fix nvt/manifold/rattle"_fix_nvt_manifold_rattle.html examples/USER/manifold http://lammps.sandia.gov/movies.html#manifold :ul :line USER-MEAMC package :link(USER-MEAMC),h4 [Contents:] A pair style for the modified embedded atom (MEAM) potential translated from the Fortran version in the "MEAM"_MEAM package to plain C++. In contrast to the MEAM package, no library needs to be compiled and the pair style can be instantiated multiple times. [Author:] Sebastian Huetter, (Otto-von-Guericke University Magdeburg) based on the Fortran version of Greg Wagner (Northwestern U) while at Sandia. [Install or un-install:] make yes-user-meamc make machine :pre make no-user-meamc make machine :pre [Supporting info:] src/USER-MEAMC: filenames -> commands src/USER-MEAMC/README -"pair meam/c"_pair_meam.html +"pair_style meam/c"_pair_meam.html examples/meam :ul :line +USER-MESO package :link(USER-MESO),h4 + +[Contents:] + +Several extensions of the the dissipative particle dynamics (DPD) +method. Specifically, energy-conserving DPD (eDPD) that can model +non-isothermal processes, many-body DPD (mDPD) for simulating +vapor-liquid coexistence, and transport DPD (tDPD) for modeling +advection-diffuion-reaction systems. The equations of motion of these +DPD extensions are integrated through a modified velocity-Verlet (MVV) +algorithm. + +[Author:] Zhen Li (Division of Applied Mathematics, Brown University) + +[Install or un-install:] + +make yes-user-meso +make machine :pre + +make no-user-meso +make machine :pre + +[Supporting info:] + +src/USER-MESO: filenames -> commands +src/USER-MESO/README +"atom_style edpd"_atom_style.html +"pair_style edpd"_pair_meso.html +"pair_style mdpd"_pair_meso.html +"pair_style tdpd"_pair_meso.html +"fix mvv/dpd"_fix_mvv.html +examples/USER/meso +http://lammps.sandia.gov/movies.html#mesodpd :ul + +:line + USER-MOLFILE package :link(USER-MOLFILE),h4 [Contents:] A "dump molfile"_dump_molfile.html command which uses molfile plugins that are bundled with the "VMD"_vmd_home molecular visualization and analysis program, to enable LAMMPS to dump snapshots in formats compatible with various molecular simulation tools. :link(vmd_home,http://www.ks.uiuc.edu/Research/vmd) To use this package you must have the desired VMD plugins available on your system. Note that this package only provides the interface code, not the plugins themselves, which will be accessed when requesting a specific plugin via the "dump molfile"_dump_molfile.html command. Plugins can be obtained from a VMD installation which has to match the platform that you are using to compile LAMMPS for. By adding plugins to VMD, support for new file formats can be added to LAMMPS (or VMD or other programs that use them) without having to recompile the application itself. More information about the VMD molfile plugins can be found at "http://www.ks.uiuc.edu/Research/vmd/plugins/molfile"_http://www.ks.uiuc.edu/Research/vmd/plugins/molfile. [Author:] Axel Kohlmeyer (Temple U). [Install or un-install:] Note that the lib/molfile/Makefile.lammps file has a setting for a dynamic loading library libdl.a that should is typically present on all systems, which is required for LAMMPS to link with this package. If the setting is not valid for your system, you will need to edit the Makefile.lammps file. See lib/molfile/README and lib/molfile/Makefile.lammps for details. make yes-user-molfile make machine :pre make no-user-molfile make machine :pre [Supporting info:] src/USER-MOLFILE: filenames -> commands src/USER-MOLFILE/README lib/molfile/README "dump molfile"_dump_molfile.html :ul :line USER-NETCDF package :link(USER-NETCDF),h4 [Contents:] Dump styles for writing NetCDF formatted dump files. NetCDF is a portable, binary, self-describing file format developed on top of HDF5. The file contents follow the AMBER NetCDF trajectory conventions (http://ambermd.org/netcdf/nctraj.xhtml), but include extensions. To use this package you must have the NetCDF library available on your system. Note that NetCDF files can be directly visualized with the following tools: "Ovito"_ovito (Ovito supports the AMBER convention and the extensions mentioned above) "VMD"_vmd_home "AtomEye"_atomeye (the libAtoms version of AtomEye contains a NetCDF reader not present in the standard distribution) :ul :link(ovito,http://www.ovito.org) :link(atomeye,http://www.libatoms.org) [Author:] Lars Pastewka (Karlsruhe Institute of Technology). [Install or un-install:] Note that to follow these steps, you need the standard NetCDF software package installed on your system. The lib/netcdf/Makefile.lammps file has settings for NetCDF include and library files that LAMMPS needs to compile and linkk with this package. If the settings are not valid for your system, you will need to edit the Makefile.lammps file. See lib/netcdf/README for details. make yes-user-netcdf make machine :pre make no-user-netcdf make machine :pre [Supporting info:] src/USER-NETCDF: filenames -> commands src/USER-NETCDF/README lib/netcdf/README "dump netcdf"_dump_netcdf.html :ul :line USER-OMP package :link(USER-OMP),h4 [Contents:] Hundreds of pair, fix, compute, bond, angle, dihedral, improper, and kspace styles which are altered to enable threading on many-core CPUs via OpenMP directives. All of them have an "omp" in their style name. "Section 5.3.4"_accelerate_omp.html gives details of what hardware and compilers are required on your system, and how to build and use this package. Its styles can be invoked at run time via the "-sf omp" or "-suffix omp" "command-line switches"_Section_start.html#start_6. Also see the "KOKKOS"_#KOKKOS, "OPT"_#OPT, and "USER-INTEL"_#USER-INTEL packages, which have styles optimized for CPUs. [Author:] Axel Kohlmeyer (Temple U). NOTE: To enable multi-threading support the compile flag "-fopenmp" and the link flag "-fopenmp" (for GNU compilers, you have to look up the equivalent flags for other compilers) must be used to build LAMMPS. When using Intel compilers, also the "-restrict" flag is required. The USER-OMP package can be compiled without enabling OpenMP; then all code will be compiled as serial and the only improvement over the regular styles are some data access optimization. These flags should be added to the CCFLAGS and LINKFLAGS lines of your Makefile.machine. See src/MAKE/OPTIONS/Makefile.omp for an example. Once you have an appropriate Makefile.machine, you can install/un-install the package and build LAMMPS in the usual manner: [Install or un-install:] make yes-user-omp make machine :pre make no-user-omp make machine :pre CCFLAGS: add -fopenmp (and -restrict when using Intel compilers) LINKFLAGS: add -fopenmp :ul [Supporting info:] src/USER-OMP: filenames -> commands src/USER-OMP/README "Section 5.3"_Section_accelerate.html#acc_3 "Section 5.3.4"_accelerate_omp.html "Section 2.6 -sf omp"_Section_start.html#start_6 "Section 2.6 -pk omp"_Section_start.html#start_6 "package omp"_package.html Styles sections of "Section 3.5"_Section_commands.html#cmd_5 for styles followed by (o) "Benchmarks page"_http://lammps.sandia.gov/bench.html of web site :ul :line USER-PHONON package :link(USER-PHONON),h4 [Contents:] A "fix phonon"_fix_phonon.html command that calculates dynamical matrices, which can then be used to compute phonon dispersion relations, directly from molecular dynamics simulations. [Author:] Ling-Ti Kong (Shanghai Jiao Tong University). [Install or un-install:] make yes-user-phonon make machine :pre make no-user-phonon make machine :pre [Supporting info:] src/USER-PHONON: filenames -> commands src/USER-PHONON/README "fix phonon"_fix_phonon.html examples/USER/phonon :ul :line USER-QMMM package :link(USER-QMMM),h4 [Contents:] A "fix qmmm"_fix_qmmm.html command which allows LAMMPS to be used in a QM/MM simulation, currently only in combination with the "Quantum ESPRESSO"_espresso package. :link(espresso,http://www.quantum-espresso.org) To use this package you must have Quantum ESPRESSO available on your system. The current implementation only supports an ONIOM style mechanical coupling to the Quantum ESPRESSO plane wave DFT package. Electrostatic coupling is in preparation and the interface has been written in a manner that coupling to other QM codes should be possible without changes to LAMMPS itself. [Author:] Axel Kohlmeyer (Temple U). [Install or un-install:] Before building LAMMPS with this package, you must first build the QMMM library in lib/qmmm. You can do this manually if you prefer; follow the first two steps explained in lib/qmmm/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/qmmm/Install.py script with the specified args: make lib-qmmm # print help message make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial") make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi") make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler :pre The build should produce two files: lib/qmmm/libqmmm.a and lib/qmmm/Makefile.lammps. The latter is copied from an existing Makefile.lammps.* and has settings needed to build LAMMPS with the QMMM library (though typically the settings are just blank). If necessary, you can edit/create a new lib/qmmm/Makefile.machine file for your system, which should define an EXTRAMAKE variable to specify a corresponding Makefile.lammps.machine file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-qmmm make machine :pre make no-user-qmmm make machine :pre NOTE: The LAMMPS executable these steps produce is not yet functional for a QM/MM simulation. You must also build Quantum ESPRESSO and create a new executable which links LAMMPS and Quanutm ESPRESSO together. These are steps 3 and 4 described in the lib/qmmm/README file. [Supporting info:] src/USER-QMMM: filenames -> commands src/USER-QMMM/README lib/qmmm/README "fix phonon"_fix_phonon.html lib/qmmm/example-ec/README lib/qmmm/example-mc/README :ul :line USER-QTB package :link(USER-QTB),h4 [Contents:] Two fixes which provide a self-consistent quantum treatment of vibrational modes in a classical molecular dynamics simulation. By coupling the MD simulation to a colored thermostat, it introduces zero point energy into the system, altering the energy power spectrum and the heat capacity to account for their quantum nature. This is useful when modeling systems at temperatures lower than their classical limits or when temperatures ramp across the classical limits in a simulation. [Author:] Yuan Shen (Stanford U). [Install or un-install:] make yes-user-qtb make machine :pre make no-user-qtb make machine :pre [Supporting info:] src/USER-QTB: filenames -> commands src/USER-QTB/README "fix qtb"_fix_qtb.html "fix qbmsst"_fix_qbmsst.html examples/USER/qtb :ul :line USER-QUIP package :link(USER-QUIP),h4 [Contents:] A "pair_style quip"_pair_quip.html command which wraps the "QUIP libAtoms library"_quip, which includes a variety of interatomic potentials, including Gaussian Approximation Potential (GAP) models developed by the Cambridge University group. :link(quip,https://github.com/libAtoms/QUIP) To use this package you must have the QUIP libAatoms library available on your system. [Author:] Albert Bartok (Cambridge University) [Install or un-install:] Note that to follow these steps to compile and link to the QUIP library, you must first download and build QUIP on your systems. It can be obtained from GitHub. See step 1 and step 1.1 in the lib/quip/README file for details on how to do this. Note that it requires setting two environment variables, QUIP_ROOT and QUIP_ARCH, which will be accessed by the lib/quip/Makefile.lammps file which is used when you compile and link LAMMPS with this package. You should only need to edit this file if the LAMMPS build can not use its settings to successfully build on your system. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-quip make machine :pre make no-user-quip make machine :pre [Supporting info:] src/USER-QUIP: filenames -> commands src/USER-QUIP/README "pair_style quip"_pair_quip.html examples/USER/quip :ul :line USER-REAXC package :link(USER-REAXC),h4 [Contents:] A pair style which implements the ReaxFF potential in C/C++ (in contrast to the "REAX package"_#REAX and its Fortran library). ReaxFF is universal reactive force field. See the src/USER-REAXC/README file for more info on differences between the two packages. Also two fixes for monitoring molecules as bonds are created and destroyed. [Author:] Hasan Metin Aktulga (MSU) while at Purdue University. [Install or un-install:] make yes-user-reaxc make machine :pre make no-user-reaxc make machine :pre [Supporting info:] src/USER-REAXC: filenames -> commands src/USER-REAXC/README "pair_style reax/c"_pair_reaxc.html "fix reax/c/bonds"_fix_reax_bonds.html "fix reax/c/species"_fix_reaxc_species.html examples/reax :ul :line USER-SMD package :link(USER-SMD),h4 [Contents:] An atom style, fixes, computes, and several pair styles which implements smoothed Mach dynamics (SMD) for solids, which is a model related to smoothed particle hydrodynamics (SPH) for liquids (see the "USER-SPH package"_#USER-SPH). This package solves solids mechanics problems via a state of the art stabilized meshless method with hourglass control. It can specify hydrostatic interactions independently from material strength models, i.e. pressure and deviatoric stresses are separated. It provides many material models (Johnson-Cook, plasticity with hardening, Mie-Grueneisen, Polynomial EOS) and allows new material models to be added. It implements rigid boundary conditions (walls) which can be specified as surface geometries from *.STL files. [Author:] Georg Ganzenmuller (Fraunhofer-Institute for High-Speed Dynamics, Ernst Mach Institute, Germany). [Install or un-install:] Before building LAMMPS with this package, you must first download the Eigen library. Eigen is a template library, so you do not need to build it, just download it. You can do this manually if you prefer; follow the instructions in lib/smd/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/smd/Install.py script with the specified args: make lib-smd # print help message make lib-smd args="-b" # download and build in default lib/smd/eigen-eigen-... make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 :pre Note that a symbolic (soft) link named "includelink" is created in lib/smd to point to the Eigen dir. When LAMMPS builds it will use this link. You should not need to edit the lib/smd/Makefile.lammps file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-smd make machine :pre make no-user-smd make machine :pre [Supporting info:] src/USER-SMD: filenames -> commands src/USER-SMD/README doc/PDF/SMD_LAMMPS_userguide.pdf examples/USER/smd http://lammps.sandia.gov/movies.html#smd :ul :line USER-SMTBQ package :link(USER-SMTBQ),h4 [Contents:] A pair style which implements a Second Moment Tight Binding model with QEq charge equilibration (SMTBQ) potential for the description of ionocovalent bonds in oxides. [Authors:] Nicolas Salles, Emile Maras, Olivier Politano, and Robert Tetot (LAAS-CNRS, France). [Install or un-install:] make yes-user-smtbq make machine :pre make no-user-smtbq make machine :pre [Supporting info:] src/USER-SMTBQ: filenames -> commands src/USER-SMTBQ/README "pair_style smtbq"_pair_smtbq.html examples/USER/smtbq :ul :line USER-SPH package :link(USER-SPH),h4 [Contents:] An atom style, fixes, computes, and several pair styles which implements smoothed particle hydrodynamics (SPH) for liquids. See the related "USER-SMD package"_#USER-SMD package for smooth Mach dynamics (SMD) for solids. This package contains ideal gas, Lennard-Jones equation of states, Tait, and full support for complete (i.e. internal-energy dependent) equations of state. It allows for plain or Monaghans XSPH integration of the equations of motion. It has options for density continuity or density summation to propagate the density field. It has "set"_set.html command options to set the internal energy and density of particles from the input script and allows the same quantities to be output with thermodynamic output or to dump files via the "compute property/atom"_compute_property_atom.html command. [Author:] Georg Ganzenmuller (Fraunhofer-Institute for High-Speed Dynamics, Ernst Mach Institute, Germany). [Install or un-install:] make yes-user-sph make machine :pre make no-user-sph make machine :pre [Supporting info:] src/USER-SPH: filenames -> commands src/USER-SPH/README doc/PDF/SPH_LAMMPS_userguide.pdf examples/USER/sph http://lammps.sandia.gov/movies.html#sph :ul :line USER-TALLY package :link(USER-TALLY),h4 [Contents:] Several compute styles that can be called when pairwise interactions are calculated to tally information (forces, heat flux, energy, stress, etc) about individual interactions. [Author:] Axel Kohlmeyer (Temple U). [Install or un-install:] make yes-user-tally make machine :pre make no-user-tally make machine :pre [Supporting info:] src/USER-TALLY: filenames -> commands src/USER-TALLY/README "compute */tally"_compute_tally.html examples/USER/tally :ul :line USER-VTK package :link(USER-VTK),h4 [Contents:] A "dump vtk"_dump_vtk.html command which outputs snapshot info in the "VTK format"_vtk, enabling visualization by "Paraview"_paraview or other visuzlization packages. :link(vtk,http://www.vtk.org) :link(paraview,http://www.paraview.org) To use this package you must have VTK library available on your system. [Authors:] Richard Berger (JKU) and Daniel Queteschiner (DCS Computing). [Install or un-install:] The lib/vtk/Makefile.lammps file has settings for accessing VTK files and its library, which are required for LAMMPS to build and link with this package. If the settings are not valid for your system, check if one of the other lib/vtk/Makefile.lammps.* files is compatible and copy it to Makefile.lammps. If none of the provided files work, you will need to edit the Makefile.lammps file. You can then install/un-install the package and build LAMMPS in the usual manner: make yes-user-vtk make machine :pre make no-user-vtk make machine :pre [Supporting info:] src/USER-VTK: filenames -> commands src/USER-VTK/README lib/vtk/README "dump vtk"_dump_vtk.html :ul diff --git a/doc/src/atom_style.txt b/doc/src/atom_style.txt index 077636dfd..49d9dde79 100644 --- a/doc/src/atom_style.txt +++ b/doc/src/atom_style.txt @@ -1,306 +1,330 @@ "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c :link(lws,http://lammps.sandia.gov) :link(ld,Manual.html) :link(lc,Section_commands.html#comm) :line atom_style command :h3 [Syntax:] atom_style style args :pre style = {angle} or {atomic} or {body} or {bond} or {charge} or {dipole} or \ - {dpd} or {electron} or {ellipsoid} or {full} or {line} or {meso} or \ - {molecular} or {peri} or {smd} or {sphere} or {tri} or \ - {template} or {hybrid} :ulb,l + {dpd} or {edpd} or {mdpd} or {tdpd} or {electron} or {ellipsoid} or \ + {full} or {line} or {meso} or {molecular} or {peri} or {smd} or \ + {sphere} or {tri} or {template} or {hybrid} :ulb,l args = none for any style except the following - {body} args = bstyle bstyle-args - bstyle = style of body particles - bstyle-args = additional arguments specific to the bstyle - see the "body"_body.html doc page for details - {template} args = template-ID - template-ID = ID of molecule template specified in a separate "molecule"_molecule.html command - {hybrid} args = list of one or more sub-styles, each with their args :pre + {body} args = bstyle bstyle-args + bstyle = style of body particles + bstyle-args = additional arguments specific to the bstyle + see the "body"_body.html doc page for details + {tdpd} arg = Nspecies + Nspecies = # of chemical species + {template} arg = template-ID + template-ID = ID of molecule template specified in a separate "molecule"_molecule.html command + {hybrid} args = list of one or more sub-styles, each with their args :pre accelerated styles (with same args) = {angle/kk} or {atomic/kk} or {bond/kk} or {charge/kk} or {full/kk} or {molecular/kk} :l :ule [Examples:] atom_style atomic atom_style bond atom_style full atom_style body nparticle 2 10 atom_style hybrid charge bond atom_style hybrid charge body nparticle 2 5 -atom_style template myMols :pre +atom_style template myMols +atom_style tdpd 2 :pre [Description:] Define what style of atoms to use in a simulation. This determines what attributes are associated with the atoms. This command must be used before a simulation is setup via a "read_data"_read_data.html, "read_restart"_read_restart.html, or "create_box"_create_box.html command. NOTE: Many of the atom styles discussed here are only enabled if LAMMPS was built with a specific package, as listed below in the Restrictions section. Once a style is assigned, it cannot be changed, so use a style general enough to encompass all attributes. E.g. with style {bond}, angular terms cannot be used or added later to the model. It is OK to use a style more general than needed, though it may be slightly inefficient. The choice of style affects what quantities are stored by each atom, what quantities are communicated between processors to enable forces to be computed, and what quantities are listed in the data file read by the "read_data"_read_data.html command. These are the additional attributes of each style and the typical kinds of physical systems they are used to model. All styles store coordinates, velocities, atom IDs and types. See the "read_data"_read_data.html, "create_atoms"_create_atoms.html, and "set"_set.html commands for info on how to set these various quantities. {angle} | bonds and angles | bead-spring polymers with stiffness | {atomic} | only the default values | coarse-grain liquids, solids, metals | {body} | mass, inertia moments, quaternion, angular momentum | arbitrary bodies | {bond} | bonds | bead-spring polymers | {charge} | charge | atomic system with charges | {dipole} | charge and dipole moment | system with dipolar particles | {dpd} | internal temperature and internal energies | DPD particles | +{edpd} | temperature and heat capacity | eDPD particles | +{mdpd} | density | mDPD particles | +{tdpd} | chemical concentration | tDPD particles | {electron} | charge and spin and eradius | electronic force field | {ellipsoid} | shape, quaternion, angular momentum | aspherical particles | {full} | molecular + charge | bio-molecules | {line} | end points, angular velocity | rigid bodies | {meso} | rho, e, cv | SPH particles | {molecular} | bonds, angles, dihedrals, impropers | uncharged molecules | {peri} | mass, volume | mesocopic Peridynamic models | {smd} | volume, kernel diameter, contact radius, mass | solid and fluid SPH particles | {sphere} | diameter, mass, angular velocity | granular models | {template} | template index, template atom | small molecules with fixed topology | {tri} | corner points, angular momentum | rigid bodies | {wavepacket} | charge, spin, eradius, etag, cs_re, cs_im | AWPMD :tb(c=3,s=|) NOTE: It is possible to add some attributes, such as a molecule ID, to atom styles that do not have them via the "fix property/atom"_fix_property_atom.html command. This command also allows new custom attributes consisting of extra integer or floating-point values to be added to atoms. See the "fix property/atom"_fix_property_atom.html doc page for examples of cases where this is useful and details on how to initialize, access, and output the custom values. All of the above styles define point particles, except the {sphere}, {ellipsoid}, {electron}, {peri}, {wavepacket}, {line}, {tri}, and {body} styles, which define finite-size particles. See "Section 6.14"_Section_howto.html#howto_14 for an overview of using finite-size particle models with LAMMPS. All of the point-particle styles assign mass to particles on a per-type basis, using the "mass"_mass.html command, The finite-size particle styles assign mass to individual particles on a per-particle basis. For the {sphere} style, the particles are spheres and each stores a per-particle diameter and mass. If the diameter > 0.0, the particle is a finite-size sphere. If the diameter = 0.0, it is a point particle. Note that by use of the {disc} keyword with the "fix nve/sphere"_fix_nve_sphere.html, "fix nvt/sphere"_fix_nvt_sphere.html, "fix nph/sphere"_fix_nph_sphere.html, "fix npt/sphere"_fix_npt_sphere.html commands, spheres can be effectively treated as 2d discs for a 2d simulation if desired. See also the "set density/disc"_set.html command. For the {ellipsoid} style, the particles are ellipsoids and each stores a flag which indicates whether it is a finite-size ellipsoid or a point particle. If it is an ellipsoid, it also stores a shape vector with the 3 diameters of the ellipsoid and a quaternion 4-vector with its orientation. For the {dipole} style, a point dipole is defined for each point particle. Note that if you wish the particles to be finite-size spheres as in a Stockmayer potential for a dipolar fluid, so that the particles can rotate due to dipole-dipole interactions, then you need to use atom_style hybrid sphere dipole, which will assign both a diameter and dipole moment to each particle. For the {electron} style, the particles representing electrons are 3d Gaussians with a specified position and bandwidth or uncertainty in position, which is represented by the eradius = electron size. For the {peri} style, the particles are spherical and each stores a per-particle mass and volume. The {dpd} style is for dissipative particle dynamics (DPD) particles. Note that it is part of the USER-DPD package, and is not for use with the "pair_style dpd or dpd/stat"_pair_dpd.html commands, which can simply use atom_style atomic. Atom_style dpd extends DPD particle properties with internal temperature (dpdTheta), internal conductive energy (uCond), internal mechanical energy (uMech), and internal chemical energy (uChem). +The {edpd} style is for energy-conserving dissipative particle +dynamics (eDPD) particles which store a temperature (edpd_temp), and +heat capacity(edpd_cv). + +The {mdpd} style is for many-body dissipative particle dynamics (mDPD) +particles which store a density (rho) for considering +density-dependent many-body interactions. + +The {tdpd} style is for transport dissipative particle dynamics (tDPD) +particles which store a set of chemical concentration. An integer +"cc_species" is required to specify the number of chemical species +involved in a tDPD system. + The {meso} style is for smoothed particle hydrodynamics (SPH) particles which store a density (rho), energy (e), and heat capacity (cv). The {smd} style is for a general formulation of Smooth Particle Hydrodynamics. Both fluids and solids can be modeled. Particles store the mass and volume of an integration point, a kernel diameter used for calculating the field variables (e.g. stress and deformation) and a contact radius for calculating repulsive forces which prevent individual physical bodies from penetrating each other. The {wavepacket} style is similar to {electron}, but the electrons may consist of several Gaussian wave packets, summed up with coefficients cs= (cs_re,cs_im). Each of the wave packets is treated as a separate particle in LAMMPS, wave packets belonging to the same electron must have identical {etag} values. For the {line} style, the particles are idealized line segments and each stores a per-particle mass and length and orientation (i.e. the end points of the line segment). For the {tri} style, the particles are planar triangles and each stores a per-particle mass and size and orientation (i.e. the corner points of the triangle). The {template} style allows molecular topology (bonds,angles,etc) to be defined via a molecule template using the "molecule"_molecule.html command. The template stores one or more molecules with a single copy of the topology info (bonds,angles,etc) of each. Individual atoms only store a template index and template atom to identify which molecule and which atom-within-the-molecule they represent. Using the {template} style instead of the {bond}, {angle}, {molecular} styles can save memory for systems comprised of a large number of small molecules, all of a single type (or small number of types). See the paper by Grime and Voth, in "(Grime)"_#Grime, for examples of how this can be advantageous for large-scale coarse-grained systems. NOTE: When using the {template} style with a "molecule template"_molecule.html that contains multiple molecules, you should insure the atom types, bond types, angle_types, etc in all the molecules are consistent. E.g. if one molecule represents H2O and another CO2, then you probably do not want each molecule file to define 2 atom types and a single bond type, because they will conflict with each other when a mixture system of H2O and CO2 molecules is defined, e.g. by the "read_data"_read_data.html command. Rather the H2O molecule should define atom types 1 and 2, and bond type 1. And the CO2 molecule should define atom types 3 and 4 (or atom types 3 and 2 if a single oxygen type is desired), and bond type 2. For the {body} style, the particles are arbitrary bodies with internal attributes defined by the "style" of the bodies, which is specified by the {bstyle} argument. Body particles can represent complex entities, such as surface meshes of discrete points, collections of sub-particles, deformable objects, etc. The "body"_body.html doc page describes the body styles LAMMPS currently supports, and provides more details as to the kind of body particles they represent. For all styles, each body particle stores moments of inertia and a quaternion 4-vector, so that its orientation and position can be time integrated due to forces and torques. Note that there may be additional arguments required along with the {bstyle} specification, in the atom_style body command. These arguments are described in the "body"_body.html doc page. :line Typically, simulations require only a single (non-hybrid) atom style. If some atoms in the simulation do not have all the properties defined by a particular style, use the simplest style that defines all the needed properties by any atom. For example, if some atoms in a simulation are charged, but others are not, use the {charge} style. If some atoms have bonds, but others do not, use the {bond} style. The only scenario where the {hybrid} style is needed is if there is no single style which defines all needed properties of all atoms. For example, as mentioned above, if you want dipolar particles which will rotate due to torque, you need to use "atom_style hybrid sphere dipole". When a hybrid style is used, atoms store and communicate the union of all quantities implied by the individual styles. When using the {hybrid} style, you cannot combine the {template} style with another molecular style that stores bond,angle,etc info on a per-atom basis. LAMMPS can be extended with new atom styles as well as new body styles; see "this section"_Section_modify.html. :line Styles with a {kk} suffix are functionally the same as the corresponding style without the suffix. They have been optimized to run faster, depending on your available hardware, as discussed in "Section 5"_Section_accelerate.html of the manual. The accelerated styles take the same arguments and should produce the same results, except for round-off and precision issues. Note that other acceleration packages in LAMMPS, specifically the GPU, USER-INTEL, USER-OMP, and OPT packages do not use accelerated atom styles. The accelerated styles are part of the KOKKOS package. They are only enabled if LAMMPS was built with those packages. See the "Making LAMMPS"_Section_start.html#start_3 section for more info. You can specify the accelerated styles explicitly in your input script by including their suffix, or you can use the "-suffix command-line switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can use the "suffix"_suffix.html command in your input script. See "Section 5"_Section_accelerate.html of the manual for more instructions on how to use the accelerated styles effectively. [Restrictions:] This command cannot be used after the simulation box is defined by a "read_data"_read_data.html or "create_box"_create_box.html command. Many of the styles listed above are only enabled if LAMMPS was built with a specific package, as listed below. See the "Making LAMMPS"_Section_start.html#start_3 section for more info. The {angle}, {bond}, {full}, {molecular}, and {template} styles are part of the MOLECULE package. The {line} and {tri} styles are part of the ASPHERE package. The {body} style is part of the BODY package. The {dipole} style is part of the DIPOLE package. The {peri} style is part of the PERI package for Peridynamics. The {electron} style is part of the USER-EFF package for "electronic force fields"_pair_eff.html. The {dpd} style is part of the USER-DPD package for dissipative particle dynamics (DPD). +The {edpd}, {mdpd}, and {tdpd} styles are part of the USER-MESO package +for energy-conserving dissipative particle dynamics (eDPD), many-body +dissipative particle dynamics (mDPD), and transport dissipative particle +dynamics (tDPD), respectively. + The {meso} style is part of the USER-SPH package for smoothed particle hydrodynamics (SPH). See "this PDF guide"_USER/sph/SPH_LAMMPS_userguide.pdf to using SPH in LAMMPS. The {wavepacket} style is part of the USER-AWPMD package for the "antisymmetrized wave packet MD method"_pair_awpmd.html. [Related commands:] "read_data"_read_data.html, "pair_style"_pair_style.html [Default:] atom_style atomic :line :link(Grime) [(Grime)] Grime and Voth, to appear in J Chem Theory & Computation (2014). diff --git a/doc/src/compute_edpd_temp_atom.txt b/doc/src/compute_edpd_temp_atom.txt new file mode 100644 index 000000000..30f8c1043 --- /dev/null +++ b/doc/src/compute_edpd_temp_atom.txt @@ -0,0 +1,61 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +compute edpd/temp/atom command :h3 + +[Syntax:] + +compute ID group-ID edpd/temp/atom :pre + +ID, group-ID are documented in "compute"_compute.html command +edpd/temp/atom = style name of this compute command :ul + +[Examples:] + +compute 1 all edpd/temp/atom :pre + +[Description:] + +Define a computation that calculates the per-atom temperature +for each eDPD particle in a group. + +The temperature is a local temperature derived from the internal energy +of each eDPD particle based on the local equilibrium hypothesis. +For more details please see "(Espanol1997)"_#Espanol1997 and "(Li2014)"_#Li2014. + +[Output info:] + +This compute calculates a per-atom vector, which can be accessed by +any command that uses per-atom values from a compute as input. See +"Section 6.15"_Section_howto.html#howto_15 for an overview of +LAMMPS output options. + +The per-atom vector values will be in temperature "units"_units.html. + +[Restrictions:] + +This compute is part of the USER-MESO package. It is only enabled if +LAMMPS was built with that package. See the "Making +LAMMPS"_Section_start.html#start_3 section for more info. + +[Related commands:] + +"pair_style edpd"_pair_meso.html + +[Default:] none + +:line + +:link(Espanol1997) +[(Espanol1997)] Espanol, Europhys Lett, 40(6): 631-636 (1997). DOI: +10.1209/epl/i1997-00515-8 + +:link(Li2014) +[(Li2014)] Li, Tang, Lei, Caswell, Karniadakis, J Comput Phys, 265: +113-127 (2014). DOI: 10.1016/j.jcp.2014.02.003. + diff --git a/doc/src/compute_tdpd_cc_atom.txt b/doc/src/compute_tdpd_cc_atom.txt new file mode 100644 index 000000000..58a49fa59 --- /dev/null +++ b/doc/src/compute_tdpd_cc_atom.txt @@ -0,0 +1,60 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +compute tdpd/cc/atom command :h3 + +[Syntax:] + +compute ID group-ID tdpd/cc/atom index :pre + +ID, group-ID are documented in "compute"_compute.html command +tdpd/cc/atom = style name of this compute command +index = index of chemical species (1 to Nspecies) :ul + +[Examples:] + +compute 1 all tdpd/cc/atom 2 :pre + +[Description:] + +Define a computation that calculates the per-atom chemical +concentration of a specified species for each tDPD particle in a +group. + +The chemical concentration of each species is defined as the number of +molecules carried by a tDPD particle for dilute solution. For more +details see "(Li2015)"_#Li2015. + +[Output info:] + +This compute calculates a per-atom vector, which can be accessed by +any command that uses per-atom values from a compute as input. See +"Section 6.15"_Section_howto.html#howto_15 for an overview of +LAMMPS output options. + +The per-atom vector values will be in the units of chemical species +per unit mass. + +[Restrictions:] + +This compute is part of the USER-MESO package. It is only enabled if +LAMMPS was built with that package. See the "Making +LAMMPS"_Section_start.html#start_3 section for more info. + +[Related commands:] + +"pair_style tdpd"_pair_meso.html + +[Default:] none + +:line + +:link(Li2015) +[(Li2015)] Li, Yazdani, Tartakovsky, Karniadakis, J Chem Phys, 143: +014101 (2015). DOI: 10.1063/1.4923254 + diff --git a/doc/src/fix_dpd_source.txt b/doc/src/fix_dpd_source.txt new file mode 100644 index 000000000..de035a94b --- /dev/null +++ b/doc/src/fix_dpd_source.txt @@ -0,0 +1,101 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +fix edpd/source command :h3 +fix tdpd/source command :h3 + +[Syntax:] + +fix ID group-ID edpd/source keyword values ... +fix ID group-ID tdpd/source cc_index keyword values ... :pre + +ID, group-ID are documented in "fix"_fix.html command :ulb,l +edpd/source or tdpd/source = style name of this fix command :l +index (only specified for tdpd/source) = index of chemical species (1 to Nspecies) :l +keyword = {sphere} or {cuboid} :l + {sphere} values = cx,cy,cz,radius,source + cx,cy,cz = x,y,z center of spherical domain (distance units) + radius = radius of a spherical domain (distance units) + source = heat source or concentration source (flux units, see below) + {cuboid} values = cx,cy,cz,dLx,dLy,dLz,source + cx,cy,cz = x,y,z lower left corner of a cuboid domain (distance units) + dLx,dLy,dLz = x,y,z side length of a cuboid domain (distance units) + source = heat source or concentration source (flux units, see below) :pre +:ule + +[Examples:] + +fix 1 all edpd/source sphere 0.0 0.0 0.0 5.0 0.01 +fix 1 all edpd/source cuboid 0.0 0.0 0.0 20.0 10.0 10.0 -0.01 +fix 1 all tdpd/source 1 sphere 5.0 0.0 0.0 5.0 0.01 +fix 1 all tdpd/source 2 cuboid 0.0 0.0 0.0 20.0 10.0 10.0 0.01 :pre + +[Description:] + +Fix {edpd/source} adds a heat source as an external heat flux to each +atom in a spherical or cuboid domain, where the {source} is in units +of energy/time. Fix {tdpd/source} adds an external concentration +source of the chemical species specified by {index} as an external +concentration flux for each atom in a spherical or cuboid domain, +where the {source} is in units of mole/volume/time. + +This command can be used to give an additional heat/concentration +source term to atoms in a simulation, such as for a simulation of a +heat conduction with a source term (see Fig.12 in "(Li2014)"_#Li2014) +or diffusion with a source term (see Fig.1 in "(Li2015)"_#Li2015), as +an analog of a periodic Poiseuille flow problem. + +If the {sphere} keyword is used, the {cx,cy,cz,radius} defines a +spherical domain to apply the source flux to. + +If the {cuboid} keyword is used, the {cx,cy,cz,dLx,dLy,dLz} defines a +cuboid domain to apply the source flux to. + +:line + +[Restart, fix_modify, output, run start/stop, minimize info:] + +No information about this fix is written to "binary restart +files"_restart.html. None of the "fix_modify"_fix_modify.html options +are relevant to this fix. No global or per-atom quantities are stored +by this fix for access by various "output +commands"_Section_howto.html#howto_15. No parameter of this fix can +be used with the {start/stop} keywords of the "run"_run.html command. +This fix is not invoked during "energy minimization"_minimize.html. + +[Restrictions:] + +This fix is part of the USER-MESO package. It is only enabled if +LAMMPS was built with that package. See the "Making +LAMMPS"_Section_start.html#start_3 section for more info. + +Fix {edpd/source} must be used with the "pair_style +edpd"_pair_meso.html command. Fix {tdpd/source} must be used with the +"pair_style tdpd"_pair_meso.html command. + +[Related commands:] + +"pair_style edpd"_pair_meso.html, "pair_style tdpd"_pair_meso.html, +"compute edpd/temp/atom"_compute_edpd_temp_atom.html, "compute +tdpd/cc/atom"_compute_tdpd_cc_atom.html + +[Default:] none + +:line + +:link(Li2014) +[(Li2014)] Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis, +"Energy-conserving dissipative particle dynamics with +temperature-dependent properties", J. Comput. Phys., 265: 113-127 +(2014). DOI: 10.1016/j.jcp.2014.02.003 + +:link(Li2015) +[(Li2015)] Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis, +"Transport dissipative particle dynamics model for mesoscopic +advection-diffusion-reaction problems", J. Chem. Phys., 143: 014101 +(2015). DOI: 10.1063/1.4923254 diff --git a/doc/src/fix_mvv_dpd.txt b/doc/src/fix_mvv_dpd.txt new file mode 100644 index 000000000..75e13744e --- /dev/null +++ b/doc/src/fix_mvv_dpd.txt @@ -0,0 +1,97 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +fix mvv/dpd command :h3 +fix mvv/edpd command :h3 +fix mvv/tdpd command :h3 + +[Syntax:] + +fix ID group-ID mvv/dpd lambda :pre +fix ID group-ID mvv/edpd lambda :pre +fix ID group-ID mvv/tdpd lambda :pre + +ID, group-ID are documented in "fix"_fix.html command +mvv/dpd, mvv/edpd, mvv/tdpd = style name of this fix command +lambda = (optional) relaxation parameter (unitless) :ul + +[Examples:] + +fix 1 all mvv/dpd +fix 1 all mvv/dpd 0.5 +fix 1 all mvv/edpd +fix 1 all mvv/edpd 0.5 +fix 1 all mvv/tdpd +fix 1 all mvv/tdpd 0.5 :pre + +[Description:] + +Perform time integration using the modified velocity-Verlet (MVV) +algorithm to update position and velocity (fix mvv/dpd), or position, +velocity and temperature (fix mvv/edpd), or position, velocity and +concentration (fix mvv/tdpd) for particles in the group each timestep. + +The modified velocity-Verlet (MVV) algorithm aims to improve the +stability of the time integrator by using an extrapolated version of +the velocity for the force evaluation: + +:c,image(Eqs/fix_mvv_dpd.jpg) + +where the parameter λ depends on the +specific choice of DPD parameters, and needs to be tuned on a +case-by-case basis. Specification of a {lambda} value is opttional. +If specified, the setting must be from 0.0 to 1.0. If not specified, +a default value of 0.5 is used, which effectively reproduces the +standard velocity-Verlet (VV) scheme. For more details, see +"Groot"_#Groot. + +Fix {mvv/dpd} updates the position and velocity of each atom. It can +be used with the "pair_style mdpd"_pair_meso.html command or other +pair styles such as "pair dpd"_pair_dpd.html. + +Fix {mvv/edpd} updates the per-atom temperature, in addition to +position and velocity, and must be used with the "pair_style +edpd"_pair_meso.html command. + +Fix {mvv/tdpd} updates the per-atom chemical concentration, in +addition to position and velocity, and must be used with the +"pair_style tdpd"_pair_meso.html command. + +:line + +[Restart, fix_modify, output, run start/stop, minimize info:] + +No information about this fix is written to "binary restart +files"_restart.html. None of the "fix_modify"_fix_modify.html options +are relevant to this fix. No global or per-atom quantities are stored +by this fix for access by various "output +commands"_Section_howto.html#howto_15. No parameter of this fix can +be used with the {start/stop} keywords of the "run"_run.html command. +This fix is not invoked during "energy minimization"_minimize.html. + +[Restrictions:] + +This fix is part of the USER-MESO package. It is only enabled if +LAMMPS was built with that package. See the "Making +LAMMPS"_Section_start.html#start_3 section for more info. + +[Related commands:] + +"pair_style mdpd"_pair_meso.html, "pair_style edpd"_pair_meso.html, +"pair_style tdpd"_pair_meso.html + +[Default:] + +The default value for the optional {lambda} parameter is 0.5. + +:line + +:link(Groot) +[(Groot)] Groot and Warren, J Chem Phys, 107: 4423-4435 (1997). DOI: +10.1063/1.474784 + diff --git a/doc/src/pair_meso.txt b/doc/src/pair_meso.txt new file mode 100644 index 000000000..bcdf717d6 --- /dev/null +++ b/doc/src/pair_meso.txt @@ -0,0 +1,277 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +pair_style edpd command :h3 +pair_style mdpd command :h3 +pair_style mdpd/rhosum command :h3 +pair_style tdpd command :h3 + +[Syntax:] + +pair_style style args :pre + +style = {edpd} or {mdpd} or {mdpd/rhosum} or {tdpd} :ulb,l +args = list of arguments for a particular style :l + {edpd} args = cutoff seed + cutoff = global cutoff for eDPD interactions (distance units) + seed = random # seed (integer) (if <= 0, eDPD will use current time as the seed) + {mdpd} args = T cutoff seed + T = temperature (temperature units) + cutoff = global cutoff for mDPD interactions (distance units) + seed = random # seed (integer) (if <= 0, mDPD will use current time as the seed) + {mdpd/rhosum} args = + {tdpd} args = T cutoff seed + T = temperature (temperature units) + cutoff = global cutoff for tDPD interactions (distance units) + seed = random # seed (integer) (if <= 0, tDPD will use current time as the seed) :pre +:ule + +[Examples:] + +pair_style edpd 1.58 9872598 +pair_coeff * * 18.75 4.5 0.41 1.58 1.42E-5 2.0 1.58 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.42E-5 2.0 1.58 power 10.54 -3.66 3.44 -4.10 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.42E-5 2.0 1.58 power 10.54 -3.66 3.44 -4.10 kappa -0.44 -3.21 5.04 0.00 :pre + +pair_style hybrid/overlay mdpd/rhosum mdpd 1.0 1.0 65689 +pair_coeff 1 1 mdpd/rhosum 0.75 +pair_coeff 1 1 mdpd -40.0 25.0 18.0 1.0 0.75 :pre + +pair_style tdpd 1.0 1.58 935662 +pair_coeff * * 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 3.0 1.0E-5 2.0 :pre + +[Description:] + +The {edpd} style computes the pairwise interactions and heat fluxes +for eDPD particles following the formulations in +"(Li2014_JCP)"_#Li2014_JCP and "Li2015_CC"_#Li2015_CC. The time +evolution of an eDPD particle is governed by the conservation of +momentum and energy given by + +:c,image(Eqs/pair_edpd_gov.jpg) + +where the three components of Fi +including the conservative force FijC, dissipative force FijD and random force FijR are expressed as + +:c,image(Eqs/pair_edpd_force.jpg) + +in which the exponent of the weighting function s can be defined as a temperature-dependent +variable. The heat flux between particles accounting for the +collisional heat flux qC, viscous +heat flux qV, and random heat flux +qR are given by + +:c,image(Eqs/pair_edpd_heat.jpg) + +where the mesoscopic heat friction κ is given by + +:c,image(Eqs/pair_edpd_kappa.jpg) + +with υ being the kinematic +viscosity. For more details, see Eq.(15) in "(Li2014_JCP)"_#Li2014_JCP. + +The following coefficients must be defined in eDPD system for each +pair of atom types via the "pair_coeff"_pair_coeff.html command as in +the examples above. + +A (force units) +gamma (force/velocity units) +power_f (positive real) +cutoff (distance units) +kappa (thermal conductivity units) +power_T (positive real) +cutoff_T (distance units) +optional keyword = power or kappa :ul + +The keyword {power} or {kappa} is optional. Both "power" and "kappa" +require 4 parameters c1, c2, +c4, c4 showing the temperature dependence +of the exponent
s(T) = +power_f*(1+c1*(T-1)+c2*(T-1)2 ++c3*(T-1)3+c4*(T-1)4)
+and of the mesoscopic heat friction
+sT(T) = +kappa*(1+c1*(T-1)+c2*(T-1)2 ++c3*(T-1)3+c4*(T-1)4)
+If the keyword {power} or {kappa} is not specified, the eDPD system +will use constant power_f and kappa, which is independent to +temperature changes. + +:line + +The {mdpd/rhosum} style computes the local particle mass density rho +for mDPD particles by kernel function interpolation. + +The following coefficients must be defined for each pair of atom types +via the "pair_coeff"_pair_coeff.html command as in the examples above. + +cutoff (distance units) :ul + +:line + +The {mdpd} style computes the many-body interactions between mDPD +particles following the formulations in +"(Li2013_POF)"_#Li2013_POF. The dissipative and random forces are in +the form same as the classical DPD, but the conservative force is +local density dependent, which are given by + +:c,image(Eqs/pair_mdpd_force.jpg) + +where the first term in FC with a +negative coefficient A < 0 stands for an attractive force within an +interaction range rc, and the second +term with B > 0 is the density-dependent repulsive force within an +interaction range rd. + +The following coefficients must be defined for each pair of atom types via the +"pair_coeff"_pair_coeff.html command as in the examples above. + +A (force units) +B (force units) +gamma (force/velocity units) +cutoff_c (distance units) +cutoff_d (distance units) :ul + +:line + +The {tdpd} style computes the pairwise interactions and chemical +concentration fluxes for tDPD particles following the formulations in +"(Li2015_JCP)"_#Li2015_JCP. The time evolution of a tDPD particle is +governed by the conservation of momentum and concentration given by + +:c,image(Eqs/pair_tdpd_gov.jpg) + +where the three components of Fi +including the conservative force FijC, dissipative force FijD and random force FijR are expressed as + +:c,image(Eqs/pair_tdpd_force.jpg) + +The concentration flux between two tDPD particles includes the Fickian +flux QijD and random flux +QijR, which are given by + +:c,image(Eqs/pair_tdpd_flux.jpg) + +where the parameters kappa and epsilon determine the strength of the +Fickian and random fluxes. ms +is the mass of a single solute molecule. In general, ms is much smaller than the mass of +a tDPD particle m. For more details, see +"(Li2015_JCP)"_#Li2015_JCP. + +The following coefficients must be defined for each pair of atom types via the +"pair_coeff"_pair_coeff.html command as in the examples above. + +A (force units) +gamma (force/velocity units) +power_f (positive real) +cutoff (distance units) +cutoff_CC (distance units) +kappa_i (diffusivity units) +epsilon_i (diffusivity units) +power_cc_i (positive real) :ul + +The last 3 values must be repeated Nspecies times, so that values for +each of the Nspecies chemical species are specified, as indicated by +the "I" suffix. In the first pair_coeff example above for pair_style +tdpd, Nspecies = 1. In the second example, Nspecies = 2, so 3 +additional coeffs are specified (for species 2). + +:line + +[Example scripts] + +There are example scripts for using all these pair styles in +examples/USER/meso. The example for an eDPD simulation models heat +conduction with source terms analog of periodic Poiseuille flow +problem. The setup follows Fig.12 in "(Li2014_JCP)"_#Li2014_JCP. The +output of the short eDPD simulation (about 2 minutes on a single core) +gives a temperature and density profiles as + +:c,image(JPG/examples_edpd.jpg) + +The example for a mDPD simulation models the oscillations of a liquid +droplet started from a liquid film. The mDPD parameters are adopted +from "(Li2013_POF)"_#Li2013_POF. The short mDPD run (about 2 minutes +on a single core) generates a particle trajectory which can +be visualized as follows. + +:c,image(JPG/examples_mdpd_first.jpg,JPG/examples_mdpd.gif) +:c,image(JPG/examples_mdpd_last.jpg) + +The first image is the initial state of the simulation. If you +click it a GIF movie should play in your browser. The second image +is the final state of the simulation. + +The example for a tDPD simulation computes the effective diffusion +coefficient of a tDPD system using a method analogous to the periodic +Poiseuille flow. The tDPD system is specified with two chemical +species, and the setup follows Fig.1 in +"(Li2015_JCP)"_#Li2015_JCP. The output of the short tDPD simulation +(about one and a half minutes on a single core) gives the +concentration profiles of the two chemical species as + +:c,image(JPG/examples_tdpd.jpg) + +:line + +[Mixing, shift, table, tail correction, restart, rRESPA info]: + +The styles {edpd}, {mdpd}, {mdpd/rhosum} and {tdpd} do not support +mixing. Thus, coefficients for all I,J pairs must be specified explicitly. + +The styles {edpd}, {mdpd}, {mdpd/rhosum} and {tdpd} do not support +the "pair_modify"_pair_modify.html shift, table, and tail options. + +The styles {edpd}, {mdpd}, {mdpd/rhosum} and {tdpd} do not write +information to "binary restart files"_restart.html. Thus, you need +to re-specify the pair_style and pair_coeff commands in an input script +that reads a restart file. + +[Restrictions:] + +The pair styles {edpd}, {mdpd}, {mdpd/rhosum} and {tdpd} are part of +the USER-MESO package. It is only enabled if LAMMPS was built with +that package. See the "Making LAMMPS"_Section_start.html#start_3 +section for more info. + +[Related commands:] + +"pair_coeff"_pair_coeff.html, "fix mvv/dpd"_fix_mvv_dpd.html, +"fix mvv/edpd"_fix_mvv_dpd.html, "fix mvv/tdpd"_fix_mvv_dpd.html, +"fix edpd/source"_fix_dpd_source.html, "fix tdpd/source"_fix_dpd_source.html, +"compute edpd/temp/atom"_compute_edpd_temp_atom.html, +"compute tdpd/cc/atom"_compute_tdpd_cc_atom.html + +[Default:] none + +:line + +:link(Li2014_JCP) +[(Li2014_JCP)] Li, Tang, Lei, Caswell, Karniadakis, J Comput Phys, +265: 113-127 (2014). DOI: 10.1016/j.jcp.2014.02.003. + +:link(Li2015_CC) +[(Li2015_CC)] Li, Tang, Li, Karniadakis, Chem Commun, 51: 11038-11040 +(2015). DOI: 10.1039/C5CC01684C. + +:link(Li2013_POF) +[(Li2013_POF)] Li, Hu, Wang, Ma, Zhou, Phys Fluids, 25: 072103 (2013). +DOI: 10.1063/1.4812366. + +:link(Li2015_JCP) +[(Li2015_JCP)] Li, Yazdani, Tartakovsky, Karniadakis, J Chem Phys, +143: 014101 (2015). DOI: 10.1063/1.4923254. diff --git a/doc/src/read_data.txt b/doc/src/read_data.txt index a8aca5369..747c3e752 100644 --- a/doc/src/read_data.txt +++ b/doc/src/read_data.txt @@ -1,1154 +1,1148 @@ "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c :link(lws,http://lammps.sandia.gov) :link(ld,Manual.html) :link(lc,Section_commands.html#comm) :line read_data command :h3 [Syntax:] read_data file keyword args ... :pre file = name of data file to read in :ulb,l zero or more keyword/arg pairs may be appended :l -keyword = {add} or {offset} or {shift} or {extra/atom/types} or {extra/bond/types} or {extra/angle/types} or {extra/dihedral/types} or {extra/improper/types} or {extra/bond/per/atom} or {extra/angle/per/atom} or {extra/dihedral/per/atom} or {extra/improper/per/atom} or {group} or {nocoeff} or {fix} :l +keyword = {add} or {offset} or {shift} or {extra/atom/types} or {extra/bond/types} or {extra/angle/types} or {extra/dihedral/types} or {extra/improper/types} or {group} or {nocoeff} or {fix} :l {add} arg = {append} or {Nstart} or {merge} append = add new atoms with IDs appended to current IDs Nstart = add new atoms with IDs starting with Nstart merge = add new atoms with their IDs unchanged {offset} args = toff boff aoff doff ioff toff = offset to add to atom types boff = offset to add to bond types aoff = offset to add to angle types doff = offset to add to dihedral types ioff = offset to add to improper types {shift} args = Sx Sy Sz Sx,Sy,Sz = distance to shift atoms when adding to system (distance units) {extra/atom/types} arg = # of extra atom types {extra/bond/types} arg = # of extra bond types {extra/angle/types} arg = # of extra angle types {extra/dihedral/types} arg = # of extra dihedral types {extra/improper/types} arg = # of extra improper types - {extra/bond/per/atom} arg = leave space for this many new bonds per atom - {extra/angle/per/atom} arg = leave space for this many new angles per atom - {extra/dihedral/per/atom} arg = leave space for this many new dihedrals per atom - {extra/improper/per/atom} arg = leave space for this many new impropers per atom - {extra/special/per/atom} arg = leave space for extra 1-2,1-3,1-4 interactions per atom {group} args = groupID groupID = add atoms in data file to this group {nocoeff} = ignore force field parameters {fix} args = fix-ID header-string section-string fix-ID = ID of fix to process header lines and sections of data file header-string = header lines containing this string will be passed to fix section-string = section names with this string will be passed to fix :pre :ule [Examples:] read_data data.lj read_data ../run7/data.polymer.gz read_data data.protein fix mycmap crossterm CMAP read_data data.water add append offset 3 1 1 1 1 shift 0.0 0.0 50.0 read_data data.water add merge 1 group solvent :pre [Description:] Read in a data file containing information LAMMPS needs to run a simulation. The file can be ASCII text or a gzipped text file (detected by a .gz suffix). This is one of 3 ways to specify initial atom coordinates; see the "read_restart"_read_restart.html and "create_atoms"_create_atoms.html commands for alternative methods. Also see the explanation of the "-restart command-line -switch"_Section_start.html#start_6 which can convert a restart file to +switch"_Section_start.html#start_7 which can convert a restart file to a data file. This command can be used multiple times to add new atoms and their properties to an existing system by using the {add}, {offset}, and {shift} keywords. See more details below, which includes the use case for the {extra} keywords. The {group} keyword adds all the atoms in the data file to the specified group-ID. The group will be created if it does not already exist. This is useful if you are reading multiple data files and wish to put sets of atoms into different groups so they can be operated on later. E.g. a group of added atoms can be moved to new positions via the "displace_atoms"_displace_atoms.html command. Note that atoms read from the data file are also always added to the "all" group. The "group"_group.html command discusses atom groups, as used in LAMMPS. The {nocoeff} keyword tells read_data to ignore force field parameters. The various Coeff sections are still read and have to have the correct number of lines, but they are not applied. This also allows to read a data file without having any pair, bond, angle, dihedral or improper styles defined, or to read a data file for a different force field. The use of the {fix} keyword is discussed below. :line [Reading multiple data files] The read_data command can be used multiple times with the same or different data files to build up a complex system from components contained in individual data files. For example one data file could contain fluid in a confined domain; a second could contain wall atoms, and the second file could be read a third time to create a wall on the other side of the fluid. The third set of atoms could be rotated to an opposing direction using the "displace_atoms"_displace_atoms.html command, after the third read_data command is used. The {add}, {offset}, {shift}, {extra}, and {group} keywords are useful in this context. If a simulation box does not yet exist, the {add} keyword cannot be used; the read_data command is being used for the first time. If a simulation box does exist, due to using the "create_box"_create_box.html command, or a previous read_data command, then the {add} keyword must be used. NOTE: The simulation box size (xlo to xhi, ylo to yhi, zlo to zhi) in the new data file will be merged with the existing simulation box to create a large enough box in each dimension to contain both the existing and new atoms. Each box dimension never shrinks due to this merge operation, it only stays the same or grows. Care must be used if you are growing the existing simulation box in a periodic dimension. If there are existing atoms with bonds that straddle that periodic boundary, then the atoms may become far apart if the box size grows. This will separate the atoms in the bond, which can lead to "lost" bond atoms or bad dynamics. The three choices for the {add} argument affect how the IDs of atoms in the data file are treated. If {append} is specified, atoms in the data file are added to the current system, with their atom IDs reset so that an atomID = M in the data file becomes atomID = N+M, where N is the largest atom ID in the current system. This rule is applied to all occurrences of atom IDs in the data file, e.g. in the Velocity or Bonds section. If {Nstart} is specified, then {Nstart} is a numeric value is given, e.g. 1000, so that an atomID = M in the data file becomes atomID = 1000+M. If {merge} is specified, the data file atoms are added to the current system without changing their IDs. They are assumed to merge (without duplication) with the currently defined atoms. It is up to you to insure there are no multiply defined atom IDs, as LAMMPS only performs an incomplete check that this is the case by insuring the resulting max atomID >= the number of atoms. The {offset} and {shift} keywords can only be used if the {add} keyword is also specified. The {offset} keyword adds the specified offset values to the atom types, bond types, angle types, dihedral types, and improper types as they are read from the data file. E.g. if {toff} = 2, and the file uses atom types 1,2,3, then the added atoms will have atom types 3,4,5. These offsets apply to all occurrences of types in the data file, e.g. for the Atoms or Masses or Pair Coeffs or Bond Coeffs sections. This makes it easy to use atoms and molecules and their attributes from a data file in different simulations, where you want their types (atom, bond, angle, etc) to be different depending on what other types already exist. All five offset values must be specified, but individual values will be ignored if the data file does not use that attribute (e.g. no bonds). The {shift} keyword can be used to specify an (Sx, Sy, Sz) displacement applied to the coordinates of each atom. Sz must be 0.0 for a 2d simulation. This is a mechanism for adding structured collections of atoms at different locations within the simulation box, to build up a complex geometry. It is up to you to insure atoms do not end up overlapping unphysically which would lead to bad dynamics. Note that the "displace_atoms"_displace_atoms.html command can be used to move a subset of atoms after they have been read from a data file. Likewise, the "delete_atoms"_delete_atoms.html command can be used to remove overlapping atoms. Note that the shift values (Sx, Sy, Sz) are also added to the simulation box information (xlo, xhi, ylo, yhi, zlo, zhi) in the data file to shift its boundaries. E.g. xlo_new = xlo + Sx, xhi_new = xhi + Sx. The {extra} keywords can only be used the first time the read_data command is used. They are useful if you intend to add new atom, bond, angle, etc types later with additional read_data commands. This is because the maximum number of allowed atom, bond, angle, etc types is set by LAMMPS when the system is first initialized. If you do not use the {extra} keywords, then the number of these types will be limited to what appears in the first data file you read. For example, if the first data file is a solid substrate of Si, it will likely specify a single atom type. If you read a second data file with a different material (water molecules) that sit on top of the substrate, you will want to use different atom types for those atoms. You can only do this if you set the {extra/atom/types} keyword to a sufficiently large value when reading the substrate data file. Note that use of the {extra} keywords also allows each data file to contain sections like Masses or Pair Coeffs or Bond Coeffs which are sized appropriately for the number of types in that data file. If the {offset} keyword is used appropriately when each data file is read, the values in those sections will be stored correctly in the larger data structures allocated by the use of the {extra} keywords. E.g. the substrate file can list mass and pair coefficients for type 1 silicon atoms. The water file can list mass and pair coefficients for type 1 and type 2 hydrogen and oxygen atoms. Use of the {extra} and {offset} keywords will store those mass and pair coefficient values appropriately in data structures that allow for 3 atom types (Si, H, O). Of course, you would still need to specify coefficients for H/Si and O/Si interactions in your input script to have a complete pairwise interaction model. An alternative to using the {extra} keywords with the read_data command, is to use the "create_box"_create_box.html command to initialize the simulation box and all the various type limits you need via its {extra} keywords. Then use the read_data command one or more times to populate the system with atoms, bonds, angles, etc, using the {offset} keyword if desired to alter types used in the various data files you read. :line [Format of a data file] The structure of the data file is important, though many settings and sections are optional or can come in any order. See the examples directory for sample data files for different problems. A data file has a header and a body. The header appears first. The first line of the header is always skipped; it typically contains a description of the file. Then lines are read one at a time. Lines can have a trailing comment starting with '#' that is ignored. If the line is blank (only whitespace after comment is deleted), it is skipped. If the line contains a header keyword, the corresponding value(s) is read from the line. If it doesn't contain a header keyword, the line begins the body of the file. The body of the file contains zero or more sections. The first line of a section has only a keyword. This line can have a trailing comment starting with '#' that is either ignored or can be used to check for a style match, as described below. The next line is skipped. The remaining lines of the section contain values. The number of lines depends on the section keyword as described below. Zero or more blank lines can be used between sections. Sections can appear in any order, with a few exceptions as noted below. The keyword {fix} can be used one or more times. Each usage specifies a fix that will be used to process a specific portion of the data file. Any header line containing {header-string} and any section with a name containing {section-string} will be passed to the specified fix. See the "fix property/atom"_fix_property_atom.html command for an example of a fix that operates in this manner. The doc page for the fix defines the syntax of the header line(s) and section(s) that it reads from the data file. Note that the {header-string} can be specified as NULL, in which case no header lines are passed to the fix. This means that it can infer the length of its Section from standard header settings, such as the number of atoms. The formatting of individual lines in the data file (indentation, spacing between words and numbers) is not important except that header and section keywords (e.g. atoms, xlo xhi, Masses, Bond Coeffs) must be capitalized as shown and can't have extra white space between their words - e.g. two spaces or a tab between the 2 words in "xlo xhi" or the 2 words in "Bond Coeffs", is not valid. :line [Format of the header of a data file] These are the recognized header keywords. Header lines can come in any order. The value(s) are read from the beginning of the line. Thus the keyword {atoms} should be in a line like "1000 atoms"; the keyword {ylo yhi} should be in a line like "-10.0 10.0 ylo yhi"; the keyword {xy xz yz} should be in a line like "0.0 5.0 6.0 xy xz yz". All these settings have a default value of 0, except the lo/hi box size defaults are -0.5 and 0.5. A line need only appear if the value is different than the default. {atoms} = # of atoms in system {bonds} = # of bonds in system {angles} = # of angles in system {dihedrals} = # of dihedrals in system {impropers} = # of impropers in system {atom types} = # of atom types in system {bond types} = # of bond types in system {angle types} = # of angle types in system {dihedral types} = # of dihedral types in system {improper types} = # of improper types in system -{extra bond per atom} = leave space for this many new bonds per atom (deprecated, use extra/bond/per/atom keyword) -{extra angle per atom} = leave space for this many new angles per atom (deprecated, use extra/angle/per/atom keyword) -{extra dihedral per atom} = leave space for this many new dihedrals per atom (deprecated, use extra/dihedral/per/atom keyword) -{extra improper per atom} = leave space for this many new impropers per atom (deprecated, use extra/improper/per/atom keyword) -{extra special per atom} = leave space for this many new special bonds per atom (deprecated, use extra/special/per/atom keyword) +{extra bond per atom} = leave space for this many new bonds per atom +{extra angle per atom} = leave space for this many new angles per atom +{extra dihedral per atom} = leave space for this many new dihedrals per atom +{extra improper per atom} = leave space for this many new impropers per atom +{extra special per atom} = leave space for this many new special bonds per atom {ellipsoids} = # of ellipsoids in system {lines} = # of line segments in system {triangles} = # of triangles in system {bodies} = # of bodies in system {xlo xhi} = simulation box boundaries in x dimension {ylo yhi} = simulation box boundaries in y dimension {zlo zhi} = simulation box boundaries in z dimension {xy xz yz} = simulation box tilt factors for triclinic system :ul The initial simulation box size is determined by the lo/hi settings. In any dimension, the system may be periodic or non-periodic; see the "boundary"_boundary.html command. When the simulation box is created it is also partitioned into a regular 3d grid of rectangular bricks, one per processor, based on the number of processors being used and the settings of the "processors"_processors.html command. The partitioning can later be changed by the "balance"_balance.html or "fix balance"_fix_balance.html commands. If the {xy xz yz} line does not appear, LAMMPS will set up an axis-aligned (orthogonal) simulation box. If the line does appear, LAMMPS creates a non-orthogonal simulation domain shaped as a parallelepiped with triclinic symmetry. The parallelepiped has its "origin" at (xlo,ylo,zlo) and is defined by 3 edge vectors starting from the origin given by A = (xhi-xlo,0,0); B = (xy,yhi-ylo,0); C = (xz,yz,zhi-zlo). {Xy,xz,yz} can be 0.0 or positive or negative values and are called "tilt factors" because they are the amount of displacement applied to faces of an originally orthogonal box to transform it into the parallelepiped. By default, the tilt factors (xy,xz,yz) can not skew the box more than half the distance of the corresponding parallel box length. For example, if xlo = 2 and xhi = 12, then the x box length is 10 and the xy tilt factor must be between -5 and 5. Similarly, both xz and yz must be between -(xhi-xlo)/2 and +(yhi-ylo)/2. Note that this is not a limitation, since if the maximum tilt factor is 5 (as in this example), then configurations with tilt = ..., -15, -5, 5, 15, 25, ... are all geometrically equivalent. If you wish to define a box with tilt factors that exceed these limits, you can use the "box tilt"_box.html command, with a setting of {large}; a setting of {small} is the default. See "Section 6.12"_Section_howto.html#howto_12 of the doc pages for a geometric description of triclinic boxes, as defined by LAMMPS, and how to transform these parameters to and from other commonly used triclinic representations. When a triclinic system is used, the simulation domain should normally be periodic in the dimension that the tilt is applied to, which is given by the second dimension of the tilt factor (e.g. y for xy tilt). This is so that pairs of atoms interacting across that boundary will have one of them shifted by the tilt factor. Periodicity is set by the "boundary"_boundary.html command. For example, if the xy tilt factor is non-zero, then the y dimension should be periodic. Similarly, the z dimension should be periodic if xz or yz is non-zero. LAMMPS does not require this periodicity, but you may lose atoms if this is not the case. Also note that if your simulation will tilt the box, e.g. via the "fix deform"_fix_deform.html command, the simulation box must be setup to be triclinic, even if the tilt factors are initially 0.0. You can also change an orthogonal box to a triclinic box or vice versa by using the "change box"_change_box.html command with its {ortho} and {triclinic} options. For 2d simulations, the {zlo zhi} values should be set to bound the z coords for atoms that appear in the file; the default of -0.5 0.5 is valid if all z coords are 0.0. For 2d triclinic simulations, the xz and yz tilt factors must be 0.0. If the system is periodic (in a dimension), then atom coordinates can be outside the bounds (in that dimension); they will be remapped (in a periodic sense) back inside the box. Note that if the {add} option is being used to add atoms to a simulation box that already exists, this periodic remapping will be performed using simulation box bounds that are the union of the existing box and the box boundaries in the new data file. NOTE: If the system is non-periodic (in a dimension), then all atoms in the data file must have coordinates (in that dimension) that are "greater than or equal to" the lo value and "less than or equal to" the hi value. If the non-periodic dimension is of style "fixed" (see the "boundary"_boundary.html command), then the atom coords must be strictly "less than" the hi value, due to the way LAMMPS assign atoms to processors. Note that you should not make the lo/hi values radically smaller/larger than the extent of the atoms. For example, if your atoms extend from 0 to 50, you should not specify the box bounds as -10000 and 10000. This is because LAMMPS uses the specified box size to layout the 3d grid of processors. A huge (mostly empty) box will be sub-optimal for performance when using "fixed" boundary conditions (see the "boundary"_boundary.html command). When using "shrink-wrap" boundary conditions (see the "boundary"_boundary.html command), a huge (mostly empty) box may cause a parallel simulation to lose atoms when LAMMPS shrink-wraps the box around the atoms. The read_data command will generate an error in this case. The "extra bond per atom" setting (angle, dihedral, improper) is only needed if new bonds (angles, dihedrals, impropers) will be added to the system when a simulation runs, e.g. by using the "fix -bond/create"_fix_bond_create.html command. Using this header flag -is deprecated; please use the {extra/bond/per/atom} keyword (and -correspondingly for angles, dihedrals and impropers) in the -read_data command instead. Either will pre-allocate space in LAMMPS - data structures for storing the new bonds (angles, +bond/create"_fix_bond_create.html command. This will pre-allocate +space in LAMMPS data structures for storing the new bonds (angles, dihedrals, impropers). The "extra special per atom" setting is typically only needed if new bonds/angles/etc will be added to the system, e.g. by using the "fix bond/create"_fix_bond_create.html command. Or if entire new molecules -will be added to the system, e.g. by using the -"fix deposit"_fix_deposit.html or "fix pour"_fix_pour.html commands, -which will have more special 1-2,1-3,1-4 neighbors than any other -molecules defined in the data file. Using this header flag is -deprecated; please use the {extra/special/per/atom} keyword instead. -Using this setting will pre-allocate space in the LAMMPS data -structures for storing these neighbors. See the +will be added to the system, e.g. by using the "fix +deposit"_fix_deposit.html or "fix pour"_fix_pour.html commands, which +will have more special 1-2,1-3,1-4 neighbors than any other molecules +defined in the data file. Using this setting will pre-allocate space +in the LAMMPS data structures for storing these neighbors. See the "special_bonds"_special_bonds.html and "molecule"_molecule.html doc pages for more discussion of 1-2,1-3,1-4 neighbors. -NOTE: All of the "extra" settings are only applied in the first data -file read and when no simulation box has yet been created; as soon as -the simulation box is created (and read_data implies that), these -settings are {locked} and cannot be changed anymore. Please see the -description of the {add} keyword above for reading multiple data files. -If they appear in later data files, they are ignored. +NOTE: All of the "extra" settings are only used if they appear in the +first data file read; see the description of the {add} keyword above +for reading multiple data files. If they appear in later data files, +they are ignored. The "ellipsoids" and "lines" and "triangles" and "bodies" settings are only used with "atom_style ellipsoid or line or tri or body"_atom_style.html and specify how many of the atoms are finite-size ellipsoids or lines or triangles or bodies; the remainder are point particles. See the discussion of ellipsoidflag and the {Ellipsoids} section below. See the discussion of lineflag and the {Lines} section below. See the discussion of triangleflag and the {Triangles} section below. See the discussion of bodyflag and the {Bodies} section below. NOTE: For "atom_style template"_atom_style.html, the molecular topology (bonds,angles,etc) is contained in the molecule templates read-in by the "molecule"_molecule.html command. This means you cannot set the {bonds}, {angles}, etc header keywords in the data file, nor can you define {Bonds}, {Angles}, etc sections as discussed below. You can set the {bond types}, {angle types}, etc header keywords, though it is not necessary. If specified, they must match the maximum values defined in any of the template molecules. :line [Format of the body of a data file] These are the section keywords for the body of the file. {Atoms, Velocities, Masses, Ellipsoids, Lines, Triangles, Bodies} = atom-property sections {Bonds, Angles, Dihedrals, Impropers} = molecular topology sections {Pair Coeffs, PairIJ Coeffs, Bond Coeffs, Angle Coeffs, Dihedral Coeffs, \ Improper Coeffs} = force field sections {BondBond Coeffs, BondAngle Coeffs, MiddleBondTorsion Coeffs, \ EndBondTorsion Coeffs, AngleTorsion Coeffs, AngleAngleTorsion Coeffs, \ BondBond13 Coeffs, AngleAngle Coeffs} = class 2 force field sections :ul These keywords will check an appended comment for a match with the currently defined style: {Atoms, Pair Coeffs, PairIJ Coeffs, Bond Coeffs, Angle Coeffs, Dihedral Coeffs, Improper Coeffs} :ul For example, these lines: Atoms # sphere Pair Coeffs # lj/cut :pre will check if the currently-defined "atom_style"_atom_style.html is {sphere}, and the current "pair_style"_pair_style.html is {lj/cut}. If not, LAMMPS will issue a warning to indicate that the data file section likely does not contain the correct number or type of parameters expected for the currently-defined style. Each section is listed below in alphabetic order. The format of each section is described including the number of lines it must contain and rules (if any) for where it can appear in the data file. Any individual line in the various sections can have a trailing comment starting with "#" for annotation purposes. E.g. in the Atoms section: 10 1 17 -1.0 10.0 5.0 6.0 # salt ion :pre :line {Angle Coeffs} section: one line per angle type :ulb,l line syntax: ID coeffs :l ID = angle type (1-N) coeffs = list of coeffs :pre example: :l 6 70 108.5 0 0 :pre :ule The number and meaning of the coefficients are specific to the defined angle style. See the "angle_style"_angle_style.html and "angle_coeff"_angle_coeff.html commands for details. Coefficients can also be set via the "angle_coeff"_angle_coeff.html command in the input script. :line {AngleAngle Coeffs} section: one line per improper type :ulb,l line syntax: ID coeffs :l ID = improper type (1-N) coeffs = list of coeffs (see "improper_coeff"_improper_coeff.html) :pre :ule :line {AngleAngleTorsion Coeffs} section: one line per dihedral type :ulb,l line syntax: ID coeffs :l ID = dihedral type (1-N) coeffs = list of coeffs (see "dihedral_coeff"_dihedral_coeff.html) :pre :ule :line {Angles} section: one line per angle :ulb,l line syntax: ID type atom1 atom2 atom3 :l ID = number of angle (1-Nangles) type = angle type (1-Nangletype) atom1,atom2,atom3 = IDs of 1st,2nd,3rd atoms in angle :pre example: :b 2 2 17 29 430 :pre :ule The 3 atoms are ordered linearly within the angle. Thus the central atom (around which the angle is computed) is the atom2 in the list. E.g. H,O,H for a water molecule. The {Angles} section must appear after the {Atoms} section. All values in this section must be integers (1, not 1.0). :line {AngleTorsion Coeffs} section: one line per dihedral type :ulb,l line syntax: ID coeffs :l ID = dihedral type (1-N) coeffs = list of coeffs (see "dihedral_coeff"_dihedral_coeff.html) :pre :ule :line {Atoms} section: one line per atom line syntax: depends on atom style :ul An {Atoms} section must appear in the data file if natoms > 0 in the header section. The atoms can be listed in any order. These are the line formats for each "atom style"_atom_style.html in LAMMPS. As discussed below, each line can optionally have 3 flags (nx,ny,nz) appended to it, which indicate which image of a periodic simulation box the atom is in. These may be important to include for some kinds of analysis. angle: atom-ID molecule-ID atom-type x y z atomic: atom-ID atom-type x y z body: atom-ID atom-type bodyflag mass x y z bond: atom-ID molecule-ID atom-type x y z charge: atom-ID atom-type q x y z dipole: atom-ID atom-type q x y z mux muy muz dpd: atom-ID atom-type theta x y z +edpd: atom-ID atom-type edpd_temp edpd_cv x y z +mdpd: atom-ID atom-type x y z +tdpd: atom-ID atom-type x y z cc1 cc2 ... ccNspecies electron: atom-ID atom-type q spin eradius x y z ellipsoid: atom-ID atom-type ellipsoidflag density x y z full: atom-ID molecule-ID atom-type q x y z line: atom-ID molecule-ID atom-type lineflag density x y z meso: atom-ID atom-type rho e cv x y z molecular: atom-ID molecule-ID atom-type x y z peri: atom-ID atom-type volume density x y z smd: atom-ID atom-type molecule volume mass kernel-radius contact-radius x y z sphere: atom-ID atom-type diameter density x y z template: atom-ID molecule-ID template-index template-atom atom-type x y z tri: atom-ID molecule-ID atom-type triangleflag density x y z wavepacket: atom-ID atom-type charge spin eradius etag cs_re cs_im x y z hybrid: atom-ID atom-type x y z sub-style1 sub-style2 ... :tb(s=:) The per-atom values have these meanings and units, listed alphabetically: atom-ID = integer ID of atom atom-type = type of atom (1-Ntype) bodyflag = 1 for body particles, 0 for point particles +cc = chemical concentration for tDPD particles for each species (mole/volume units) contact-radius = ??? (distance units) cs_re,cs_im = real/imaginary parts of wavepacket coefficients cv = heat capacity (need units) for SPH particles density = density of particle (mass/distance^3 or mass/distance^2 or mass/distance units, depending on dimensionality of particle) diameter = diameter of spherical atom (distance units) e = energy (need units) for SPH particles +edpd_temp = temperature for eDPD particles (temperature units) +edpd_cv = volumetric heat capacity for eDPD particles (energy/temperature/volume units) ellipsoidflag = 1 for ellipsoidal particles, 0 for point particles eradius = electron radius (or fixed-core radius) etag = integer ID of electron that each wavepacket belongs to kernel-radius = ??? (distance units) lineflag = 1 for line segment particles, 0 for point or spherical particles mass = mass of particle (mass units) molecule-ID = integer ID of molecule the atom belongs to mux,muy,muz = components of dipole moment of atom (dipole units) q = charge on atom (charge units) rho = density (need units) for SPH particles spin = electron spin (+1/-1), 0 = nuclei, 2 = fixed-core, 3 = pseudo-cores (i.e. ECP) template-atom = which atom within a template molecule the atom is template-index = which molecule within the molecule template the atom is part of theta = internal temperature of a DPD particle triangleflag = 1 for triangular particles, 0 for point or spherical particles volume = volume of Peridynamic particle (distance^3 units) x,y,z = coordinates of atom (distance units) :ul The units for these quantities depend on the unit style; see the "units"_units.html command for details. For 2d simulations specify z as 0.0, or a value within the {zlo zhi} setting in the data file header. The atom-ID is used to identify the atom throughout the simulation and in dump files. Normally, it is a unique value from 1 to Natoms for each atom. Unique values larger than Natoms can be used, but they will cause extra memory to be allocated on each processor, if an atom map array is used, but not if an atom map hash is used; see the "atom_modify"_atom_modify.html command for details. If an atom map is not used (e.g. an atomic system with no bonds), and you don't care if unique atom IDs appear in dump files, then the atom-IDs can all be set to 0. The molecule ID is a 2nd identifier attached to an atom. Normally, it is a number from 1 to N, identifying which molecule the atom belongs to. It can be 0 if it is an unbonded atom or if you don't care to keep track of molecule assignments. The diameter specifies the size of a finite-size spherical particle. It can be set to 0.0, which means that atom is a point particle. The ellipsoidflag, lineflag, triangleflag, and bodyflag determine whether the particle is a finite-size ellipsoid or line or triangle or body of finite size, or whether the particle is a point particle. Additional attributes must be defined for each ellipsoid, line, triangle, or body in the corresponding {Ellipsoids}, {Lines}, {Triangles}, or {Bodies} section. The {template-index} and {template-atom} are only defined used by "atom_style template"_atom_style.html. In this case the "molecule"_molecule.html command is used to define a molecule template which contains one or more molecules. If an atom belongs to one of those molecules, its {template-index} and {template-atom} are both set to positive integers; if not the values are both 0. The {template-index} is which molecule (1 to Nmols) the atom belongs to. The {template-atom} is which atom (1 to Natoms) within the molecule the atom is. Some pair styles and fixes and computes that operate on finite-size particles allow for a mixture of finite-size and point particles. See the doc pages of individual commands for details. For finite-size particles, the density is used in conjunction with the particle volume to set the mass of each particle as mass = density * volume. In this context, volume can be a 3d quantity (for spheres or ellipsoids), a 2d quantity (for triangles), or a 1d quantity (for line segments). If the volume is 0.0, meaning a point particle, then the density value is used as the mass. One exception is for the body atom style, in which case the mass of each particle (body or point particle) is specified explicitly. This is because the volume of the body is unknown. Note that for 2d simulations of spheres, this command will treat them as spheres when converting density to mass. However, they can also be modeled as 2d discs (circles) if the "set density/disc"_set.html command is used to reset their mass after the read_data command is used. A {disc} keyword can also be used with time integration fixes, such as "fix nve/sphere"_fix_nve_sphere.html and "fix nvt/sphere"_fix_nve_sphere.html to time integrate their motion as 2d discs (not 3d spheres), by changing their moment of inertia. For atom_style hybrid, following the 5 initial values (ID,type,x,y,z), specific values for each sub-style must be listed. The order of the sub-styles is the same as they were listed in the "atom_style"_atom_style.html command. The sub-style specific values are those that are not the 5 standard ones (ID,type,x,y,z). For example, for the "charge" sub-style, a "q" value would appear. For the "full" sub-style, a "molecule-ID" and "q" would appear. These are listed in the same order they appear as listed above. Thus if atom_style hybrid charge sphere :pre were used in the input script, each atom line would have these fields: atom-ID atom-type x y z q diameter density :pre Note that if a non-standard value is defined by multiple sub-styles, it must appear mutliple times in the atom line. E.g. the atom line for atom_style hybrid dipole full would list "q" twice: atom-ID atom-type x y z q mux muy myz molecule-ID q :pre Atom lines specify the (x,y,z) coordinates of atoms. These can be inside or outside the simulation box. When the data file is read, LAMMPS wraps coordinates outside the box back into the box for dimensions that are periodic. As discussed above, if an atom is outside the box in a non-periodic dimension, it will be lost. LAMMPS always stores atom coordinates as values which are inside the simulation box. It also stores 3 flags which indicate which image of the simulation box (in each dimension) the atom would be in if its coordinates were unwrapped across periodic boundaries. An image flag of 0 means the atom is still inside the box when unwrapped. A value of 2 means add 2 box lengths to get the unwrapped coordinate. A value of -1 means subtract 1 box length to get the unwrapped coordinate. LAMMPS updates these flags as atoms cross periodic boundaries during the simulation. The "dump"_dump.html command can output atom atom coordinates in wrapped or unwrapped form, as well as the 3 image flags. In the data file, atom lines (all lines or none of them) can optionally list 3 trailing integer values (nx,ny,nz), which are used to initialize the atom's image flags. If nx,ny,nz values are not listed in the data file, LAMMPS initializes them to 0. Note that the image flags are immediately updated if an atom's coordinates need to wrapped back into the simulation box. It is only important to set image flags correctly in a data file if a simulation model relies on unwrapped coordinates for some calculation; otherwise they can be left unspecified. Examples of LAMMPS commands that use unwrapped coordinates internally are as follows: Atoms in a rigid body (see "fix rigid"_fix_rigid.html, "fix rigid/small"_fix_rigid.html) must have consistent image flags, so that when the atoms are unwrapped, they are near each other, i.e. as a single body. :ulb,l If the "replicate"_replicate.html command is used to generate a larger system, image flags must be consistent for bonded atoms when the bond crosses a periodic boundary. I.e. the values of the image flags should be different by 1 (in the appropriate dimension) for the two atoms in such a bond. :l If you plan to "dump"_dump.html image flags and perform post-analysis that will unwrap atom coordinates, it may be important that a continued run (restarted from a data file) begins with image flags that are consistent with the previous run. :l :ule NOTE: If your system is an infinite periodic crystal with bonds then it is impossible to have fully consistent image flags. This is because some bonds will cross periodic boundaries and connect two atoms with the same image flag. Atom velocities and other atom quantities not defined above are set to 0.0 when the {Atoms} section is read. Velocities can be set later by a {Velocities} section in the data file or by a "velocity"_velocity.html or "set"_set.html command in the input script. :line {Bodies} section: one or more lines per body :ulb,l first line syntax: atom-ID Ninteger Ndouble :l Ninteger = # of integer quantities for this particle Ndouble = # of floating-point quantities for this particle :pre 0 or more integer lines with total of Ninteger values :l 0 or more double lines with total of Ndouble values :l example: :l 12 3 6 2 3 2 1.0 2.0 3.0 1.0 2.0 4.0 :pre example: :l 12 0 14 1.0 2.0 3.0 1.0 2.0 4.0 1.0 2.0 3.0 1.0 2.0 4.0 4.0 2.0 :pre :ule The {Bodies} section must appear if "atom_style body"_atom_style.html is used and any atoms listed in the {Atoms} section have a bodyflag = 1. The number of bodies should be specified in the header section via the "bodies" keyword. Each body can have a variable number of integer and/or floating-point values. The number and meaning of the values is defined by the body style, as described in the "body"_body.html doc page. The body style is given as an argument to the "atom_style body"_atom_style.html command. The Ninteger and Ndouble values determine how many integer and floating-point values are specified for this particle. Ninteger and Ndouble can be as large as needed and can be different for every body. Integer values are then listed next on subsequent lines. Lines are read one at a time until Ninteger values are read. Floating-point values follow on subsequent lines, Again lines are read one at a time until Ndouble values are read. Note that if there are no values of a particular type, no lines appear for that type. The {Bodies} section must appear after the {Atoms} section. :line {Bond Coeffs} section: one line per bond type :ulb,l line syntax: ID coeffs :l ID = bond type (1-N) coeffs = list of coeffs :pre example: :l 4 250 1.49 :pre :ule The number and meaning of the coefficients are specific to the defined bond style. See the "bond_style"_bond_style.html and "bond_coeff"_bond_coeff.html commands for details. Coefficients can also be set via the "bond_coeff"_bond_coeff.html command in the input script. :line {BondAngle Coeffs} section: one line per angle type :ulb,l line syntax: ID coeffs :l ID = angle type (1-N) coeffs = list of coeffs (see class 2 section of "angle_coeff"_angle_coeff.html) :pre :ule :line {BondBond Coeffs} section: one line per angle type :ulb,l line syntax: ID coeffs :l ID = angle type (1-N) coeffs = list of coeffs (see class 2 section of "angle_coeff"_angle_coeff.html) :pre :ule :line {BondBond13 Coeffs} section: one line per dihedral type :ulb,l line syntax: ID coeffs :l ID = dihedral type (1-N) coeffs = list of coeffs (see class 2 section of "dihedral_coeff"_dihedral_coeff.html) :pre :ule :line {Bonds} section: one line per bond :ulb,l line syntax: ID type atom1 atom2 :l ID = bond number (1-Nbonds) type = bond type (1-Nbondtype) atom1,atom2 = IDs of 1st,2nd atoms in bond :pre example: :l 12 3 17 29 :pre :ule The {Bonds} section must appear after the {Atoms} section. All values in this section must be integers (1, not 1.0). :line {Dihedral Coeffs} section: one line per dihedral type :ulb,l line syntax: ID coeffs :l ID = dihedral type (1-N) coeffs = list of coeffs :pre example: :l 3 0.6 1 0 1 :pre :ule The number and meaning of the coefficients are specific to the defined dihedral style. See the "dihedral_style"_dihedral_style.html and "dihedral_coeff"_dihedral_coeff.html commands for details. Coefficients can also be set via the "dihedral_coeff"_dihedral_coeff.html command in the input script. :line {Dihedrals} section: one line per dihedral :ulb,l line syntax: ID type atom1 atom2 atom3 atom4 :l ID = number of dihedral (1-Ndihedrals) type = dihedral type (1-Ndihedraltype) atom1,atom2,atom3,atom4 = IDs of 1st,2nd,3rd,4th atoms in dihedral :pre example: :l 12 4 17 29 30 21 :pre :ule The 4 atoms are ordered linearly within the dihedral. The {Dihedrals} section must appear after the {Atoms} section. All values in this section must be integers (1, not 1.0). :line {Ellipsoids} section: one line per ellipsoid :ulb,l line syntax: atom-ID shapex shapey shapez quatw quati quatj quatk :l atom-ID = ID of atom which is an ellipsoid shapex,shapey,shapez = 3 diameters of ellipsoid (distance units) quatw,quati,quatj,quatk = quaternion components for orientation of atom :pre example: :l 12 1 2 1 1 0 0 0 :pre :ule The {Ellipsoids} section must appear if "atom_style ellipsoid"_atom_style.html is used and any atoms are listed in the {Atoms} section with an ellipsoidflag = 1. The number of ellipsoids should be specified in the header section via the "ellipsoids" keyword. The 3 shape values specify the 3 diameters or aspect ratios of a finite-size ellipsoidal particle, when it is oriented along the 3 coordinate axes. They must all be non-zero values. The values {quatw}, {quati}, {quatj}, and {quatk} set the orientation of the atom as a quaternion (4-vector). Note that the shape attributes specify the aspect ratios of an ellipsoidal particle, which is oriented by default with its x-axis along the simulation box's x-axis, and similarly for y and z. If this body is rotated (via the right-hand rule) by an angle theta around a unit vector (a,b,c), then the quaternion that represents its new orientation is given by (cos(theta/2), a*sin(theta/2), b*sin(theta/2), c*sin(theta/2)). These 4 components are quatw, quati, quatj, and quatk as specified above. LAMMPS normalizes each atom's quaternion in case (a,b,c) is not specified as a unit vector. The {Ellipsoids} section must appear after the {Atoms} section. :line {EndBondTorsion Coeffs} section: one line per dihedral type :ulb,l line syntax: ID coeffs :l ID = dihedral type (1-N) coeffs = list of coeffs (see class 2 section of "dihedral_coeff"_dihedral_coeff.html) :pre :ule :line {Improper Coeffs} section: one line per improper type :ulb,l line syntax: ID coeffs :l ID = improper type (1-N) coeffs = list of coeffs :pre example: :l 2 20 0.0548311 :pre :ule The number and meaning of the coefficients are specific to the defined improper style. See the "improper_style"_improper_style.html and "improper_coeff"_improper_coeff.html commands for details. Coefficients can also be set via the "improper_coeff"_improper_coeff.html command in the input script. :line {Impropers} section: one line per improper :ulb,l line syntax: ID type atom1 atom2 atom3 atom4 :l ID = number of improper (1-Nimpropers) type = improper type (1-Nimpropertype) atom1,atom2,atom3,atom4 = IDs of 1st,2nd,3rd,4th atoms in improper :pre example: :l 12 3 17 29 13 100 :pre :ule The ordering of the 4 atoms determines the definition of the improper angle used in the formula for each "improper style"_improper_style.html. See the doc pages for individual styles for details. The {Impropers} section must appear after the {Atoms} section. All values in this section must be integers (1, not 1.0). :line {Lines} section: one line per line segment :ulb,l line syntax: atom-ID x1 y1 x2 y2 :l atom-ID = ID of atom which is a line segment x1,y1 = 1st end point x2,y2 = 2nd end point :pre example: :l 12 1.0 0.0 2.0 0.0 :pre :ule The {Lines} section must appear if "atom_style line"_atom_style.html is used and any atoms are listed in the {Atoms} section with a lineflag = 1. The number of lines should be specified in the header section via the "lines" keyword. The 2 end points are the end points of the line segment. The ordering of the 2 points should be such that using a right-hand rule to cross the line segment with a unit vector in the +z direction, gives an "outward" normal vector perpendicular to the line segment. I.e. normal = (c2-c1) x (0,0,1). This orientation may be important for defining some interactions. The {Lines} section must appear after the {Atoms} section. :line {Masses} section: one line per atom type :ulb,l line syntax: ID mass :l ID = atom type (1-N) mass = mass value :pre example: :l 3 1.01 :pre :ule This defines the mass of each atom type. This can also be set via the "mass"_mass.html command in the input script. This section cannot be used for atom styles that define a mass for individual atoms - e.g. "atom_style sphere"_atom_style.html. :line {MiddleBondTorsion Coeffs} section: one line per dihedral type :ulb,l line syntax: ID coeffs :l ID = dihedral type (1-N) coeffs = list of coeffs (see class 2 section of "dihedral_coeff"_dihedral_coeff.html) :pre :ule :line {Pair Coeffs} section: one line per atom type :ulb,l line syntax: ID coeffs :l ID = atom type (1-N) coeffs = list of coeffs :pre example: :l 3 0.022 2.35197 0.022 2.35197 :pre :ule The number and meaning of the coefficients are specific to the defined pair style. See the "pair_style"_pair_style.html and "pair_coeff"_pair_coeff.html commands for details. Since pair coefficients for types I != J are not specified, these will be generated automatically by the pair style's mixing rule. See the individual pair_style doc pages and the "pair_modify mix"_pair_modify.html command for details. Pair coefficients can also be set via the "pair_coeff"_pair_coeff.html command in the input script. :line {PairIJ Coeffs} section: one line per pair of atom types for all I,J with I <= J :ulb,l line syntax: ID1 ID2 coeffs :l ID1 = atom type I = 1-N ID2 = atom type J = I-N, with I <= J coeffs = list of coeffs :pre examples: :l 3 3 0.022 2.35197 0.022 2.35197 3 5 0.022 2.35197 0.022 2.35197 :pre :ule This section must have N*(N+1)/2 lines where N = # of atom types. The number and meaning of the coefficients are specific to the defined pair style. See the "pair_style"_pair_style.html and "pair_coeff"_pair_coeff.html commands for details. Since pair coefficients for types I != J are all specified, these values will turn off the default mixing rule defined by the pair style. See the individual pair_style doc pages and the "pair_modify mix"_pair_modify.html command for details. Pair coefficients can also be set via the "pair_coeff"_pair_coeff.html command in the input script. :line {Triangles} section: one line per triangle :ulb,l line syntax: atom-ID x1 y1 z1 x2 y2 z2 x3 y3 z3 :l atom-ID = ID of atom which is a line segment x1,y1,z1 = 1st corner point x2,y2,z2 = 2nd corner point x3,y3,z3 = 3rd corner point :pre example: :l 12 0.0 0.0 0.0 2.0 0.0 1.0 0.0 2.0 1.0 :pre :ule The {Triangles} section must appear if "atom_style tri"_atom_style.html is used and any atoms are listed in the {Atoms} section with a triangleflag = 1. The number of lines should be specified in the header section via the "triangles" keyword. The 3 corner points are the corner points of the triangle. The ordering of the 3 points should be such that using a right-hand rule to go from point1 to point2 to point3 gives an "outward" normal vector to the face of the triangle. I.e. normal = (c2-c1) x (c3-c1). This orientation may be important for defining some interactions. The {Triangles} section must appear after the {Atoms} section. :line {Velocities} section: one line per atom line syntax: depends on atom style :ul all styles except those listed: atom-ID vx vy vz electron: atom-ID vx vy vz ervel ellipsoid: atom-ID vx vy vz lx ly lz sphere: atom-ID vx vy vz wx wy wz hybrid: atom-ID vx vy vz sub-style1 sub-style2 ... :tb(s=:) where the keywords have these meanings: vx,vy,vz = translational velocity of atom lx,ly,lz = angular momentum of aspherical atom wx,wy,wz = angular velocity of spherical atom ervel = electron radial velocity (0 for fixed-core):ul The velocity lines can appear in any order. This section can only be used after an {Atoms} section. This is because the {Atoms} section must have assigned a unique atom ID to each atom so that velocities can be assigned to them. Vx, vy, vz, and ervel are in "units"_units.html of velocity. Lx, ly, lz are in units of angular momentum (distance-velocity-mass). Wx, Wy, Wz are in units of angular velocity (radians/time). For atom_style hybrid, following the 4 initial values (ID,vx,vy,vz), specific values for each sub-style must be listed. The order of the sub-styles is the same as they were listed in the "atom_style"_atom_style.html command. The sub-style specific values are those that are not the 5 standard ones (ID,vx,vy,vz). For example, for the "sphere" sub-style, "wx", "wy", "wz" values would appear. These are listed in the same order they appear as listed above. Thus if atom_style hybrid electron sphere :pre were used in the input script, each velocity line would have these fields: atom-ID vx vy vz ervel wx wy wz :pre Translational velocities can also be set by the "velocity"_velocity.html command in the input script. :line [Restrictions:] To read gzipped data files, you must compile LAMMPS with the -DLAMMPS_GZIP option - see the "Making LAMMPS"_Section_start.html#start_2 section of the documentation. [Related commands:] "read_dump"_read_dump.html, "read_restart"_read_restart.html, "create_atoms"_create_atoms.html, "write_data"_write_data.html [Default:] The default for all the {extra} keywords is 0. diff --git a/doc/src/set.txt b/doc/src/set.txt index 14460c974..4757d1c57 100644 --- a/doc/src/set.txt +++ b/doc/src/set.txt @@ -1,449 +1,469 @@ "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c :link(lws,http://lammps.sandia.gov) :link(ld,Manual.html) :link(lc,Section_commands.html#comm) :line set command :h3 [Syntax:] set style ID keyword values ... :pre style = {atom} or {type} or {mol} or {group} or {region} :ulb,l ID = atom ID range or type range or mol ID range or group ID or region ID :l one or more keyword/value pairs may be appended :l keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \ {charge} or {dipole} or {dipole/random} or {quat} or \ {quat/random} or {diameter} or {shape} or \ {length} or {tri} or {theta} or {theta/random} or \ {angmom} or {omega} or \ {mass} or {density} or {density/disc} or {volume} or {image} or \ {bond} or {angle} or {dihedral} or {improper} or \ {meso/e} or {meso/cv} or {meso/rho} or \ {smd/contact/radius} or {smd/mass/density} or {dpd/theta} or \ - {i_name} or {d_name} :l + {edpd/temp} or {edpd/cv} or {cc} or {i_name} or {d_name} :l {type} value = atom type value can be an atom-style variable (see below) {type/fraction} values = type fraction seed type = new atom type fraction = fraction of selected atoms to set to new atom type seed = random # seed (positive integer) {mol} value = molecule ID value can be an atom-style variable (see below) {x},{y},{z} value = atom coordinate (distance units) value can be an atom-style variable (see below) {charge} value = atomic charge (charge units) value can be an atom-style variable (see below) {dipole} values = x y z x,y,z = orientation of dipole moment vector any of x,y,z can be an atom-style variable (see below) {dipole/random} value = seed Dlen seed = random # seed (positive integer) for dipole moment orientations Dlen = magnitude of dipole moment (dipole units) {quat} values = a b c theta a,b,c = unit vector to rotate particle around via right-hand rule theta = rotation angle (degrees) any of a,b,c,theta can be an atom-style variable (see below) {quat/random} value = seed seed = random # seed (positive integer) for quaternion orientations {diameter} value = diameter of spherical particle (distance units) value can be an atom-style variable (see below) {shape} value = Sx Sy Sz Sx,Sy,Sz = 3 diameters of ellipsoid (distance units) {length} value = len len = length of line segment (distance units) len can be an atom-style variable (see below) {tri} value = side side = side length of equilateral triangle (distance units) side can be an atom-style variable (see below) {theta} value = angle (degrees) angle = orientation of line segment with respect to x-axis angle can be an atom-style variable (see below) {theta/random} value = seed seed = random # seed (positive integer) for line segment orienations {angmom} values = Lx Ly Lz Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units) any of Lx,Ly,Lz can be an atom-style variable (see below) {omega} values = Wx Wy Wz Wx,Wy,Wz = components of angular velocity vector (radians/time units) any of wx,wy,wz can be an atom-style variable (see below) {mass} value = per-atom mass (mass units) value can be an atom-style variable (see below) {density} value = particle density for a sphere or ellipsoid (mass/distance^3 units), or for a triangle (mass/distance^2 units) or line (mass/distance units) particle value can be an atom-style variable (see below) {density/disc} value = particle density for a 2d disc or ellipse (mass/distance^2 units) value can be an atom-style variable (see below) {volume} value = particle volume for Peridynamic particle (distance^3 units) value can be an atom-style variable (see below) {image} nx ny nz nx,ny,nz = which periodic image of the simulation box the atom is in any of nx,ny,nz can be an atom-style variable (see below) {bond} value = bond type for all bonds between selected atoms {angle} value = angle type for all angles between selected atoms {dihedral} value = dihedral type for all dihedrals between selected atoms {improper} value = improper type for all impropers between selected atoms {meso/e} value = energy of SPH particles (need units) value can be an atom-style variable (see below) {meso/cv} value = heat capacity of SPH particles (need units) value can be an atom-style variable (see below) {meso/rho} value = density of SPH particles (need units) value can be an atom-style variable (see below) {smd/contact/radius} = radius for short range interactions, i.e. contact and friction value can be an atom-style variable (see below) {smd/mass/density} = set particle mass based on volume by providing a mass density value can be an atom-style variable (see below) {dpd/theta} value = internal temperature of DPD particles (temperature units) value can be an atom-style variable (see below) value can be NULL which sets internal temp of each particle to KE temp + {edpd/temp} value = temperature of eDPD particles (temperature units) + value can be an atom-style variable (see below) + {edpd/cv} value = volumetric heat capacity of eDPD particles (energy/temperature/volume units) + value can be an atom-style variable (see below) + {cc} values = index cc + index = index of a chemical species (1 to Nspecies) + cc = chemical concentration of tDPD particles for a species (mole/volume units) {i_name} value = value for custom integer vector with name {d_name} value = value for custom floating-point vector with name :pre :ule [Examples:] set group solvent type 2 set group solvent type/fraction 2 0.5 12393 set group edge bond 4 set region half charge 0.5 set type 3 charge 0.5 set type 1*3 charge 0.5 set atom * charge v_atomfile set atom 100*200 x 0.5 y 1.0 set atom 1492 type 3 :pre [Description:] Set one or more properties of one or more atoms. Since atom properties are initially assigned by the "read_data"_read_data.html, "read_restart"_read_restart.html or "create_atoms"_create_atoms.html commands, this command changes those assignments. This can be useful for overriding the default values assigned by the "create_atoms"_create_atoms.html command (e.g. charge = 0.0). It can be useful for altering pairwise and molecular force interactions, since force-field coefficients are defined in terms of types. It can be used to change the labeling of atoms by atom type or molecule ID when they are output in "dump"_dump.html files. It can also be useful for debugging purposes; i.e. positioning an atom at a precise location to compute subsequent forces or energy. Note that the {style} and {ID} arguments determine which atoms have their properties reset. The remaining keywords specify which properties to reset and what the new values are. Some strings like {type} or {mol} can be used as a style and/or a keyword. :line This section describes how to select which atoms to change the properties of, via the {style} and {ID} arguments. The style {atom} selects all the atoms in a range of atom IDs. The style {type} selects all the atoms in a range of types. The style {mol} selects all the atoms in a range of molecule IDs. In each of the range cases, the range can be specified as a single numeric value, or a wildcard asterisk can be used to specify a range of values. This takes the form "*" or "*n" or "n*" or "m*n". For example, for the style {type}, if N = the number of atom types, then an asterisk with no numeric values means all types from 1 to N. A leading asterisk means all types from 1 to n (inclusive). A trailing asterisk means all types from n to N (inclusive). A middle asterisk means all types from m to n (inclusive). For all the styles except {mol}, the lowest value for the wildcard is 1; for {mol} it is 0. The style {group} selects all the atoms in the specified group. The style {region} selects all the atoms in the specified geometric region. See the "group"_group.html and "region"_region.html commands for details of how to specify a group or region. :line This section describes the keyword options for which properties to change, for the selected atoms. Note that except where explicitly prohibited below, all of the keywords allow an "atom-style or atomfile-style variable"_variable.html to be used as the specified value(s). If the value is a variable, it should be specified as v_name, where name is the variable name. In this case, the variable will be evaluated, and its resulting per-atom value used to determine the value assigned to each selected atom. Note that the per-atom value from the variable will be ignored for atoms that are not selected via the {style} and {ID} settings explained above. A simple way to use per-atom values from the variable to reset a property for all atoms is to use style {atom} with {ID} = "*"; this selects all atom IDs. Atom-style variables can specify formulas with various mathematical functions, and include "thermo_style"_thermo_style.html command keywords for the simulation box parameters and timestep and elapsed time. They can also include per-atom values, such as atom coordinates. Thus it is easy to specify a time-dependent or spatially-dependent set of per-atom values. As explained on the "variable"_variable.html doc page, atomfile-style variables can be used in place of atom-style variables, and thus as arguments to the set command. Atomfile-style variables read their per-atoms values from a file. NOTE: Atom-style and atomfile-style variables return floating point per-atom values. If the values are assigned to an integer variable, such as the molecule ID, then the floating point value is truncated to its integer portion, e.g. a value of 2.6 would become 2. Keyword {type} sets the atom type for all selected atoms. The specified value must be from 1 to ntypes, where ntypes was set by the "create_box"_create_box.html command or the {atom types} field in the header of the data file read by the "read_data"_read_data.html command. Keyword {type/fraction} sets the atom type for a fraction of the selected atoms. The actual number of atoms changed is not guaranteed to be exactly the requested fraction, but should be statistically close. Random numbers are used in such a way that a particular atom is changed or not changed, regardless of how many processors are being used. This keyword does not allow use of an atom-style variable. Keyword {mol} sets the molecule ID for all selected atoms. The "atom style"_atom_style.html being used must support the use of molecule IDs. Keywords {x}, {y}, {z}, and {charge} set the coordinates or charge of all selected atoms. For {charge}, the "atom style"_atom_style.html being used must support the use of atomic charge. Keyword {dipole} uses the specified x,y,z values as components of a vector to set as the orientation of the dipole moment vectors of the selected atoms. The magnitude of the dipole moment is set by the length of this orientation vector. Keyword {dipole/random} randomizes the orientation of the dipole moment vectors for the selected atoms and sets the magnitude of each to the specified {Dlen} value. For 2d systems, the z component of the orientation is set to 0.0. Random numbers are used in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. This keyword does not allow use of an atom-style variable. Keyword {quat} uses the specified values to create a quaternion (4-vector) that represents the orientation of the selected atoms. The particles must define a quaternion for their orientation (e.g. ellipsoids, triangles, body particles) as defined by the "atom_style"_atom_style.html command. Note that particles defined by "atom_style ellipsoid"_atom_style.html have 3 shape parameters. The 3 values must be non-zero for each particle set by this command. They are used to specify the aspect ratios of an ellipsoidal particle, which is oriented by default with its x-axis along the simulation box's x-axis, and similarly for y and z. If this body is rotated (via the right-hand rule) by an angle theta around a unit rotation vector (a,b,c), then the quaternion that represents its new orientation is given by (cos(theta/2), a*sin(theta/2), b*sin(theta/2), c*sin(theta/2)). The theta and a,b,c values are the arguments to the {quat} keyword. LAMMPS normalizes the quaternion in case (a,b,c) was not specified as a unit vector. For 2d systems, the a,b,c values are ignored, since a rotation vector of (0,0,1) is the only valid choice. Keyword {quat/random} randomizes the orientation of the quaternion for the selected atoms. The particles must define a quaternion for their orientation (e.g. ellipsoids, triangles, body particles) as defined by the "atom_style"_atom_style.html command. Random numbers are used in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. For 2d systems, only orientations in the xy plane are generated. As with keyword {quat}, for ellipsoidal particles, the 3 shape values must be non-zero for each particle set by this command. This keyword does not allow use of an atom-style variable. Keyword {diameter} sets the size of the selected atoms. The particles must be finite-size spheres as defined by the "atom_style sphere"_atom_style.html command. The diameter of a particle can be set to 0.0, which means they will be treated as point particles. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the "read_data"_read_data.html command. Keyword {shape} sets the size and shape of the selected atoms. The particles must be ellipsoids as defined by the "atom_style ellipsoid"_atom_style.html command. The {Sx}, {Sy}, {Sz} settings are the 3 diameters of the ellipsoid in each direction. All 3 can be set to the same value, which means the ellipsoid is effectively a sphere. They can also all be set to 0.0 which means the particle will be treated as a point particle. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the "read_data"_read_data.html command. Keyword {length} sets the length of selected atoms. The particles must be line segments as defined by the "atom_style line"_atom_style.html command. If the specified value is non-zero the line segment is (re)set to a length = the specified value, centered around the particle position, with an orientation along the x-axis. If the specified value is 0.0, the particle will become a point particle. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the "read_data"_read_data.html command. Keyword {tri} sets the size of selected atoms. The particles must be triangles as defined by the "atom_style tri"_atom_style.html command. If the specified value is non-zero the triangle is (re)set to be an equilateral triangle in the xy plane with side length = the specified value, with a centroid at the particle position, with its base parallel to the x axis, and the y-axis running from the center of the base to the top point of the triangle. If the specified value is 0.0, the particle will become a point particle. Note that this command does not adjust the particle mass, even if it was defined with a density, e.g. via the "read_data"_read_data.html command. Keyword {theta} sets the orientation of selected atoms. The particles must be line segments as defined by the "atom_style line"_atom_style.html command. The specified value is used to set the orientation angle of the line segments with respect to the x axis. Keyword {theta/random} randomizes the orientation of theta for the selected atoms. The particles must be line segments as defined by the "atom_style line"_atom_style.html command. Random numbers are used in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. This keyword does not allow use of an atom-style variable. Keyword {angmom} sets the angular momentum of selected atoms. The particles must be ellipsoids as defined by the "atom_style ellipsoid"_atom_style.html command or triangles as defined by the "atom_style tri"_atom_style.html command. The angular momentum vector of the particles is set to the 3 specified components. Keyword {omega} sets the angular velocity of selected atoms. The particles must be spheres as defined by the "atom_style sphere"_ atom_style.html command. The angular velocity vector of the particles is set to the 3 specified components. Keyword {mass} sets the mass of all selected particles. The particles must have a per-atom mass attribute, as defined by the "atom_style"_atom_style.html command. See the "mass" command for how to set mass values on a per-type basis. Keyword {density} or {density/disc} also sets the mass of all selected particles, but in a different way. The particles must have a per-atom mass attribute, as defined by the "atom_style"_atom_style.html command. If the atom has a radius attribute (see "atom_style sphere"_atom_style.html) and its radius is non-zero, its mass is set from the density and particle volume for 3d systems (the input density is assumed to be in mass/distance^3 units). For 2d, the default is for LAMMPS to model particles with a radius attribute as spheres. However, if the {density/disc} keyword is used, then they can be modeled as 2d discs (circles). Their mass is set from the density and particle area (the input density is assumed to be in mass/distance^2 units). If the atom has a shape attribute (see "atom_style ellipsoid"_atom_style.html) and its 3 shape parameters are non-zero, then its mass is set from the density and particle volume (the input density is assumed to be in mass/distance^3 units). The {density/disc} keyword has no effect; it does not (yet) treat 3d ellipsoids as 2d ellipses. If the atom has a length attribute (see "atom_style line"_atom_style.html) and its length is non-zero, then its mass is set from the density and line segment length (the input density is assumed to be in mass/distance units). If the atom has an area attribute (see "atom_style tri"_atom_style.html) and its area is non-zero, then its mass is set from the density and triangle area (the input density is assumed to be in mass/distance^2 units). If none of these cases are valid, then the mass is set to the density value directly (the input density is assumed to be in mass units). Keyword {volume} sets the volume of all selected particles. Currently, only the "atom_style peri"_atom_style.html command defines particles with a volume attribute. Note that this command does not adjust the particle mass. Keyword {image} sets which image of the simulation box the atom is considered to be in. An image of 0 means it is inside the box as defined. A value of 2 means add 2 box lengths to get the true value. A value of -1 means subtract 1 box length to get the true value. LAMMPS updates these flags as atoms cross periodic boundaries during the simulation. The flags can be output with atom snapshots via the "dump"_dump.html command. If a value of NULL is specified for any of nx,ny,nz, then the current image value for that dimension is unchanged. For non-periodic dimensions only a value of 0 can be specified. This command can be useful after a system has been equilibrated and atoms have diffused one or more box lengths in various directions. This command can then reset the image values for atoms so that they are effectively inside the simulation box, e.g if a diffusion coefficient is about to be measured via the "compute msd"_compute_msd.html command. Care should be taken not to reset the image flags of two atoms in a bond to the same value if the bond straddles a periodic boundary (rather they should be different by +/- 1). This will not affect the dynamics of a simulation, but may mess up analysis of the trajectories if a LAMMPS diagnostic or your own analysis relies on the image flags to unwrap a molecule which straddles the periodic box. Keywords {bond}, {angle}, {dihedral}, and {improper}, set the bond type (angle type, etc) of all bonds (angles, etc) of selected atoms to the specified value from 1 to nbondtypes (nangletypes, etc). All atoms in a particular bond (angle, etc) must be selected atoms in order for the change to be made. The value of nbondtype (nangletypes, etc) was set by the {bond types} ({angle types}, etc) field in the header of the data file read by the "read_data"_read_data.html command. These keywords do not allow use of an atom-style variable. Keywords {meso/e}, {meso/cv}, and {meso/rho} set the energy, heat capacity, and density of smoothed particle hydrodynamics (SPH) particles. See "this PDF guide"_USER/sph/SPH_LAMMPS_userguide.pdf to using SPH in LAMMPS. Keyword {smd/mass/density} sets the mass of all selected particles, but it is only applicable to the Smooth Mach Dynamics package USER-SMD. It assumes that the particle volume has already been correctly set and calculates particle mass from the provided mass density value. Keyword {smd/contact/radius} only applies to simulations with the Smooth Mach Dynamics package USER-SMD. Itsets an interaction radius for computing short-range interactions, e.g. repulsive forces to prevent different individual physical bodies from penetrating each other. Note that the SPH smoothing kernel diameter used for computing long range, nonlocal interactions, is set using the {diameter} keyword. Keyword {dpd/theta} sets the internal temperature of a DPD particle as defined by the USER-DPD package. If the specified value is a number it must be >= 0.0. If the specified value is NULL, then the kinetic temperature Tkin of each particle is computed as 3/2 k Tkin = KE = 1/2 m v^2 = 1/2 m (vx*vx+vy*vy+vz*vz). Each particle's internal temperature is set to Tkin. If the specified value is an atom-style variable, then the variable is evaluated for each particle. If a value >= 0.0, the internal temperature is set to that value. If it is < 0.0, the computation of Tkin is performed and the internal temperature is set to that value. +Keywords {edpd/temp} and {edpd/cv} set the temperature and volumetric +heat capacity of an eDPD particle as defined by the USER-MESO package. +Currently, only "atom_style edpd"_atom_style.html defines particles +with these attributes. The values for the temperature and heat +capacity must be positive. + +Keyword {cc} sets the chemical concentration of a tDPD particle for a +specified species as defined by the USER-MESO package. Currently, only +"atom_style tdpd"_atom_style.html defines particles with this +attribute. An integer for "index" selects a chemical species (1 to +Nspecies) where Nspecies is set by the atom_style command. The value +for the chemical concentration must be >= 0.0. + Keywords {i_name} and {d_name} refer to custom integer and floating-point properties that have been added to each atom via the "fix property/atom"_fix_property_atom.html command. When that command is used specific names are given to each attribute which are what is specified as the "name" portion of {i_name} or {d_name}. [Restrictions:] You cannot set an atom attribute (e.g. {mol} or {q} or {volume}) if the "atom_style"_atom_style.html does not have that attribute. This command requires inter-processor communication to coordinate the setting of bond types (angle types, etc). This means that your system must be ready to perform a simulation before using one of these keywords (force fields set, atom mass set, etc). This is not necessary for other keywords. Using the {region} style with the bond (angle, etc) keywords can give unpredictable results if there are bonds (angles, etc) that straddle periodic boundaries. This is because the region may only extend up to the boundary and partner atoms in the bond (angle, etc) may have coordinates outside the simulation box if they are ghost atoms. [Related commands:] "create_box"_create_box.html, "create_atoms"_create_atoms.html, "read_data"_read_data.html [Default:] none diff --git a/examples/USER/meso/README b/examples/USER/meso/README new file mode 100644 index 000000000..4accc7ba0 --- /dev/null +++ b/examples/USER/meso/README @@ -0,0 +1,40 @@ +This directory contains input scripts for performing +simulations with these models: + +eDPD - energy-conserving dissipative particle dynamics +mDPD - many-body dissipative particle dynamics +tDPD - transport dissipative particle dynamics + +1) eDPD: The input script in.mdpd is an example simulation of +measuring the thermal conductivity by heat conduction analog of +periodic Poiseuille flow. The initial eDPD system is randomly filled +by many eDPD particles, and a set command "edpd/temp" gives the +initial temperature and a set command "edpd/cv" gives the heat +capacity of eDPD particles. A non-contact heat source/sink term is +applied by a fix command "edpd/source". A compute command +"edpd/temp/atom" obtain the temperature on each eDPD particle. The +simulation will generate a file named "temp.profile" showing the +temperature profile. For details please see online LAMMPS +documentation and Fig.12 in the paper Z. Li, et al. J Comput Phys, +2014, 265: 113-127. DOI: 10.1016/j.jcp.2014.02.003 + +2) mDPD: The input script "in.mdpd" is an example simulation of +oscillations of a free liquid droplet. The initial configuration is a +liquid film whose particles are in a fcc lattice created by the +command "create atoms". Then the liquid film has a tendency to form a +spherical droplet under the effect of surface tension. For details +please see online LAMMPS documentation and the paper Z. Li, et +al. Phys Fluids, 2013, 25: 072103. DOI: 10.1063/1.4812366 + +3) tDPD: The input script in.tdpd is an example simulation of +computing the effective diffusion coefficient of a tDPD system using a +method analogous to the periodic Poiseuille flow. Command "atom_style +tdpd 2" specifies the tDPD system with two chemical species. The +initial tDPD system is randomly filled by many tDPD particles, and a +set "cc" command gives initial concentration for each chemical +species. Fix commands "tdpd/source" add source terms and compute +commands "tdpd/cc/atom" obtain the chemical concentration on each tDPD +particle. The simulation will generate a file named "cc.profile" +showing the concentration profiles of the two chemical species. For +details please see online LAMMPS documentation and Fig.1 in the paper +Z. Li, et al. J Chem Phys, 2015, 143: 014101. DOI: 10.1063/1.4923254 diff --git a/examples/USER/meso/edpd/in.edpd b/examples/USER/meso/edpd/in.edpd new file mode 100644 index 000000000..316099bce --- /dev/null +++ b/examples/USER/meso/edpd/in.edpd @@ -0,0 +1,54 @@ +######################################################################## +### Heat conduction analog of periodic Poiseuille flow problem ### +### using energy-conserving DPD (eDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### mDPD system setup follows Fig.12 in the publication: ### +### Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. ### +### "Energy-conserving dissipative particle dynamics with ### +### temperature-dependent properties". J. Comput. Phys., ### +### 2014, 265: 113-127. DOI: 10.1016/j.jcp.2014.02.003 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style edpd + +region edpd block -10 10 -10 10 -5 5 units box +create_box 1 edpd +create_atoms 1 random 16000 276438 NULL +mass 1 1.0 +set atom * edpd/temp 1.0 +set atom * edpd/cv 1.0E5 + +pair_style edpd 1.58 9872598 +#pair_coeff 1 1 18.75 4.5 0.41 1.58 1.45E-5 2.0 1.58 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.41E-5 2.0 1.58 & + power 10.54 -3.66 3.44 -4.10 & + kappa -0.44 -3.21 5.04 0.00 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/edpd 0.5 +fix upper all edpd/source cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower all edpd/source cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 + +timestep 0.01 +run 500 +reset_timestep 0 + +compute temp all edpd/temp/atom +compute ccT all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 500 500 ccT c_temp density/number norm sample file temp.profile + +run 500 diff --git a/examples/USER/meso/edpd/log.16Aug17.edpd.g++.1 b/examples/USER/meso/edpd/log.16Aug17.edpd.g++.1 new file mode 100644 index 000000000..af975f877 --- /dev/null +++ b/examples/USER/meso/edpd/log.16Aug17.edpd.g++.1 @@ -0,0 +1,142 @@ +LAMMPS (11 Aug 2017) +######################################################################## +### Heat conduction analog of periodic Poiseuille flow problem ### +### using energy-conserving DPD (eDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### mDPD system setup follows Fig.12 in the publication: ### +### Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. ### +### "Energy-conserving dissipative particle dynamics with ### +### temperature-dependent properties". J. Comput. Phys., ### +### 2014, 265: 113-127. DOI: 10.1016/j.jcp.2014.02.003 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style edpd + +region edpd block -10 10 -10 10 -5 5 units box +create_box 1 edpd +Created orthogonal box = (-10 -10 -5) to (10 10 5) + 1 by 1 by 1 MPI processor grid +create_atoms 1 random 16000 276438 NULL +Created 16000 atoms +mass 1 1.0 +set atom * edpd/temp 1.0 + 16000 settings made for edpd/temp +set atom * edpd/cv 1.0E5 + 16000 settings made for edpd/cv + +pair_style edpd 1.58 9872598 +#pair_coeff 1 1 18.75 4.5 0.41 1.58 1.45E-5 2.0 1.58 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.41E-5 2.0 1.58 power 10.54 -3.66 3.44 -4.10 kappa -0.44 -3.21 5.04 0.00 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/edpd 0.5 +fix upper all edpd/source cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower all edpd/source cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 + +timestep 0.01 +run 500 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.78 + ghost atom cutoff = 1.78 + binsize = 0.89, bins = 23 23 12 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair edpd, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.64 | 11.64 | 11.64 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1 48.948932 0 50.448838 201.73366 + 100 1.0069712 43.754293 0 45.264656 199.5369 + 200 0.98667561 43.716052 0 45.195973 196.72854 + 300 1.0036944 43.706299 0 45.211746 195.35714 + 400 1.0024228 43.697014 0 45.200554 197.0062 + 500 0.99968161 43.687445 0 45.186873 193.80596 +Loop time of 80.7995 on 1 procs for 500 steps with 16000 atoms + +Performance: 5346.567 tau/day, 6.188 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 75.106 | 75.106 | 75.106 | 0.0 | 92.95 +Neigh | 4.9836 | 4.9836 | 4.9836 | 0.0 | 6.17 +Comm | 0.31199 | 0.31199 | 0.31199 | 0.0 | 0.39 +Output | 0.00048232 | 0.00048232 | 0.00048232 | 0.0 | 0.00 +Modify | 0.29985 | 0.29985 | 0.29985 | 0.0 | 0.37 +Other | | 0.09751 | | | 0.12 + +Nlocal: 16000 ave 16000 max 16000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 14091 ave 14091 max 14091 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 749111 ave 749111 max 749111 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 749111 +Ave neighs/atom = 46.8194 +Neighbor list builds = 181 +Dangerous builds = 0 +reset_timestep 0 + +compute temp all edpd/temp/atom +compute ccT all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 500 500 ccT c_temp density/number norm sample file temp.profile + +run 500 +Per MPI rank memory allocation (min/avg/max) = 12.14 | 12.14 | 12.14 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0.99968161 43.687397 0 45.186825 196.38426 + 100 1.0041443 43.668196 0 45.174318 195.38066 + 200 0.99628392 43.666173 0 45.160505 197.84675 + 300 1.0029116 43.66224 0 45.166513 199.67414 + 400 0.99922193 43.64406 0 45.142799 196.94404 + 500 0.99355431 43.623266 0 45.113505 195.94136 +Loop time of 80.7742 on 1 procs for 500 steps with 16000 atoms + +Performance: 5348.242 tau/day, 6.190 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 75.073 | 75.073 | 75.073 | 0.0 | 92.94 +Neigh | 4.8786 | 4.8786 | 4.8786 | 0.0 | 6.04 +Comm | 0.31086 | 0.31086 | 0.31086 | 0.0 | 0.38 +Output | 0.00045919 | 0.00045919 | 0.00045919 | 0.0 | 0.00 +Modify | 0.4139 | 0.4139 | 0.4139 | 0.0 | 0.51 +Other | | 0.09731 | | | 0.12 + +Nlocal: 16000 ave 16000 max 16000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 14091 ave 14091 max 14091 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 749667 ave 749667 max 749667 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 749667 +Ave neighs/atom = 46.8542 +Neighbor list builds = 178 +Dangerous builds = 0 + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:02:41 diff --git a/examples/USER/meso/edpd/log.16Aug17.edpd.g++.4 b/examples/USER/meso/edpd/log.16Aug17.edpd.g++.4 new file mode 100644 index 000000000..21206d38c --- /dev/null +++ b/examples/USER/meso/edpd/log.16Aug17.edpd.g++.4 @@ -0,0 +1,142 @@ +LAMMPS (11 Aug 2017) +######################################################################## +### Heat conduction analog of periodic Poiseuille flow problem ### +### using energy-conserving DPD (eDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### mDPD system setup follows Fig.12 in the publication: ### +### Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. ### +### "Energy-conserving dissipative particle dynamics with ### +### temperature-dependent properties". J. Comput. Phys., ### +### 2014, 265: 113-127. DOI: 10.1016/j.jcp.2014.02.003 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style edpd + +region edpd block -10 10 -10 10 -5 5 units box +create_box 1 edpd +Created orthogonal box = (-10 -10 -5) to (10 10 5) + 2 by 2 by 1 MPI processor grid +create_atoms 1 random 16000 276438 NULL +Created 16000 atoms +mass 1 1.0 +set atom * edpd/temp 1.0 + 16000 settings made for edpd/temp +set atom * edpd/cv 1.0E5 + 16000 settings made for edpd/cv + +pair_style edpd 1.58 9872598 +#pair_coeff 1 1 18.75 4.5 0.41 1.58 1.45E-5 2.0 1.58 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.41E-5 2.0 1.58 power 10.54 -3.66 3.44 -4.10 kappa -0.44 -3.21 5.04 0.00 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/edpd 0.5 +fix upper all edpd/source cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower all edpd/source cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 + +timestep 0.01 +run 500 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.78 + ghost atom cutoff = 1.78 + binsize = 0.89, bins = 23 23 12 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair edpd, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.969 | 4.979 | 4.985 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1 48.948932 0 50.448838 199.51547 + 100 1.0106415 43.744371 0 45.260239 196.39598 + 200 1.0053215 43.714413 0 45.222301 195.35298 + 300 0.99886399 43.713356 0 45.211559 196.74821 + 400 1.0035264 43.699086 0 45.204282 195.47446 + 500 1.0025285 43.698051 0 45.20175 197.27042 +Loop time of 21.165 on 4 procs for 500 steps with 16000 atoms + +Performance: 20411.046 tau/day, 23.624 timesteps/s +99.9% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 18.713 | 19.101 | 19.41 | 6.0 | 90.25 +Neigh | 1.2687 | 1.2925 | 1.3177 | 1.5 | 6.11 +Comm | 0.33013 | 0.66337 | 1.0747 | 34.3 | 3.13 +Output | 0.00023484 | 0.00028092 | 0.00036526 | 0.0 | 0.00 +Modify | 0.073931 | 0.075277 | 0.076306 | 0.3 | 0.36 +Other | | 0.03227 | | | 0.15 + +Nlocal: 4000 ave 4067 max 3930 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Nghost: 5997.5 ave 6052 max 5943 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 187388 ave 193157 max 181221 min +Histogram: 1 1 0 0 0 0 0 0 0 2 + +Total # of neighbors = 749552 +Ave neighs/atom = 46.847 +Neighbor list builds = 181 +Dangerous builds = 0 +reset_timestep 0 + +compute temp all edpd/temp/atom +compute ccT all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 500 500 ccT c_temp density/number norm sample file temp.profile + +run 500 +Per MPI rank memory allocation (min/avg/max) = 5.221 | 5.23 | 5.236 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1.0025285 43.69801 0 45.201708 194.00452 + 100 0.9885969 43.679927 0 45.16273 196.28442 + 200 1.0028463 43.663067 0 45.167242 198.25592 + 300 1.0027516 43.648817 0 45.152851 198.82226 + 400 0.99695312 43.641469 0 45.136805 197.97499 + 500 0.98202292 43.627163 0 45.100105 199.16319 +Loop time of 21.576 on 4 procs for 500 steps with 16000 atoms + +Performance: 20022.203 tau/day, 23.174 timesteps/s +99.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 18.438 | 19.121 | 19.812 | 14.1 | 88.62 +Neigh | 1.2568 | 1.2885 | 1.325 | 2.5 | 5.97 +Comm | 0.29482 | 1.0219 | 1.7352 | 63.9 | 4.74 +Output | 0.00027728 | 0.00029719 | 0.0003531 | 0.0 | 0.00 +Modify | 0.11153 | 0.11265 | 0.1135 | 0.2 | 0.52 +Other | | 0.03194 | | | 0.15 + +Nlocal: 4000 ave 4092 max 3899 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 5974 ave 6019 max 5915 min +Histogram: 1 0 0 1 0 0 0 0 0 2 +Neighs: 187414 ave 196149 max 178418 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 749658 +Ave neighs/atom = 46.8536 +Neighbor list builds = 181 +Dangerous builds = 0 + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:00:42 diff --git a/examples/USER/meso/edpd/temp.profile.16Aug17.edpd.g++.1 b/examples/USER/meso/edpd/temp.profile.16Aug17.edpd.g++.1 new file mode 100644 index 000000000..469b55025 --- /dev/null +++ b/examples/USER/meso/edpd/temp.profile.16Aug17.edpd.g++.1 @@ -0,0 +1,24 @@ +# Chunk-averaged data for fix stat and group density/number +# Timestep Number-of-chunks Total-count +# Chunk Coord1 Ncount c_temp density/number +500 20 16000 + 1 -9.5 801.636 0.986368 4.00818 + 2 -8.5 809.788 0.966281 4.04894 + 3 -7.5 819.754 0.952764 4.09877 + 4 -6.5 820.364 0.944592 4.10182 + 5 -5.5 826.146 0.940968 4.13073 + 6 -4.5 819.52 0.941415 4.0976 + 7 -3.5 815.182 0.945887 4.07591 + 8 -2.5 817.168 0.95487 4.08584 + 9 -1.5 817.282 0.969225 4.08641 + 10 -0.5 804.204 0.989552 4.02102 + 11 0.5 793.266 1.01015 3.96633 + 12 1.5 789.056 1.0308 3.94528 + 13 2.5 784.344 1.04568 3.92172 + 14 3.5 780.592 1.05508 3.90296 + 15 4.5 772.218 1.05968 3.86109 + 16 5.5 776.968 1.06003 3.88484 + 17 6.5 780.858 1.05612 3.90429 + 18 7.5 786.174 1.04752 3.93087 + 19 8.5 788.922 1.03347 3.94461 + 20 9.5 796.558 1.01278 3.98279 diff --git a/examples/USER/meso/edpd/temp.profile.16Aug17.edpd.g++.4 b/examples/USER/meso/edpd/temp.profile.16Aug17.edpd.g++.4 new file mode 100644 index 000000000..1c50a9b6e --- /dev/null +++ b/examples/USER/meso/edpd/temp.profile.16Aug17.edpd.g++.4 @@ -0,0 +1,24 @@ +# Chunk-averaged data for fix stat and group density/number +# Timestep Number-of-chunks Total-count +# Chunk Coord1 Ncount c_temp density/number +500 20 16000 + 1 -9.5 801.642 0.986089 4.00821 + 2 -8.5 819.168 0.966072 4.09584 + 3 -7.5 817.382 0.952718 4.08691 + 4 -6.5 818 0.944633 4.09 + 5 -5.5 817.806 0.941105 4.08903 + 6 -4.5 826.11 0.941499 4.13055 + 7 -3.5 821.946 0.945922 4.10973 + 8 -2.5 816.202 0.954889 4.08101 + 9 -1.5 813.202 0.969281 4.06601 + 10 -0.5 798.904 0.989463 3.99452 + 11 0.5 798.056 1.01005 3.99028 + 12 1.5 793.114 1.03073 3.96557 + 13 2.5 782.812 1.04569 3.91406 + 14 3.5 775.69 1.05498 3.87845 + 15 4.5 778.094 1.05965 3.89047 + 16 5.5 778.856 1.06002 3.89428 + 17 6.5 780.51 1.05621 3.90255 + 18 7.5 780.518 1.04782 3.90259 + 19 8.5 789.698 1.03348 3.94849 + 20 9.5 792.29 1.01261 3.96145 diff --git a/examples/USER/meso/mdpd/in.mdpd b/examples/USER/meso/mdpd/in.mdpd new file mode 100644 index 000000000..201b4a340 --- /dev/null +++ b/examples/USER/meso/mdpd/in.mdpd @@ -0,0 +1,52 @@ +######################################################################## +#### 3D droplet oscilation using many-body DPD simulation ### +#### ### +#### Created : Zhen Li (zhen_li@brown.edu) ### +#### Division of Applied Mathematics, Brown University. ### +#### ### +#### mDPD parameters follow the choice of the publication: ### +#### Z. Li et al. "Three dimensional flow structures in a moving ### +#### droplet on substrate: a dissipative particle dynamics study" ### +#### Physics of Fluids, 2013, 25: 072103. DOI: 10.1063/1.4812366 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.3 bin +neigh_modify every 1 delay 0 check yes + +atom_style mdpd + +region mdpd block -25 25 -10 10 -10 10 units box +create_box 1 mdpd + +lattice fcc 6 +region film block -20 20 -7.5 7.5 -2.0 2.0 units box +create_atoms 1 region film + +pair_style hybrid/overlay mdpd/rhosum mdpd 1.0 1.0 9872598 +pair_coeff 1 1 mdpd/rhosum 0.75 +pair_coeff 1 1 mdpd -40 25 18.0 1.0 0.75 +mass 1 1.0 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 38497 loop local dist gaussian + +fix mvv all mvv/dpd + +#dump mydump all atom 100 atom.lammpstrj + +#dump jpg all image 200 image.*.jpg type type zoom 5 adiam 0.5 & +# view 90 90 box no 0 size 600 200 +#dump_modify jpg pad 4 + +#dump avi all movie 200 movie.avi type type zoom 5 adiam 0.5 & +# view 90 90 box no 0 size 600 200 +#dump_modify avi pad 4 + +timestep 0.01 +run 4000 diff --git a/examples/USER/meso/mdpd/log.16Aug17.mdpd.g++.1 b/examples/USER/meso/mdpd/log.16Aug17.mdpd.g++.1 new file mode 100644 index 000000000..c3c14da55 --- /dev/null +++ b/examples/USER/meso/mdpd/log.16Aug17.mdpd.g++.1 @@ -0,0 +1,147 @@ +LAMMPS (11 Aug 2017) +######################################################################## +#### 3D droplet oscilation using many-body DPD simulation ### +#### ### +#### Created : Zhen Li (zhen_li@brown.edu) ### +#### Division of Applied Mathematics, Brown University. ### +#### ### +#### mDPD parameters follow the choice of the publication: ### +#### Z. Li et al. "Three dimensional flow structures in a moving ### +#### droplet on substrate: a dissipative particle dynamics study" ### +#### Physics of Fluids, 2013, 25: 072103. DOI: 10.1063/1.4812366 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.3 bin +neigh_modify every 1 delay 0 check yes + +atom_style mdpd + +region mdpd block -25 25 -10 10 -10 10 units box +create_box 1 mdpd +Created orthogonal box = (-25 -10 -10) to (25 10 10) + 1 by 1 by 1 MPI processor grid + +lattice fcc 6 +Lattice spacing in x,y,z = 0.87358 0.87358 0.87358 +region film block -20 20 -7.5 7.5 -2.0 2.0 units box +create_atoms 1 region film +Created 14333 atoms + +pair_style hybrid/overlay mdpd/rhosum mdpd 1.0 1.0 9872598 +pair_coeff 1 1 mdpd/rhosum 0.75 +pair_coeff 1 1 mdpd -40 25 18.0 1.0 0.75 +mass 1 1.0 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 38497 loop local dist gaussian + +fix mvv all mvv/dpd + +dump mydump all atom 100 atom.lammpstrj + +#dump jpg all image 200 image.*.jpg type type zoom 5 adiam 0.5 # view 90 90 box no 0 size 600 200 +#dump_modify jpg pad 4 + +#dump avi all movie 200 movie.avi type type zoom 5 adiam 0.5 # view 90 90 box no 0 size 600 200 +#dump_modify avi pad 4 + +timestep 0.01 +run 4000 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 1.3 + binsize = 0.65, bins = 77 31 31 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair mdpd/rhosum, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard + (2) pair mdpd, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 9.931 | 9.931 | 9.931 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1 -13.346542 0 -11.846647 -6.8495478 + 100 1.0321029 -7.2846779 0 -5.7366316 -0.77640205 + 200 1.042287 -6.9534532 0 -5.3901317 -0.27750815 + 300 1.0583027 -6.8483105 0 -5.2609672 -0.30347708 + 400 1.0493719 -6.8648608 0 -5.2909127 -0.15312495 + 500 1.0723786 -6.8341085 0 -5.2256528 0.017227511 + 600 1.0545695 -6.8152957 0 -5.2335517 -0.024362439 + 700 1.0507193 -6.8076033 0 -5.2316344 -0.07101536 + 800 1.0531856 -6.9378568 0 -5.3581886 -0.053943939 + 900 1.0442995 -6.8501126 0 -5.2837726 -0.13347942 + 1000 1.0335049 -6.8883554 0 -5.3382062 -0.18420426 + 1100 1.0287276 -6.8298226 0 -5.2868389 -0.12081558 + 1200 1.0322527 -6.9462828 0 -5.3980117 -0.18047625 + 1300 1.0599443 -6.9449975 0 -5.355192 -0.011763589 + 1400 1.0560932 -6.845479 0 -5.2614498 0.032130055 + 1500 1.0432786 -6.9035877 0 -5.338779 -0.10268662 + 1600 1.064183 -6.9116836 0 -5.3155205 -0.060722129 + 1700 1.0586249 -6.8768278 0 -5.2890013 0.037005566 + 1800 1.0576064 -7.0060193 0 -5.4197204 -0.036211254 + 1900 1.0595141 -6.838741 0 -5.2495807 -0.12395681 + 2000 1.0650509 -6.897976 0 -5.3005111 0.003594807 + 2100 1.0768273 -6.8874245 0 -5.2722962 0.033283489 + 2200 1.0511606 -6.9823162 0 -5.4056854 0.015008427 + 2300 1.0461138 -6.8820601 0 -5.3129988 0.064646933 + 2400 1.0485369 -6.9437148 0 -5.3710191 -0.16534939 + 2500 1.0507221 -6.9394786 0 -5.3635054 -0.098289859 + 2600 1.0518352 -6.8947578 0 -5.3171152 -0.011666785 + 2700 1.0402369 -6.9273377 0 -5.3670913 0.035267073 + 2800 1.0426109 -6.912024 0 -5.3482168 0.049597305 + 2900 1.0358928 -6.9574778 0 -5.4037471 -0.063216561 + 3000 1.0351023 -6.9844192 0 -5.4318742 -0.10323465 + 3100 1.0255005 -6.9382486 0 -5.4001052 -0.073954735 + 3200 1.0150616 -6.9843183 0 -5.4618321 -0.095136405 + 3300 1.0118112 -6.9522082 0 -5.4345973 -0.12686179 + 3400 1.0071522 -6.970158 0 -5.4595351 -0.012487475 + 3500 1.0041758 -6.9773019 0 -5.4711433 -0.098027653 + 3600 1.0189298 -6.9393039 0 -5.4110158 0.061631719 + 3700 1.012442 -6.9341423 0 -5.4155852 0.10442772 + 3800 1.0021246 -6.9594374 0 -5.4563553 -0.081535223 + 3900 1.0165002 -6.9045321 0 -5.3798882 -0.0088283303 + 4000 1.0077099 -6.9145511 0 -5.4030918 0.048349691 +Loop time of 135.409 on 1 procs for 4000 steps with 14333 atoms + +Performance: 25522.736 tau/day, 29.540 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 93.074 | 93.074 | 93.074 | 0.0 | 68.74 +Neigh | 40.192 | 40.192 | 40.192 | 0.0 | 29.68 +Comm | 0.19625 | 0.19625 | 0.19625 | 0.0 | 0.14 +Output | 0.41756 | 0.41756 | 0.41756 | 0.0 | 0.31 +Modify | 1.0706 | 1.0706 | 1.0706 | 0.0 | 0.79 +Other | | 0.4581 | | | 0.34 + +Nlocal: 14333 ave 14333 max 14333 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 11 ave 11 max 11 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 401803 ave 401803 max 401803 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 803606 ave 803606 max 803606 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 803606 +Ave neighs/atom = 56.0668 +Neighbor list builds = 1050 +Dangerous builds = 0 + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:02:15 diff --git a/examples/USER/meso/mdpd/log.16Aug17.mdpd.g++.4 b/examples/USER/meso/mdpd/log.16Aug17.mdpd.g++.4 new file mode 100644 index 000000000..ec3d8fbdd --- /dev/null +++ b/examples/USER/meso/mdpd/log.16Aug17.mdpd.g++.4 @@ -0,0 +1,147 @@ +LAMMPS (11 Aug 2017) +######################################################################## +#### 3D droplet oscilation using many-body DPD simulation ### +#### ### +#### Created : Zhen Li (zhen_li@brown.edu) ### +#### Division of Applied Mathematics, Brown University. ### +#### ### +#### mDPD parameters follow the choice of the publication: ### +#### Z. Li et al. "Three dimensional flow structures in a moving ### +#### droplet on substrate: a dissipative particle dynamics study" ### +#### Physics of Fluids, 2013, 25: 072103. DOI: 10.1063/1.4812366 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.3 bin +neigh_modify every 1 delay 0 check yes + +atom_style mdpd + +region mdpd block -25 25 -10 10 -10 10 units box +create_box 1 mdpd +Created orthogonal box = (-25 -10 -10) to (25 10 10) + 4 by 1 by 1 MPI processor grid + +lattice fcc 6 +Lattice spacing in x,y,z = 0.87358 0.87358 0.87358 +region film block -20 20 -7.5 7.5 -2.0 2.0 units box +create_atoms 1 region film +Created 14333 atoms + +pair_style hybrid/overlay mdpd/rhosum mdpd 1.0 1.0 9872598 +pair_coeff 1 1 mdpd/rhosum 0.75 +pair_coeff 1 1 mdpd -40 25 18.0 1.0 0.75 +mass 1 1.0 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 38497 loop local dist gaussian + +fix mvv all mvv/dpd + +dump mydump all atom 100 atom.lammpstrj + +#dump jpg all image 200 image.*.jpg type type zoom 5 adiam 0.5 # view 90 90 box no 0 size 600 200 +#dump_modify jpg pad 4 + +#dump avi all movie 200 movie.avi type type zoom 5 adiam 0.5 # view 90 90 box no 0 size 600 200 +#dump_modify avi pad 4 + +timestep 0.01 +run 4000 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 1.3 + binsize = 0.65, bins = 77 31 31 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair mdpd/rhosum, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard + (2) pair mdpd, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 6.265 | 6.655 | 7.045 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1 -13.346542 0 -11.846647 -6.9757225 + 100 1.0406108 -7.2500697 0 -5.6892624 -0.80306477 + 200 1.0535506 -6.9452928 0 -5.3650772 -0.39911584 + 300 1.0644295 -6.8599907 0 -5.2634577 -0.2997968 + 400 1.0780123 -6.9471342 0 -5.3302286 -0.06274869 + 500 1.0672153 -6.8269984 0 -5.2262872 0.021251762 + 600 1.0634304 -6.8366569 0 -5.2416226 -0.021863333 + 700 1.0544807 -6.8272074 0 -5.2455967 -0.0064688066 + 800 1.0556172 -6.8859788 0 -5.3026634 0.023983333 + 900 1.0436201 -6.9246523 0 -5.3593313 -0.12409618 + 1000 1.0617016 -6.8632331 0 -5.2707919 -0.1145505 + 1100 1.0323831 -6.951554 0 -5.4030874 -0.030031884 + 1200 1.0407785 -6.931048 0 -5.3699892 -0.018362136 + 1300 1.0380953 -6.8785296 0 -5.3214953 -0.099308737 + 1400 1.0418898 -6.8998 0 -5.3370743 -0.14199421 + 1500 1.0487254 -6.9671212 0 -5.3941429 -0.12132644 + 1600 1.0561042 -6.8948881 0 -5.3108424 -0.09627292 + 1700 1.0524479 -6.9531441 0 -5.3745823 -0.11959782 + 1800 1.0541197 -6.9219819 0 -5.3409126 0.032964029 + 1900 1.0531221 -6.8805815 0 -5.3010085 0.030124685 + 2000 1.0531819 -6.8612868 0 -5.2816242 -0.076876781 + 2100 1.0757791 -6.919875 0 -5.3063189 -0.04060439 + 2200 1.069423 -6.9005754 0 -5.2965527 0.015347467 + 2300 1.0403109 -6.9015402 0 -5.3411827 0.0034687897 + 2400 1.0547448 -6.9325539 0 -5.3505471 -0.021202325 + 2500 1.0404195 -6.8494675 0 -5.2889472 0.086947847 + 2600 1.0499828 -6.9861392 0 -5.4112749 -0.018079308 + 2700 1.0294278 -6.8525151 0 -5.3084811 0.16911472 + 2800 1.0220652 -6.8993978 0 -5.366407 0.064820531 + 2900 1.0347904 -6.9322703 0 -5.3801929 -0.11384964 + 3000 1.0391372 -6.9519088 0 -5.3933117 0.003050577 + 3100 1.0335828 -7.0090074 0 -5.4587413 -0.17366664 + 3200 1.0211896 -6.9421289 0 -5.4104513 0.025299853 + 3300 1.0019232 -6.9426488 0 -5.4398688 -0.098334724 + 3400 1.0203541 -6.9310981 0 -5.4006737 -0.0015544982 + 3500 1.0076794 -6.9519932 0 -5.4405796 -0.056956902 + 3600 1.0086525 -6.9620979 0 -5.4492247 0.020014884 + 3700 1.0046112 -7.0011625 0 -5.4943508 -0.083936527 + 3800 1.0096867 -6.9470382 0 -5.4326138 -0.089521759 + 3900 1.0074482 -6.9959414 0 -5.4848745 -0.11873698 + 4000 1.01222 -6.9535694 0 -5.4353454 0.042191466 +Loop time of 63.0327 on 4 procs for 4000 steps with 14333 atoms + +Performance: 54828.695 tau/day, 63.459 timesteps/s +98.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 16.591 | 29.795 | 42.814 | 236.6 | 47.27 +Neigh | 2.0347 | 10.239 | 18.555 | 255.6 | 16.24 +Comm | 0.70099 | 6.0601 | 11.386 | 207.4 | 9.61 +Output | 0.20713 | 0.40902 | 0.61087 | 31.5 | 0.65 +Modify | 0.058089 | 0.27033 | 0.4851 | 40.7 | 0.43 +Other | | 16.26 | | | 25.79 + +Nlocal: 3583.25 ave 7207 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 1055.75 ave 2131 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 100549 ave 202192 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +FullNghs: 201098 ave 404372 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 804390 +Ave neighs/atom = 56.1215 +Neighbor list builds = 1049 +Dangerous builds = 0 + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:01:03 diff --git a/examples/USER/meso/tdpd/cc.profile.16Aug17.tdpd.g++.1 b/examples/USER/meso/tdpd/cc.profile.16Aug17.tdpd.g++.1 new file mode 100644 index 000000000..a87260050 --- /dev/null +++ b/examples/USER/meso/tdpd/cc.profile.16Aug17.tdpd.g++.1 @@ -0,0 +1,24 @@ +# Chunk-averaged data for fix stat and group c_cc2 +# Timestep Number-of-chunks Total-count +# Chunk Coord1 Ncount c_cc1 c_cc2 +100 20 16000 + 1 -9.5 797.17 0.986661 1.0077 + 2 -8.5 802.61 0.967974 1.02003 + 3 -7.5 795.46 0.957045 1.02873 + 4 -6.5 806.46 0.951271 1.03428 + 5 -5.5 802.34 0.94898 1.03692 + 6 -4.5 799.84 0.949378 1.03673 + 7 -3.5 798.4 0.952505 1.03374 + 8 -2.5 800.36 0.959322 1.02778 + 9 -1.5 797.65 0.971516 1.01867 + 10 -0.5 808.88 0.990644 1.00626 + 11 0.5 786.29 1.00924 0.993828 + 12 1.5 807.16 1.02831 0.981436 + 13 2.5 797.54 1.04071 0.972184 + 14 3.5 799.67 1.04749 0.966258 + 15 4.5 799.61 1.05063 0.963256 + 16 5.5 806.11 1.05105 0.963052 + 17 6.5 803.67 1.04877 0.965688 + 18 7.5 797.39 1.04305 0.971187 + 19 8.5 801.85 1.03208 0.97993 + 20 9.5 791.54 1.01351 0.992209 diff --git a/examples/USER/meso/tdpd/cc.profile.16Aug17.tdpd.g++.4 b/examples/USER/meso/tdpd/cc.profile.16Aug17.tdpd.g++.4 new file mode 100644 index 000000000..de34ef26c --- /dev/null +++ b/examples/USER/meso/tdpd/cc.profile.16Aug17.tdpd.g++.4 @@ -0,0 +1,24 @@ +# Chunk-averaged data for fix stat and group c_cc2 +# Timestep Number-of-chunks Total-count +# Chunk Coord1 Ncount c_cc1 c_cc2 +100 20 16000 + 1 -9.5 806.92 0.986675 1.00766 + 2 -8.5 798.01 0.96792 1.02003 + 3 -7.5 805.43 0.956909 1.02883 + 4 -6.5 800.54 0.951207 1.03432 + 5 -5.5 794.14 0.948967 1.03691 + 6 -4.5 799.75 0.949379 1.03672 + 7 -3.5 799.65 0.952492 1.03374 + 8 -2.5 799.94 0.959331 1.02778 + 9 -1.5 800.96 0.971664 1.01861 + 10 -0.5 803.97 0.99074 1.00622 + 11 0.5 800.66 1.00949 0.993673 + 12 1.5 779.22 1.02824 0.981461 + 13 2.5 809.13 1.04056 0.972274 + 14 3.5 805.23 1.04747 0.966272 + 15 4.5 795.95 1.05061 0.96327 + 16 5.5 796.4 1.05105 0.963035 + 17 6.5 806.1 1.04883 0.965621 + 18 7.5 806.41 1.04305 0.971224 + 19 8.5 792.2 1.03211 0.979955 + 20 9.5 799.39 1.01362 0.992156 diff --git a/examples/USER/meso/tdpd/in.tdpd b/examples/USER/meso/tdpd/in.tdpd new file mode 100644 index 000000000..748a4f507 --- /dev/null +++ b/examples/USER/meso/tdpd/in.tdpd @@ -0,0 +1,54 @@ +######################################################################## +### Pure diffusion with a reaction source term analog of a periodic ### +### Poiseuille flow problem using transport DPD (tDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### tDPD system setup follows Fig.1 in the publication: ### +### Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. ### +### "Transport dissipative particle dynamics model for mesoscopic ### +### advection-diffusion-reaction problems. J. Chem. Phys., ### +### 2015, 143: 014101. DOI: 10.1063/1.4923254 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style tdpd 2 + +region tdpd block -10 10 -10 10 -5 5 units box +create_box 1 tdpd +create_atoms 1 random 16000 276438 NULL +mass 1 1.0 +set atom * cc 1 1.0 +set atom * cc 2 1.0 + +pair_style tdpd 1.0 1.58 9872598 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 3.0 1.0E-5 2.0 + +compute mythermo all temp +thermo 50 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/tdpd 0.5 +fix upper1 all tdpd/source 1 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower1 all tdpd/source 1 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 +fix upper2 all tdpd/source 2 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 -0.01 +fix lower2 all tdpd/source 2 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 0.01 + +timestep 0.01 +run 500 +reset_timestep 0 + +compute cc1 all tdpd/cc/atom 1 +compute cc2 all tdpd/cc/atom 2 +compute bin all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 100 100 bin c_cc1 c_cc2 norm sample file cc.profile + +run 100 diff --git a/examples/USER/meso/tdpd/log.16Aug17.tdpd.g++.1 b/examples/USER/meso/tdpd/log.16Aug17.tdpd.g++.1 new file mode 100644 index 000000000..21b618148 --- /dev/null +++ b/examples/USER/meso/tdpd/log.16Aug17.tdpd.g++.1 @@ -0,0 +1,146 @@ +LAMMPS (11 Aug 2017) +######################################################################## +### Pure diffusion with a reaction source term analog of a periodic ### +### Poiseuille flow problem using transport DPD (tDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### tDPD system setup follows Fig.1 in the publication: ### +### Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. ### +### "Transport dissipative particle dynamics model for mesoscopic ### +### advection-diffusion-reaction problems. J. Chem. Phys., ### +### 2015, 143: 014101. DOI: 10.1063/1.4923254 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style tdpd 2 + +region tdpd block -10 10 -10 10 -5 5 units box +create_box 1 tdpd +Created orthogonal box = (-10 -10 -5) to (10 10 5) + 1 by 1 by 1 MPI processor grid +create_atoms 1 random 16000 276438 NULL +Created 16000 atoms +mass 1 1.0 +set atom * cc 1 1.0 + 16000 settings made for cc index 1 +set atom * cc 2 1.0 + 16000 settings made for cc index 2 + +pair_style tdpd 1.0 1.58 9872598 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 3.0 1.0E-5 2.0 + +compute mythermo all temp +thermo 50 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/tdpd 0.5 +fix upper1 all tdpd/source 1 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower1 all tdpd/source 1 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 +fix upper2 all tdpd/source 2 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 -0.01 +fix lower2 all tdpd/source 2 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 0.01 + +timestep 0.01 +run 500 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.78 + ghost atom cutoff = 1.78 + binsize = 0.89, bins = 23 23 12 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair tdpd, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.3 | 11.3 | 11.3 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1 48.948932 0 50.448838 202.19166 + 50 0.99837766 43.949877 0 45.447349 195.80936 + 100 0.99846831 43.756995 0 45.254604 198.22348 + 150 1.0026903 43.72408 0 45.228021 196.61676 + 200 1.0063144 43.722388 0 45.231765 194.17954 + 250 1.0032304 43.721864 0 45.226615 197.85829 + 300 0.9932656 43.703526 0 45.193331 196.57406 + 350 1.0002916 43.720498 0 45.220841 193.55346 + 400 0.99475486 43.722965 0 45.215004 196.81546 + 450 1.0011803 43.712447 0 45.214124 200.46118 + 500 1.0009006 43.708984 0 45.210241 197.38953 +Loop time of 96.0326 on 1 procs for 500 steps with 16000 atoms + +Performance: 4498.474 tau/day, 5.207 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 90.083 | 90.083 | 90.083 | 0.0 | 93.80 +Neigh | 5.049 | 5.049 | 5.049 | 0.0 | 5.26 +Comm | 0.34141 | 0.34141 | 0.34141 | 0.0 | 0.36 +Output | 0.00092816 | 0.00092816 | 0.00092816 | 0.0 | 0.00 +Modify | 0.45991 | 0.45991 | 0.45991 | 0.0 | 0.48 +Other | | 0.09865 | | | 0.10 + +Nlocal: 16000 ave 16000 max 16000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 14091 ave 14091 max 14091 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 749379 ave 749379 max 749379 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 749379 +Ave neighs/atom = 46.8362 +Neighbor list builds = 183 +Dangerous builds = 0 +reset_timestep 0 + +compute cc1 all tdpd/cc/atom 1 +compute cc2 all tdpd/cc/atom 2 +compute bin all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 100 100 bin c_cc1 c_cc2 norm sample file cc.profile + +run 100 +Per MPI rank memory allocation (min/avg/max) = 11.8 | 11.8 | 11.8 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1.0009006 43.708984 0 45.210241 199.3205 + 50 1.0007276 43.704844 0 45.205842 197.77053 + 100 1.0039032 43.714201 0 45.219961 197.31118 +Loop time of 19.0326 on 1 procs for 100 steps with 16000 atoms + +Performance: 4539.577 tau/day, 5.254 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 17.842 | 17.842 | 17.842 | 0.0 | 93.74 +Neigh | 0.98674 | 0.98674 | 0.98674 | 0.0 | 5.18 +Comm | 0.066013 | 0.066013 | 0.066013 | 0.0 | 0.35 +Output | 0.00016284 | 0.00016284 | 0.00016284 | 0.0 | 0.00 +Modify | 0.11795 | 0.11795 | 0.11795 | 0.0 | 0.62 +Other | | 0.02012 | | | 0.11 + +Nlocal: 16000 ave 16000 max 16000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 14126 ave 14126 max 14126 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 748927 ave 748927 max 748927 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 748927 +Ave neighs/atom = 46.8079 +Neighbor list builds = 37 +Dangerous builds = 0 + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:01:55 diff --git a/examples/USER/meso/tdpd/log.16Aug17.tdpd.g++.4 b/examples/USER/meso/tdpd/log.16Aug17.tdpd.g++.4 new file mode 100644 index 000000000..6cd99168f --- /dev/null +++ b/examples/USER/meso/tdpd/log.16Aug17.tdpd.g++.4 @@ -0,0 +1,146 @@ +LAMMPS (11 Aug 2017) +######################################################################## +### Pure diffusion with a reaction source term analog of a periodic ### +### Poiseuille flow problem using transport DPD (tDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### tDPD system setup follows Fig.1 in the publication: ### +### Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. ### +### "Transport dissipative particle dynamics model for mesoscopic ### +### advection-diffusion-reaction problems. J. Chem. Phys., ### +### 2015, 143: 014101. DOI: 10.1063/1.4923254 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style tdpd 2 + +region tdpd block -10 10 -10 10 -5 5 units box +create_box 1 tdpd +Created orthogonal box = (-10 -10 -5) to (10 10 5) + 2 by 2 by 1 MPI processor grid +create_atoms 1 random 16000 276438 NULL +Created 16000 atoms +mass 1 1.0 +set atom * cc 1 1.0 + 16000 settings made for cc index 1 +set atom * cc 2 1.0 + 16000 settings made for cc index 2 + +pair_style tdpd 1.0 1.58 9872598 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 3.0 1.0E-5 2.0 + +compute mythermo all temp +thermo 50 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/tdpd 0.5 +fix upper1 all tdpd/source 1 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower1 all tdpd/source 1 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 +fix upper2 all tdpd/source 2 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 -0.01 +fix lower2 all tdpd/source 2 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 0.01 + +timestep 0.01 +run 500 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.78 + ghost atom cutoff = 1.78 + binsize = 0.89, bins = 23 23 12 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair tdpd, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.814 | 4.823 | 4.829 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1 48.948932 0 50.448838 199.65978 + 50 1.0153476 43.948796 0 45.471722 198.3346 + 100 1.0064284 43.754875 0 45.264424 197.5308 + 150 0.99609985 43.726751 0 45.220807 197.50623 + 200 1.0016604 43.720283 0 45.22268 197.81129 + 250 1.0054979 43.718568 0 45.22672 195.79405 + 300 0.9997618 43.716617 0 45.216166 197.84788 + 350 0.99170101 43.72093 0 45.208389 196.07711 + 400 1.0043692 43.71648 0 45.22294 199.55247 + 450 1.0086263 43.709988 0 45.222833 198.20516 + 500 1.0029076 43.717879 0 45.222146 197.26281 +Loop time of 24.5533 on 4 procs for 500 steps with 16000 atoms + +Performance: 17594.412 tau/day, 20.364 timesteps/s +99.9% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 22.236 | 22.418 | 22.736 | 4.0 | 91.30 +Neigh | 1.2759 | 1.2883 | 1.3077 | 1.1 | 5.25 +Comm | 0.35749 | 0.69526 | 0.88462 | 24.1 | 2.83 +Output | 0.00043321 | 0.00050318 | 0.00070691 | 0.0 | 0.00 +Modify | 0.11555 | 0.11648 | 0.11888 | 0.4 | 0.47 +Other | | 0.03473 | | | 0.14 + +Nlocal: 4000 ave 4012 max 3982 min +Histogram: 1 0 0 0 0 1 0 0 0 2 +Nghost: 5986.25 ave 6016 max 5956 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Neighs: 187309 ave 188264 max 186087 min +Histogram: 1 0 0 0 1 0 0 1 0 1 + +Total # of neighbors = 749235 +Ave neighs/atom = 46.8272 +Neighbor list builds = 180 +Dangerous builds = 0 +reset_timestep 0 + +compute cc1 all tdpd/cc/atom 1 +compute cc2 all tdpd/cc/atom 2 +compute bin all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 100 100 bin c_cc1 c_cc2 norm sample file cc.profile + +run 100 +Per MPI rank memory allocation (min/avg/max) = 5.065 | 5.074 | 5.082 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 1.0029076 43.717879 0 45.222146 198.45789 + 50 1.0077982 43.713264 0 45.224867 196.56183 + 100 1.0036823 43.708022 0 45.213451 196.00815 +Loop time of 4.79577 on 4 procs for 100 steps with 16000 atoms + +Performance: 18015.870 tau/day, 20.852 timesteps/s +99.9% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 4.3481 | 4.39 | 4.4398 | 1.7 | 91.54 +Neigh | 0.25477 | 0.25675 | 0.25963 | 0.4 | 5.35 +Comm | 0.059327 | 0.11194 | 0.15608 | 11.0 | 2.33 +Output | 0.00011206 | 0.00011748 | 0.00011992 | 0.0 | 0.00 +Modify | 0.030417 | 0.030622 | 0.030739 | 0.1 | 0.64 +Other | | 0.006301 | | | 0.13 + +Nlocal: 4000 ave 4010 max 3987 min +Histogram: 1 0 0 0 0 1 1 0 0 1 +Nghost: 5985.25 ave 6025 max 5959 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Neighs: 187304 ave 188092 max 186449 min +Histogram: 1 0 0 0 0 2 0 0 0 1 + +Total # of neighbors = 749216 +Ave neighs/atom = 46.826 +Neighbor list builds = 38 +Dangerous builds = 0 + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:00:29 diff --git a/src/Makefile b/src/Makefile index 3b67d2284..91d65a11c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,385 +1,386 @@ # LAMMPS multiple-machine -*- Makefile -*- SHELL = /bin/bash PYTHON = python #.IGNORE: # Definitions ROOT = lmp EXE = lmp_$@ ARLIB = liblammps_$@.a SHLIB = liblammps_$@.so ARLINK = liblammps.a SHLINK = liblammps.so OBJDIR = Obj_$@ OBJSHDIR = Obj_shared_$@ SRC = $(wildcard *.cpp) INC = $(wildcard *.h) OBJ = $(SRC:.cpp=.o) SRCLIB = $(filter-out main.cpp,$(SRC)) OBJLIB = $(filter-out main.o,$(OBJ)) # Command-line options for mode: exe (default), shexe, lib, shlib mode = exe objdir = $(OBJDIR) ifeq ($(mode),shexe) objdir = $(OBJSHDIR) endif ifeq ($(mode),lib) objdir = $(OBJDIR) endif ifeq ($(mode),shlib) objdir = $(OBJSHDIR) endif # Package variables # PACKAGE = standard packages # PACKUSER = user packagse # PACKLIB = all packages that require an additional lib # should be PACKSYS + PACKINT + PACKEXT # PACKSYS = subset that reqiure a common system library # include MPIIO and LB b/c require full MPI, not just STUBS # PACKINT = subset that require an internal (provided) library # PACKEXT = subset that require an external (downloaded) library PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \ granular kim kokkos kspace manybody mc meam misc molecule \ mpiio mscg opt peri poems \ python qeq reax replica rigid shock snap srd voronoi PACKUSER = user-atc user-awpmd user-cgdna user-cgsdk user-colvars \ user-diffraction user-dpd user-drude user-eff user-fep user-h5md \ - user-intel user-lb user-manifold user-meamc user-mgpt user-misc user-molfile \ + user-intel user-lb user-manifold user-meamc user-meso \ + user-mgpt user-misc user-molfile \ user-netcdf user-omp user-phonon user-qmmm user-qtb \ user-quip user-reaxc user-smd user-smtbq user-sph user-tally \ user-vtk PACKLIB = compress gpu kim kokkos meam mpiio mscg poems \ python reax voronoi \ user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \ user-netcdf user-qmmm user-quip user-smd user-vtk PACKSYS = compress mpiio python user-lb PACKINT = gpu kokkos meam poems reax user-atc user-awpmd user-colvars PACKEXT = kim mscg voronoi \ user-h5md user-molfile user-netcdf user-qmmm user-quip \ user-smd user-vtk PACKALL = $(PACKAGE) $(PACKUSER) PACKAGEUC = $(shell echo $(PACKAGE) | tr a-z A-Z) PACKUSERUC = $(shell echo $(PACKUSER) | tr a-z A-Z) YESDIR = $(shell echo $(@:yes-%=%) | tr a-z A-Z) NODIR = $(shell echo $(@:no-%=%) | tr a-z A-Z) LIBDIR = $(shell echo $(@:lib-%=%)) LIBUSERDIR = $(shell echo $(@:lib-user-%=%)) # List of all targets help: @echo '' @echo 'make clean-all delete all object files' @echo 'make clean-machine delete object files for one machine' @echo 'make mpi-stubs build dummy MPI library in STUBS' @echo 'make install-python install LAMMPS wrapper in Python' @echo 'make tar create lmp_src.tar.gz for src dir and packages' @echo '' @echo 'make package list available packages and their dependencies' @echo 'make package-status (ps) status of all packages' @echo 'make yes-package install a single pgk in src dir' @echo 'make no-package remove a single pkg from src dir' @echo 'make yes-all install all pgks in src dir' @echo 'make no-all remove all pkgs from src dir' @echo 'make yes-standard (yes-std) install all standard pkgs' @echo 'make no-standard (no-std) remove all standard pkgs' @echo 'make yes-user install all user pkgs' @echo 'make no-user remove all user pkgs' @echo 'make yes-lib install all pkgs with libs (included or ext)' @echo 'make no-lib remove all pkgs with libs (included or ext)' @echo 'make yes-ext install all pkgs with external libs' @echo 'make no-ext remove all pkgs with external libs' @echo '' @echo 'make package-update (pu) replace src files with updated package files' @echo 'make package-overwrite replace package files with src files' @echo 'make package-diff (pd) diff src files against package files' @echo '' @echo 'make lib-package help for download/build/install a package library' @echo 'make lib-package args="..." download/build/install a package library' @echo 'make purge purge obsolete copies of source files' @echo '' @echo 'make machine build LAMMPS for machine' @echo 'make mode=lib machine build LAMMPS as static lib for machine' @echo 'make mode=shlib machine build LAMMPS as shared lib for machine' @echo 'make mode=shexe machine build LAMMPS as shared exe for machine' @echo 'make makelist create Makefile.list used by old makes' @echo 'make -f Makefile.list machine build LAMMPS for machine (old)' @echo '' @echo 'machine is one of these from src/MAKE:' @echo '' @files="`ls MAKE/Makefile.*`"; \ for file in $$files; do head -1 $$file; done @echo '' @echo '... or one of these from src/MAKE/OPTIONS:' @echo '' @files="`ls MAKE/OPTIONS/Makefile.*`"; \ for file in $$files; do head -1 $$file; done @echo '' @echo '... or one of these from src/MAKE/MACHINES:' @echo '' @files="`ls MAKE/MACHINES/Makefile.*`"; \ for file in $$files; do head -1 $$file; done @echo '' @echo '... or one of these from src/MAKE/MINE:' @echo '' @files="`ls MAKE/MINE/Makefile.* 2>/dev/null`"; \ for file in $$files; do head -1 $$file; done @echo '' # Build LAMMPS in one of 4 modes # exe = exe with static compile in Obj_machine (default) # shexe = exe with shared compile in Obj_shared_machine # lib = static lib in Obj_machine # shlib = shared lib in Obj_shared_machine .DEFAULT: @if [ $@ = "serial" -a ! -f STUBS/libmpi_stubs.a ]; \ then $(MAKE) mpi-stubs; fi @test -f MAKE/Makefile.$@ -o -f MAKE/OPTIONS/Makefile.$@ -o \ -f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@ @if [ ! -d $(objdir) ]; then mkdir $(objdir); fi @$(SHELL) Make.sh style @if [ -f MAKE/MACHINES/Makefile.$@ ]; \ then cp MAKE/MACHINES/Makefile.$@ $(objdir)/Makefile; fi @if [ -f MAKE/OPTIONS/Makefile.$@ ]; \ then cp MAKE/OPTIONS/Makefile.$@ $(objdir)/Makefile; fi @if [ -f MAKE/Makefile.$@ ]; \ then cp MAKE/Makefile.$@ $(objdir)/Makefile; fi @if [ -f MAKE/MINE/Makefile.$@ ]; \ then cp MAKE/MINE/Makefile.$@ $(objdir)/Makefile; fi @if [ ! -e Makefile.package ]; \ then cp Makefile.package.empty Makefile.package; fi @if [ ! -e Makefile.package.settings ]; \ then cp Makefile.package.settings.empty Makefile.package.settings; fi @cp Makefile.package Makefile.package.settings $(objdir) @cd $(objdir); rm -f .depend; \ $(MAKE) $(MFLAGS) "SRC = $(SRC)" "INC = $(INC)" depend || : ifeq ($(mode),exe) @cd $(objdir); \ $(MAKE) $(MFLAGS) "OBJ = $(OBJ)" "INC = $(INC)" "SHFLAGS =" \ "EXE = ../$(EXE)" ../$(EXE) endif ifeq ($(mode),shexe) @cd $(objdir); \ $(MAKE) $(MFLAGS) "OBJ = $(OBJ)" "INC = $(INC)" \ "EXE = ../$(EXE)" ../$(EXE) endif ifeq ($(mode),lib) @cd $(objdir); \ $(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" "SHFLAGS =" \ "EXE = ../$(ARLIB)" lib @rm -f $(ARLINK) @ln -s $(ARLIB) $(ARLINK) endif ifeq ($(mode),shlib) @cd $(objdir); \ $(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" \ "EXE = ../$(SHLIB)" shlib @rm -f $(SHLINK) @ln -s $(SHLIB) $(SHLINK) endif # Remove machine-specific object files clean: @echo 'make clean-all delete all object files' @echo 'make clean-machine delete object files for one machine' clean-all: rm -rf Obj_* clean-%: rm -rf Obj_$(@:clean-%=%) Obj_shared_$(@:clean-%=%) # Create Makefile.list makelist: @$(SHELL) Make.sh style @$(SHELL) Make.sh Makefile.list # Make MPI STUBS library mpi-stubs: @cd STUBS; $(MAKE) clean; $(MAKE) # install LAMMPS shared lib and Python wrapper for Python usage # include python package settings to # automatically adapt name of python interpreter sinclude ../lib/python/Makefile.lammps install-python: @$(PYTHON) ../python/install.py # Create a tarball of src dir and packages tar: @cd STUBS; $(MAKE) clean @cd ..; tar cvzf src/$(ROOT)_src.tar.gz \ src/Make* src/Package.sh src/Depend.sh src/Install.sh \ src/MAKE src/DEPEND src/*.cpp src/*.h src/STUBS \ $(patsubst %,src/%,$(PACKAGEUC)) $(patsubst %,src/%,$(PACKUSERUC)) \ --exclude=*/.svn @cd STUBS; $(MAKE) @echo "Created $(ROOT)_src.tar.gz" # Package management package: @echo 'Standard packages:' $(PACKAGE) @echo '' @echo 'User-contributed packages:' $(PACKUSER) @echo '' @echo 'Packages that need system libraries:' $(PACKSYS) @echo '' @echo 'Packages that need provided libraries:' $(PACKINT) @echo '' @echo 'Packages that need external libraries:' $(PACKEXT) @echo '' @echo 'make package list available packages' @echo 'make package list available packages' @echo 'make package-status (ps) status of all packages' @echo 'make yes-package install a single pgk in src dir' @echo 'make no-package remove a single pkg from src dir' @echo 'make yes-all install all pgks in src dir' @echo 'make no-all remove all pkgs from src dir' @echo 'make yes-standard (yes-std) install all standard pkgs' @echo 'make no-standard (no-srd) remove all standard pkgs' @echo 'make yes-user install all user pkgs' @echo 'make no-user remove all user pkgs' @echo 'make yes-lib install all pkgs with libs (included or ext)' @echo 'make no-lib remove all pkgs with libs (included or ext)' @echo 'make yes-ext install all pkgs with external libs' @echo 'make no-ext remove all pkgs with external libs' @echo '' @echo 'make package-update (pu) replace src files with package files' @echo 'make package-overwrite replace package files with src files' @echo 'make package-diff (pd) diff src files against package file' @echo '' @echo 'make lib-package build and/or download a package library' yes-all: @for p in $(PACKALL); do $(MAKE) yes-$$p; done no-all: @for p in $(PACKALL); do $(MAKE) no-$$p; done yes-standard yes-std: @for p in $(PACKAGE); do $(MAKE) yes-$$p; done no-standard no-std: @for p in $(PACKAGE); do $(MAKE) no-$$p; done yes-user: @for p in $(PACKUSER); do $(MAKE) yes-$$p; done no-user: @for p in $(PACKUSER); do $(MAKE) no-$$p; done yes-lib: @for p in $(PACKLIB); do $(MAKE) yes-$$p; done no-lib: @for p in $(PACKLIB); do $(MAKE) no-$$p; done yes-ext: @for p in $(PACKEXT); do $(MAKE) yes-$$p; done no-ext: @for p in $(PACKEXT); do $(MAKE) no-$$p; done yes-%: @if [ ! -e Makefile.package ]; \ then cp Makefile.package.empty Makefile.package; fi @if [ ! -e Makefile.package.settings ]; \ then cp Makefile.package.settings.empty Makefile.package.settings; fi @if [ ! -e $(YESDIR) ]; then \ echo "Package $(@:yes-%=%) does not exist"; \ elif [ -e $(YESDIR)/Install.sh ]; then \ echo "Installing package $(@:yes-%=%)"; \ cd $(YESDIR); $(SHELL) Install.sh 1; cd ..; \ $(SHELL) Depend.sh $(YESDIR) 1; \ else \ echo "Installing package $(@:yes-%=%)"; \ cd $(YESDIR); $(SHELL) ../Install.sh 1; cd ..; \ $(SHELL) Depend.sh $(YESDIR) 1; \ fi; no-%: @if [ ! -e $(NODIR) ]; then \ echo "Package $(@:no-%=%) does not exist"; \ elif [ -e $(NODIR)/Install.sh ]; then \ echo "Uninstalling package $(@:no-%=%)"; \ cd $(NODIR); $(SHELL) Install.sh 0; cd ..; \ $(SHELL) Depend.sh $(NODIR) 0; \ else \ echo "Uninstalling package $(@:no-%=%)"; \ cd $(NODIR); $(SHELL) ../Install.sh 0; cd ..; \ $(SHELL) Depend.sh $(NODIR) 0; \ fi; # download/build/install a package library # update the timestamp on main.cpp to trigger a relink with "make machine" lib-%: @if [ -e ../lib/$(LIBDIR)/Install.py ]; then \ echo "Installing lib $(@:lib-%=%)"; \ ( cd ../lib/$(LIBDIR); $(PYTHON) Install.py $(args) ); \ elif [ -e ../lib/$(LIBUSERDIR)/Install.py ]; then \ echo "Installing lib $(@:lib-user-%=%)"; \ ( cd ../lib/$(LIBUSERDIR); $(PYTHON) Install.py $(args) ); \ else \ echo "Install script for lib $(@:lib-%=%) does not exist"; \ fi; touch main.cpp # status = list src files that differ from package files # update = replace src files with newer package files # overwrite = overwrite package files with newer src files # diff = show differences between src and package files # purge = delete obsolete and auto-generated package files package-status ps: @for p in $(PACKAGEUC); do $(SHELL) Package.sh $$p status; done @echo '' @for p in $(PACKUSERUC); do $(SHELL) Package.sh $$p status; done package-update pu: @for p in $(PACKAGEUC); do $(SHELL) Package.sh $$p update; done @echo '' @for p in $(PACKUSERUC); do $(SHELL) Package.sh $$p update; done package-overwrite: @for p in $(PACKAGEUC); do $(SHELL) Package.sh $$p overwrite; done @echo '' @for p in $(PACKUSERUC); do $(SHELL) Package.sh $$p overwrite; done package-diff pd: @for p in $(PACKAGEUC); do $(SHELL) Package.sh $$p diff; done @echo '' @for p in $(PACKUSERUC); do $(SHELL) Package.sh $$p diff; done purge: Purge.list @echo 'Purging obsolete and auto-generated source files' @for f in `grep -v '#' Purge.list` ; \ do test -f $$f && rm $$f && echo $$f || : ; \ done diff --git a/src/USER-MESO/README b/src/USER-MESO/README new file mode 100644 index 000000000..0119fdb9f --- /dev/null +++ b/src/USER-MESO/README @@ -0,0 +1,50 @@ +This package implements three extensions of the dissipative particle +dynamics (DPD) method, i.e., energy-conserving DPD (eDPD) that can +model non-isothermal processes, many-body DPD (mDPD) for simulating +vapor-liquid coexistence, and transport DPD (tDPD) for modeling +advection-diffuion-reaction systems. The equations of motion of these +DPD extensions are integrated through the modified velocity-Verlet +(MVV) algorithm. + +Currently, the package has the following features: + +* Three new atom styles (eDPD, mDPD, tDPD) for tracking the particles + with internal temperature, local mass density, and chemical + concentration. + +* Three set commands (edpd/temp, edpd/cv, cc) for setting internal + temperature (edpd/temp) and heat capacity (edpd/cv) for eDPD + particles and for setting chemical concentration (cc) for tDPD + particles. + +* Two compute commands (edpd/temp/atom, tdpd/cc/atom) for accessing + the internal temperature of eDPD particles and the chemical + concentration of tDPD particles. + +* Three fix commands (mvv/dpd, mvv/edpd, mvv/tdpd) for integrating the + shochastic ODEs using the modified velocity-Verlet (MVV) algorithm. + +* Two fix commands (edpd/source, tdpd/source) for adding additional + heat source/sink or chemical concentration source/sink to eDPD and + tDPD particles. + +* One pair style (edpd) for modeling a eDPD fluid. + +* Two pair styles (mdpd/rhosum, mdpd) for modeling a mDPD fluid. + +* One pair style (tdpd) for modeling a tDPD fluid. + +See the doc pages for "atom style edpd", "atom style mdpd", "atom +style tdpd", "set edpd/temp", "set edpd/cv", "set tdpd/cc", "compute +edpd/temp/atom", "compute tdpd/cc/atom", "fix mvv/dpd", "fix +mvv/edpd", "fix mvv/tdpd", "fix edpd/source", "fix tdpd/source", "pair +edpd", "pair mdpd/rhosum", "pair mdpd", "pair tdpd" commands to get +started. At the bottom of the doc pages are many links to additional +documentation contained in the doc/USER/meso directory. + +There are example scripts for using this package in +examples/USER/meso. + +The person who created this package is Zhen Li (zhen_li at brown.edu) +at Division of Applied Mathematics, Brown University, USA. Contact him +directly if you have questions. diff --git a/src/USER-MESO/atom_vec_edpd.cpp b/src/USER-MESO/atom_vec_edpd.cpp new file mode 100644 index 000000000..635743cc9 --- /dev/null +++ b/src/USER-MESO/atom_vec_edpd.cpp @@ -0,0 +1,844 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ +#include +#include +#include "atom_vec_edpd.h" +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "modify.h" +#include "fix.h" +#include "update.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +AtomVecEDPD::AtomVecEDPD(LAMMPS *lmp) : AtomVec(lmp) +{ + if(strcmp(update->unit_style,"lj") != 0) + error->all(FLERR,"Atom style edpd requires lj units"); + + molecular = 0; + mass_type = 1; + forceclearflag = 1; + + comm_x_only = comm_f_only = 0; + comm->ghost_velocity = 1; + + size_forward = 3 + 5; // edpd_temp + vest[4] + size_reverse = 3 + 1; // edpd_flux + size_border = 6 + 6; // edpd_temp + edpd_cv + vest[4] + size_velocity = 3; + size_data_atom = 5 + 2; // we read id + type + edpd_temp + edpd_cv + xyz[3] + size_data_vel = 4; + xcol_data = 5; + + atom->edpd_flag = 1; + atom->vest_flag = 1; +} + +/* ---------------------------------------------------------------------- + grow atom arrays + n = 0 grows arrays by a chunk + n > 0 allocates arrays to size n +------------------------------------------------------------------------- */ + +void AtomVecEDPD::grow(int n) +{ + if (n == 0) grow_nmax(); + else nmax = n; + atom->nmax = nmax; + if (nmax < 0 || nmax > MAXSMALLINT) + error->one(FLERR,"Per-processor system is too big"); + + tag = memory->grow(atom->tag,nmax,"atom:tag"); + type = memory->grow(atom->type,nmax,"atom:type"); + mask = memory->grow(atom->mask,nmax,"atom:mask"); + image = memory->grow(atom->image,nmax,"atom:image"); + x = memory->grow(atom->x,nmax,3,"atom:x"); + v = memory->grow(atom->v,nmax,3,"atom:v"); + f = memory->grow(atom->f,nmax*comm->nthreads,3,"atom:f"); + edpd_cv= memory->grow(atom->edpd_cv, nmax, "atom:edpd_cv"); + edpd_temp = memory->grow(atom->edpd_temp, nmax, "atom:edpd_temp"); + edpd_flux = memory->grow(atom->edpd_flux, nmax*comm->nthreads,"atom:edpd_flux"); + vest = memory->grow(atom->vest, nmax, 4, "atom:vest"); + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); +} + +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecEDPD::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + edpd_cv = atom->cv; edpd_temp = atom->edpd_temp; edpd_flux = atom->edpd_flux; + vest = atom->vest; +} + +/* ---------------------------------------------------------------------- + copy atom I info to atom J +------------------------------------------------------------------------- */ + +void AtomVecEDPD::copy(int i, int j, int delflag) +{ + tag[j] = tag[i]; + type[j] = type[i]; + mask[j] = mask[i]; + image[j] = image[i]; + x[j][0] = x[i][0]; + x[j][1] = x[i][1]; + x[j][2] = x[i][2]; + v[j][0] = v[i][0]; + v[j][1] = v[i][1]; + v[j][2] = v[i][2]; + + edpd_temp[j] = edpd_temp[i]; + edpd_flux[j] = edpd_flux[i]; + edpd_cv[j] = edpd_cv[i]; + vest[j][0] = vest[i][0]; + vest[j][1] = vest[i][1]; + vest[j][2] = vest[i][2]; + vest[j][3] = vest[i][3]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); +} + + +void AtomVecEDPD::force_clear(int n, size_t nbytes) +{ + memset(&edpd_flux[n],0,nbytes); +} + + +/* ---------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,k,m; + double dx,dy,dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = edpd_temp[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]*domain->xprd + pbc[5]*domain->xy + pbc[4]*domain->xz; + dy = pbc[1]*domain->yprd + pbc[3]*domain->yz; + dz = pbc[2]*domain->zprd; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = edpd_temp[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_comm_vel(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,k,m; + double dx,dy,dz,dvx,dvy,dvz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = edpd_temp[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]*domain->xprd + pbc[5]*domain->xy + pbc[4]*domain->xz; + dy = pbc[1]*domain->yprd + pbc[3]*domain->yz; + dz = pbc[2]*domain->zprd; + } + if (!deform_vremap) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = edpd_temp[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } else { + dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; + dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; + dvz = pbc[2]*h_rate[2]; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + if (mask[i] & deform_groupbit) { + buf[m++] = v[j][0] + dvx; + buf[m++] = v[j][1] + dvy; + buf[m++] = v[j][2] + dvz; + } else { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + } + buf[m++] = edpd_temp[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecEDPD::unpack_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + edpd_temp[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + vest[i][3] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecEDPD::unpack_comm_vel(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + v[i][0] = buf[m++]; + v[i][1] = buf[m++]; + v[i][2] = buf[m++]; + edpd_temp[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + vest[i][3] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_reverse(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = f[i][0]; + buf[m++] = f[i][1]; + buf[m++] = f[i][2]; + buf[m++] = edpd_flux[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecEDPD::unpack_reverse(int n, int *list, double *buf) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + f[j][0] += buf[m++]; + f[j][1] += buf[m++]; + f[j][2] += buf[m++]; + edpd_flux[j] += buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_border(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,m; + double dx,dy,dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = edpd_temp[j]; + buf[m++] = edpd_cv[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]; + dy = pbc[1]; + dz = pbc[2]; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = edpd_temp[j]; + buf[m++] = edpd_cv[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_border_vel(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,m; + double dx,dy,dz,dvx,dvy,dvz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = edpd_temp[j]; + buf[m++] = edpd_cv[j]; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]; + dy = pbc[1]; + dz = pbc[2]; + } + if (!deform_vremap) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = edpd_temp[j]; + buf[m++] = edpd_cv[j]; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } else { + dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; + dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; + dvz = pbc[2]*h_rate[2]; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = edpd_temp[j]; + buf[m++] = edpd_cv[j]; + if (mask[i] & deform_groupbit) { + buf[m++] = v[j][0] + dvx; + buf[m++] = v[j][1] + dvy; + buf[m++] = v[j][2] + dvz; + buf[m++] = vest[j][0] + dvx; + buf[m++] = vest[j][1] + dvy; + buf[m++] = vest[j][2] + dvz; + buf[m++] = vest[j][3]; + } else { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + buf[m++] = vest[j][3]; + } + } + } + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecEDPD::unpack_border(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (i == nmax) grow(0); + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + tag[i] = (tagint) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + edpd_temp[i] = buf[m++]; + edpd_cv[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + vest[i][3] = buf[m++]; + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]-> + unpack_border(n,first,&buf[m]); +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecEDPD::unpack_border_vel(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (i == nmax) grow(0); + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + tag[i] = (tagint) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + edpd_temp[i] = buf[m++]; + edpd_cv[i] = buf[m++]; + v[i][0] = buf[m++]; + v[i][1] = buf[m++]; + v[i][2] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + vest[i][3] = buf[m++]; + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]-> + unpack_border(n,first,&buf[m]); +} + +/* ---------------------------------------------------------------------- + pack data for atom I for sending to another proc + xyz must be 1st 3 values, so comm::exchange() can test on them +------------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_exchange(int i, double *buf) +{ + int m = 1; + buf[m++] = x[i][0]; + buf[m++] = x[i][1]; + buf[m++] = x[i][2]; + buf[m++] = v[i][0]; + buf[m++] = v[i][1]; + buf[m++] = v[i][2]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; + buf[m++] = edpd_temp[i]; + buf[m++] = edpd_cv[i]; + buf[m++] = vest[i][0]; + buf[m++] = vest[i][1]; + buf[m++] = vest[i][2]; + buf[m++] = vest[i][3]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf[m]); + + buf[0] = m; + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecEDPD::unpack_exchange(double *buf) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + int m = 1; + x[nlocal][0] = buf[m++]; + x[nlocal][1] = buf[m++]; + x[nlocal][2] = buf[m++]; + v[nlocal][0] = buf[m++]; + v[nlocal][1] = buf[m++]; + v[nlocal][2] = buf[m++]; + tag[nlocal] = (tagint) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (imageint) ubuf(buf[m++]).i; + edpd_temp[nlocal] = buf[m++]; + edpd_cv[nlocal] = buf[m++]; + vest[nlocal][0] = buf[m++]; + vest[nlocal][1] = buf[m++]; + vest[nlocal][2] = buf[m++]; + vest[nlocal][3] = buf[m++]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + m += modify->fix[atom->extra_grow[iextra]]-> + unpack_exchange(nlocal,&buf[m]); + + atom->nlocal++; + return m; +} + +/* ---------------------------------------------------------------------- + size of restart data for all atoms owned by this proc + include extra data stored by fixes +------------------------------------------------------------------------- */ + +int AtomVecEDPD::size_restart() +{ + int i; + + int nlocal = atom->nlocal; + int n = (11 + 6) * nlocal; // 11 + edpd_temp + edpd_cv + vest[4] + + if (atom->nextra_restart) + for (int iextra = 0; iextra < atom->nextra_restart; iextra++) + for (i = 0; i < nlocal; i++) + n += modify->fix[atom->extra_restart[iextra]]->size_restart(i); + + return n; +} + +/* ---------------------------------------------------------------------- + pack atom I's data for restart file including extra quantities + xyz must be 1st 3 values, so that read_restart can test on them + molecular types may be negative, but write as positive +------------------------------------------------------------------------- */ + +int AtomVecEDPD::pack_restart(int i, double *buf) +{ + int m = 1; + buf[m++] = x[i][0]; + buf[m++] = x[i][1]; + buf[m++] = x[i][2]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; + buf[m++] = v[i][0]; + buf[m++] = v[i][1]; + buf[m++] = v[i][2]; + buf[m++] = edpd_temp[i]; + buf[m++] = edpd_cv[i]; + buf[m++] = vest[i][0]; + buf[m++] = vest[i][1]; + buf[m++] = vest[i][2]; + buf[m++] = vest[i][3]; + + if (atom->nextra_restart) + for (int iextra = 0; iextra < atom->nextra_restart; iextra++) + m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i,&buf[m]); + + buf[0] = m; + return m; +} + +/* ---------------------------------------------------------------------- + unpack data for one atom from restart file including extra quantities +------------------------------------------------------------------------- */ + +int AtomVecEDPD::unpack_restart(double *buf) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) { + grow(0); + if (atom->nextra_store) + memory->grow(atom->extra,nmax,atom->nextra_store,"atom:extra"); + } + + int m = 1; + x[nlocal][0] = buf[m++]; + x[nlocal][1] = buf[m++]; + x[nlocal][2] = buf[m++]; + tag[nlocal] = (tagint) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (imageint) ubuf(buf[m++]).i; + v[nlocal][0] = buf[m++]; + v[nlocal][1] = buf[m++]; + v[nlocal][2] = buf[m++]; + + edpd_temp[nlocal] = buf[m++]; + edpd_cv[nlocal]= buf[m++]; + vest[nlocal][0] = buf[m++]; + vest[nlocal][1] = buf[m++]; + vest[nlocal][2] = buf[m++]; + vest[nlocal][3] = buf[m++]; + + double **extra = atom->extra; + if (atom->nextra_store) { + int size = static_cast (buf[0]) - m; + for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++]; + } + + atom->nlocal++; + return m; +} + +/* ---------------------------------------------------------------------- + create one atom of itype at coord + set other values to defaults +------------------------------------------------------------------------- */ + +void AtomVecEDPD::create_atom(int itype, double *coord) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + tag[nlocal] = 0; + type[nlocal] = itype; + x[nlocal][0] = coord[0]; + x[nlocal][1] = coord[1]; + x[nlocal][2] = coord[2]; + mask[nlocal] = 1; + image[nlocal] = ((imageint) IMGMAX << IMG2BITS) | + ((imageint) IMGMAX << IMGBITS) | IMGMAX; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + + edpd_temp[nlocal] = 1.0; + edpd_flux[nlocal] = 0.0; + edpd_cv[nlocal]= 1.0E5; + vest[nlocal][0] = 0.0; + vest[nlocal][1] = 0.0; + vest[nlocal][2] = 0.0; + vest[nlocal][3] = edpd_temp[nlocal]; + + atom->nlocal++; +} + +/* ---------------------------------------------------------------------- + unpack one line from Atoms section of data file + initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecEDPD::data_atom(double *coord, imageint imagetmp, char **values) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + tag[nlocal] = ATOTAGINT(values[0]); + type[nlocal] = atoi(values[1]); + if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes) + error->one(FLERR,"Invalid atom type in Atoms section of data file"); + + edpd_temp[nlocal] = atof(values[2]); + edpd_cv[nlocal] = atof(values[3]); + + x[nlocal][0] = coord[0]; + x[nlocal][1] = coord[1]; + x[nlocal][2] = coord[2]; + + image[nlocal] = imagetmp; + + mask[nlocal] = 1; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + + vest[nlocal][0] = 0.0; + vest[nlocal][1] = 0.0; + vest[nlocal][2] = 0.0; + vest[nlocal][3] = edpd_temp[nlocal]; + edpd_flux[nlocal] = 0.0; + + atom->nlocal++; +} + +/* ---------------------------------------------------------------------- + pack atom info for data file including 3 image flags +------------------------------------------------------------------------- */ + +void AtomVecEDPD::pack_data(double **buf) +{ + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; + buf[i][2] = edpd_temp[i]; + buf[i][3] = edpd_cv[i]; + buf[i][4] = x[i][0]; + buf[i][5] = x[i][1]; + buf[i][6] = x[i][2]; + buf[i][7] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; + } +} + +/* ---------------------------------------------------------------------- + write atom info to data file including 3 image flags +------------------------------------------------------------------------- */ + +void AtomVecEDPD::write_data(FILE *fp, int n, double **buf) +{ + for (int i = 0; i < n; i++) + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", + (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4],buf[i][5],buf[i][6], + (int) ubuf(buf[i][7]).i,(int) ubuf(buf[i][8]).i,(int) ubuf(buf[i][9]).i); +} + +/* ---------------------------------------------------------------------- + return # of bytes of allocated memory +------------------------------------------------------------------------- */ + +bigint AtomVecEDPD::memory_usage() +{ + bigint bytes = 0; + + if (atom->memcheck("tag")) bytes += memory->usage(tag,nmax); + if (atom->memcheck("type")) bytes += memory->usage(type,nmax); + if (atom->memcheck("mask")) bytes += memory->usage(mask,nmax); + if (atom->memcheck("image")) bytes += memory->usage(image,nmax); + if (atom->memcheck("x")) bytes += memory->usage(x,nmax,3); + if (atom->memcheck("v")) bytes += memory->usage(v,nmax,3); + if (atom->memcheck("f")) bytes += memory->usage(f,nmax*comm->nthreads,3); + if (atom->memcheck("edpd_temp")) bytes += memory->usage(edpd_temp,nmax); + if (atom->memcheck("edpd_flux")) bytes += memory->usage(edpd_flux,nmax*comm->nthreads); + if (atom->memcheck("edpd_cv")) bytes += memory->usage(edpd_cv,nmax); + if (atom->memcheck("vest")) bytes += memory->usage(vest,nmax,4); + + return bytes; +} diff --git a/src/USER-MESO/atom_vec_edpd.h b/src/USER-MESO/atom_vec_edpd.h new file mode 100644 index 000000000..36a4cae97 --- /dev/null +++ b/src/USER-MESO/atom_vec_edpd.h @@ -0,0 +1,68 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef ATOM_CLASS + +AtomStyle(edpd,AtomVecEDPD) + +#else + +#ifndef LMP_ATOM_VEC_EDPD_H +#define LMP_ATOM_VEC_EDPD_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecEDPD : public AtomVec { + public: + AtomVecEDPD(class LAMMPS *); + virtual ~AtomVecEDPD() {} + void grow(int); + void grow_reset(); + void copy(int, int, int); + void force_clear(int, size_t); + virtual int pack_comm(int, int *, double *, int, int *); + virtual int pack_comm_vel(int, int *, double *, int, int *); + virtual void unpack_comm(int, int, double *); + virtual void unpack_comm_vel(int, int, double *); + int pack_reverse(int, int, double *); + void unpack_reverse(int, int *, double *); + virtual int pack_border(int, int *, double *, int, int *); + virtual int pack_border_vel(int, int *, double *, int, int *); + virtual void unpack_border(int, int, double *); + virtual void unpack_border_vel(int, int, double *); + virtual int pack_exchange(int, double *); + virtual int unpack_exchange(double *); + int size_restart(); + int pack_restart(int, double *); + int unpack_restart(double *); + void create_atom(int, double *); + void data_atom(double *, imageint, char **); + void pack_data(double **); + void write_data(FILE *, int, double **); + bigint memory_usage(); + + protected: + tagint *tag; + int *type,*mask; + imageint *image; + double **x,**v,**f; + double **vest; // store intermediate velocity for using mvv integrator + double *edpd_temp,*edpd_flux,*edpd_cv; // temperature, heat flux, and heat capacity +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/atom_vec_mdpd.cpp b/src/USER-MESO/atom_vec_mdpd.cpp new file mode 100644 index 000000000..0a4d302c3 --- /dev/null +++ b/src/USER-MESO/atom_vec_mdpd.cpp @@ -0,0 +1,951 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. + ------------------------------------------------------------------------- */ + +#include +#include +#include "atom_vec_mdpd.h" +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "modify.h" +#include "fix.h" +#include "update.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +AtomVecMDPD::AtomVecMDPD(LAMMPS *lmp) : AtomVec(lmp) +{ + if(strcmp(update->unit_style,"lj") != 0) + error->all(FLERR,"Atom style mdpd requires lj units"); + + molecular = 0; + mass_type = 1; + forceclearflag = 1; + + comm_x_only = comm_f_only = 0; + comm->ghost_velocity = 1; + + size_forward = 3 + 4; // 3 + rho + vest[3], that means we may only communicate 4 in hybrid + size_reverse = 3 + 1; // 3 + drho + size_border = 6 + 4; // 6 + rho + vest[3] + size_velocity = 3; + size_data_atom = 5; + size_data_vel = 4; + xcol_data = 3; + + atom->rho_flag = 1; + atom->vest_flag = 1; +} + +/* ---------------------------------------------------------------------- + grow atom arrays + n = 0 grows arrays by a chunk + n > 0 allocates arrays to size n + ------------------------------------------------------------------------- */ + +void AtomVecMDPD::grow(int n) +{ + if (n == 0) grow_nmax(); + else nmax = n; + atom->nmax = nmax; + if (nmax < 0 || nmax > MAXSMALLINT) + error->one(FLERR,"Per-processor system is too big"); + + tag = memory->grow(atom->tag, nmax, "atom:tag"); + type = memory->grow(atom->type, nmax, "atom:type"); + mask = memory->grow(atom->mask, nmax, "atom:mask"); + image = memory->grow(atom->image, nmax, "atom:image"); + x = memory->grow(atom->x, nmax, 3, "atom:x"); + v = memory->grow(atom->v, nmax, 3, "atom:v"); + f = memory->grow(atom->f, nmax*comm->nthreads, 3, "atom:f"); + + rho = memory->grow(atom->rho, nmax, "atom:rho"); + drho = memory->grow(atom->drho, nmax*comm->nthreads, "atom:drho"); + vest = memory->grow(atom->vest, nmax, 3, "atom:vest"); + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); +} + +/* ---------------------------------------------------------------------- + reset local array ptrs + ------------------------------------------------------------------------- */ + +void AtomVecMDPD::grow_reset() { + tag = atom->tag; + type = atom->type; + mask = atom->mask; + image = atom->image; + x = atom->x; + v = atom->v; + f = atom->f; + rho = atom->rho; + drho = atom->drho; + vest = atom->vest; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::copy(int i, int j, int delflag) { + //printf("in AtomVecMDPD::copy\n"); + tag[j] = tag[i]; + type[j] = type[i]; + mask[j] = mask[i]; + image[j] = image[i]; + x[j][0] = x[i][0]; + x[j][1] = x[i][1]; + x[j][2] = x[i][2]; + v[j][0] = v[i][0]; + v[j][1] = v[i][1]; + v[j][2] = v[i][2]; + + rho[j] = rho[i]; + drho[j] = drho[i]; + vest[j][0] = vest[i][0]; + vest[j][1] = vest[i][1]; + vest[j][2] = vest[i][2]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i, j,delflag); +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::force_clear(int n, size_t nbytes) +{ + memset(&drho[n],0,nbytes); +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_comm_hybrid(int n, int *list, double *buf) { + //printf("in AtomVecMDPD::pack_comm_hybrid\n"); + int i, j, m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::unpack_comm_hybrid(int n, int first, double *buf) { + //printf("in AtomVecMDPD::unpack_comm_hybrid\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + rho[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_border_hybrid(int n, int *list, double *buf) { + //printf("in AtomVecMDPD::pack_border_hybrid\n"); + int i, j, m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::unpack_border_hybrid(int n, int first, double *buf) { + //printf("in AtomVecMDPD::unpack_border_hybrid\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + rho[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_reverse_hybrid(int n, int first, double *buf) { + //printf("in AtomVecMDPD::pack_reverse_hybrid\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = drho[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::unpack_reverse_hybrid(int n, int *list, double *buf) { + //printf("in AtomVecMDPD::unpack_reverse_hybrid\n"); + int i, j, m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + drho[j] += buf[m++]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_comm(int n, int *list, double *buf, int pbc_flag, + int *pbc) { + //printf("in AtomVecMDPD::pack_comm\n"); + int i, j, m; + double dx, dy, dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; + } else { + dx = pbc[0] * domain->xprd + pbc[5] * domain->xy + pbc[4] * domain->xz; + dy = pbc[1] * domain->yprd + pbc[3] * domain->yz; + dz = pbc[2] * domain->zprd; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_comm_vel(int n, int *list, double *buf, int pbc_flag, + int *pbc) { + //printf("in AtomVecMDPD::pack_comm_vel\n"); + int i, j, m; + double dx, dy, dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; + } else { + dx = pbc[0] * domain->xprd + pbc[5] * domain->xy + pbc[4] * domain->xz; + dy = pbc[1] * domain->yprd + pbc[3] * domain->yz; + dz = pbc[2] * domain->zprd; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::unpack_comm(int n, int first, double *buf) { + //printf("in AtomVecMDPD::unpack_comm\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + rho[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::unpack_comm_vel(int n, int first, double *buf) { + //printf("in AtomVecMDPD::unpack_comm_vel\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + v[i][0] = buf[m++]; + v[i][1] = buf[m++]; + v[i][2] = buf[m++]; + rho[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_reverse(int n, int first, double *buf) { + //printf("in AtomVecMDPD::pack_reverse\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = f[i][0]; + buf[m++] = f[i][1]; + buf[m++] = f[i][2]; + buf[m++] = drho[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::unpack_reverse(int n, int *list, double *buf) { + //printf("in AtomVecMDPD::unpack_reverse\n"); + int i, j, m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + f[j][0] += buf[m++]; + f[j][1] += buf[m++]; + f[j][2] += buf[m++]; + drho[j] += buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_border(int n, int *list, double *buf, int pbc_flag, + int *pbc) { + //printf("in AtomVecMDPD::pack_border\n"); + int i, j, m; + double dx, dy, dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; + } else { + dx = pbc[0]; + dy = pbc[1]; + dz = pbc[2]; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_border_vel(int n, int *list, double *buf, int pbc_flag, + int *pbc) +{ + int i,j,m; + double dx,dy,dz,dvx,dvy,dvz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; + } else { + dx = pbc[0]; + dy = pbc[1]; + dz = pbc[2]; + } + if (!deform_vremap) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + dvx = pbc[0] * h_rate[0] + pbc[5] * h_rate[5] + pbc[4] * h_rate[4]; + dvy = pbc[1] * h_rate[1] + pbc[3] * h_rate[3]; + dvz = pbc[2] * h_rate[2]; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (mask[i] & deform_groupbit) { + buf[m++] = v[j][0] + dvx; + buf[m++] = v[j][1] + dvy; + buf[m++] = v[j][2] + dvz; + buf[m++] = rho[j]; + buf[m++] = vest[j][0] + dvx; + buf[m++] = vest[j][1] + dvy; + buf[m++] = vest[j][2] + dvz; + } else { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = rho[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + } + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::unpack_border(int n, int first, double *buf) { + //printf("in AtomVecMDPD::unpack_border\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (i == nmax) + grow(0); + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + tag[i] = (tagint) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + rho[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]-> + unpack_border(n,first,&buf[m]); +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecMDPD::unpack_border_vel(int n, int first, double *buf) { + //printf("in AtomVecMDPD::unpack_border_vel\n"); + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (i == nmax) + grow(0); + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + tag[i] = (tagint) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + v[i][0] = buf[m++]; + v[i][1] = buf[m++]; + v[i][2] = buf[m++]; + rho[i] = buf[m++]; + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]-> + unpack_border(n,first,&buf[m]); +} + +/* ---------------------------------------------------------------------- + pack data for atom I for sending to another proc + xyz must be 1st 3 values, so comm::exchange() can test on them + ------------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_exchange(int i, double *buf) { + //printf("in AtomVecMDPD::pack_exchange\n"); + int m = 1; + buf[m++] = x[i][0]; + buf[m++] = x[i][1]; + buf[m++] = x[i][2]; + buf[m++] = v[i][0]; + buf[m++] = v[i][1]; + buf[m++] = v[i][2]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; + buf[m++] = rho[i]; + buf[m++] = vest[i][0]; + buf[m++] = vest[i][1]; + buf[m++] = vest[i][2]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i, &buf[m]); + + buf[0] = m; + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecMDPD::unpack_exchange(double *buf) { + //printf("in AtomVecMDPD::unpack_exchange\n"); + int nlocal = atom->nlocal; + if (nlocal == nmax) + grow(0); + + int m = 1; + x[nlocal][0] = buf[m++]; + x[nlocal][1] = buf[m++]; + x[nlocal][2] = buf[m++]; + v[nlocal][0] = buf[m++]; + v[nlocal][1] = buf[m++]; + v[nlocal][2] = buf[m++]; + tag[nlocal] = (tagint) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (imageint) ubuf(buf[m++]).i; + rho[nlocal] = buf[m++]; + vest[nlocal][0] = buf[m++]; + vest[nlocal][1] = buf[m++]; + vest[nlocal][2] = buf[m++]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + m += modify->fix[atom->extra_grow[iextra]]-> unpack_exchange(nlocal, + &buf[m]); + + atom->nlocal++; + return m; +} + +/* ---------------------------------------------------------------------- + size of restart data for all atoms owned by this proc + include extra data stored by fixes + ------------------------------------------------------------------------- */ + +int AtomVecMDPD::size_restart() { + int i; + + int nlocal = atom->nlocal; + int n = 15 * nlocal; // 11 + rho + vest[3] + + if (atom->nextra_restart) + for (int iextra = 0; iextra < atom->nextra_restart; iextra++) + for (i = 0; i < nlocal; i++) + n += modify->fix[atom->extra_restart[iextra]]->size_restart(i); + + return n; +} + +/* ---------------------------------------------------------------------- + pack atom I's data for restart file including extra quantities + xyz must be 1st 3 values, so that read_restart can test on them + molecular types may be negative, but write as positive + ------------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_restart(int i, double *buf) { + int m = 1; + buf[m++] = x[i][0]; + buf[m++] = x[i][1]; + buf[m++] = x[i][2]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; + buf[m++] = v[i][0]; + buf[m++] = v[i][1]; + buf[m++] = v[i][2]; + buf[m++] = rho[i]; + buf[m++] = vest[i][0]; + buf[m++] = vest[i][1]; + buf[m++] = vest[i][2]; + + if (atom->nextra_restart) + for (int iextra = 0; iextra < atom->nextra_restart; iextra++) + m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i, &buf[m]); + + buf[0] = m; + return m; +} + +/* ---------------------------------------------------------------------- + unpack data for one atom from restart file including extra quantities + ------------------------------------------------------------------------- */ + +int AtomVecMDPD::unpack_restart(double *buf) { + int nlocal = atom->nlocal; + if (nlocal == nmax) { + grow(0); + if (atom->nextra_store) + memory->grow(atom->extra, nmax, atom->nextra_store, "atom:extra"); + } + + int m = 1; + x[nlocal][0] = buf[m++]; + x[nlocal][1] = buf[m++]; + x[nlocal][2] = buf[m++]; + tag[nlocal] = (tagint) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (imageint) ubuf(buf[m++]).i; + v[nlocal][0] = buf[m++]; + v[nlocal][1] = buf[m++]; + v[nlocal][2] = buf[m++]; + rho[nlocal] = buf[m++]; + vest[nlocal][0] = buf[m++]; + vest[nlocal][1] = buf[m++]; + vest[nlocal][2] = buf[m++]; + + double **extra = atom->extra; + if (atom->nextra_store) { + int size = static_cast (buf[0]) - m; + for (int i = 0; i < size; i++) + extra[nlocal][i] = buf[m++]; + } + + atom->nlocal++; + return m; +} + +/* ---------------------------------------------------------------------- + create one atom of itype at coord + set other values to defaults + ------------------------------------------------------------------------- */ + +void AtomVecMDPD::create_atom(int itype, double *coord) { + int nlocal = atom->nlocal; + if (nlocal == nmax) + grow(0); + + tag[nlocal] = 0; + type[nlocal] = itype; + x[nlocal][0] = coord[0]; + x[nlocal][1] = coord[1]; + x[nlocal][2] = coord[2]; + mask[nlocal] = 1; + image[nlocal] = ((imageint) IMGMAX << IMG2BITS) | + ((imageint) IMGMAX << IMGBITS) | IMGMAX; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + rho[nlocal] = 0.0; + vest[nlocal][0] = 0.0; + vest[nlocal][1] = 0.0; + vest[nlocal][2] = 0.0; + drho[nlocal] = 0.0; + + atom->nlocal++; +} + +/* ---------------------------------------------------------------------- + unpack one line from Atoms section of data file + initialize other atom quantities + ------------------------------------------------------------------------- */ + +void AtomVecMDPD::data_atom(double *coord, imageint imagetmp, char **values) { + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + tag[nlocal] = ATOTAGINT(values[0]); + type[nlocal] = atoi(values[1]); + if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes) + error->one(FLERR,"Invalid atom type in Atoms section of data file"); + + x[nlocal][0] = coord[0]; + x[nlocal][1] = coord[1]; + x[nlocal][2] = coord[2]; + + image[nlocal] = imagetmp; + + mask[nlocal] = 1; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + + vest[nlocal][0] = 0.0; + vest[nlocal][1] = 0.0; + vest[nlocal][2] = 0.0; + + rho[nlocal] = 0.0; + drho[nlocal] = 0.0; + + atom->nlocal++; +} + +/* ---------------------------------------------------------------------- + unpack hybrid quantities from one line in Atoms section of data file + initialize other atom quantities for this sub-style + ------------------------------------------------------------------------- */ + +int AtomVecMDPD::data_atom_hybrid(int nlocal, char **values) +{ + rho[nlocal] = atof(values[0]); + return 3; +} + +/* ---------------------------------------------------------------------- + pack atom info for data file including 3 image flags +------------------------------------------------------------------------- */ + +void AtomVecMDPD::pack_data(double **buf) +{ + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; + buf[i][2] = rho[i]; + buf[i][3] = x[i][0]; + buf[i][4] = x[i][1]; + buf[i][5] = x[i][2]; + buf[i][6] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; + } +} + +/* ---------------------------------------------------------------------- + pack hybrid atom info for data file +------------------------------------------------------------------------- */ + +int AtomVecMDPD::pack_data_hybrid(int i, double *buf) +{ + buf[0] = rho[i]; + return 3; +} + +/* ---------------------------------------------------------------------- + write atom info to data file including 3 image flags +------------------------------------------------------------------------- */ + +void AtomVecMDPD::write_data(FILE *fp, int n, double **buf) +{ + for (int i = 0; i < n; i++) + fprintf(fp,TAGINT_FORMAT + " %d %-1.16e %-1.16e %-1.16e %-1.16e " + "%d %d %d\n", + (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4],buf[i][5], + (int) ubuf(buf[i][6]).i,(int) ubuf(buf[i][7]).i, + (int) ubuf(buf[i][8]).i); +} + +/* ---------------------------------------------------------------------- + write hybrid atom info to data file +------------------------------------------------------------------------- */ + +int AtomVecMDPD::write_data_hybrid(FILE *fp, double *buf) +{ + fprintf(fp," %-1.16e",buf[0]); + return 3; +} + +/* ---------------------------------------------------------------------- + assign an index to named atom property and return index + return -1 if name is unknown to this atom style +------------------------------------------------------------------------- */ + +int AtomVecMDPD::property_atom(char *name) +{ + if (strcmp(name,"rho") == 0) return 0; + if (strcmp(name,"drho") == 0) return 1; + return -1; +} + +/* ---------------------------------------------------------------------- + pack per-atom data into buf for ComputePropertyAtom + index maps to data specific to this atom style +------------------------------------------------------------------------- */ + +void AtomVecMDPD::pack_property_atom(int index, double *buf, + int nvalues, int groupbit) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + int n = 0; + + if (index == 0) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = rho[i]; + else buf[n] = 0.0; + n += nvalues; + } + } else if (index == 1) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = drho[i]; + else buf[n] = 0.0; + n += nvalues; + } + } +} + +/* ---------------------------------------------------------------------- + return # of bytes of allocated memory + ------------------------------------------------------------------------- */ + +bigint AtomVecMDPD::memory_usage() { + bigint bytes = 0; + + if (atom->memcheck("tag")) bytes += memory->usage(tag, nmax); + if (atom->memcheck("type")) bytes += memory->usage(type, nmax); + if (atom->memcheck("mask")) bytes += memory->usage(mask, nmax); + if (atom->memcheck("image")) bytes += memory->usage(image, nmax); + if (atom->memcheck("x")) bytes += memory->usage(x, nmax, 3); + if (atom->memcheck("v")) bytes += memory->usage(v, nmax, 3); + if (atom->memcheck("f")) bytes += memory->usage(f, nmax*comm->nthreads, 3); + if (atom->memcheck("rho")) bytes += memory->usage(rho, nmax); + if (atom->memcheck("drho")) bytes += memory->usage(drho, nmax*comm->nthreads); + if (atom->memcheck("vest")) bytes += memory->usage(vest, nmax, 3); + + return bytes; +} diff --git a/src/USER-MESO/atom_vec_mdpd.h b/src/USER-MESO/atom_vec_mdpd.h new file mode 100644 index 000000000..9e9ffcdcf --- /dev/null +++ b/src/USER-MESO/atom_vec_mdpd.h @@ -0,0 +1,79 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef ATOM_CLASS + +AtomStyle(mdpd,AtomVecMDPD) + +#else + +#ifndef LMP_ATOM_VEC_MDPD_H +#define LMP_ATOM_VEC_MDPD_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecMDPD : public AtomVec { + public: + AtomVecMDPD(class LAMMPS *); + ~AtomVecMDPD() {} + void grow(int); + void grow_reset(); + void copy(int, int, int); + void force_clear(int, size_t); + int pack_comm(int, int *, double *, int, int *); + int pack_comm_vel(int, int *, double *, int, int *); + void unpack_comm(int, int, double *); + void unpack_comm_vel(int, int, double *); + int pack_reverse(int, int, double *); + void unpack_reverse(int, int *, double *); + int pack_comm_hybrid(int, int *, double *); + int unpack_comm_hybrid(int, int, double *); + int pack_border_hybrid(int, int *, double *); + int unpack_border_hybrid(int, int, double *); + int pack_reverse_hybrid(int, int, double *); + int unpack_reverse_hybrid(int, int *, double *); + int pack_border(int, int *, double *, int, int *); + int pack_border_vel(int, int *, double *, int, int *); + void unpack_border(int, int, double *); + void unpack_border_vel(int, int, double *); + int pack_exchange(int, double *); + int unpack_exchange(double *); + int size_restart(); + int pack_restart(int, double *); + int unpack_restart(double *); + void create_atom(int, double *); + void data_atom(double *, imageint, char **); + int data_atom_hybrid(int, char **); + void pack_data(double **); + int pack_data_hybrid(int, double *); + void write_data(FILE *, int, double **); + int write_data_hybrid(FILE *, double *); + int property_atom(char *); + void pack_property_atom(int, double *, int, int); + bigint memory_usage(); + + private: + tagint *tag; + int *type,*mask; + imageint *image; + double **x,**v,**f; + double *rho, *drho; + double **vest; // estimated velocity during force computation +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/atom_vec_tdpd.cpp b/src/USER-MESO/atom_vec_tdpd.cpp new file mode 100644 index 000000000..ce9e49202 --- /dev/null +++ b/src/USER-MESO/atom_vec_tdpd.cpp @@ -0,0 +1,879 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include +#include +#include "atom_vec_tdpd.h" +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "domain.h" +#include "modify.h" +#include "fix.h" +#include "update.h" +#include "memory.h" +#include "error.h" +#include "input.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +AtomVecTDPD::AtomVecTDPD(LAMMPS *lmp) : AtomVec(lmp) +{ + if(strcmp(update->unit_style,"lj") != 0) + error->all(FLERR,"Atom style edpd requires lj units"); + + molecular = 0; + mass_type = 1; + forceclearflag = 1; + + comm_x_only = comm_f_only = 0; + comm->ghost_velocity = 1; + + cc_species = 0; // for now, reset in process_args() + + size_forward = 3 + cc_species + 3; //vest[3] + size_reverse = 3 + cc_species; + size_border = 6 + cc_species + 3; //vest[3] + size_velocity = 3; + // for data_atom, we read id + type + xyz[3] + cc[i] where i=1,cc_species + size_data_atom = 5 + cc_species; + size_data_vel = 4; + xcol_data = 3; + + atom->tdpd_flag = 1; + atom->vest_flag = 1; +} + +/* ---------------------------------------------------------------------- + process additional args + single arg = number of cc_species +------------------------------------------------------------------------- */ + +void AtomVecTDPD::process_args(int narg, char **arg) +{ + if (narg < 1) error->all(FLERR,"Invalid atom_style tdpd command"); + + atom->cc_species = force->inumeric(FLERR,arg[0]); + cc_species = atom->cc_species; + + // reset sizes that depend on cc_species + + size_forward = 3 + cc_species + 3; + size_reverse = 3 + cc_species; + size_border = 6 + cc_species + 3; + size_data_atom = 5 + cc_species; +} + +/* ---------------------------------------------------------------------- + grow atom arrays + n = 0 grows arrays by a chunk + n > 0 allocates arrays to size n +------------------------------------------------------------------------- */ + +void AtomVecTDPD::grow(int n) +{ + if (n == 0) grow_nmax(); + else nmax = n; + atom->nmax = nmax; + if (nmax < 0 || nmax > MAXSMALLINT) + error->one(FLERR,"Per-processor system is too big"); + + tag = memory->grow(atom->tag,nmax,"atom:tag"); + type = memory->grow(atom->type,nmax,"atom:type"); + mask = memory->grow(atom->mask,nmax,"atom:mask"); + image = memory->grow(atom->image,nmax,"atom:image"); + x = memory->grow(atom->x,nmax,3,"atom:x"); + v = memory->grow(atom->v,nmax,3,"atom:v"); + f = memory->grow(atom->f,nmax*comm->nthreads,3,"atom:f"); + cc = memory->grow(atom->cc,nmax*comm->nthreads,cc_species,"atom:cc"); + cc_flux = memory->grow(atom->cc_flux,nmax*comm->nthreads,cc_species, + "atom:cc_flux"); + vest = memory->grow(atom->vest, nmax, 3, "atom:vest"); + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax); +} + +/* ---------------------------------------------------------------------- + reset local array ptrs +------------------------------------------------------------------------- */ + +void AtomVecTDPD::grow_reset() +{ + tag = atom->tag; type = atom->type; + mask = atom->mask; image = atom->image; + x = atom->x; v = atom->v; f = atom->f; + cc = atom->cc; cc_flux = atom->cc_flux; + vest = atom->vest; +} + +/* ---------------------------------------------------------------------- + copy atom I info to atom J +------------------------------------------------------------------------- */ + +void AtomVecTDPD::copy(int i, int j, int delflag) +{ + tag[j] = tag[i]; + type[j] = type[i]; + mask[j] = mask[i]; + image[j] = image[i]; + x[j][0] = x[i][0]; + x[j][1] = x[i][1]; + x[j][2] = x[i][2]; + v[j][0] = v[i][0]; + v[j][1] = v[i][1]; + v[j][2] = v[i][2]; + + for(int k = 0; k < cc_species; k++) + cc[j][k] = cc[i][k]; + + vest[j][0] = vest[i][0]; + vest[j][1] = vest[i][1]; + vest[j][2] = vest[i][2]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); +} + + +void AtomVecTDPD::force_clear(int n, size_t nbytes) +{ + memset(&cc_flux[n][0],0,cc_species*nbytes); +} + + +/* ---------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,k,m; + double dx,dy,dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + + for(k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]*domain->xprd + pbc[5]*domain->xy + pbc[4]*domain->xz; + dy = pbc[1]*domain->yprd + pbc[3]*domain->yz; + dz = pbc[2]*domain->zprd; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + + for(k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_comm_vel(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,k,m; + double dx,dy,dz,dvx,dvy,dvz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + + for(k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]*domain->xprd + pbc[5]*domain->xy + pbc[4]*domain->xz; + dy = pbc[1]*domain->yprd + pbc[3]*domain->yz; + dz = pbc[2]*domain->zprd; + } + if (!deform_vremap) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + + for(k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; + dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; + dvz = pbc[2]*h_rate[2]; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + if (mask[i] & deform_groupbit) { + buf[m++] = v[j][0] + dvx; + buf[m++] = v[j][1] + dvy; + buf[m++] = v[j][2] + dvz; + } else { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + } + for(k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecTDPD::unpack_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + + for(int k = 0; k < cc_species; k++) + cc[i][k] = buf[m++]; + + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecTDPD::unpack_comm_vel(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + v[i][0] = buf[m++]; + v[i][1] = buf[m++]; + v[i][2] = buf[m++]; + for(int k = 0; k < cc_species; k++) + cc[i][k] = buf[m++]; + + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_reverse(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = f[i][0]; + buf[m++] = f[i][1]; + buf[m++] = f[i][2]; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc_flux[i][k]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecTDPD::unpack_reverse(int n, int *list, double *buf) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + f[j][0] += buf[m++]; + f[j][1] += buf[m++]; + f[j][2] += buf[m++]; + for(int k = 0; k < cc_species; k++) + cc_flux[j][k] += buf[m++]; + } +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_border(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,m; + double dx,dy,dz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]; + dy = pbc[1]; + dz = pbc[2]; + } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_border_vel(int n, int *list, double *buf, + int pbc_flag, int *pbc) +{ + int i,j,m; + double dx,dy,dz,dvx,dvy,dvz; + + m = 0; + if (pbc_flag == 0) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0]; + buf[m++] = x[j][1]; + buf[m++] = x[j][2]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + if (domain->triclinic == 0) { + dx = pbc[0]*domain->xprd; + dy = pbc[1]*domain->yprd; + dz = pbc[2]*domain->zprd; + } else { + dx = pbc[0]; + dy = pbc[1]; + dz = pbc[2]; + } + if (!deform_vremap) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; + dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; + dvz = pbc[2]*h_rate[2]; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (mask[i] & deform_groupbit) { + buf[m++] = v[j][0] + dvx; + buf[m++] = v[j][1] + dvy; + buf[m++] = v[j][2] + dvz; + } else { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + } + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[j][k]; + + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecTDPD::unpack_border(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (i == nmax) grow(0); + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + tag[i] = (tagint) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + for(int k = 0; k < cc_species; k++) + cc[i][k] = buf[m++]; + + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]-> + unpack_border(n,first,&buf[m]); +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecTDPD::unpack_border_vel(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + if (i == nmax) grow(0); + x[i][0] = buf[m++]; + x[i][1] = buf[m++]; + x[i][2] = buf[m++]; + tag[i] = (tagint) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + v[i][0] = buf[m++]; + v[i][1] = buf[m++]; + v[i][2] = buf[m++]; + for(int k = 0; k < cc_species; k++) + cc[i][k] = buf[m++]; + + vest[i][0] = buf[m++]; + vest[i][1] = buf[m++]; + vest[i][2] = buf[m++]; + } + + if (atom->nextra_border) + for (int iextra = 0; iextra < atom->nextra_border; iextra++) + m += modify->fix[atom->extra_border[iextra]]-> + unpack_border(n,first,&buf[m]); +} + +/* ---------------------------------------------------------------------- + pack data for atom I for sending to another proc + xyz must be 1st 3 values, so comm::exchange() can test on them +------------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_exchange(int i, double *buf) +{ + int m = 1; + buf[m++] = x[i][0]; + buf[m++] = x[i][1]; + buf[m++] = x[i][2]; + buf[m++] = v[i][0]; + buf[m++] = v[i][1]; + buf[m++] = v[i][2]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[i][k]; + + buf[m++] = vest[i][0]; + buf[m++] = vest[i][1]; + buf[m++] = vest[i][2]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf[m]); + + buf[0] = m; + return m; +} + +/* ---------------------------------------------------------------------- */ + +int AtomVecTDPD::unpack_exchange(double *buf) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + int m = 1; + x[nlocal][0] = buf[m++]; + x[nlocal][1] = buf[m++]; + x[nlocal][2] = buf[m++]; + v[nlocal][0] = buf[m++]; + v[nlocal][1] = buf[m++]; + v[nlocal][2] = buf[m++]; + tag[nlocal] = (tagint) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (imageint) ubuf(buf[m++]).i; + for(int k = 0; k < cc_species; k++) + cc[nlocal][k] = buf[m++]; + + vest[nlocal][0] = buf[m++]; + vest[nlocal][1] = buf[m++]; + vest[nlocal][2] = buf[m++]; + + if (atom->nextra_grow) + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) + m += modify->fix[atom->extra_grow[iextra]]-> + unpack_exchange(nlocal,&buf[m]); + + atom->nlocal++; + return m; +} + +/* ---------------------------------------------------------------------- + size of restart data for all atoms owned by this proc + include extra data stored by fixes +------------------------------------------------------------------------- */ + +int AtomVecTDPD::size_restart() +{ + int i; + + int nlocal = atom->nlocal; + int n = (11 + cc_species + 3) * nlocal; // 11 + cc[i] + vest[3] + + if (atom->nextra_restart) + for (int iextra = 0; iextra < atom->nextra_restart; iextra++) + for (i = 0; i < nlocal; i++) + n += modify->fix[atom->extra_restart[iextra]]->size_restart(i); + + return n; +} + +/* ---------------------------------------------------------------------- + pack atom I's data for restart file including extra quantities + xyz must be 1st 3 values, so that read_restart can test on them + molecular types may be negative, but write as positive +------------------------------------------------------------------------- */ + +int AtomVecTDPD::pack_restart(int i, double *buf) +{ + int m = 1; + buf[m++] = x[i][0]; + buf[m++] = x[i][1]; + buf[m++] = x[i][2]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; + buf[m++] = v[i][0]; + buf[m++] = v[i][1]; + buf[m++] = v[i][2]; + for(int k = 0; k < cc_species; k++) + buf[m++] = cc[i][k]; + + buf[m++] = vest[i][0]; + buf[m++] = vest[i][1]; + buf[m++] = vest[i][2]; + + if (atom->nextra_restart) + for (int iextra = 0; iextra < atom->nextra_restart; iextra++) + m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i,&buf[m]); + + buf[0] = m; + return m; +} + +/* ---------------------------------------------------------------------- + unpack data for one atom from restart file including extra quantities +------------------------------------------------------------------------- */ + +int AtomVecTDPD::unpack_restart(double *buf) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) { + grow(0); + if (atom->nextra_store) + memory->grow(atom->extra,nmax,atom->nextra_store,"atom:extra"); + } + + int m = 1; + x[nlocal][0] = buf[m++]; + x[nlocal][1] = buf[m++]; + x[nlocal][2] = buf[m++]; + tag[nlocal] = (tagint) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (imageint) ubuf(buf[m++]).i; + v[nlocal][0] = buf[m++]; + v[nlocal][1] = buf[m++]; + v[nlocal][2] = buf[m++]; + for(int k = 0; k < cc_species; k++) + cc[nlocal][k] = buf[m++]; + + vest[nlocal][0] = buf[m++]; + vest[nlocal][1] = buf[m++]; + vest[nlocal][2] = buf[m++]; + + double **extra = atom->extra; + if (atom->nextra_store) { + int size = static_cast (buf[0]) - m; + for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++]; + } + + atom->nlocal++; + return m; +} + +/* ---------------------------------------------------------------------- + create one atom of itype at coord + set other values to defaults +------------------------------------------------------------------------- */ + +void AtomVecTDPD::create_atom(int itype, double *coord) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + tag[nlocal] = 0; + type[nlocal] = itype; + x[nlocal][0] = coord[0]; + x[nlocal][1] = coord[1]; + x[nlocal][2] = coord[2]; + mask[nlocal] = 1; + image[nlocal] = ((imageint) IMGMAX << IMG2BITS) | + ((imageint) IMGMAX << IMGBITS) | IMGMAX; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + + for(int k = 0; k < cc_species; k++) + cc[nlocal][k] = 0.0; + + vest[nlocal][0] = 0.0; + vest[nlocal][1] = 0.0; + vest[nlocal][2] = 0.0; + + atom->nlocal++; +} + +/* ---------------------------------------------------------------------- + unpack one line from Atoms section of data file + initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecTDPD::data_atom(double *coord, imageint imagetmp, char **values) +{ + int nlocal = atom->nlocal; + if (nlocal == nmax) grow(0); + + tag[nlocal] = ATOTAGINT(values[0]); + type[nlocal] = atoi(values[1]); + if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes) + error->one(FLERR,"Invalid atom type in Atoms section of data file"); + + x[nlocal][0] = coord[0]; + x[nlocal][1] = coord[1]; + x[nlocal][2] = coord[2]; + + for(int k = 0; k < cc_species; k++) + cc[nlocal][k] = atof( values[5+k] ); + + image[nlocal] = imagetmp; + + mask[nlocal] = 1; + v[nlocal][0] = 0.0; + v[nlocal][1] = 0.0; + v[nlocal][2] = 0.0; + + vest[nlocal][0] = 0.0; + vest[nlocal][1] = 0.0; + vest[nlocal][2] = 0.0; + + atom->nlocal++; +} + +/* ---------------------------------------------------------------------- + pack atom info for data file including 3 image flags +------------------------------------------------------------------------- */ + +void AtomVecTDPD::pack_data(double **buf) +{ + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; + buf[i][2] = x[i][0]; + buf[i][3] = x[i][1]; + buf[i][4] = x[i][2]; + buf[i][5] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][6] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; + for(int k = 0; k < cc_species; k++) + buf[i][8+k] = cc[i][k]; + } +} + +/* ---------------------------------------------------------------------- + write atom info to data file including 3 image flags +------------------------------------------------------------------------- */ + +void AtomVecTDPD::write_data(FILE *fp, int n, double **buf) +{ + for (int i = 0; i < n; i++){ + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %d %d %d", + (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4], + (int) ubuf(buf[i][5]).i,(int) ubuf(buf[i][6]).i, + (int) ubuf(buf[i][7]).i); + for(int k = 0; k < cc_species; k++) + fprintf(fp,TAGINT_FORMAT " %-1.16e",buf[i][8+k]); + fprintf(fp,TAGINT_FORMAT "\n"); + } +} + +/* ---------------------------------------------------------------------- + return # of bytes of allocated memory +------------------------------------------------------------------------- */ + +bigint AtomVecTDPD::memory_usage() +{ + bigint bytes = 0; + + if (atom->memcheck("tag")) bytes += memory->usage(tag,nmax); + if (atom->memcheck("type")) bytes += memory->usage(type,nmax); + if (atom->memcheck("mask")) bytes += memory->usage(mask,nmax); + if (atom->memcheck("image")) bytes += memory->usage(image,nmax); + if (atom->memcheck("x")) bytes += memory->usage(x,nmax,3); + if (atom->memcheck("v")) bytes += memory->usage(v,nmax,3); + if (atom->memcheck("f")) bytes += memory->usage(f,nmax*comm->nthreads,3); + if (atom->memcheck("cc")) bytes += memory->usage(cc,nmax*comm->nthreads,cc_species); + if (atom->memcheck("cc_flux")) bytes += memory->usage(cc_flux,nmax*comm->nthreads,cc_species); + if (atom->memcheck("vest")) bytes += memory->usage(vest, nmax); + + return bytes; +} diff --git a/src/USER-MESO/atom_vec_tdpd.h b/src/USER-MESO/atom_vec_tdpd.h new file mode 100644 index 000000000..86e9ae4bb --- /dev/null +++ b/src/USER-MESO/atom_vec_tdpd.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef ATOM_CLASS + +AtomStyle(tdpd,AtomVecTDPD) + +#else + +#ifndef LMP_ATOM_VEC_TDPD_H +#define LMP_ATOM_VEC_TDPD_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecTDPD : public AtomVec { + public: + AtomVecTDPD(class LAMMPS *); + virtual ~AtomVecTDPD() {} + void process_args(int, char **); + void grow(int); + void grow_reset(); + void copy(int, int, int); + void force_clear(int, size_t); + virtual int pack_comm(int, int *, double *, int, int *); + virtual int pack_comm_vel(int, int *, double *, int, int *); + virtual void unpack_comm(int, int, double *); + virtual void unpack_comm_vel(int, int, double *); + int pack_reverse(int, int, double *); + void unpack_reverse(int, int *, double *); + virtual int pack_border(int, int *, double *, int, int *); + virtual int pack_border_vel(int, int *, double *, int, int *); + virtual void unpack_border(int, int, double *); + virtual void unpack_border_vel(int, int, double *); + virtual int pack_exchange(int, double *); + virtual int unpack_exchange(double *); + int size_restart(); + int pack_restart(int, double *); + int unpack_restart(double *); + void create_atom(int, double *); + void data_atom(double *, imageint, char **); + void pack_data(double **); + void write_data(FILE *, int, double **); + bigint memory_usage(); + + protected: + tagint *tag; + int *type,*mask; + imageint *image; + double **x,**v,**f; + double **vest; // store intermediate velocity for using mvv integrator + double **cc,**cc_flux; + int cc_species; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Per-processor system is too big + +The number of owned atoms plus ghost atoms on a single +processor must fit in 32-bit integer. + +E: Invalid atom type in Atoms section of data file + +Atom types must range from 1 to specified # of types. + +*/ diff --git a/src/USER-MESO/compute_edpd_temp_atom.cpp b/src/USER-MESO/compute_edpd_temp_atom.cpp new file mode 100644 index 000000000..15fdab2a6 --- /dev/null +++ b/src/USER-MESO/compute_edpd_temp_atom.cpp @@ -0,0 +1,97 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include +#include "compute_edpd_temp_atom.h" +#include "atom.h" +#include "update.h" +#include "modify.h" +#include "comm.h" +#include "force.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeEDPDTempAtom::ComputeEDPDTempAtom(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg) +{ + if (narg != 3) error->all(FLERR,"Number of arguments for compute edpd/temp/atom command != 3"); + if (atom->edpd_flag != 1) error->all(FLERR,"compute edpd/temp/atom command requires atom_style with temperature (e.g. edpd)"); + + peratom_flag = 1; + size_peratom_cols = 0; + + nmax = 0; + temp_vector = NULL; +} + +/* ---------------------------------------------------------------------- */ + +ComputeEDPDTempAtom::~ComputeEDPDTempAtom() +{ + memory->sfree(temp_vector); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeEDPDTempAtom::init() +{ + + int count = 0; + for (int i = 0; i < modify->ncompute; i++) + if (strcmp(modify->compute[i]->style,"temp_vector/atom") == 0) count++; + if (count > 1 && comm->me == 0) + error->warning(FLERR,"More than one compute temp_vector/atom"); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeEDPDTempAtom::compute_peratom() +{ + invoked_peratom = update->ntimestep; + + // grow temp_vector array if necessary + + if (atom->nmax > nmax) { + memory->sfree(temp_vector); + nmax = atom->nmax; + temp_vector = (double *) memory->smalloc(nmax*sizeof(double),"temp_vector/atom:temp_vector"); + vector_atom = temp_vector; + } + + double *edpd_temp = atom->edpd_temp; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + temp_vector[i] = edpd_temp[i]; + } + else { + temp_vector[i] = 0.0; + } + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeEDPDTempAtom::memory_usage() +{ + double bytes = nmax * sizeof(double); + return bytes; +} diff --git a/src/USER-MESO/compute_edpd_temp_atom.h b/src/USER-MESO/compute_edpd_temp_atom.h new file mode 100644 index 000000000..4c61b664c --- /dev/null +++ b/src/USER-MESO/compute_edpd_temp_atom.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMPUTE_CLASS + +ComputeStyle(edpd/temp/atom,ComputeEDPDTempAtom) + +#else + +#ifndef LMP_COMPUTE_EDPD_TEMP_ATOM_H +#define LMP_COMPUTE_EDPD_TEMP_ATOM_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeEDPDTempAtom : public Compute { + public: + ComputeEDPDTempAtom(class LAMMPS *, int, char **); + ~ComputeEDPDTempAtom(); + void init(); + void compute_peratom(); + double memory_usage(); + + private: + int nmax; + double *temp_vector; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/compute_tdpd_cc_atom.cpp b/src/USER-MESO/compute_tdpd_cc_atom.cpp new file mode 100644 index 000000000..b33550f5c --- /dev/null +++ b/src/USER-MESO/compute_tdpd_cc_atom.cpp @@ -0,0 +1,98 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include +#include "compute_tdpd_cc_atom.h" +#include "atom.h" +#include "update.h" +#include "modify.h" +#include "comm.h" +#include "force.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeTDPDCCAtom::ComputeTDPDCCAtom(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg) +{ + if (narg != 4) error->all(FLERR,"Number of arguments for compute tdpd/cc/atom command != 4"); + if (atom->tdpd_flag != 1) error->all(FLERR,"compute tdpd/cc/atom command requires atom_style with concentration (e.g. tdpd)"); + + index = force->inumeric(FLERR,arg[3]); + + peratom_flag = 1; + size_peratom_cols = 0; + + nmax = 0; + cc_vector = NULL; +} + +/* ---------------------------------------------------------------------- */ + +ComputeTDPDCCAtom::~ComputeTDPDCCAtom() +{ + memory->sfree(cc_vector); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeTDPDCCAtom::init() +{ + + int count = 0; + for (int i = 0; i < modify->ncompute; i++) + if (strcmp(modify->compute[i]->style,"cc_vector/atom") == 0) count++; + if (count > 1 && comm->me == 0) + error->warning(FLERR,"More than one compute cc_vector/atom"); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeTDPDCCAtom::compute_peratom() +{ + invoked_peratom = update->ntimestep; + + // grow cc_vector array if necessary + + if (atom->nmax > nmax) { + memory->sfree(cc_vector); + nmax = atom->nmax; + cc_vector = (double *) memory->smalloc(nmax*sizeof(double),"cc_vector/atom:cc_vector"); + vector_atom = cc_vector; + } + + double **cc = atom->cc; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + cc_vector[i] = cc[i][index-1]; + } + else + cc_vector[i] = 0.0; + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeTDPDCCAtom::memory_usage() +{ + double bytes = nmax * sizeof(double); + return bytes; +} diff --git a/src/USER-MESO/compute_tdpd_cc_atom.h b/src/USER-MESO/compute_tdpd_cc_atom.h new file mode 100644 index 000000000..324cb779a --- /dev/null +++ b/src/USER-MESO/compute_tdpd_cc_atom.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMPUTE_CLASS + +ComputeStyle(tdpd/cc/atom,ComputeTDPDCCAtom) + +#else + +#ifndef LMP_COMPUTE_TDPD_CC_ATOM_H +#define LMP_COMPUTE_TDPD_CC_ATOM_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeTDPDCCAtom : public Compute { + public: + ComputeTDPDCCAtom(class LAMMPS *, int, char **); + ~ComputeTDPDCCAtom(); + void init(); + void compute_peratom(); + double memory_usage(); + + private: + int nmax; + int index; + double *cc_vector; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/fix_edpd_source.cpp b/src/USER-MESO/fix_edpd_source.cpp new file mode 100644 index 000000000..3ee7e8e29 --- /dev/null +++ b/src/USER-MESO/fix_edpd_source.cpp @@ -0,0 +1,120 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include +#include +#include "fix_edpd_source.h" +#include "atom.h" +#include "comm.h" +#include "update.h" +#include "modify.h" +#include "domain.h" +#include "lattice.h" +#include "input.h" +#include "variable.h" +#include "error.h" +#include "force.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixEDPDSource::FixEDPDSource(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (strcmp(style,"edpd/source") != 0 && narg < 4) + error->all(FLERR,"Illegal fix edpd/source command"); + + int iarg = 3; + + if (strcmp(arg[iarg],"sphere") == 0) option = 0; + else if (strcmp(arg[iarg],"cuboid") == 0) option = 1; + else error->all(FLERR,"Illegal fix edpd/source command"); + iarg++; + + if(option == 0){ + if (narg != 9 ) error->all(FLERR,"Illegal fix edpd/source command (5 args for sphere)"); + center[0] = force->numeric(FLERR,arg[iarg++]); + center[1] = force->numeric(FLERR,arg[iarg++]); + center[2] = force->numeric(FLERR,arg[iarg++]); + radius = force->numeric(FLERR,arg[iarg++]); + value = force->numeric(FLERR,arg[iarg++]); + } + else if(option == 1){ + if (narg != 11 ) error->all(FLERR,"Illegal fix edpd/edpd command (7 args for cuboid)"); + center[0] = force->numeric(FLERR,arg[iarg++]); + center[1] = force->numeric(FLERR,arg[iarg++]); + center[2] = force->numeric(FLERR,arg[iarg++]); + dLx = force->numeric(FLERR,arg[iarg++]); + dLy = force->numeric(FLERR,arg[iarg++]); + dLz = force->numeric(FLERR,arg[iarg++]); + value = force->numeric(FLERR,arg[iarg++]); + } + else error->all(FLERR,"Illegal fix edpd/source command"); +} + +/* ---------------------------------------------------------------------- */ + +FixEDPDSource::~FixEDPDSource() +{ +} + +/* ---------------------------------------------------------------------- */ + +int FixEDPDSource::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixEDPDSource::init() +{ +} + +/* ---------------------------------------------------------------------- */ + +void FixEDPDSource::post_force(int vflag) +{ + double **x = atom->x; + double *edpd_flux = atom->edpd_flux; + double *edpd_cv = atom->edpd_cv; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + double drx, dry, drz, rsq; + double radius_sq = radius*radius*radius; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if(option == 0){ + drx = x[i][0] - center[0]; + dry = x[i][1] - center[1]; + drz = x[i][2] - center[2]; + rsq = drx*drx + dry*dry + drz*drz; + if(rsq < radius_sq) + edpd_flux[i] += value*edpd_cv[i]; + } + else if(option == 1){ + drx = x[i][0] - center[0]; + dry = x[i][1] - center[1]; + drz = x[i][2] - center[2]; + if(abs(drx) <= 0.5*dLx && abs(dry) <= 0.5*dLy && abs(drz) <= 0.5*dLz) + edpd_flux[i] += value*edpd_cv[i]; + } + } + } +} diff --git a/src/USER-MESO/fix_edpd_source.h b/src/USER-MESO/fix_edpd_source.h new file mode 100644 index 000000000..1ea8610ce --- /dev/null +++ b/src/USER-MESO/fix_edpd_source.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(edpd/source,FixEDPDSource) + +#else + +#ifndef LMP_FIX_EDPDSOURCE_H +#define LMP_FIX_EDPDSOURCE_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixEDPDSource : public Fix { + public: + FixEDPDSource(class LAMMPS *, int, char **); + ~FixEDPDSource(); + int setmask(); + void init(); + void post_force(int); + + protected: + int option; + double center[3], radius, dLx, dLy, dLz; + double value; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/fix_mvv_dpd.cpp b/src/USER-MESO/fix_mvv_dpd.cpp new file mode 100644 index 000000000..77a67273f --- /dev/null +++ b/src/USER-MESO/fix_mvv_dpd.cpp @@ -0,0 +1,136 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This is a time integrator for position and velocity (x and v) using the + modified velocity-Verlet (MVV) algorithm. + Setting verlet = 0.5 recovers the standard velocity-Verlet algorithm. + + Contributing author: Zhen Li (Brown University) + Email: zhen_li@brown.edu +------------------------------------------------------------------------- */ + +#include +#include +#include "fix_mvv_dpd.h" +#include "atom.h" +#include "force.h" +#include "update.h" +#include "respa.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixMvvDPD::FixMvvDPD(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (strcmp(style,"mvv/dpd") != 0 && narg < 3) + error->all(FLERR,"Illegal fix mvv/dpd command"); + + verlet = 0.5; + if(narg > 3) verlet = force->numeric(FLERR,arg[3]); + + dynamic_group_allow = 1; + time_integrate = 1; +} + +/* ---------------------------------------------------------------------- */ + +int FixMvvDPD::setmask() +{ + int mask = 0; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvDPD::init() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- + allow for both per-type and per-atom mass +------------------------------------------------------------------------- */ + +void FixMvvDPD::initial_integrate(int vflag) +{ + double dtfm; + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double **vest = atom->vest; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (rmass) dtfm = dtf / rmass[i]; + else dtfm = dtf / mass[type[i]]; + + vest[i][0] = v[i][0] + dtfm * f[i][0]; + vest[i][1] = v[i][1] + dtfm * f[i][1]; + vest[i][2] = v[i][2] + dtfm * f[i][2]; + + x[i][0] += dtv * vest[i][0]; + x[i][1] += dtv * vest[i][1]; + x[i][2] += dtv * vest[i][2]; + v[i][0] += 2.0 * verlet * dtfm * f[i][0]; + v[i][1] += 2.0 * verlet * dtfm * f[i][1]; + v[i][2] += 2.0 * verlet * dtfm * f[i][2]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvDPD::final_integrate() +{ + double dtfm; + double **v = atom->v; + double **f = atom->f; + double **vest = atom->vest; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (rmass) dtfm = dtf / rmass[i]; + else dtfm = dtf / mass[type[i]]; + + v[i][0] = vest[i][0] + dtfm * f[i][0]; + v[i][1] = vest[i][1] + dtfm * f[i][1]; + v[i][2] = vest[i][2] + dtfm * f[i][2]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvDPD::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} diff --git a/src/USER-MESO/fix_mvv_dpd.h b/src/USER-MESO/fix_mvv_dpd.h new file mode 100644 index 000000000..86cc79485 --- /dev/null +++ b/src/USER-MESO/fix_mvv_dpd.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(mvv/dpd,FixMvvDPD) + +#else + +#ifndef LMP_FIX_MVV_DPD_H +#define LMP_FIX_MVV_DPD_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixMvvDPD : public Fix { + public: + FixMvvDPD(class LAMMPS *, int, char **); + virtual ~FixMvvDPD() {} + int setmask(); + virtual void init(); + virtual void initial_integrate(int); + virtual void final_integrate(); + virtual void reset_dt(); + + protected: + double dtv, dtf; + double verlet; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/fix_mvv_edpd.cpp b/src/USER-MESO/fix_mvv_edpd.cpp new file mode 100644 index 000000000..fe801d6d3 --- /dev/null +++ b/src/USER-MESO/fix_mvv_edpd.cpp @@ -0,0 +1,163 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This is a time integrator for position, velocity and temperature (x, + v and edpd_T) using the modified velocity-Verlet (MVV) algorithm. + Setting verlet = 0.5 recovers the standard velocity-Verlet algorithm. + + Contributing author: Zhen Li (Brown University) + Email: zhen_li@brown.edu + + Please cite the related publication: + Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. "Energy- + conserving dissipative particle dynamics with temperature-dependent + properties". Journal of Computational Physics, 2014, 265: 113-127. + + Z. Li, Y.-H. Tang , X. Li and G.E. Karniadakis. "Mesoscale modeling of + phase transition dynamics of thermoresponsive polymers". Chemical + Communications, 2015, 51: 11038-11040. +------------------------------------------------------------------------- */ + +#include +#include +#include "fix_mvv_edpd.h" +#include "atom.h" +#include "force.h" +#include "update.h" +#include "respa.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixMvvEDPD::FixMvvEDPD(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (strcmp(style,"mvv/edpd") != 0 && narg < 3) + error->all(FLERR,"Illegal fix mvv/edpd command"); + + verlet = 0.5; + if(narg > 3) verlet = force->numeric(FLERR,arg[3]); + + dynamic_group_allow = 1; + time_integrate = 1; +} + +/* ---------------------------------------------------------------------- */ + +int FixMvvEDPD::setmask() +{ + int mask = 0; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvEDPD::init() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- + allow for both per-type and per-atom mass +------------------------------------------------------------------------- */ + +void FixMvvEDPD::initial_integrate(int vflag) +{ + double dtfm,dtT; + // update v and x and cc of atoms in group + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *edpd_temp = atom->edpd_temp; + double *edpd_flux = atom->edpd_flux; + double *edpd_cv = atom->edpd_cv; + double **vest = atom->vest; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (rmass) dtfm = dtf / rmass[i]; + else dtfm = dtf / mass[type[i]]; + + dtT = 0.5 * dtv / edpd_cv[i]; + + vest[i][0] = v[i][0] + dtfm * f[i][0]; + vest[i][1] = v[i][1] + dtfm * f[i][1]; + vest[i][2] = v[i][2] + dtfm * f[i][2]; + vest[i][3] = edpd_temp[i] + dtT * edpd_flux[i]; + + x[i][0] += dtv * vest[i][0]; + x[i][1] += dtv * vest[i][1]; + x[i][2] += dtv * vest[i][2]; + v[i][0] += 2.0 * verlet * dtfm * f[i][0]; + v[i][1] += 2.0 * verlet * dtfm * f[i][1]; + v[i][2] += 2.0 * verlet * dtfm * f[i][2]; + edpd_temp[i] += 2.0 * verlet * dtT * edpd_flux[i]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvEDPD::final_integrate() +{ + double dtfm, dtT; + + // update v and edpd_temp of atoms in group + + double **v = atom->v; + double **f = atom->f; + double *edpd_temp = atom->edpd_temp; + double *edpd_flux = atom->edpd_flux; + double *edpd_cv = atom->edpd_cv; + double **vest = atom->vest; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (rmass) dtfm = dtf / rmass[i]; + else dtfm = dtf / mass[type[i]]; + + dtT = 0.5 * dtv / edpd_cv[i]; + + v[i][0] = vest[i][0] + dtfm * f[i][0]; + v[i][1] = vest[i][1] + dtfm * f[i][1]; + v[i][2] = vest[i][2] + dtfm * f[i][2]; + edpd_temp[i] = vest[i][3] + dtT * edpd_flux[i]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvEDPD::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} diff --git a/src/USER-MESO/fix_mvv_edpd.h b/src/USER-MESO/fix_mvv_edpd.h new file mode 100644 index 000000000..0d9c5f195 --- /dev/null +++ b/src/USER-MESO/fix_mvv_edpd.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(mvv/edpd,FixMvvEDPD) + +#else + +#ifndef LMP_FIX_MVV_EDPD_H +#define LMP_FIX_MVV_EDPD_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixMvvEDPD : public Fix { + public: + FixMvvEDPD(class LAMMPS *, int, char **); + virtual ~FixMvvEDPD() {} + int setmask(); + virtual void init(); + virtual void initial_integrate(int); + virtual void final_integrate(); + virtual void reset_dt(); + + protected: + double dtv, dtf; + double verlet; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/fix_mvv_tdpd.cpp b/src/USER-MESO/fix_mvv_tdpd.cpp new file mode 100644 index 000000000..382ce9033 --- /dev/null +++ b/src/USER-MESO/fix_mvv_tdpd.cpp @@ -0,0 +1,156 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This is a time integrator for position, velocity and concentration (x, + v and cc) using the modified velocity-Verlet (MVV) algorithm. + Setting verlet = 0.5 recovers the standard velocity-Verlet algorithm. + + Contributing author: Zhen Li (Brown University) + Email: zhen_li@brown.edu + + Please cite the related publication: + Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. "Transport + dissipative particle dynamics model for mesoscopic advection-diffusion + -reaction problems". The Journal of Chemical Physics, 2015, 143: 014101. +------------------------------------------------------------------------- */ + +#include +#include +#include "fix_mvv_tdpd.h" +#include "atom.h" +#include "force.h" +#include "update.h" +#include "respa.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixMvvTDPD::FixMvvTDPD(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (strcmp(style,"tdpd/verlet") != 0 && narg < 3) + error->all(FLERR,"Illegal fix mvv/tdpd command"); + + verlet = 0.5; + if(narg > 3) verlet = force->numeric(FLERR,arg[3]); + + cc_species = atom->cc_species; + + dynamic_group_allow = 1; + time_integrate = 1; +} + +/* ---------------------------------------------------------------------- */ + +int FixMvvTDPD::setmask() +{ + int mask = 0; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvTDPD::init() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- + allow for both per-type and per-atom mass +------------------------------------------------------------------------- */ + +void FixMvvTDPD::initial_integrate(int vflag) +{ + double dtfm; + // update v and x and cc of atoms in group + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double **cc = atom->cc; + double **cc_flux = atom->cc_flux; + double **vest = atom->vest; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (rmass) dtfm = dtf / rmass[i]; + else dtfm = dtf / mass[type[i]]; + + vest[i][0] = v[i][0] + dtfm * f[i][0]; + vest[i][1] = v[i][1] + dtfm * f[i][1]; + vest[i][2] = v[i][2] + dtfm * f[i][2]; + + x[i][0] += dtv * vest[i][0]; + x[i][1] += dtv * vest[i][1]; + x[i][2] += dtv * vest[i][2]; + v[i][0] += 2.0 * verlet * dtfm * f[i][0]; + v[i][1] += 2.0 * verlet * dtfm * f[i][1]; + v[i][2] += 2.0 * verlet * dtfm * f[i][2]; + for(int k = 0; k < cc_species; k++) + cc[i][k] += 0.5 * dtv * cc_flux[i][k]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvTDPD::final_integrate() +{ + double dtfm; + + // update v of atoms in group + + double **v = atom->v; + double **f = atom->f; + double **cc = atom->cc; + double **cc_flux = atom->cc_flux; + double **vest = atom->vest; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (rmass) dtfm = dtf / rmass[i]; + else dtfm = dtf / mass[type[i]]; + + v[i][0] = vest[i][0] + dtfm * f[i][0]; + v[i][1] = vest[i][1] + dtfm * f[i][1]; + v[i][2] = vest[i][2] + dtfm * f[i][2]; + for(int k = 0; k < cc_species; k++) + cc[i][k] += 0.5 * dtv * cc_flux[i][k]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMvvTDPD::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} diff --git a/src/USER-MESO/fix_mvv_tdpd.h b/src/USER-MESO/fix_mvv_tdpd.h new file mode 100644 index 000000000..7adb23af6 --- /dev/null +++ b/src/USER-MESO/fix_mvv_tdpd.h @@ -0,0 +1,46 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(mvv/tdpd,FixMvvTDPD) + +#else + +#ifndef LMP_FIX_MVV_TDPD_H +#define LMP_FIX_MVV_TDPD_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixMvvTDPD : public Fix { + public: + FixMvvTDPD(class LAMMPS *, int, char **); + virtual ~FixMvvTDPD() {} + int setmask(); + virtual void init(); + virtual void initial_integrate(int); + virtual void final_integrate(); + virtual void reset_dt(); + + protected: + double dtv, dtf; + double verlet; + int cc_species; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/fix_tdpd_source.cpp b/src/USER-MESO/fix_tdpd_source.cpp new file mode 100644 index 000000000..3dfeba478 --- /dev/null +++ b/src/USER-MESO/fix_tdpd_source.cpp @@ -0,0 +1,120 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include +#include +#include "fix_tdpd_source.h" +#include "atom.h" +#include "comm.h" +#include "update.h" +#include "modify.h" +#include "domain.h" +#include "lattice.h" +#include "input.h" +#include "variable.h" +#include "error.h" +#include "force.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixTDPDSource::FixTDPDSource(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (strcmp(style,"tdpd/source") != 0 && narg < 4) + error->all(FLERR,"Illegal fix tdpd/source command"); + + int iarg = 3; + cc_index = force->inumeric(FLERR,arg[iarg++]); + + if (strcmp(arg[iarg],"sphere") == 0) option = 0; + else if (strcmp(arg[iarg],"cuboid") == 0) option = 1; + else error->all(FLERR,"Illegal fix tdpd/source command"); + iarg++; + + if(option == 0){ + if (narg != 10 ) error->all(FLERR,"Illegal fix tdpd/source command (5 args for sphere)"); + center[0] = force->numeric(FLERR,arg[iarg++]); + center[1] = force->numeric(FLERR,arg[iarg++]); + center[2] = force->numeric(FLERR,arg[iarg++]); + radius = force->numeric(FLERR,arg[iarg++]); + value = force->numeric(FLERR,arg[iarg++]); + } + else if(option == 1){ + if (narg != 12 ) error->all(FLERR,"Illegal fix tdpd/edpd command (7 args for cuboid)"); + center[0] = force->numeric(FLERR,arg[iarg++]); + center[1] = force->numeric(FLERR,arg[iarg++]); + center[2] = force->numeric(FLERR,arg[iarg++]); + dLx = force->numeric(FLERR,arg[iarg++]); + dLy = force->numeric(FLERR,arg[iarg++]); + dLz = force->numeric(FLERR,arg[iarg++]); + value = force->numeric(FLERR,arg[iarg++]); + } + else error->all(FLERR,"Illegal fix tdpd/source command"); +} + +/* ---------------------------------------------------------------------- */ + +FixTDPDSource::~FixTDPDSource() +{ +} + +/* ---------------------------------------------------------------------- */ + +int FixTDPDSource::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixTDPDSource::init() +{ +} + +/* ---------------------------------------------------------------------- */ + +void FixTDPDSource::post_force(int vflag) +{ + double **x = atom->x; + double **cc_flux = atom->cc_flux; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + double drx, dry, drz, rsq; + double radius_sq = radius*radius*radius; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if(option == 0){ + drx = x[i][0] - center[0]; + dry = x[i][1] - center[1]; + drz = x[i][2] - center[2]; + rsq = drx*drx + dry*dry + drz*drz; + if(rsq < radius_sq) + cc_flux[i][cc_index-1] += value; + } + else if(option == 1){ + drx = x[i][0] - center[0]; + dry = x[i][1] - center[1]; + drz = x[i][2] - center[2]; + if(abs(drx) <= 0.5*dLx && abs(dry) <= 0.5*dLy && abs(drz) <= 0.5*dLz) + cc_flux[i][cc_index-1] += value; + } + } + } +} diff --git a/src/USER-MESO/fix_tdpd_source.h b/src/USER-MESO/fix_tdpd_source.h new file mode 100644 index 000000000..302fe8209 --- /dev/null +++ b/src/USER-MESO/fix_tdpd_source.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(tdpd/source,FixTDPDSource) + +#else + +#ifndef LMP_FIX_TDPDSOURCE_H +#define LMP_FIX_TDPDSOURCE_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixTDPDSource : public Fix { + public: + FixTDPDSource(class LAMMPS *, int, char **); + ~FixTDPDSource(); + int setmask(); + void init(); + void post_force(int); + + protected: + int option; + int cc_index; + double center[3], radius, dLx, dLy, dLz; + double value; +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/pair_edpd.cpp b/src/USER-MESO/pair_edpd.cpp new file mode 100644 index 000000000..c1c100db4 --- /dev/null +++ b/src/USER-MESO/pair_edpd.cpp @@ -0,0 +1,551 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Zhen Li (Brown University) + Email: zhen_li@brown.edu +------------------------------------------------------------------------- */ + +#include +#include +#include +#include "pair_edpd.h" +#include "atom.h" +#include "atom_vec.h" +#include "comm.h" +#include "update.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "random_mars.h" +#include "citeme.h" +#include "memory.h" +#include "error.h" +#include +#include + +using namespace LAMMPS_NS; + +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#define MAX(A,B) ((A) > (B) ? (A) : (B)) + +#define EPSILON 1.0e-10 + +static const char cite_pair_edpd[] = + "pair edpd command:\n\n" + "@Article{ZLi2014_JCP,\n" + " author = {Li, Z. and Tang, Y.-H. and Lei, H. and Caswell, B. and Karniadakis, G.E.},\n" + " title = {Energy-conserving dissipative particle dynamics with temperature-dependent properties},\n" + " journal = {Journal of Computational Physics},\n" + " year = {2014},\n" + " volume = {265},\n" + " pages = {113--127}\n" + "}\n\n" + "@Article{ZLi2015_CC,\n" + " author = {Li, Z. and Tang, Y.-H. and Li, X. and Karniadakis, G.E.},\n" + " title = {Mesoscale modeling of phase transition dynamics of thermoresponsive polymers},\n" + " journal = {Chemical Communications},\n" + " year = {2015},\n" + " volume = {51},\n" + " pages = {11038--11040}\n" + "}\n\n"; +; + +/* ---------------------------------------------------------------------- */ + +PairEDPD::PairEDPD(LAMMPS *lmp) : Pair(lmp) +{ + if (lmp->citeme) lmp->citeme->add(cite_pair_edpd); + writedata = 1; + random = NULL; + randomT = NULL; +} + +/* ---------------------------------------------------------------------- */ + +PairEDPD::~PairEDPD() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + memory->destroy(cutT); + + memory->destroy(a0); + memory->destroy(gamma); + memory->destroy(power); + memory->destroy(kappa); + memory->destroy(powerT); + } + if (power_flag) memory->destroy(sc); + if (kappa_flag) memory->destroy(kc); + + if (random) delete random; + if (randomT) delete randomT; +} + +/* ---------------------------------------------------------------------- */ + +void PairEDPD::compute(int eflag, int vflag) +{ + double evdwl = 0.0; + if (eflag || vflag) ev_setup(eflag,vflag); + else evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *T = atom->edpd_temp; + double *Q = atom->edpd_flux; + double *cv = atom->edpd_cv; + int *type = atom->type; + double *mass = atom->mass; + int nlocal = atom->nlocal; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; + double dtinvsqrt = 1.0/sqrt(update->dt); + double kboltz = 1.0; + + int inum = list->inum; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; + double xtmp = x[i][0]; + double ytmp = x[i][1]; + double ztmp = x[i][2]; + double vxtmp = v[i][0]; + double vytmp = v[i][1]; + double vztmp = v[i][2]; + int itype = type[i]; + int *jlist = firstneigh[i]; + int jnum = numneigh[i]; + + for (int jj = 0; jj < jnum; jj++) { + int j = jlist[jj]; + double factor_dpd = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + double delx = xtmp - x[j][0]; + double dely = ytmp - x[j][1]; + double delz = ztmp - x[j][2]; + double rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + double r = sqrt(rsq); + if (r < EPSILON) continue; + double rinv = 1.0/r; + double delvx = vxtmp - v[j][0]; + double delvy = vytmp - v[j][1]; + double delvz = vztmp - v[j][2]; + double dot = delx*delvx + dely*delvy + delz*delvz; + double vijeij = dot*rinv; + double randnum = random->gaussian(); + + double T_ij=0.5*(T[i]+T[j]); + double T_pow[4]; + T_pow[0] = T_ij - 1.0; + T_pow[1] = T_pow[0]*T_pow[0]; + T_pow[2] = T_pow[0]*T_pow[1]; + T_pow[3] = T_pow[0]*T_pow[2]; + + double power_d = power[itype][jtype]; + if(power_flag){ + double factor = 1.0; + for(int k = 0; k < 4; k++) + factor += sc[itype][jtype][k]*T_pow[k]; + power_d *= factor; + } + + power_d = MAX(0.01,power_d); + double wc = 1.0 - r/cut[itype][jtype]; + wc = MAX(0.0,MIN(1.0,wc)); + double wr = pow(wc, 0.5*power_d); + + double GammaIJ = gamma[itype][jtype]; + double SigmaIJ = 4.0*GammaIJ*kboltz*T[i]*T[j]/(T[i]+T[j]); + SigmaIJ = sqrt(SigmaIJ); + + double fpair = a0[itype][jtype]*T_ij*wc; + fpair -= GammaIJ *wr*wr *dot*rinv; + fpair += SigmaIJ * wr *randnum * dtinvsqrt; + fpair *= factor_dpd*rinv; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + + // heat transfer + double dQc,dQd,dQr; + if( r < cutT[itype][jtype]) { + double wrT = 1.0 - r/cutT[itype][jtype]; + wrT = MAX(0.0,MIN(1.0,wrT)); + wrT = pow(wrT, 0.5*powerT[itype][jtype]); + double randnumT = randomT->gaussian(); + randnumT = MAX(-5.0,MIN(randnum,5.0)); + + double kappaT = kappa[itype][jtype]; + if(kappa_flag) { + double factor = 1.0; + for(int k = 0; k < 4; k++) + factor += kc[itype][jtype][k]*T_pow[k]; + kappaT *= factor; + } + + double kij = cv[i]*cv[j]*kappaT * T_ij*T_ij; + double alphaij = sqrt(2.0*kboltz*kij); + + dQc = kij * wrT*wrT * ( T[j] - T[i] )/(T[i]*T[j]); + dQd = wr*wr*( GammaIJ * vijeij*vijeij - SigmaIJ*SigmaIJ/mass[itype] ) - SigmaIJ * wr *vijeij *randnum; + dQd /= (cv[i]+cv[j]); + dQr = alphaij * wrT * dtinvsqrt * randnumT; + Q[i] += (dQc + dQd + dQr ); + } + //----------------------------------------------------------- + + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + Q[j] -= ( dQc - dQd + dQr ); + } + + if (eflag) { + evdwl = 0.5*a0[itype][jtype]*T_ij*cut[itype][jtype] * wc*wc; + evdwl *= factor_dpd; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairEDPD::allocate() +{ + int i,j; + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (i = 1; i <= n; i++) + for (j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + + memory->create(cut,n+1,n+1,"pair:cut"); + memory->create(cutT,n+1,n+1,"pair:cutT"); + memory->create(a0,n+1,n+1,"pair:a0"); + memory->create(gamma,n+1,n+1,"pair:gamma"); + memory->create(power,n+1,n+1,"pair:power"); + memory->create(kappa,n+1,n+1,"pair:kappa"); + memory->create(powerT,n+1,n+1,"pair:powerT"); + +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairEDPD::settings(int narg, char **arg) +{ + if (narg != 2) error->all(FLERR,"Illegal pair_style command"); + + cut_global = force->numeric(FLERR,arg[0]); + seed = force->inumeric(FLERR,arg[1]); + + // initialize Marsaglia RNG with processor-unique seed + + if (seed <= 0 ) { + struct timespec time; + clock_gettime( CLOCK_REALTIME, &time ); + seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed + } + delete random; + random = new RanMars(lmp,(seed + comm->me) % 900000000); + randomT = new RanMars(lmp,(2*seed + comm->me) % 900000000); + + // reset cutoffs that have been explicitly set + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i+1; j <= atom->ntypes; j++) + if (setflag[i][j]) + cut[i][j] = cut_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairEDPD::coeff(int narg, char **arg) +{ + if (narg < 9) + error->all(FLERR,"Incorrect args for pair edpd coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); + force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + + double a0_one = force->numeric(FLERR,arg[2]); + double gamma_one = force->numeric(FLERR,arg[3]); + double power_one = force->numeric(FLERR,arg[4]); + double cut_one = force->numeric(FLERR,arg[5]); + double kappa_one = force->numeric(FLERR,arg[6]); + double powerT_one= force->numeric(FLERR,arg[7]); + double cutT_one = force->numeric(FLERR,arg[8]); + + int iarg = 9; + power_flag = kappa_flag = 0; + double sc_one[4], kc_one[4]; + int n = atom->ntypes; + while (iarg < narg) { + if (strcmp(arg[iarg],"power") == 0) { + if (iarg+5 > narg) error->all(FLERR,"Illegal pair edpd coefficients"); + for (int i = 0; i < 4; i++) + sc_one[i] = force->numeric(FLERR,arg[iarg+i+1]); + iarg += 5; + power_flag = 1; + memory->create(sc,n+1,n+1,4,"pair:sc"); + } else if (strcmp(arg[iarg],"kappa") == 0) { + if (iarg+5 > narg) error->all(FLERR,"Illegal pair edpd coefficients"); + for (int i = 0; i < 4; i++) + kc_one[i] = force->numeric(FLERR,arg[iarg+i+1]); + iarg += 5; + kappa_flag = 1; + memory->create(kc,n+1,n+1,4,"pair:kc"); + } else error->all(FLERR,"Illegal pair edpd coefficients"); + } + + int count = 0; + for (int i = ilo; i <= ihi; i++) + for (int j = MAX(jlo,i); j <= jhi; j++) { + a0[i][j] = a0_one; + gamma[i][j] = gamma_one; + power[i][j] = power_one; + cut[i][j] = cut_one; + kappa[i][j] = kappa_one; + powerT[i][j]= powerT_one; + cutT[i][j] = cutT_one; + + if(power_flag) + for (int k = 0; k < 4; k++) + sc[i][j][k] = sc_one[k]; + + if(kappa_flag) + for (int k = 0; k < 4; k++) + kc[i][j][k] = kc_one[k]; + + setflag[i][j] = 1; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairEDPD::init_style() +{ + if (comm->ghost_velocity == 0) + error->all(FLERR,"Pair edpd requires ghost atoms store velocity"); + + // if newton off, forces between atoms ij will be double computed + // using different random numbers + + if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR, + "Pair tdpd needs newton pair on for momentum conservation"); + + neighbor->request(this,instance_me); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairEDPD::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + + cut[j][i] = cut[i][j]; + cutT[j][i] = cutT[i][j]; + a0[j][i] = a0[i][j]; + gamma[j][i] = gamma[i][j]; + power[j][i] = power[i][j]; + kappa[j][i] = kappa[i][j]; + powerT[j][i]= powerT[i][j]; + + if(power_flag) + for (int k = 0; k < 4; k++) + sc[j][i][k] = sc[i][j][k]; + + if(kappa_flag) + for (int k = 0; k < 4; k++) + kc[j][i][k] = kc[i][j][k]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairEDPD::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&a0[i][j],sizeof(double),1,fp); + fwrite(&gamma[i][j],sizeof(double),1,fp); + fwrite(&power[i][j],sizeof(double),1,fp); + fwrite(&cut[i][j],sizeof(double),1,fp); + fwrite(&kappa[i][j],sizeof(double),1,fp); + fwrite(&powerT[i][j],sizeof(double),1,fp); + fwrite(&cutT[i][j],sizeof(double),1,fp); + if(power_flag) + for (int k = 0; k < 4; k++) + fwrite(&sc[i][j][k],sizeof(double),1,fp); + + if(kappa_flag) + for (int k = 0; k < 4; k++) + fwrite(&kc[i][j][k],sizeof(double),1,fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairEDPD::read_restart(FILE *fp) +{ + read_restart_settings(fp); + + allocate(); + + int me = comm->me; + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) { + if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + fread(&a0[i][j],sizeof(double),1,fp); + fread(&gamma[i][j],sizeof(double),1,fp); + fread(&power[i][j],sizeof(double),1,fp); + fread(&cut[i][j],sizeof(double),1,fp); + fread(&kappa[i][j],sizeof(double),1,fp); + fread(&powerT[i][j],sizeof(double),1,fp); + fread(&cutT[i][j],sizeof(double),1,fp); + if(power_flag) + for (int k = 0; k < 4; k++) + fread(&sc[i][j][k],sizeof(double),1,fp); + + if(kappa_flag) + for (int k = 0; k < 4; k++) + fread(&kc[i][j][k],sizeof(double),1,fp); + } + MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&power[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&kappa[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&powerT[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cutT[i][j],1,MPI_DOUBLE,0,world); + if(power_flag) + for (int k = 0; k < 4; k++) + MPI_Bcast(&sc[i][j][k],1,MPI_DOUBLE,0,world); + + if(kappa_flag) + for (int k = 0; k < 4; k++) + MPI_Bcast(&kc[i][j][k],1,MPI_DOUBLE,0,world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairEDPD::write_restart_settings(FILE *fp) +{ + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&seed,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairEDPD::read_restart_settings(FILE *fp) +{ + if (comm->me == 0) { + fread(&cut_global,sizeof(double),1,fp); + fread(&seed,sizeof(int),1,fp); + fread(&mix_flag,sizeof(int),1,fp); + } + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&seed,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + + // initialize Marsaglia RNG with processor-unique seed + // same seed that pair_style command initially specified + + if (random) delete random; + random = new RanMars(lmp,seed + comm->me); + if (randomT) delete randomT; + randomT = new RanMars(lmp,seed + comm->me); +} + +/* ---------------------------------------------------------------------- */ + +double PairEDPD::single(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_dpd, double &fforce) +{ + double r,rinv,wc,phi; + double *T = atom->edpd_temp; + + r = sqrt(rsq); + if (r < EPSILON) { + fforce = 0.0; + return 0.0; + } + double T_ij = 0.5*(T[i]+T[j]); + rinv = 1.0/r; + wc = 1.0 - r/cut[itype][jtype]; + fforce = a0[itype][jtype]*T_ij*wc*factor_dpd*rinv; + + phi = 0.5*a0[itype][jtype]*T_ij*cut[itype][jtype]*wc*wc; + return factor_dpd*phi; +} diff --git a/src/USER-MESO/pair_edpd.h b/src/USER-MESO/pair_edpd.h new file mode 100644 index 000000000..9ab0ad967 --- /dev/null +++ b/src/USER-MESO/pair_edpd.h @@ -0,0 +1,85 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(edpd,PairEDPD) + +#else + +#ifndef LMP_PAIR_EDPD_H +#define LMP_PAIR_EDPD_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairEDPD : public Pair { + public: + PairEDPD(class LAMMPS *); + virtual ~PairEDPD(); + virtual void compute(int, int); + virtual void settings(int, char **); + virtual void coeff(int, char **); + void init_style(); + double init_one(int, int); + virtual void write_restart(FILE *); + virtual void read_restart(FILE *); + virtual void write_restart_settings(FILE *); + virtual void read_restart_settings(FILE *); + double single(int, int, int, int, double, double, double, double &); + + protected: + double cut_global; + int seed; + double **cut,**cutT; + double **a0,**gamma; + double **power; + double **slope; + double **kappa; + double **powerT; + int power_flag, kappa_flag; + double ***sc,***kc; + class RanMars *random; + class RanMars *randomT; + + void allocate(); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +W: Pair tdpd needs newton pair on for momentum conservation + +Self-explanatory. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ diff --git a/src/USER-MESO/pair_mdpd.cpp b/src/USER-MESO/pair_mdpd.cpp new file mode 100644 index 000000000..bf78ea5af --- /dev/null +++ b/src/USER-MESO/pair_mdpd.cpp @@ -0,0 +1,425 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Zhen Li (Brown University) + Email: zhen_li@brown.edu +------------------------------------------------------------------------- */ + +#include +#include +#include +#include "pair_mdpd.h" +#include "atom.h" +#include "atom_vec.h" +#include "comm.h" +#include "update.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "random_mars.h" +#include "citeme.h" +#include "memory.h" +#include "error.h" +#include + +using namespace LAMMPS_NS; + +#define EPSILON 1.0e-10 + +static const char cite_pair_mdpd[] = + "pair mdpd command:\n\n" + "@Article{ZLi2013_POF,\n" + " author = {Li, Z. and Hu, G.H. and Wang, Z.L. and Ma Y.B. and Zhou, Z.W.},\n" + " title = {Three dimensional flow structures in a moving droplet on substrate: a dissipative particle dynamics study},\n" + " journal = {Physics of Fluids},\n" + " year = {2013},\n" + " volume = {25},\n" + " pages = {072103}\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairMDPD::PairMDPD(LAMMPS *lmp) : Pair(lmp) +{ + if (lmp->citeme) lmp->citeme->add(cite_pair_mdpd); + + writedata = 1; + random = NULL; +} + +/* ---------------------------------------------------------------------- */ + +PairMDPD::~PairMDPD() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + memory->destroy(cut_r); + memory->destroy(A_att); + memory->destroy(B_rep); + memory->destroy(gamma); + memory->destroy(sigma); + } + if (random) delete random; +} + +/* ---------------------------------------------------------------------- */ + +void PairMDPD::compute(int eflag, int vflag) +{ + int i,j,ii,jj,inum,jnum,itype,jtype; + double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; + double vxtmp,vytmp,vztmp,delvx,delvy,delvz; + double rsq,r,rinv,dot,wc,wc_r, wr,randnum,factor_dpd; + int *ilist,*jlist,*numneigh,**firstneigh; + double rhoi, rhoj; + + evdwl = 0.0; + if (eflag || vflag) ev_setup(eflag,vflag); + else evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *rho= atom->rho; + int *type = atom->type; + int nlocal = atom->nlocal; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; + double dtinvsqrt = 1.0/sqrt(update->dt); + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + vxtmp = v[i][0]; + vytmp = v[i][1]; + vztmp = v[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + rhoi = rho[i]; + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_dpd = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r = sqrt(rsq); + if (r < EPSILON) continue; // r can be 0.0 in MDPD systems + rinv = 1.0/r; + delvx = vxtmp - v[j][0]; + delvy = vytmp - v[j][1]; + delvz = vztmp - v[j][2]; + dot = delx*delvx + dely*delvy + delz*delvz; + + wc = 1.0 - r/cut[itype][jtype]; + wc_r = 1.0 - r/cut_r[itype][jtype]; + wc_r = MAX(wc_r,0.0); + wr = wc; + + rhoj = rho[j]; + randnum = random->gaussian(); + + // conservative force = A_att * wc + B_rep*(rhoi+rhoj)*wc_r + // drag force = -gamma * wr^2 * (delx dot delv) / r + // random force = sigma * wr * rnd * dtinvsqrt; + + fpair = A_att[itype][jtype]*wc + B_rep[itype][jtype]*(rhoi+rhoj)*wc_r; + fpair -= gamma[itype][jtype]*wr*wr*dot*rinv; + fpair += sigma[itype][jtype]*wr*randnum*dtinvsqrt; + fpair *= factor_dpd*rinv; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (eflag) { + // unshifted eng of conservative term: + // eng shifted to 0.0 at cutoff + evdwl = 0.5*A_att[itype][jtype]*cut[itype][jtype] * wr*wr + 0.5*B_rep[itype][jtype]*cut_r[itype][jtype]*(rhoi+rhoj)*wc_r*wc_r; + evdwl *= factor_dpd; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + } + } + } + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairMDPD::allocate() +{ + int i,j; + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (i = 1; i <= n; i++) + for (j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + + memory->create(cut,n+1,n+1,"pair:cut"); + memory->create(cut_r,n+1,n+1,"pair:cut_r"); + memory->create(A_att,n+1,n+1,"pair:A_att"); + memory->create(B_rep,n+1,n+1,"pair:B_rep"); + memory->create(gamma,n+1,n+1,"pair:gamma"); + memory->create(sigma,n+1,n+1,"pair:sigma"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairMDPD::settings(int narg, char **arg) +{ + if (narg != 3) error->all(FLERR,"Illegal pair_style command"); + + temperature = force->numeric(FLERR,arg[0]); + cut_global = force->numeric(FLERR,arg[1]); + seed = force->inumeric(FLERR,arg[2]); + + // initialize Marsaglia RNG with processor-unique seed + + if (seed <= 0 ) { + struct timespec time; + clock_gettime( CLOCK_REALTIME, &time ); + seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed + } + delete random; + random = new RanMars(lmp,(seed + comm->me) % 900000000); + + // reset cutoffs that have been explicitly set + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i+1; j <= atom->ntypes; j++) + if (setflag[i][j]) cut[i][j] = cut_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairMDPD::coeff(int narg, char **arg) +{ + if(narg != 7 ) error->all(FLERR,"Incorrect args for pair coefficients\n itype jtype A B gamma cutA cutB"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); + force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + + double A_one = force->numeric(FLERR,arg[2]); + double B_one = force->numeric(FLERR,arg[3]); + double gamma_one = force->numeric(FLERR,arg[4]); + double cut_one = force->numeric(FLERR,arg[5]); + double cut_two = force->numeric(FLERR,arg[6]); + + if(cut_one < cut_two) error->all(FLERR,"Incorrect args for pair coefficients\n cutA should be larger than cutB."); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + A_att[i][j] = A_one; + B_rep[i][j] = B_one; + gamma[i][j] = gamma_one; + cut[i][j] = cut_one; + cut_r[i][j] = cut_two; + setflag[i][j] = 1; + count++; + } + } + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairMDPD::init_style() +{ + if (comm->ghost_velocity == 0) + error->all(FLERR,"Pair mdpd requires ghost atoms store velocity"); + + // if newton off, forces between atoms ij will be double computed + // using different random numbers + + if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR, + "Pair mdpd needs newton pair on for momentum conservation"); + + neighbor->request(this,instance_me); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairMDPD::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + + sigma[i][j] = sqrt(2.0*force->boltz*temperature*gamma[i][j]); + + cut[j][i] = cut[i][j]; + cut_r[j][i] = cut_r[i][j]; + A_att[j][i] = A_att[i][j]; + B_rep[j][i] = B_rep[i][j]; + gamma[j][i] = gamma[i][j]; + sigma[j][i] = sigma[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairMDPD::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&A_att[i][j],sizeof(double),1,fp); + fwrite(&B_rep[i][j],sizeof(double),1,fp); + fwrite(&gamma[i][j],sizeof(double),1,fp); + fwrite(&cut[i][j],sizeof(double),1,fp); + fwrite(&cut_r[i][j],sizeof(double),1,fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairMDPD::read_restart(FILE *fp) +{ + read_restart_settings(fp); + + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + fread(&A_att[i][j],sizeof(double),1,fp); + fread(&B_rep[i][j],sizeof(double),1,fp); + fread(&gamma[i][j],sizeof(double),1,fp); + fread(&cut[i][j],sizeof(double),1,fp); + fread(&cut_r[i][j],sizeof(double),1,fp); + } + MPI_Bcast(&A_att[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&B_rep[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_r[i][j],1,MPI_DOUBLE,0,world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairMDPD::write_restart_settings(FILE *fp) +{ + fwrite(&temperature,sizeof(double),1,fp); + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&seed,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairMDPD::read_restart_settings(FILE *fp) +{ + if (comm->me == 0) { + fread(&temperature,sizeof(double),1,fp); + fread(&cut_global,sizeof(double),1,fp); + fread(&seed,sizeof(int),1,fp); + fread(&mix_flag,sizeof(int),1,fp); + } + MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&seed,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + + // initialize Marsaglia RNG with processor-unique seed + // same seed that pair_style command initially specified + + if (random) delete random; + random = new RanMars(lmp,seed + comm->me); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairMDPD::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d %g %g %g\n",i,A_att[i][i],B_rep[i][i],gamma[i][i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairMDPD::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g %g %g %g %g\n",i,j,A_att[i][j],B_rep[i][j],gamma[i][j],cut[i][j],cut_r[i][j]); +} + diff --git a/src/USER-MESO/pair_mdpd.h b/src/USER-MESO/pair_mdpd.h new file mode 100644 index 000000000..ea0389c7f --- /dev/null +++ b/src/USER-MESO/pair_mdpd.h @@ -0,0 +1,84 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(mdpd,PairMDPD) + +#else + +#ifndef LMP_PAIR_MDPD_H +#define LMP_PAIR_MDPD_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairMDPD : public Pair { + public: + PairMDPD(class LAMMPS *); + virtual ~PairMDPD(); + virtual void compute(int, int); + virtual void settings(int, char **); + virtual void coeff(int, char **); + void init_style(); + double init_one(int, int); + virtual void write_restart(FILE *); + virtual void read_restart(FILE *); + virtual void write_restart_settings(FILE *); + virtual void read_restart_settings(FILE *); + virtual void write_data(FILE *); + virtual void write_data_all(FILE *); + + protected: + double cut_global,temperature; + int seed; + double **cut, **cut_r; + double **A_att,**B_rep; + double **gamma,**sigma; + class RanMars *random; + + void allocate(); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: Pair dpd requires ghost atoms store velocity + +Use the comm_modify vel yes command to enable this. + +W: Pair dpd needs newton pair on for momentum conservation + +Self-explanatory. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ diff --git a/src/USER-MESO/pair_mdpd_rhosum.cpp b/src/USER-MESO/pair_mdpd_rhosum.cpp new file mode 100644 index 000000000..9c4d6f804 --- /dev/null +++ b/src/USER-MESO/pair_mdpd_rhosum.cpp @@ -0,0 +1,267 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. + ------------------------------------------------------------------------- */ + +/*----------------------------------------------------------------------- + This is a Child Class PairMDPD for taking care of density summation + before the force calculation. + The code uses 3D Lucy kernel, it can be modified for other kernels. + + Contributing author: Zhen Li (Brown University) +------------------------------------------------------------------------- */ + +#include +#include +#include "pair_mdpd_rhosum.h" +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "memory.h" +#include "error.h" +#include "neighbor.h" +#include "update.h" +#include "domain.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairMDPDRhoSum::PairMDPDRhoSum(LAMMPS *lmp) : Pair(lmp) +{ + restartinfo = 0; + + // set comm size needed by this Pair + + comm_forward = 1; + first = 1; +} + +/* ---------------------------------------------------------------------- */ + +PairMDPDRhoSum::~PairMDPDRhoSum() { + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + } +} + +/* ---------------------------------------------------------------------- + init specific to this pair style + ------------------------------------------------------------------------- */ + +void PairMDPDRhoSum::init_style() { + // need a full neighbor list + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; +} + +/* ---------------------------------------------------------------------- */ + +void PairMDPDRhoSum::compute(int eflag, int vflag) { + int i, j, ii, jj, jnum, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz; + double r, rsq, h, ih, ihsq; + int *jlist; + double wf; + // neighbor list variables + int inum, *ilist, *numneigh, **firstneigh; + + if (eflag || vflag) + ev_setup(eflag, vflag); + else + evflag = vflag_fdotr = 0; + + double **x = atom->x; + double *rho = atom->rho; + int *type = atom->type; + double *mass = atom->mass; + + // check consistency of pair coefficients + if (first) { + for (i = 1; i <= atom->ntypes; i++) + for (j = 1; i <= atom->ntypes; i++) + if (cutsq[i][j] > 0.0) + if (!setflag[i][i] || !setflag[j][j]) + if (comm->me == 0) + printf("mDPD particle types %d and %d interact, but not all of their single particle properties are set.\n", i, j); + + first = 0; + } + + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // recompute density + // we use a full neighborlist here + + // initialize density with zero self-contribution, + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + itype = type[i]; + + h = cut[itype][itype]; + // Lucy kernel, 3d + wf = 2.0889086280811262819e0 / (h * h * h); + rho[i] = 0; + } + + // add density at each atom via kernel function overlap + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + jtype = type[j]; + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + if (rsq < cutsq[itype][jtype]) { + h = cut[itype][jtype]; + ih = 1.0 / h; + ihsq = ih * ih; + + // Lucy kernel, 3d + r = sqrt(rsq); + wf = (h - r) * ihsq; + wf = 2.0889086280811262819e0 * (h + 3. * r) * wf * wf * wf * ih; + rho[i] += mass[jtype]*wf; + } + } + } + + // communicate densities + comm->forward_comm_pair(this); +} + +/* ---------------------------------------------------------------------- + allocate all arrays + ------------------------------------------------------------------------- */ + +void PairMDPDRhoSum::allocate() { + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag, n + 1, n + 1, "pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); + + memory->create(cut, n + 1, n + 1, "pair:cut"); +} + +/* ---------------------------------------------------------------------- + global settings + ------------------------------------------------------------------------- */ + +void PairMDPDRhoSum::settings(int narg, char **arg) { + if (narg != 0) + error->all(FLERR,"Illegal number of setting arguments for pair_style mdpd/rhosum"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs + ------------------------------------------------------------------------- */ + +void PairMDPDRhoSum::coeff(int narg, char **arg) { + if (narg != 3) + error->all(FLERR,"Incorrect number of args for mdpd/rhosum coefficients"); + if (!allocated) + allocate(); + + int ilo, ihi, jlo, jhi; + force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); + force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + + double cut_one = force->numeric(FLERR,arg[2]); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + cut[i][j] = cut_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) + error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i + ------------------------------------------------------------------------- */ + +double PairMDPDRhoSum::init_one(int i, int j) { + if (setflag[i][j] == 0) { + error->all(FLERR,"All pair mdpd/rhosum coeffs are not set"); + } + + cut[j][i] = cut[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- */ + +double PairMDPDRhoSum::single(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_lj, double &fforce) { + fforce = 0.0; + + return 0.0; +} + +/* ---------------------------------------------------------------------- */ + +int PairMDPDRhoSum::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { + int i, j, m; + double *rho = atom->rho; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = rho[j]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairMDPDRhoSum::unpack_forward_comm(int n, int first, double *buf) { + int i, m, last; + double *rho = atom->rho; + + m = 0; + last = first + n; + for (i = first; i < last; i++) + rho[i] = buf[m++]; +} diff --git a/src/USER-MESO/pair_mdpd_rhosum.h b/src/USER-MESO/pair_mdpd_rhosum.h new file mode 100644 index 000000000..a972ec7cc --- /dev/null +++ b/src/USER-MESO/pair_mdpd_rhosum.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(mdpd/rhosum,PairMDPDRhoSum) + +#else + +#ifndef LMP_PAIR_MDPD_RHOSUM_H +#define LMP_PAIR_MDPD_RHOSUM_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairMDPDRhoSum : public Pair { + public: + PairMDPDRhoSum(class LAMMPS *); + virtual ~PairMDPDRhoSum(); + void init_style(); + virtual void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + virtual double init_one(int, int); + virtual double single(int, int, int, int, double, double, double, double &); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); + + protected: + double **cut; + int first; + + void allocate(); +}; + +} + +#endif +#endif diff --git a/src/USER-MESO/pair_tdpd.cpp b/src/USER-MESO/pair_tdpd.cpp new file mode 100644 index 000000000..22c856ee3 --- /dev/null +++ b/src/USER-MESO/pair_tdpd.cpp @@ -0,0 +1,477 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Zhen Li (Brown University) + Email: zhen_li@brown.edu +------------------------------------------------------------------------- */ + +#include +#include +#include +#include "pair_tdpd.h" +#include "atom.h" +#include "atom_vec.h" +#include "comm.h" +#include "update.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "random_mars.h" +#include "citeme.h" +#include "memory.h" +#include "error.h" +#include + +using namespace LAMMPS_NS; + +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#define MAX(A,B) ((A) > (B) ? (A) : (B)) + +#define EPSILON 1.0e-10 + +static const char cite_pair_tdpd[] = + "pair tdpd command:\n\n" + "@Article{ZLi2015_JCP,\n" + " author = {Li, Z. and Yazdani, A. and Tartakovsky, A. and Karniadakis, G.E.},\n" + " title = {Transport dissipative particle dynamics model for mesoscopic advection-diffusion-reaction problems},\n" + " journal = {The Journal of Chemical Physics},\n" + " year = {2015},\n" + " volume = {143},\n" + " pages = {014101}\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairTDPD::PairTDPD(LAMMPS *lmp) : Pair(lmp) +{ + if (lmp->citeme) lmp->citeme->add(cite_pair_tdpd); + cc_species = atom->cc_species; + + writedata = 1; + random = NULL; +} + +/* ---------------------------------------------------------------------- */ + +PairTDPD::~PairTDPD() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + memory->destroy(cutcc); + + memory->destroy(a0); + memory->destroy(gamma); + memory->destroy(sigma); + + memory->destroy(power); + memory->destroy(kappa); + memory->destroy(epsilon); + memory->destroy(powercc); + } + + if (random) delete random; +} + +/* ---------------------------------------------------------------------- */ + +void PairTDPD::compute(int eflag, int vflag) +{ + double evdwl = 0.0; + double fpair; + if (eflag || vflag) ev_setup(eflag,vflag); + else evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double **cc = atom->cc; + double **cc_flux = atom->cc_flux; + int *type = atom->type; + int nlocal = atom->nlocal; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; + double dtinvsqrt = 1.0/sqrt(update->dt); + + int inum = list->inum; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; + double xtmp = x[i][0]; + double ytmp = x[i][1]; + double ztmp = x[i][2]; + double vxtmp = v[i][0]; + double vytmp = v[i][1]; + double vztmp = v[i][2]; + int itype = type[i]; + int *jlist = firstneigh[i]; + int jnum = numneigh[i]; + + for (int jj = 0; jj < jnum; jj++) { + int j = jlist[jj]; + double factor_dpd = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + double delx = xtmp - x[j][0]; + double dely = ytmp - x[j][1]; + double delz = ztmp - x[j][2]; + double rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + double r = sqrt(rsq); + if (r < EPSILON) continue; // r can be 0.0 in DPD systems + double rinv = 1.0/r; + double delvx = vxtmp - v[j][0]; + double delvy = vytmp - v[j][1]; + double delvz = vztmp - v[j][2]; + double dot = delx*delvx + dely*delvy + delz*delvz; + double wc = 1.0 - r/cut[itype][jtype]; + wc = MAX(0,MIN(1.0,wc)); + double wr = pow(wc, 0.5*power[itype][jtype]); + double randnum = random->gaussian(); + + // conservative force = a0 * wc + // drag force = -gamma * wr^2 * (delx dot delv) / r + // random force = sigma * wr^(power/2) * rnd * dtinvsqrt; + + double fpair = a0[itype][jtype]*wc; + fpair -= gamma[itype][jtype]*wr*wr*dot*rinv; + fpair += sigma[itype][jtype]*wr*randnum*dtinvsqrt; + fpair *= factor_dpd*rinv; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + + // chemical concentration transport + if( r < cutcc[itype][jtype]) { + for(int k=0; kgaussian(); + randnum = MAX(-5.0,MIN(randnum,5.0)); + double dQc = -kappa[itype][jtype][k] * wcr*wcr *(cc[i][k]-cc[j][k]); + double dQr = epsilon[itype][jtype][k] *wcr* (cc[i][k]+cc[j][k]) *randnum*dtinvsqrt; + cc_flux[i][k] += (dQc + dQr); + if (newton_pair || j < nlocal) + cc_flux[j][k] -= ( dQc + dQr ); + } + } + //----------------------------------------------------------- + + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (eflag) { + evdwl = 0.5*a0[itype][jtype]*cut[itype][jtype] * wc*wc; + evdwl *= factor_dpd; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairTDPD::allocate() +{ + int i,j; + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (i = 1; i <= n; i++) + for (j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + + memory->create(cut,n+1,n+1,"pair:cut"); + memory->create(cutcc,n+1,n+1,"pair:cutcc"); + memory->create(a0,n+1,n+1,"pair:a0"); + memory->create(gamma,n+1,n+1,"pair:gamma"); + memory->create(sigma,n+1,n+1,"pair:sigma"); + memory->create(power,n+1,n+1,"pair:power"); + memory->create(kappa,n+1,n+1,cc_species,"pair:kappa"); + memory->create(epsilon,n+1,n+1,cc_species,"pair:epsilon"); + memory->create(powercc,n+1,n+1,cc_species,"pair:powercc"); + + for (i = 0; i <= atom->ntypes; i++) + for (j = 0; j <= atom->ntypes; j++) + sigma[i][j] = gamma[i][j] = 0.0; +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairTDPD::settings(int narg, char **arg) +{ + if (narg != 3) error->all(FLERR,"Illegal pair_style command"); + + temperature = force->numeric(FLERR,arg[0]); + cut_global = force->numeric(FLERR,arg[1]); + seed = force->inumeric(FLERR,arg[2]); + + // initialize Marsaglia RNG with processor-unique seed + + if (seed <= 0 ) { + struct timespec time; + clock_gettime( CLOCK_REALTIME, &time ); + seed = time.tv_nsec; // if seed is non-positive, get the current time as the seed + } + delete random; + random = new RanMars(lmp,(seed + comm->me) % 900000000); + + // reset cutoffs that have been explicitly set + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i+1; j <= atom->ntypes; j++) + if (setflag[i][j]) + cut[i][j] = cut_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairTDPD::coeff(int narg, char **arg) +{ + if (narg != 7 + 3*cc_species) + error->all(FLERR,"Incorrect args for pair tdpd coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); + force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + + double a0_one = force->numeric(FLERR,arg[2]); + double gamma_one = force->numeric(FLERR,arg[3]); + double power_one = force->numeric(FLERR,arg[4]); + double cut_one = force->numeric(FLERR,arg[5]); + double cutcc_one = force->numeric(FLERR,arg[6]); + double kappa_one[cc_species],epsilon_one[cc_species],powercc_one[cc_species]; + for(int k=0; knumeric(FLERR,arg[7+3*k]); + epsilon_one[k] = force->numeric(FLERR,arg[8+3*k]); + powercc_one[k] = force->numeric(FLERR,arg[9+3*k]); + } + + int count = 0; + for (int i = ilo; i <= ihi; i++) + for (int j = MAX(jlo,i); j <= jhi; j++) { + a0[i][j] = a0_one; + gamma[i][j] = gamma_one; + power[i][j] = power_one; + cut[i][j] = cut_one; + cutcc[i][j] = cutcc_one; + for(int k=0; kall(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairTDPD::init_style() +{ + if (comm->ghost_velocity == 0) + error->all(FLERR,"Pair tdpd requires ghost atoms store velocity"); + + // if newton off, forces between atoms ij will be double computed + // using different random numbers + + if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR, + "Pair tdpd needs newton pair on for momentum conservation"); + + neighbor->request(this,instance_me); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairTDPD::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + + sigma[i][j] = sqrt(2.0*force->boltz*temperature*gamma[i][j]); + + cut[j][i] = cut[i][j]; + cutcc[j][i] = cutcc[i][j]; + a0[j][i] = a0[i][j]; + gamma[j][i] = gamma[i][j]; + sigma[j][i] = sigma[i][j]; + power[j][i] = power[i][j]; + for(int k=0; kntypes; i++) + for (int j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&a0[i][j],sizeof(double),1,fp); + fwrite(&gamma[i][j],sizeof(double),1,fp); + fwrite(&power[i][j],sizeof(double),1,fp); + fwrite(&cut[i][j],sizeof(double),1,fp); + fwrite(&cutcc[i][j],sizeof(double),1,fp); + for(int k=0; kme; + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) { + if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + fread(&a0[i][j],sizeof(double),1,fp); + fread(&gamma[i][j],sizeof(double),1,fp); + fread(&power[i][j],sizeof(double),1,fp); + fread(&cut[i][j],sizeof(double),1,fp); + fread(&cutcc[i][j],sizeof(double),1,fp); + for(int k=0; kme == 0) { + fread(&temperature,sizeof(double),1,fp); + fread(&cut_global,sizeof(double),1,fp); + fread(&seed,sizeof(int),1,fp); + fread(&mix_flag,sizeof(int),1,fp); + } + MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&seed,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + + // initialize Marsaglia RNG with processor-unique seed + // same seed that pair_style command initially specified + + if (random) delete random; + random = new RanMars(lmp,seed + comm->me); +} + +/* ---------------------------------------------------------------------- */ + +double PairTDPD::single(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_dpd, double &fforce) +{ + double r,rinv,wc,phi; + + r = sqrt(rsq); + if (r < EPSILON) { + fforce = 0.0; + return 0.0; + } + + rinv = 1.0/r; + wc = 1.0 - r/cut[itype][jtype]; + fforce = a0[itype][jtype]*wc*factor_dpd*rinv; + + phi = 0.5*a0[itype][jtype]*cut[itype][jtype]*wc*wc; + return factor_dpd*phi; +} diff --git a/src/USER-MESO/pair_tdpd.h b/src/USER-MESO/pair_tdpd.h new file mode 100644 index 000000000..9245308d3 --- /dev/null +++ b/src/USER-MESO/pair_tdpd.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(tdpd,PairTDPD) + +#else + +#ifndef LMP_PAIR_TDPD_H +#define LMP_PAIR_TDPD_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairTDPD : public Pair { + public: + PairTDPD(class LAMMPS *); + virtual ~PairTDPD(); + virtual void compute(int, int); + virtual void settings(int, char **); + virtual void coeff(int, char **); + void init_style(); + double init_one(int, int); + virtual void write_restart(FILE *); + virtual void read_restart(FILE *); + virtual void write_restart_settings(FILE *); + virtual void read_restart_settings(FILE *); + double single(int, int, int, int, double, double, double, double &); + + protected: + double cut_global,temperature; + int seed,cc_species; + double **cut,**cutcc; + double **a0,**gamma,**sigma; + double **power; + double ***kappa,***epsilon; + double ***powercc; + class RanMars *random; + + void allocate(); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +W: Pair tdpd needs newton pair on for momentum conservation + +Self-explanatory. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ diff --git a/src/atom.cpp b/src/atom.cpp index e46b1a724..d4c00bc0a 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1,2256 +1,2268 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #include #include #include #include #include #include #include "atom.h" #include "style_atom.h" #include "atom_vec.h" #include "atom_vec_ellipsoid.h" #include "comm.h" #include "neighbor.h" #include "force.h" #include "modify.h" #include "fix.h" #include "compute.h" #include "output.h" #include "thermo.h" #include "update.h" #include "domain.h" #include "group.h" #include "input.h" #include "variable.h" #include "molecule.h" #include "atom_masks.h" #include "math_const.h" #include "memory.h" #include "error.h" #ifdef LMP_USER_INTEL #include "neigh_request.h" #endif using namespace LAMMPS_NS; using namespace MathConst; #define DELTA 1 #define DELTA_MEMSTR 1024 #define EPSILON 1.0e-6 enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files /* ---------------------------------------------------------------------- */ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) { natoms = 0; nlocal = nghost = nmax = 0; ntypes = 0; nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0; nbonds = nangles = ndihedrals = nimpropers = 0; firstgroupname = NULL; sortfreq = 1000; nextsort = 0; userbinsize = 0.0; maxbin = maxnext = 0; binhead = NULL; next = permute = NULL; // initialize atom arrays // customize by adding new array tag = NULL; type = mask = NULL; image = NULL; x = v = f = NULL; molecule = NULL; molindex = molatom = NULL; q = NULL; mu = NULL; omega = angmom = torque = NULL; radius = rmass = NULL; ellipsoid = line = tri = body = NULL; vfrac = s0 = NULL; x0 = NULL; spin = NULL; eradius = ervel = erforce = NULL; cs = csforce = vforce = ervelforce = NULL; etag = NULL; rho = drho = e = de = cv = NULL; vest = NULL; // USER-DPD uCond = uMech = uChem = uCG = uCGnew = NULL; duChem = NULL; dpdTheta = NULL; ssaAIR = NULL; + // USER-MESO + + cc = cc_flux = NULL; + edpd_temp = edpd_flux = edpd_cv = NULL; + // USER-SMD contact_radius = NULL; smd_data_9 = NULL; smd_stress = NULL; eff_plastic_strain = NULL; eff_plastic_strain_rate = NULL; damage = NULL; // molecular info bond_per_atom = extra_bond_per_atom = 0; num_bond = NULL; bond_type = NULL; bond_atom = NULL; angle_per_atom = extra_angle_per_atom = 0; num_angle = NULL; angle_type = NULL; angle_atom1 = angle_atom2 = angle_atom3 = NULL; dihedral_per_atom = extra_dihedral_per_atom = 0; num_dihedral = NULL; dihedral_type = NULL; dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; improper_per_atom = extra_improper_per_atom = 0; num_improper = NULL; improper_type = NULL; improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; maxspecial = 1; nspecial = NULL; special = NULL; // user-defined molecules nmolecule = 0; molecules = NULL; // custom atom arrays nivector = ndvector = 0; ivector = NULL; dvector = NULL; iname = dname = NULL; // initialize atom style and array existence flags // customize by adding new flag sphere_flag = peri_flag = electron_flag = 0; wavepacket_flag = sph_flag = 0; molecule_flag = 0; q_flag = mu_flag = 0; omega_flag = torque_flag = angmom_flag = 0; radius_flag = rmass_flag = 0; ellipsoid_flag = line_flag = tri_flag = body_flag = 0; vfrac_flag = 0; spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0; cs_flag = csforce_flag = vforce_flag = etag_flag = 0; rho_flag = e_flag = cv_flag = vest_flag = 0; - dpd_flag = 0; + dpd_flag = edpd_flag = tdpd_flag = 0; // USER-SMD smd_flag = 0; contact_radius_flag = 0; smd_data_9_flag = 0; smd_stress_flag = 0; x0_flag = 0; eff_plastic_strain_flag = 0; eff_plastic_strain_rate_flag = 0; damage_flag = 0; // Peridynamic scale factor pdscale = 1.0; // ntype-length arrays mass = NULL; mass_setflag = NULL; // callback lists & extra restart info nextra_grow = nextra_restart = nextra_border = 0; extra_grow = extra_restart = extra_border = NULL; nextra_grow_max = nextra_restart_max = nextra_border_max = 0; nextra_store = 0; extra = NULL; // default atom ID and mapping values tag_enable = 1; map_style = map_user = 0; map_tag_max = -1; map_maxarray = map_nhash = -1; max_same = 0; sametag = NULL; map_array = NULL; map_bucket = NULL; map_hash = NULL; atom_style = NULL; avec = NULL; avec_map = new AtomVecCreatorMap(); #define ATOM_CLASS #define AtomStyle(key,Class) \ (*avec_map)[#key] = &avec_creator; #include "style_atom.h" #undef AtomStyle #undef ATOM_CLASS } /* ---------------------------------------------------------------------- */ Atom::~Atom() { delete [] atom_style; delete avec; delete avec_map; delete [] firstgroupname; memory->destroy(binhead); memory->destroy(next); memory->destroy(permute); // delete atom arrays // customize by adding new array memory->destroy(tag); memory->destroy(type); memory->destroy(mask); memory->destroy(image); memory->destroy(x); memory->destroy(v); memory->destroy(f); memory->destroy(molecule); memory->destroy(molindex); memory->destroy(molatom); memory->destroy(q); memory->destroy(mu); memory->destroy(omega); memory->destroy(angmom); memory->destroy(torque); memory->destroy(radius); memory->destroy(rmass); memory->destroy(ellipsoid); memory->destroy(line); memory->destroy(tri); memory->destroy(body); memory->destroy(vfrac); memory->destroy(s0); memory->destroy(x0); memory->destroy(spin); memory->destroy(eradius); memory->destroy(ervel); memory->destroy(erforce); memory->destroy(ervelforce); memory->destroy(cs); memory->destroy(csforce); memory->destroy(vforce); memory->destroy(etag); memory->destroy(rho); memory->destroy(drho); memory->destroy(e); memory->destroy(de); memory->destroy(cv); memory->destroy(vest); memory->destroy(contact_radius); memory->destroy(smd_data_9); memory->destroy(smd_stress); memory->destroy(eff_plastic_strain); memory->destroy(eff_plastic_strain_rate); memory->destroy(damage); memory->destroy(dpdTheta); memory->destroy(uCond); memory->destroy(uMech); memory->destroy(uChem); memory->destroy(uCG); memory->destroy(uCGnew); memory->destroy(duChem); memory->destroy(ssaAIR); + memory->destroy(cc); + memory->destroy(cc_flux); + memory->destroy(edpd_temp); + memory->destroy(edpd_flux); + memory->destroy(edpd_cv); + memory->destroy(nspecial); memory->destroy(special); memory->destroy(num_bond); memory->destroy(bond_type); memory->destroy(bond_atom); memory->destroy(num_angle); memory->destroy(angle_type); memory->destroy(angle_atom1); memory->destroy(angle_atom2); memory->destroy(angle_atom3); memory->destroy(num_dihedral); memory->destroy(dihedral_type); memory->destroy(dihedral_atom1); memory->destroy(dihedral_atom2); memory->destroy(dihedral_atom3); memory->destroy(dihedral_atom4); memory->destroy(num_improper); memory->destroy(improper_type); memory->destroy(improper_atom1); memory->destroy(improper_atom2); memory->destroy(improper_atom3); memory->destroy(improper_atom4); // delete custom atom arrays for (int i = 0; i < nivector; i++) { delete [] iname[i]; memory->destroy(ivector[i]); } for (int i = 0; i < ndvector; i++) { delete [] dname[i]; memory->destroy(dvector[i]); } memory->sfree(iname); memory->sfree(dname); memory->sfree(ivector); memory->sfree(dvector); // delete user-defined molecules for (int i = 0; i < nmolecule; i++) delete molecules[i]; memory->sfree(molecules); // delete per-type arrays delete [] mass; delete [] mass_setflag; // delete extra arrays memory->destroy(extra_grow); memory->destroy(extra_restart); memory->destroy(extra_border); memory->destroy(extra); // delete mapping data structures map_delete(); } /* ---------------------------------------------------------------------- copy modify settings from old Atom class to current Atom class ------------------------------------------------------------------------- */ void Atom::settings(Atom *old) { tag_enable = old->tag_enable; map_user = old->map_user; map_style = old->map_style; sortfreq = old->sortfreq; userbinsize = old->userbinsize; if (old->firstgroupname) { int n = strlen(old->firstgroupname) + 1; firstgroupname = new char[n]; strcpy(firstgroupname,old->firstgroupname); } } /* ---------------------------------------------------------------------- create an AtomVec style called from lammps.cpp, input script, restart file, replicate ------------------------------------------------------------------------- */ void Atom::create_avec(const char *style, int narg, char **arg, int trysuffix) { delete [] atom_style; if (avec) delete avec; atom_style = NULL; avec = NULL; // unset atom style and array existence flags // may have been set by old avec // customize by adding new flag sphere_flag = peri_flag = electron_flag = 0; wavepacket_flag = sph_flag = 0; molecule_flag = 0; q_flag = mu_flag = 0; omega_flag = torque_flag = angmom_flag = 0; radius_flag = rmass_flag = 0; ellipsoid_flag = line_flag = tri_flag = body_flag = 0; vfrac_flag = 0; spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0; cs_flag = csforce_flag = vforce_flag = etag_flag = 0; rho_flag = e_flag = cv_flag = vest_flag = 0; // create instance of AtomVec // use grow() to initialize atom-based arrays to length 1 // so that x[0][0] can always be referenced even if proc has no atoms int sflag; avec = new_avec(style,trysuffix,sflag); avec->store_args(narg,arg); avec->process_args(narg,arg); avec->grow(1); if (sflag) { char estyle[256]; if (sflag == 1) sprintf(estyle,"%s/%s",style,lmp->suffix); else sprintf(estyle,"%s/%s",style,lmp->suffix2); int n = strlen(estyle) + 1; atom_style = new char[n]; strcpy(atom_style,estyle); } else { int n = strlen(style) + 1; atom_style = new char[n]; strcpy(atom_style,style); } // if molecular system: // atom IDs must be defined // force atom map to be created // map style may be reset by map_init() and its call to map_style_set() molecular = avec->molecular; if (molecular && tag_enable == 0) error->all(FLERR,"Atom IDs must be used for molecular systems"); if (molecular) map_style = 1; } /* ---------------------------------------------------------------------- generate an AtomVec class, first with suffix appended ------------------------------------------------------------------------- */ AtomVec *Atom::new_avec(const char *style, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { sflag = 1; char estyle[256]; sprintf(estyle,"%s/%s",style,lmp->suffix); if (avec_map->find(estyle) != avec_map->end()) { AtomVecCreator avec_creator = (*avec_map)[estyle]; return avec_creator(lmp); } } if (lmp->suffix2) { sflag = 2; char estyle[256]; sprintf(estyle,"%s/%s",style,lmp->suffix2); if (avec_map->find(estyle) != avec_map->end()) { AtomVecCreator avec_creator = (*avec_map)[estyle]; return avec_creator(lmp); } } } sflag = 0; if (avec_map->find(style) != avec_map->end()) { AtomVecCreator avec_creator = (*avec_map)[style]; return avec_creator(lmp); } error->all(FLERR,"Unknown atom style"); return NULL; } /* ---------------------------------------------------------------------- one instance per AtomVec style in style_atom.h ------------------------------------------------------------------------- */ template AtomVec *Atom::avec_creator(LAMMPS *lmp) { return new T(lmp); } /* ---------------------------------------------------------------------- */ void Atom::init() { // delete extra array since it doesn't persist past first run if (nextra_store) { memory->destroy(extra); extra = NULL; nextra_store = 0; } // check arrays that are atom type in length check_mass(FLERR); // setup of firstgroup if (firstgroupname) { firstgroup = group->find(firstgroupname); if (firstgroup < 0) error->all(FLERR,"Could not find atom_modify first group ID"); } else firstgroup = -1; // init AtomVec avec->init(); } /* ---------------------------------------------------------------------- */ void Atom::setup() { // setup bins for sorting // cannot do this in init() because uses neighbor cutoff if (sortfreq > 0) setup_sort_bins(); } /* ---------------------------------------------------------------------- return ptr to AtomVec class if matches style or to matching hybrid sub-class return NULL if no match ------------------------------------------------------------------------- */ AtomVec *Atom::style_match(const char *style) { if (strcmp(atom_style,style) == 0) return avec; else if (strcmp(atom_style,"hybrid") == 0) { AtomVecHybrid *avec_hybrid = (AtomVecHybrid *) avec; for (int i = 0; i < avec_hybrid->nstyles; i++) if (strcmp(avec_hybrid->keywords[i],style) == 0) return avec_hybrid->styles[i]; } return NULL; } /* ---------------------------------------------------------------------- modify parameters of the atom style some options can only be invoked before simulation box is defined first and sort options cannot be used together ------------------------------------------------------------------------- */ void Atom::modify_params(int narg, char **arg) { if (narg == 0) error->all(FLERR,"Illegal atom_modify command"); int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg],"id") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (domain->box_exist) error->all(FLERR, "Atom_modify id command after simulation box is defined"); if (strcmp(arg[iarg+1],"yes") == 0) tag_enable = 1; else if (strcmp(arg[iarg+1],"no") == 0) tag_enable = 0; else error->all(FLERR,"Illegal atom_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"map") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (domain->box_exist) error->all(FLERR, "Atom_modify map command after simulation box is defined"); if (strcmp(arg[iarg+1],"array") == 0) map_user = 1; else if (strcmp(arg[iarg+1],"hash") == 0) map_user = 2; else error->all(FLERR,"Illegal atom_modify command"); map_style = map_user; iarg += 2; } else if (strcmp(arg[iarg],"first") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (strcmp(arg[iarg+1],"all") == 0) { delete [] firstgroupname; firstgroupname = NULL; } else { int n = strlen(arg[iarg+1]) + 1; firstgroupname = new char[n]; strcpy(firstgroupname,arg[iarg+1]); sortfreq = 0; } iarg += 2; } else if (strcmp(arg[iarg],"sort") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal atom_modify command"); sortfreq = force->inumeric(FLERR,arg[iarg+1]); userbinsize = force->numeric(FLERR,arg[iarg+2]); if (sortfreq < 0 || userbinsize < 0.0) error->all(FLERR,"Illegal atom_modify command"); if (sortfreq >= 0 && firstgroupname) error->all(FLERR,"Atom_modify sort and first options " "cannot be used together"); iarg += 3; } else error->all(FLERR,"Illegal atom_modify command"); } } /* ---------------------------------------------------------------------- check that atom IDs are valid error if any atom ID < 0 or atom ID = MAXTAGINT if any atom ID > 0, error if any atom ID == 0 if any atom ID > 0, error if tag_enable = 0 if all atom IDs = 0, tag_enable must be 0 if max atom IDs < natoms, must be duplicates OK if max atom IDs > natoms NOTE: not fully checking that atom IDs are unique ------------------------------------------------------------------------- */ void Atom::tag_check() { tagint min = MAXTAGINT; tagint max = 0; for (int i = 0; i < nlocal; i++) { min = MIN(min,tag[i]); max = MAX(max,tag[i]); } tagint minall,maxall; MPI_Allreduce(&min,&minall,1,MPI_LMP_TAGINT,MPI_MIN,world); MPI_Allreduce(&max,&maxall,1,MPI_LMP_TAGINT,MPI_MAX,world); if (minall < 0) error->all(FLERR,"One or more Atom IDs is negative"); if (maxall >= MAXTAGINT) error->all(FLERR,"One or more atom IDs is too big"); if (maxall > 0 && minall == 0) error->all(FLERR,"One or more atom IDs is zero"); if (maxall > 0 && tag_enable == 0) error->all(FLERR,"Non-zero atom IDs with atom_modify id = no"); if (maxall == 0 && natoms && tag_enable) error->all(FLERR,"All atom IDs = 0 but atom_modify id = yes"); if (tag_enable && maxall < natoms) error->all(FLERR,"Duplicate atom IDs exist"); } /* ---------------------------------------------------------------------- add unique tags to any atoms with tag = 0 new tags are grouped by proc and start after max current tag called after creating new atoms error if new tags will exceed MAXTAGINT ------------------------------------------------------------------------- */ void Atom::tag_extend() { // maxtag_all = max tag for all atoms tagint maxtag = 0; for (int i = 0; i < nlocal; i++) maxtag = MAX(maxtag,tag[i]); tagint maxtag_all; MPI_Allreduce(&maxtag,&maxtag_all,1,MPI_LMP_TAGINT,MPI_MAX,world); // DEBUG: useful for generating 64-bit IDs even for small systems // use only when LAMMPS is compiled with BIGBIG //maxtag_all += 1000000000000; // notag = # of atoms I own with no tag (tag = 0) // notag_sum = # of total atoms on procs <= me with no tag bigint notag = 0; for (int i = 0; i < nlocal; i++) if (tag[i] == 0) notag++; bigint notag_total; MPI_Allreduce(¬ag,¬ag_total,1,MPI_LMP_BIGINT,MPI_SUM,world); if (notag_total >= MAXTAGINT) error->all(FLERR,"New atom IDs exceed maximum allowed ID"); bigint notag_sum; MPI_Scan(¬ag,¬ag_sum,1,MPI_LMP_BIGINT,MPI_SUM,world); // itag = 1st new tag that my untagged atoms should use tagint itag = maxtag_all + notag_sum - notag + 1; for (int i = 0; i < nlocal; i++) if (tag[i] == 0) tag[i] = itag++; } /* ---------------------------------------------------------------------- check that atom IDs span range from 1 to Natoms inclusive return 0 if mintag != 1 or maxtag != Natoms return 1 if OK doesn't actually check if all tag values are used ------------------------------------------------------------------------- */ int Atom::tag_consecutive() { tagint idmin = MAXTAGINT; tagint idmax = 0; for (int i = 0; i < nlocal; i++) { idmin = MIN(idmin,tag[i]); idmax = MAX(idmax,tag[i]); } tagint idminall,idmaxall; MPI_Allreduce(&idmin,&idminall,1,MPI_LMP_TAGINT,MPI_MIN,world); MPI_Allreduce(&idmax,&idmaxall,1,MPI_LMP_TAGINT,MPI_MAX,world); if (idminall != 1 || idmaxall != natoms) return 0; return 1; } /* ---------------------------------------------------------------------- count and return words in a single line make copy of line before using strtok so as not to change line trim anything from '#' onward ------------------------------------------------------------------------- */ int Atom::count_words(const char *line) { int n = strlen(line) + 1; char *copy; memory->create(copy,n,"atom:copy"); strcpy(copy,line); char *ptr; if ((ptr = strchr(copy,'#'))) *ptr = '\0'; if (strtok(copy," \t\n\r\f") == NULL) { memory->destroy(copy); return 0; } n = 1; while (strtok(NULL," \t\n\r\f")) n++; memory->destroy(copy); return n; } /* ---------------------------------------------------------------------- count and return words in a single line using provided copy buf make copy of line before using strtok so as not to change line trim anything from '#' onward ------------------------------------------------------------------------- */ int Atom::count_words(const char *line, char *copy) { strcpy(copy,line); char *ptr; if ((ptr = strchr(copy,'#'))) *ptr = '\0'; if (strtok(copy," \t\n\r\f") == NULL) { memory->destroy(copy); return 0; } int n = 1; while (strtok(NULL," \t\n\r\f")) n++; return n; } /* ---------------------------------------------------------------------- deallocate molecular topology arrays done before realloc with (possibly) new 2nd dimension set to correctly initialized per-atom values, e.g. bond_per_atom needs to be called whenever 2nd dimensions are changed and these arrays are already pre-allocated, e.g. due to grow(1) in create_avec() ------------------------------------------------------------------------- */ void Atom::deallocate_topology() { memory->destroy(atom->bond_type); memory->destroy(atom->bond_atom); atom->bond_type = NULL; atom->bond_atom = NULL; memory->destroy(atom->angle_type); memory->destroy(atom->angle_atom1); memory->destroy(atom->angle_atom2); memory->destroy(atom->angle_atom3); atom->angle_type = NULL; atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL; memory->destroy(atom->dihedral_type); memory->destroy(atom->dihedral_atom1); memory->destroy(atom->dihedral_atom2); memory->destroy(atom->dihedral_atom3); memory->destroy(atom->dihedral_atom4); atom->dihedral_type = NULL; atom->dihedral_atom1 = atom->dihedral_atom2 = atom->dihedral_atom3 = atom->dihedral_atom4 = NULL; memory->destroy(atom->improper_type); memory->destroy(atom->improper_atom1); memory->destroy(atom->improper_atom2); memory->destroy(atom->improper_atom3); memory->destroy(atom->improper_atom4); atom->improper_type = NULL; atom->improper_atom1 = atom->improper_atom2 = atom->improper_atom3 = atom->improper_atom4 = NULL; } /* ---------------------------------------------------------------------- unpack N lines from Atom section of data file call style-specific routine to parse line ------------------------------------------------------------------------- */ void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset, int shiftflag, double *shift) { int m,xptr,iptr; imageint imagedata; double xdata[3],lamda[3]; double *coord; char *next; next = strchr(buf,'\n'); *next = '\0'; int nwords = count_words(buf); *next = '\n'; if (nwords != avec->size_data_atom && nwords != avec->size_data_atom + 3) error->all(FLERR,"Incorrect atom format in data file"); char **values = new char*[nwords]; // set bounds for my proc // if periodic and I am lo/hi proc, adjust bounds by EPSILON // insures all data atoms will be owned even with round-off int triclinic = domain->triclinic; double epsilon[3]; if (triclinic) epsilon[0] = epsilon[1] = epsilon[2] = EPSILON; else { epsilon[0] = domain->prd[0] * EPSILON; epsilon[1] = domain->prd[1] * EPSILON; epsilon[2] = domain->prd[2] * EPSILON; } double sublo[3],subhi[3]; if (triclinic == 0) { sublo[0] = domain->sublo[0]; subhi[0] = domain->subhi[0]; sublo[1] = domain->sublo[1]; subhi[1] = domain->subhi[1]; sublo[2] = domain->sublo[2]; subhi[2] = domain->subhi[2]; } else { sublo[0] = domain->sublo_lamda[0]; subhi[0] = domain->subhi_lamda[0]; sublo[1] = domain->sublo_lamda[1]; subhi[1] = domain->subhi_lamda[1]; sublo[2] = domain->sublo_lamda[2]; subhi[2] = domain->subhi_lamda[2]; } if (comm->layout != LAYOUT_TILED) { if (domain->xperiodic) { if (comm->myloc[0] == 0) sublo[0] -= epsilon[0]; if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] += epsilon[0]; } if (domain->yperiodic) { if (comm->myloc[1] == 0) sublo[1] -= epsilon[1]; if (comm->myloc[1] == comm->procgrid[1]-1) subhi[1] += epsilon[1]; } if (domain->zperiodic) { if (comm->myloc[2] == 0) sublo[2] -= epsilon[2]; if (comm->myloc[2] == comm->procgrid[2]-1) subhi[2] += epsilon[2]; } } else { if (domain->xperiodic) { if (comm->mysplit[0][0] == 0.0) sublo[0] -= epsilon[0]; if (comm->mysplit[0][1] == 1.0) subhi[0] += epsilon[0]; } if (domain->yperiodic) { if (comm->mysplit[1][0] == 0.0) sublo[1] -= epsilon[1]; if (comm->mysplit[1][1] == 1.0) subhi[1] += epsilon[1]; } if (domain->zperiodic) { if (comm->mysplit[2][0] == 0.0) sublo[2] -= epsilon[2]; if (comm->mysplit[2][1] == 1.0) subhi[2] += epsilon[2]; } } // xptr = which word in line starts xyz coords // iptr = which word in line starts ix,iy,iz image flags xptr = avec->xcol_data - 1; int imageflag = 0; if (nwords > avec->size_data_atom) imageflag = 1; if (imageflag) iptr = nwords - 3; // loop over lines of atom data // tokenize the line into values // extract xyz coords and image flags // remap atom into simulation box // if atom is in my sub-domain, unpack its values for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); if (values[0] == NULL) error->all(FLERR,"Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { values[m] = strtok(NULL," \t\n\r\f"); if (values[m] == NULL) error->all(FLERR,"Incorrect atom format in data file"); } if (imageflag) imagedata = ((imageint) (atoi(values[iptr]) + IMGMAX) & IMGMASK) | (((imageint) (atoi(values[iptr+1]) + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (atoi(values[iptr+2]) + IMGMAX) & IMGMASK) << IMG2BITS); else imagedata = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; xdata[0] = atof(values[xptr]); xdata[1] = atof(values[xptr+1]); xdata[2] = atof(values[xptr+2]); if (shiftflag) { xdata[0] += shift[0]; xdata[1] += shift[1]; xdata[2] += shift[2]; } domain->remap(xdata,imagedata); if (triclinic) { domain->x2lamda(xdata,lamda); coord = lamda; } else coord = xdata; if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && coord[1] < subhi[1] && coord[2] >= sublo[2] && coord[2] < subhi[2]) { avec->data_atom(xdata,imagedata,values); if (id_offset) tag[nlocal-1] += id_offset; if (type_offset) { type[nlocal-1] += type_offset; if (type[nlocal-1] > ntypes) error->one(FLERR,"Invalid atom type in Atoms section of data file"); } } buf = next + 1; } delete [] values; } /* ---------------------------------------------------------------------- unpack N lines from Velocity section of data file check that atom IDs are > 0 and <= map_tag_max call style-specific routine to parse line ------------------------------------------------------------------------- */ void Atom::data_vels(int n, char *buf, tagint id_offset) { int j,m; tagint tagdata; char *next; next = strchr(buf,'\n'); *next = '\0'; int nwords = count_words(buf); *next = '\n'; if (nwords != avec->size_data_vel) error->all(FLERR,"Incorrect velocity format in data file"); char **values = new char*[nwords]; // loop over lines of atom velocities // tokenize the line into values // if I own atom tag, unpack its values for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) values[j] = strtok(NULL," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) error->one(FLERR,"Invalid atom ID in Velocities section of data file"); if ((m = map(tagdata)) >= 0) avec->data_vel(m,&values[1]); buf = next + 1; } delete [] values; } /* ---------------------------------------------------------------------- process N bonds read into buf from data files if count is non-NULL, just count bonds per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, int type_offset) { int m,tmp,itype; tagint atom1,atom2; char *next; int newton_bond = force->newton_bond; for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); *next = '\0'; sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&itype,&atom1,&atom2); if (id_offset) { atom1 += id_offset; atom2 += id_offset; } itype += type_offset; if (atom1 <= 0 || atom1 > map_tag_max || atom2 <= 0 || atom2 > map_tag_max) error->one(FLERR,"Invalid atom ID in Bonds section of data file"); if (itype <= 0 || itype > nbondtypes) error->one(FLERR,"Invalid bond type in Bonds section of data file"); if ((m = map(atom1)) >= 0) { if (count) count[m]++; else { bond_type[m][num_bond[m]] = itype; bond_atom[m][num_bond[m]] = atom2; num_bond[m]++; } } if (newton_bond == 0) { if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { bond_type[m][num_bond[m]] = itype; bond_atom[m][num_bond[m]] = atom1; num_bond[m]++; } } } buf = next + 1; } } /* ---------------------------------------------------------------------- process N angles read into buf from data files if count is non-NULL, just count angles per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, int type_offset) { int m,tmp,itype; tagint atom1,atom2,atom3; char *next; int newton_bond = force->newton_bond; for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); *next = '\0'; sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&itype,&atom1,&atom2,&atom3); if (id_offset) { atom1 += id_offset; atom2 += id_offset; atom3 += id_offset; } itype += type_offset; if (atom1 <= 0 || atom1 > map_tag_max || atom2 <= 0 || atom2 > map_tag_max || atom3 <= 0 || atom3 > map_tag_max) error->one(FLERR,"Invalid atom ID in Angles section of data file"); if (itype <= 0 || itype > nangletypes) error->one(FLERR,"Invalid angle type in Angles section of data file"); if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { angle_type[m][num_angle[m]] = itype; angle_atom1[m][num_angle[m]] = atom1; angle_atom2[m][num_angle[m]] = atom2; angle_atom3[m][num_angle[m]] = atom3; num_angle[m]++; } } if (newton_bond == 0) { if ((m = map(atom1)) >= 0) { if (count) count[m]++; else { angle_type[m][num_angle[m]] = itype; angle_atom1[m][num_angle[m]] = atom1; angle_atom2[m][num_angle[m]] = atom2; angle_atom3[m][num_angle[m]] = atom3; num_angle[m]++; } } if ((m = map(atom3)) >= 0) { if (count) count[m]++; else { angle_type[m][num_angle[m]] = itype; angle_atom1[m][num_angle[m]] = atom1; angle_atom2[m][num_angle[m]] = atom2; angle_atom3[m][num_angle[m]] = atom3; num_angle[m]++; } } } buf = next + 1; } } /* ---------------------------------------------------------------------- process N dihedrals read into buf from data files if count is non-NULL, just count diihedrals per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, int type_offset) { int m,tmp,itype; tagint atom1,atom2,atom3,atom4; char *next; int newton_bond = force->newton_bond; for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); *next = '\0'; sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&itype,&atom1,&atom2,&atom3,&atom4); if (id_offset) { atom1 += id_offset; atom2 += id_offset; atom3 += id_offset; atom4 += id_offset; } itype += type_offset; if (atom1 <= 0 || atom1 > map_tag_max || atom2 <= 0 || atom2 > map_tag_max || atom3 <= 0 || atom3 > map_tag_max || atom4 <= 0 || atom4 > map_tag_max) error->one(FLERR,"Invalid atom ID in Dihedrals section of data file"); if (itype <= 0 || itype > ndihedraltypes) error->one(FLERR, "Invalid dihedral type in Dihedrals section of data file"); if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { dihedral_type[m][num_dihedral[m]] = itype; dihedral_atom1[m][num_dihedral[m]] = atom1; dihedral_atom2[m][num_dihedral[m]] = atom2; dihedral_atom3[m][num_dihedral[m]] = atom3; dihedral_atom4[m][num_dihedral[m]] = atom4; num_dihedral[m]++; } } if (newton_bond == 0) { if ((m = map(atom1)) >= 0) { if (count) count[m]++; else { dihedral_type[m][num_dihedral[m]] = itype; dihedral_atom1[m][num_dihedral[m]] = atom1; dihedral_atom2[m][num_dihedral[m]] = atom2; dihedral_atom3[m][num_dihedral[m]] = atom3; dihedral_atom4[m][num_dihedral[m]] = atom4; num_dihedral[m]++; } } if ((m = map(atom3)) >= 0) { if (count) count[m]++; else { dihedral_type[m][num_dihedral[m]] = itype; dihedral_atom1[m][num_dihedral[m]] = atom1; dihedral_atom2[m][num_dihedral[m]] = atom2; dihedral_atom3[m][num_dihedral[m]] = atom3; dihedral_atom4[m][num_dihedral[m]] = atom4; num_dihedral[m]++; } } if ((m = map(atom4)) >= 0) { if (count) count[m]++; else { dihedral_type[m][num_dihedral[m]] = itype; dihedral_atom1[m][num_dihedral[m]] = atom1; dihedral_atom2[m][num_dihedral[m]] = atom2; dihedral_atom3[m][num_dihedral[m]] = atom3; dihedral_atom4[m][num_dihedral[m]] = atom4; num_dihedral[m]++; } } } buf = next + 1; } } /* ---------------------------------------------------------------------- process N impropers read into buf from data files if count is non-NULL, just count impropers per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset, int type_offset) { int m,tmp,itype; tagint atom1,atom2,atom3,atom4; char *next; int newton_bond = force->newton_bond; for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); *next = '\0'; sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&itype,&atom1,&atom2,&atom3,&atom4); if (id_offset) { atom1 += id_offset; atom2 += id_offset; atom3 += id_offset; atom4 += id_offset; } itype += type_offset; if (atom1 <= 0 || atom1 > map_tag_max || atom2 <= 0 || atom2 > map_tag_max || atom3 <= 0 || atom3 > map_tag_max || atom4 <= 0 || atom4 > map_tag_max) error->one(FLERR,"Invalid atom ID in Impropers section of data file"); if (itype <= 0 || itype > nimpropertypes) error->one(FLERR, "Invalid improper type in Impropers section of data file"); if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { improper_type[m][num_improper[m]] = itype; improper_atom1[m][num_improper[m]] = atom1; improper_atom2[m][num_improper[m]] = atom2; improper_atom3[m][num_improper[m]] = atom3; improper_atom4[m][num_improper[m]] = atom4; num_improper[m]++; } } if (newton_bond == 0) { if ((m = map(atom1)) >= 0) { if (count) count[m]++; else { improper_type[m][num_improper[m]] = itype; improper_atom1[m][num_improper[m]] = atom1; improper_atom2[m][num_improper[m]] = atom2; improper_atom3[m][num_improper[m]] = atom3; improper_atom4[m][num_improper[m]] = atom4; num_improper[m]++; } } if ((m = map(atom3)) >= 0) { if (count) count[m]++; else { improper_type[m][num_improper[m]] = itype; improper_atom1[m][num_improper[m]] = atom1; improper_atom2[m][num_improper[m]] = atom2; improper_atom3[m][num_improper[m]] = atom3; improper_atom4[m][num_improper[m]] = atom4; num_improper[m]++; } } if ((m = map(atom4)) >= 0) { if (count) count[m]++; else { improper_type[m][num_improper[m]] = itype; improper_atom1[m][num_improper[m]] = atom1; improper_atom2[m][num_improper[m]] = atom2; improper_atom3[m][num_improper[m]] = atom3; improper_atom4[m][num_improper[m]] = atom4; num_improper[m]++; } } } buf = next + 1; } } /* ---------------------------------------------------------------------- unpack N lines from atom-style specific bonus section of data file check that atom IDs are > 0 and <= map_tag_max call style-specific routine to parse line ------------------------------------------------------------------------- */ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) { int j,m,tagdata; char *next; next = strchr(buf,'\n'); *next = '\0'; int nwords = count_words(buf); *next = '\n'; if (nwords != avec_bonus->size_data_bonus) error->all(FLERR,"Incorrect bonus data format in data file"); char **values = new char*[nwords]; // loop over lines of bonus atom data // tokenize the line into values // if I own atom tag, unpack its values for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) values[j] = strtok(NULL," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) error->one(FLERR,"Invalid atom ID in Bonus section of data file"); // ok to call child's data_atom_bonus() method thru parent avec_bonus, // since data_bonus() was called with child ptr, and method is virtual if ((m = map(tagdata)) >= 0) avec_bonus->data_atom_bonus(m,&values[1]); buf = next + 1; } delete [] values; } /* ---------------------------------------------------------------------- unpack N bodies from Bodies section of data file each body spans multiple lines check that atom IDs are > 0 and <= map_tag_max call style-specific routine to parse line ------------------------------------------------------------------------- */ void Atom::data_bodies(int n, char *buf, AtomVecBody *avec_body, tagint id_offset) { int j,m,nvalues,tagdata,ninteger,ndouble; int maxint = 0; int maxdouble = 0; int *ivalues = NULL; double *dvalues = NULL; // loop over lines of body data // if I own atom tag, tokenize lines into ivalues/dvalues, call data_body() // else skip values for (int i = 0; i < n; i++) { if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f")) + id_offset; else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f")) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) error->one(FLERR,"Invalid atom ID in Bodies section of data file"); ninteger = force->inumeric(FLERR,strtok(NULL," \t\n\r\f")); ndouble = force->inumeric(FLERR,strtok(NULL," \t\n\r\f")); if ((m = map(tagdata)) >= 0) { if (ninteger > maxint) { delete [] ivalues; maxint = ninteger; ivalues = new int[maxint]; } if (ndouble > maxdouble) { delete [] dvalues; maxdouble = ndouble; dvalues = new double[maxdouble]; } for (j = 0; j < ninteger; j++) ivalues[j] = force->inumeric(FLERR,strtok(NULL," \t\n\r\f")); for (j = 0; j < ndouble; j++) dvalues[j] = force->numeric(FLERR,strtok(NULL," \t\n\r\f")); avec_body->data_body(m,ninteger,ndouble,ivalues,dvalues); } else { nvalues = ninteger + ndouble; // number of values to skip for (j = 0; j < nvalues; j++) strtok(NULL," \t\n\r\f"); } } delete [] ivalues; delete [] dvalues; } /* ---------------------------------------------------------------------- init per-atom fix/compute/variable values for newly created atoms called from create_atoms, read_data, read_dump, lib::lammps_create_atoms() fixes, computes, variables may or may not exist when called ------------------------------------------------------------------------- */ void Atom::data_fix_compute_variable(int nprev, int nnew) { for (int m = 0; m < modify->nfix; m++) { Fix *fix = modify->fix[m]; if (fix->create_attribute) for (int i = nprev; i < nnew; i++) fix->set_arrays(i); } for (int m = 0; m < modify->ncompute; m++) { Compute *compute = modify->compute[m]; if (compute->create_attribute) for (int i = nprev; i < nnew; i++) compute->set_arrays(i); } for (int i = nprev; i < nnew; i++) input->variable->set_arrays(i); } /* ---------------------------------------------------------------------- allocate arrays of length ntypes only done after ntypes is set ------------------------------------------------------------------------- */ void Atom::allocate_type_arrays() { if (avec->mass_type) { mass = new double[ntypes+1]; mass_setflag = new int[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) mass_setflag[itype] = 0; } } /* ---------------------------------------------------------------------- set a mass and flag it as set called from reading of data file type_offset may be used when reading multiple data files ------------------------------------------------------------------------- */ void Atom::set_mass(const char *file, int line, const char *str, int type_offset) { if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); int itype; double mass_one; int n = sscanf(str,"%d %lg",&itype,&mass_one); if (n != 2) error->all(file,line,"Invalid mass line in data file"); itype += type_offset; if (itype < 1 || itype > ntypes) error->all(file,line,"Invalid type for mass set"); mass[itype] = mass_one; mass_setflag[itype] = 1; if (mass[itype] <= 0.0) error->all(file,line,"Invalid mass value"); } /* ---------------------------------------------------------------------- set a mass and flag it as set called from EAM pair routine ------------------------------------------------------------------------- */ void Atom::set_mass(const char *file, int line, int itype, double value) { if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); if (itype < 1 || itype > ntypes) error->all(file,line,"Invalid type for mass set"); mass[itype] = value; mass_setflag[itype] = 1; if (mass[itype] <= 0.0) error->all(file,line,"Invalid mass value"); } /* ---------------------------------------------------------------------- set one or more masses and flag them as set called from reading of input script ------------------------------------------------------------------------- */ void Atom::set_mass(const char *file, int line, int narg, char **arg) { if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); int lo,hi; force->bounds(file,line,arg[0],ntypes,lo,hi); if (lo < 1 || hi > ntypes) error->all(file,line,"Invalid type for mass set"); for (int itype = lo; itype <= hi; itype++) { mass[itype] = atof(arg[1]); mass_setflag[itype] = 1; if (mass[itype] <= 0.0) error->all(file,line,"Invalid mass value"); } } /* ---------------------------------------------------------------------- set all masses as read in from restart file ------------------------------------------------------------------------- */ void Atom::set_mass(double *values) { for (int itype = 1; itype <= ntypes; itype++) { mass[itype] = values[itype]; mass_setflag[itype] = 1; } } /* ---------------------------------------------------------------------- check that all per-atom-type masses have been set ------------------------------------------------------------------------- */ void Atom::check_mass(const char *file, int line) { if (mass == NULL) return; if (rmass_flag) return; for (int itype = 1; itype <= ntypes; itype++) if (mass_setflag[itype] == 0) error->all(file,line,"Not all per-type masses are set"); } /* ---------------------------------------------------------------------- check that radii of all particles of itype are the same return 1 if true, else return 0 also return the radius value for that type ------------------------------------------------------------------------- */ int Atom::radius_consistency(int itype, double &rad) { double value = -1.0; int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] != itype) continue; if (value < 0.0) value = radius[i]; else if (value != radius[i]) flag = 1; } int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall) return 0; MPI_Allreduce(&value,&rad,1,MPI_DOUBLE,MPI_MAX,world); return 1; } /* ---------------------------------------------------------------------- check that shape of all particles of itype are the same return 1 if true, else return 0 also return the 3 shape params for itype ------------------------------------------------------------------------- */ int Atom::shape_consistency(int itype, double &shapex, double &shapey, double &shapez) { double zero[3] = {0.0, 0.0, 0.0}; double one[3] = {-1.0, -1.0, -1.0}; double *shape; AtomVecEllipsoid *avec_ellipsoid = (AtomVecEllipsoid *) style_match("ellipsoid"); AtomVecEllipsoid::Bonus *bonus = avec_ellipsoid->bonus; int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] != itype) continue; if (ellipsoid[i] < 0) shape = zero; else shape = bonus[ellipsoid[i]].shape; if (one[0] < 0.0) { one[0] = shape[0]; one[1] = shape[1]; one[2] = shape[2]; } else if (one[0] != shape[0] || one[1] != shape[1] || one[2] != shape[2]) flag = 1; } int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall) return 0; double oneall[3]; MPI_Allreduce(one,oneall,3,MPI_DOUBLE,MPI_MAX,world); shapex = oneall[0]; shapey = oneall[1]; shapez = oneall[2]; return 1; } /* ---------------------------------------------------------------------- add a new molecule template = set of molecules ------------------------------------------------------------------------- */ void Atom::add_molecule(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal molecule command"); if (find_molecule(arg[0]) >= 0) error->all(FLERR,"Reuse of molecule template ID"); // 1st molecule in set stores nset = # of mols, others store nset = 0 // ifile = count of molecules in set // index = argument index where next molecule starts, updated by constructor int ifile = 1; int index = 1; while (1) { molecules = (Molecule **) memory->srealloc(molecules,(nmolecule+1)*sizeof(Molecule *), "atom::molecules"); molecules[nmolecule] = new Molecule(lmp,narg,arg,index); molecules[nmolecule]->nset = 0; molecules[nmolecule-ifile+1]->nset++; nmolecule++; if (molecules[nmolecule-1]->last) break; ifile++; } } /* ---------------------------------------------------------------------- find first molecule in set with template ID return -1 if does not exist ------------------------------------------------------------------------- */ int Atom::find_molecule(char *id) { if(id == NULL) return -1; int imol; for (imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; return -1; } /* ---------------------------------------------------------------------- add info to current atom ilocal from molecule template onemol and its iatom offset = atom ID preceding IDs of atoms in this molecule called by fixes and commands that add molecules ------------------------------------------------------------------------- */ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint offset) { if (onemol->qflag && q_flag) q[ilocal] = onemol->q[iatom]; if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom]; if (onemol->rmassflag && rmass_flag) rmass[ilocal] = onemol->rmass[iatom]; else if (rmass_flag) rmass[ilocal] = 4.0*MY_PI/3.0 * radius[ilocal]*radius[ilocal]*radius[ilocal]; if (onemol->bodyflag) { body[ilocal] = 0; // as if a body read from data file onemol->avec_body->data_body(ilocal,onemol->nibody,onemol->ndbody, onemol->ibodyparams,onemol->dbodyparams); onemol->avec_body->set_quat(ilocal,onemol->quat_external); } if (molecular != 1) return; // add bond topology info // for molecular atom styles, but not atom style template if (avec->bonds_allow) { num_bond[ilocal] = onemol->num_bond[iatom]; for (int i = 0; i < num_bond[ilocal]; i++) { bond_type[ilocal][i] = onemol->bond_type[iatom][i]; bond_atom[ilocal][i] = onemol->bond_atom[iatom][i] + offset; } } if (avec->angles_allow) { num_angle[ilocal] = onemol->num_angle[iatom]; for (int i = 0; i < num_angle[ilocal]; i++) { angle_type[ilocal][i] = onemol->angle_type[iatom][i]; angle_atom1[ilocal][i] = onemol->angle_atom1[iatom][i] + offset; angle_atom2[ilocal][i] = onemol->angle_atom2[iatom][i] + offset; angle_atom3[ilocal][i] = onemol->angle_atom3[iatom][i] + offset; } } if (avec->dihedrals_allow) { num_dihedral[ilocal] = onemol->num_dihedral[iatom]; for (int i = 0; i < num_dihedral[ilocal]; i++) { dihedral_type[ilocal][i] = onemol->dihedral_type[iatom][i]; dihedral_atom1[ilocal][i] = onemol->dihedral_atom1[iatom][i] + offset; dihedral_atom2[ilocal][i] = onemol->dihedral_atom2[iatom][i] + offset; dihedral_atom3[ilocal][i] = onemol->dihedral_atom3[iatom][i] + offset; dihedral_atom4[ilocal][i] = onemol->dihedral_atom4[iatom][i] + offset; } } if (avec->impropers_allow) { num_improper[ilocal] = onemol->num_improper[iatom]; for (int i = 0; i < num_improper[ilocal]; i++) { improper_type[ilocal][i] = onemol->improper_type[iatom][i]; improper_atom1[ilocal][i] = onemol->improper_atom1[iatom][i] + offset; improper_atom2[ilocal][i] = onemol->improper_atom2[iatom][i] + offset; improper_atom3[ilocal][i] = onemol->improper_atom3[iatom][i] + offset; improper_atom4[ilocal][i] = onemol->improper_atom4[iatom][i] + offset; } } if (onemol->specialflag) { nspecial[ilocal][0] = onemol->nspecial[iatom][0]; nspecial[ilocal][1] = onemol->nspecial[iatom][1]; int n = nspecial[ilocal][2] = onemol->nspecial[iatom][2]; for (int i = 0; i < n; i++) special[ilocal][i] = onemol->special[iatom][i] + offset; } } /* ---------------------------------------------------------------------- reorder owned atoms so those in firstgroup appear first called by comm->exchange() if atom_modify first group is set only owned atoms exist at this point, no ghost atoms ------------------------------------------------------------------------- */ void Atom::first_reorder() { // insure there is one extra atom location at end of arrays for swaps if (nlocal == nmax) avec->grow(0); // loop over owned atoms // nfirst = index of first atom not in firstgroup // when find firstgroup atom out of place, swap it with atom nfirst int bitmask = group->bitmask[firstgroup]; nfirst = 0; while (nfirst < nlocal && mask[nfirst] & bitmask) nfirst++; for (int i = 0; i < nlocal; i++) { if (mask[i] & bitmask && i > nfirst) { avec->copy(i,nlocal,0); avec->copy(nfirst,i,0); avec->copy(nlocal,nfirst,0); while (nfirst < nlocal && mask[nfirst] & bitmask) nfirst++; } } } /* ---------------------------------------------------------------------- perform spatial sort of atoms within my sub-domain always called between comm->exchange() and comm->borders() don't have to worry about clearing/setting atom->map since done in comm ------------------------------------------------------------------------- */ void Atom::sort() { int i,m,n,ix,iy,iz,ibin,empty; // set next timestep for sorting to take place nextsort = (update->ntimestep/sortfreq)*sortfreq + sortfreq; // re-setup sort bins if needed if (domain->box_change) setup_sort_bins(); if (nbins == 1) return; // reallocate per-atom vectors if needed if (nlocal > maxnext) { memory->destroy(next); memory->destroy(permute); maxnext = atom->nmax; memory->create(next,maxnext,"atom:next"); memory->create(permute,maxnext,"atom:permute"); } // insure there is one extra atom location at end of arrays for swaps if (nlocal == nmax) avec->grow(0); // bin atoms in reverse order so linked list will be in forward order for (i = 0; i < nbins; i++) binhead[i] = -1; for (i = nlocal-1; i >= 0; i--) { ix = static_cast ((x[i][0]-bboxlo[0])*bininvx); iy = static_cast ((x[i][1]-bboxlo[1])*bininvy); iz = static_cast ((x[i][2]-bboxlo[2])*bininvz); ix = MAX(ix,0); iy = MAX(iy,0); iz = MAX(iz,0); ix = MIN(ix,nbinx-1); iy = MIN(iy,nbiny-1); iz = MIN(iz,nbinz-1); ibin = iz*nbiny*nbinx + iy*nbinx + ix; next[i] = binhead[ibin]; binhead[ibin] = i; } // permute = desired permutation of atoms // permute[I] = J means Ith new atom will be Jth old atom n = 0; for (m = 0; m < nbins; m++) { i = binhead[m]; while (i >= 0) { permute[n++] = i; i = next[i]; } } // current = current permutation, just reuse next vector // current[I] = J means Ith current atom is Jth old atom int *current = next; for (i = 0; i < nlocal; i++) current[i] = i; // reorder local atom list, when done, current = permute // perform "in place" using copy() to extra atom location at end of list // inner while loop processes one cycle of the permutation // copy before inner-loop moves an atom to end of atom list // copy after inner-loop moves atom at end of list back into list // empty = location in atom list that is currently empty for (i = 0; i < nlocal; i++) { if (current[i] == permute[i]) continue; avec->copy(i,nlocal,0); empty = i; while (permute[empty] != i) { avec->copy(permute[empty],empty,0); empty = current[empty] = permute[empty]; } avec->copy(nlocal,empty,0); current[empty] = permute[empty]; } // sanity check that current = permute //int flag = 0; //for (i = 0; i < nlocal; i++) // if (current[i] != permute[i]) flag = 1; //int flagall; //MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); //if (flagall) error->all(FLERR,"Atom sort did not operate correctly"); } /* ---------------------------------------------------------------------- setup bins for spatial sorting of atoms ------------------------------------------------------------------------- */ void Atom::setup_sort_bins() { // binsize: // user setting if explicitly set // default = 1/2 of neighbor cutoff // check if neighbor cutoff = 0.0 double binsize; if (userbinsize > 0.0) binsize = userbinsize; else binsize = 0.5 * neighbor->cutneighmax; if (binsize == 0.0) error->all(FLERR,"Atom sorting has bin size = 0.0"); double bininv = 1.0/binsize; // nbin xyz = local bins // bbox lo/hi = bounding box of my sub-domain if (domain->triclinic) domain->bbox(domain->sublo_lamda,domain->subhi_lamda,bboxlo,bboxhi); else { bboxlo[0] = domain->sublo[0]; bboxlo[1] = domain->sublo[1]; bboxlo[2] = domain->sublo[2]; bboxhi[0] = domain->subhi[0]; bboxhi[1] = domain->subhi[1]; bboxhi[2] = domain->subhi[2]; } nbinx = static_cast ((bboxhi[0]-bboxlo[0]) * bininv); nbiny = static_cast ((bboxhi[1]-bboxlo[1]) * bininv); nbinz = static_cast ((bboxhi[2]-bboxlo[2]) * bininv); if (domain->dimension == 2) nbinz = 1; if (nbinx == 0) nbinx = 1; if (nbiny == 0) nbiny = 1; if (nbinz == 0) nbinz = 1; bininvx = nbinx / (bboxhi[0]-bboxlo[0]); bininvy = nbiny / (bboxhi[1]-bboxlo[1]); bininvz = nbinz / (bboxhi[2]-bboxlo[2]); #ifdef LMP_USER_INTEL int intel_neigh = 0; if (neighbor->nrequest) { if (neighbor->requests[0]->intel) intel_neigh = 1; } else if (neighbor->old_nrequest) if (neighbor->old_requests[0]->intel) intel_neigh = 1; if (intel_neigh && userbinsize == 0.0) { if (neighbor->binsizeflag) bininv = 1.0/neighbor->binsize_user; double nx_low = neighbor->bboxlo[0]; double ny_low = neighbor->bboxlo[1]; double nz_low = neighbor->bboxlo[2]; double nxbbox = neighbor->bboxhi[0] - nx_low; double nybbox = neighbor->bboxhi[1] - ny_low; double nzbbox = neighbor->bboxhi[2] - nz_low; int nnbinx = static_cast (nxbbox * bininv); int nnbiny = static_cast (nybbox * bininv); int nnbinz = static_cast (nzbbox * bininv); if (domain->dimension == 2) nnbinz = 1; if (nnbinx == 0) nnbinx = 1; if (nnbiny == 0) nnbiny = 1; if (nnbinz == 0) nnbinz = 1; double binsizex = nxbbox/nnbinx; double binsizey = nybbox/nnbiny; double binsizez = nzbbox/nnbinz; bininvx = 1.0 / binsizex; bininvy = 1.0 / binsizey; bininvz = 1.0 / binsizez; int lxo = (bboxlo[0] - nx_low) * bininvx; int lyo = (bboxlo[1] - ny_low) * bininvy; int lzo = (bboxlo[2] - nz_low) * bininvz; bboxlo[0] = nx_low + static_cast(lxo) / bininvx; bboxlo[1] = ny_low + static_cast(lyo) / bininvy; bboxlo[2] = nz_low + static_cast(lzo) / bininvz; nbinx = static_cast((bboxhi[0] - bboxlo[0]) * bininvx) + 1; nbiny = static_cast((bboxhi[1] - bboxlo[1]) * bininvy) + 1; nbinz = static_cast((bboxhi[2] - bboxlo[2]) * bininvz) + 1; bboxhi[0] = bboxlo[0] + static_cast(nbinx) / bininvx; bboxhi[1] = bboxlo[1] + static_cast(nbiny) / bininvy; bboxhi[2] = bboxlo[2] + static_cast(nbinz) / bininvz; } #endif if (1.0*nbinx*nbiny*nbinz > INT_MAX) error->one(FLERR,"Too many atom sorting bins"); nbins = nbinx*nbiny*nbinz; // reallocate per-bin memory if needed if (nbins > maxbin) { memory->destroy(binhead); maxbin = nbins; memory->create(binhead,maxbin,"atom:binhead"); } } /* ---------------------------------------------------------------------- register a callback to a fix so it can manage atom-based arrays happens when fix is created flag = 0 for grow, 1 for restart, 2 for border comm ------------------------------------------------------------------------- */ void Atom::add_callback(int flag) { int ifix; // find the fix // if find NULL ptr: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation // if don't find NULL ptr: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) if (modify->fix[ifix] == NULL) break; // add callback to lists, reallocating if necessary if (flag == 0) { if (nextra_grow == nextra_grow_max) { nextra_grow_max += DELTA; memory->grow(extra_grow,nextra_grow_max,"atom:extra_grow"); } extra_grow[nextra_grow] = ifix; nextra_grow++; } else if (flag == 1) { if (nextra_restart == nextra_restart_max) { nextra_restart_max += DELTA; memory->grow(extra_restart,nextra_restart_max,"atom:extra_restart"); } extra_restart[nextra_restart] = ifix; nextra_restart++; } else if (flag == 2) { if (nextra_border == nextra_border_max) { nextra_border_max += DELTA; memory->grow(extra_border,nextra_border_max,"atom:extra_border"); } extra_border[nextra_border] = ifix; nextra_border++; } } /* ---------------------------------------------------------------------- unregister a callback to a fix happens when fix is deleted, called by its destructor flag = 0 for grow, 1 for restart ------------------------------------------------------------------------- */ void Atom::delete_callback(const char *id, int flag) { if (id == NULL) return; int ifix; for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(id,modify->fix[ifix]->id) == 0) break; // compact the list of callbacks if (flag == 0) { int match; for (match = 0; match < nextra_grow; match++) if (extra_grow[match] == ifix) break; for (int i = match; i < nextra_grow-1; i++) extra_grow[i] = extra_grow[i+1]; nextra_grow--; } else if (flag == 1) { int match; for (match = 0; match < nextra_restart; match++) if (extra_restart[match] == ifix) break; for (int i = match; i < nextra_restart-1; i++) extra_restart[i] = extra_restart[i+1]; nextra_restart--; } else if (flag == 2) { int match; for (match = 0; match < nextra_border; match++) if (extra_border[match] == ifix) break; for (int i = match; i < nextra_border-1; i++) extra_border[i] = extra_border[i+1]; nextra_border--; } } /* ---------------------------------------------------------------------- decrement ptrs in callback lists to fixes beyond the deleted ifix happens after fix is deleted ------------------------------------------------------------------------- */ void Atom::update_callback(int ifix) { for (int i = 0; i < nextra_grow; i++) if (extra_grow[i] > ifix) extra_grow[i]--; for (int i = 0; i < nextra_restart; i++) if (extra_restart[i] > ifix) extra_restart[i]--; for (int i = 0; i < nextra_border; i++) if (extra_border[i] > ifix) extra_border[i]--; } /* ---------------------------------------------------------------------- find custom per-atom vector with name return index if found, and flag = 0/1 for int/double return -1 if not found ------------------------------------------------------------------------- */ int Atom::find_custom(const char *name, int &flag) { if(name == NULL) return -1; for (int i = 0; i < nivector; i++) if (iname[i] && strcmp(iname[i],name) == 0) { flag = 0; return i; } for (int i = 0; i < ndvector; i++) if (dname[i] && strcmp(dname[i],name) == 0) { flag = 1; return i; } return -1; } /* ---------------------------------------------------------------------- add a custom variable with name of type flag = 0/1 for int/double assumes name does not already exist return index in ivector or dvector of its location ------------------------------------------------------------------------- */ int Atom::add_custom(const char *name, int flag) { int index; if (flag == 0) { index = nivector; nivector++; iname = (char **) memory->srealloc(iname,nivector*sizeof(char *), "atom:iname"); int n = strlen(name) + 1; iname[index] = new char[n]; strcpy(iname[index],name); ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *), "atom:ivector"); memory->create(ivector[index],nmax,"atom:ivector"); } else { index = ndvector; ndvector++; dname = (char **) memory->srealloc(dname,ndvector*sizeof(char *), "atom:dname"); int n = strlen(name) + 1; dname[index] = new char[n]; strcpy(dname[index],name); dvector = (double **) memory->srealloc(dvector,ndvector*sizeof(double *), "atom:dvector"); memory->create(dvector[index],nmax,"atom:dvector"); } return index; } /* ---------------------------------------------------------------------- remove a custom variable of type flag = 0/1 for int/double at index free memory for vector and name and set ptrs to NULL ivector/dvector and iname/dname lists never shrink ------------------------------------------------------------------------- */ void Atom::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); ivector[index] = NULL; delete [] iname[index]; iname[index] = NULL; } else { memory->destroy(dvector[index]); dvector[index] = NULL; delete [] dname[index]; dname[index] = NULL; } } /* ---------------------------------------------------------------------- return a pointer to a named internal variable if don't recognize name, return NULL customize by adding names ------------------------------------------------------------------------- */ void *Atom::extract(char *name) { if (strcmp(name,"mass") == 0) return (void *) mass; if (strcmp(name,"id") == 0) return (void *) tag; if (strcmp(name,"type") == 0) return (void *) type; if (strcmp(name,"mask") == 0) return (void *) mask; if (strcmp(name,"image") == 0) return (void *) image; if (strcmp(name,"x") == 0) return (void *) x; if (strcmp(name,"v") == 0) return (void *) v; if (strcmp(name,"f") == 0) return (void *) f; if (strcmp(name,"molecule") == 0) return (void *) molecule; if (strcmp(name,"q") == 0) return (void *) q; if (strcmp(name,"mu") == 0) return (void *) mu; if (strcmp(name,"omega") == 0) return (void *) omega; if (strcmp(name,"angmom") == 0) return (void *) angmom; if (strcmp(name,"torque") == 0) return (void *) torque; if (strcmp(name,"radius") == 0) return (void *) radius; if (strcmp(name,"rmass") == 0) return (void *) rmass; if (strcmp(name,"ellipsoid") == 0) return (void *) ellipsoid; if (strcmp(name,"line") == 0) return (void *) line; if (strcmp(name,"tri") == 0) return (void *) tri; if (strcmp(name,"vfrac") == 0) return (void *) vfrac; if (strcmp(name,"s0") == 0) return (void *) s0; if (strcmp(name,"x0") == 0) return (void *) x0; if (strcmp(name,"spin") == 0) return (void *) spin; if (strcmp(name,"eradius") == 0) return (void *) eradius; if (strcmp(name,"ervel") == 0) return (void *) ervel; if (strcmp(name,"erforce") == 0) return (void *) erforce; if (strcmp(name,"ervelforce") == 0) return (void *) ervelforce; if (strcmp(name,"cs") == 0) return (void *) cs; if (strcmp(name,"csforce") == 0) return (void *) csforce; if (strcmp(name,"vforce") == 0) return (void *) vforce; if (strcmp(name,"etag") == 0) return (void *) etag; if (strcmp(name,"rho") == 0) return (void *) rho; if (strcmp(name,"drho") == 0) return (void *) drho; if (strcmp(name,"e") == 0) return (void *) e; if (strcmp(name,"de") == 0) return (void *) de; if (strcmp(name,"cv") == 0) return (void *) cv; if (strcmp(name,"vest") == 0) return (void *) vest; if (strcmp(name, "contact_radius") == 0) return (void *) contact_radius; if (strcmp(name, "smd_data_9") == 0) return (void *) smd_data_9; if (strcmp(name, "smd_stress") == 0) return (void *) smd_stress; if (strcmp(name, "eff_plastic_strain") == 0) return (void *) eff_plastic_strain; if (strcmp(name, "eff_plastic_strain_rate") == 0) return (void *) eff_plastic_strain_rate; if (strcmp(name, "damage") == 0) return (void *) damage; if (strcmp(name,"dpdTheta") == 0) return (void *) dpdTheta; + if (strcmp(name,"edpd_temp") == 0) return (void *) edpd_temp; return NULL; } /* ---------------------------------------------------------------------- return # of bytes of allocated memory call to avec tallies per-atom vectors add in global to local mapping storage ------------------------------------------------------------------------- */ bigint Atom::memory_usage() { memlength = DELTA_MEMSTR; memory->create(memstr,memlength,"atom:memstr"); memstr[0] = '\0'; bigint bytes = avec->memory_usage(); memory->destroy(memstr); bytes += max_same*sizeof(int); if (map_style == 1) bytes += memory->usage(map_array,map_maxarray); else if (map_style == 2) { bytes += map_nbucket*sizeof(int); bytes += map_nhash*sizeof(HashElem); } if (maxnext) { bytes += memory->usage(next,maxnext); bytes += memory->usage(permute,maxnext); } return bytes; } /* ---------------------------------------------------------------------- accumulate per-atom vec names in memstr, padded by spaces return 1 if padded str is not already in memlist, else 0 ------------------------------------------------------------------------- */ int Atom::memcheck(const char *str) { int n = strlen(str) + 3; char *padded = new char[n]; strcpy(padded," "); strcat(padded,str); strcat(padded," "); if (strstr(memstr,padded)) { delete [] padded; return 0; } if (strlen(memstr) + n >= memlength) { memlength += DELTA_MEMSTR; memory->grow(memstr,memlength,"atom:memstr"); } strcat(memstr,padded); delete [] padded; return 1; } diff --git a/src/atom.h b/src/atom.h index 0f84c8242..29a1c5d69 100644 --- a/src/atom.h +++ b/src/atom.h @@ -1,519 +1,526 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifndef LMP_ATOM_H #define LMP_ATOM_H #include "pointers.h" #include #include namespace LAMMPS_NS { class Atom : protected Pointers { public: char *atom_style; class AtomVec *avec; // atom counts bigint natoms; // total # of atoms in system, could be 0 // natoms may not be current if atoms lost int nlocal,nghost; // # of owned and ghost atoms on this proc int nmax; // max # of owned+ghost in arrays on this proc int tag_enable; // 0/1 if atom ID tags are defined int molecular; // 0 = atomic, 1 = standard molecular system, // 2 = molecule template system bigint nbonds,nangles,ndihedrals,nimpropers; int ntypes,nbondtypes,nangletypes,ndihedraltypes,nimpropertypes; int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom; int extra_bond_per_atom,extra_angle_per_atom; int extra_dihedral_per_atom,extra_improper_per_atom; int firstgroup; // store atoms in this group first, -1 if unset int nfirst; // # of atoms in first group on this proc char *firstgroupname; // group-ID to store first, NULL if unset // per-atom arrays // customize by adding new array tagint *tag; int *type,*mask; imageint *image; double **x,**v,**f; tagint *molecule; int *molindex,*molatom; double *q,**mu; double **omega,**angmom,**torque; double *radius,*rmass; int *ellipsoid,*line,*tri,*body; // PERI package double *vfrac,*s0; double **x0; // USER-EFF and USER-AWPMD packages int *spin; double *eradius,*ervel,*erforce,*ervelforce; double *cs,*csforce,*vforce; int *etag; // USER-SPH package double *rho,*drho,*e,*de,*cv; double **vest; // USER-SMD package double *contact_radius; double **smd_data_9; double **smd_stress; double *eff_plastic_strain; double *eff_plastic_strain_rate; double *damage; // USER-DPD package double *uCond,*uMech,*uChem,*uCGnew,*uCG; double *duChem; double *dpdTheta; int nspecies_dpd; int *ssaAIR; // Shardlow Splitting Algorithm Active Interaction Region number + // USER-MESO package + + double **cc, **cc_flux; // cc = chemical concentration + double *edpd_temp,*edpd_flux; // temperature and heat flux + double *edpd_cv; // heat capacity + int cc_species; + // molecular info int **nspecial; // 0,1,2 = cumulative # of 1-2,1-3,1-4 neighs tagint **special; // IDs of 1-2,1-3,1-4 neighs of each atom int maxspecial; // special[nlocal][maxspecial] int *num_bond; int **bond_type; tagint **bond_atom; int *num_angle; int **angle_type; tagint **angle_atom1,**angle_atom2,**angle_atom3; int *num_dihedral; int **dihedral_type; tagint **dihedral_atom1,**dihedral_atom2,**dihedral_atom3,**dihedral_atom4; int *num_improper; int **improper_type; tagint **improper_atom1,**improper_atom2,**improper_atom3,**improper_atom4; // custom arrays used by fix property/atom int **ivector; double **dvector; char **iname,**dname; int nivector,ndvector; // atom style and per-atom array existence flags // customize by adding new flag int sphere_flag,ellipsoid_flag,line_flag,tri_flag,body_flag; int peri_flag,electron_flag; int ecp_flag; int wavepacket_flag,sph_flag; int molecule_flag,molindex_flag,molatom_flag; int q_flag,mu_flag; int rmass_flag,radius_flag,omega_flag,torque_flag,angmom_flag; int vfrac_flag,spin_flag,eradius_flag,ervel_flag,erforce_flag; int cs_flag,csforce_flag,vforce_flag,ervelforce_flag,etag_flag; int rho_flag,e_flag,cv_flag,vest_flag; - int dpd_flag; + int dpd_flag,edpd_flag,tdpd_flag; // USER-SMD package int smd_flag; int contact_radius_flag; int smd_data_9_flag; int smd_stress_flag; int x0_flag; int eff_plastic_strain_flag; int eff_plastic_strain_rate_flag; int damage_flag; // Peridynamics scale factor, used by dump cfg double pdscale; // molecule templates // each template can be a set of consecutive molecules // each with same ID (stored in molecules) // 1st molecule in template stores nset = # in set int nmolecule; class Molecule **molecules; // extra peratom info in restart file destined for fix & diag double **extra; // per-type arrays double *mass; int *mass_setflag; // callback ptrs for atom arrays managed by fix classes int nextra_grow,nextra_restart,nextra_border; // # of callbacks of each type int *extra_grow,*extra_restart,*extra_border; // index of fix to callback to int nextra_grow_max,nextra_restart_max; // size of callback lists int nextra_border_max; int nextra_store; int map_style; // style of atom map: 0=none, 1=array, 2=hash int map_user; // user selected style = same 0,1,2 tagint map_tag_max; // max atom ID that map() is setup for // spatial sorting of atoms int sortfreq; // sort atoms every this many steps, 0 = off bigint nextsort; // next timestep to sort on double userbinsize; // requested sort bin size // indices of atoms with same ID int *sametag; // sametag[I] = next atom with same ID, -1 if no more // AtomVec factory types and map typedef AtomVec *(*AtomVecCreator)(LAMMPS *); typedef std::map AtomVecCreatorMap; AtomVecCreatorMap *avec_map; // functions Atom(class LAMMPS *); ~Atom(); void settings(class Atom *); void create_avec(const char *, int, char **, int); virtual class AtomVec *new_avec(const char *, int, int &); void init(); void setup(); class AtomVec *style_match(const char *); void modify_params(int, char **); void tag_check(); void tag_extend(); int tag_consecutive(); int parse_data(const char *); int count_words(const char *); int count_words(const char *, char *); void deallocate_topology(); void data_atoms(int, char *, tagint, int, int, double *); void data_vels(int, char *, tagint); void data_bonds(int, char *, int *, tagint, int); void data_angles(int, char *, int *, tagint, int); void data_dihedrals(int, char *, int *, tagint, int); void data_impropers(int, char *, int *, tagint, int); void data_bonus(int, char *, class AtomVec *, tagint); void data_bodies(int, char *, class AtomVecBody *, tagint); void data_fix_compute_variable(int, int); virtual void allocate_type_arrays(); void set_mass(const char *, int, const char *, int); void set_mass(const char *, int, int, double); void set_mass(const char *, int, int, char **); void set_mass(double *); void check_mass(const char *, int); int radius_consistency(int, double &); int shape_consistency(int, double &, double &, double &); void add_molecule(int, char **); int find_molecule(char *); void add_molecule_atom(class Molecule *, int, int, tagint); void first_reorder(); virtual void sort(); void add_callback(int); void delete_callback(const char *, int); void update_callback(int); int find_custom(const char *, int &); int add_custom(const char *, int); void remove_custom(int, int); virtual void sync_modify(ExecutionSpace, unsigned int, unsigned int) {} void *extract(char *); inline int* get_map_array() {return map_array;}; inline int get_map_size() {return map_tag_max+1;}; bigint memory_usage(); int memcheck(const char *); // functions for global to local ID mapping // map lookup function inlined for efficiency // return -1 if no map defined inline int map(tagint global) { if (map_style == 1) return map_array[global]; else if (map_style == 2) return map_find_hash(global); else return -1; }; void map_init(int check = 1); void map_clear(); void map_set(); void map_one(tagint, int); int map_style_set(); void map_delete(); int map_find_hash(tagint); protected: // global to local ID mapping int *map_array; // direct map via array that holds map_tag_max int map_maxarray; // allocated size of map_array (1 larger than this) struct HashElem { // hashed map tagint global; // key to search on = global ID int local; // value associated with key = local index int next; // next entry in this bucket, -1 if last }; int map_nhash; // # of entries hash table can hold int map_nused; // # of actual entries in hash table int map_free; // ptr to 1st unused entry in hash table int map_nbucket; // # of hash buckets int *map_bucket; // ptr to 1st entry in each bucket HashElem *map_hash; // hash table int max_same; // allocated size of sametag // spatial sorting of atoms int nbins; // # of sorting bins int nbinx,nbiny,nbinz; // bins in each dimension int maxbin; // max # of bins int maxnext; // max size of next,permute int *binhead; // 1st atom in each bin int *next; // next atom in bin int *permute; // permutation vector double bininvx,bininvy,bininvz; // inverse actual bin sizes double bboxlo[3],bboxhi[3]; // bounding box of my sub-domain int memlength; // allocated size of memstr char *memstr; // string of array names already counted void setup_sort_bins(); int next_prime(int); private: template static AtomVec *avec_creator(LAMMPS *); }; } #endif /* ERROR/WARNING messages: E: Atom IDs must be used for molecular systems Atom IDs are used to identify and find partner atoms in bonds. E: Unknown atom style The choice of atom style is unknown. E: Could not find atom_modify first group ID Self-explanatory. E: Illegal ... command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: Atom_modify id command after simulation box is defined The atom_modify id command cannot be used after a read_data, read_restart, or create_box command. E: Atom_modify map command after simulation box is defined The atom_modify map command cannot be used after a read_data, read_restart, or create_box command. E: Atom_modify sort and first options cannot be used together Self-explanatory. E: One or more Atom IDs is negative Atom IDs must be positive integers. E: One or more atom IDs is too big The limit on atom IDs is set by the SMALLBIG, BIGBIG, SMALLSMALL setting in your Makefile. See Section_start 2.2 of the manual for more details. E: One or more atom IDs is zero Either all atoms IDs must be zero or none of them. E: Non-zero atom IDs with atom_modify id = no Self-explanatory. E: All atom IDs = 0 but atom_modify id = yes Self-explanatory. E: Duplicate atom IDs exist Self-explanatory. E: New atom IDs exceed maximum allowed ID See the setting for tagint in the src/lmptype.h file. E: Incorrect atom format in data file Number of values per atom line in the data file is not consistent with the atom style. E: Invalid atom type in Atoms section of data file Atom types must range from 1 to specified # of types. E: Incorrect velocity format in data file Each atom style defines a format for the Velocity section of the data file. The read-in lines do not match. E: Invalid atom ID in Velocities section of data file Atom IDs must be positive integers and within range of defined atoms. E: Invalid atom ID in Bonds section of data file Atom IDs must be positive integers and within range of defined atoms. E: Invalid bond type in Bonds section of data file Bond type must be positive integer and within range of specified bond types. E: Invalid atom ID in Angles section of data file Atom IDs must be positive integers and within range of defined atoms. E: Invalid angle type in Angles section of data file Angle type must be positive integer and within range of specified angle types. E: Invalid atom ID in Dihedrals section of data file Atom IDs must be positive integers and within range of defined atoms. E: Invalid dihedral type in Dihedrals section of data file Dihedral type must be positive integer and within range of specified dihedral types. E: Invalid atom ID in Impropers section of data file Atom IDs must be positive integers and within range of defined atoms. E: Invalid improper type in Impropers section of data file Improper type must be positive integer and within range of specified improper types. E: Incorrect bonus data format in data file See the read_data doc page for a description of how various kinds of bonus data must be formatted for certain atom styles. E: Invalid atom ID in Bonus section of data file Atom IDs must be positive integers and within range of defined atoms. E: Invalid atom ID in Bodies section of data file Atom IDs must be positive integers and within range of defined atoms. E: Cannot set mass for this atom style This atom style does not support mass settings for each atom type. Instead they are defined on a per-atom basis in the data file. E: Invalid mass line in data file Self-explanatory. E: Invalid type for mass set Mass command must set a type from 1-N where N is the number of atom types. E: Invalid mass value Self-explanatory. E: All masses are not set For atom styles that define masses for each atom type, all masses must be set in the data file or by the mass command before running a simulation. They must also be set before using the velocity command. E: Reuse of molecule template ID The template IDs must be unique. E: Atom sort did not operate correctly This is an internal LAMMPS error. Please report it to the developers. E: Atom sorting has bin size = 0.0 The neighbor cutoff is being used as the bin size, but it is zero. Thus you must explicitly list a bin size in the atom_modify sort command or turn off sorting. E: Too many atom sorting bins This is likely due to an immense simulation box that has blown up to a large size. */ diff --git a/src/set.cpp b/src/set.cpp index 59625b7e6..2b1c0edee 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -1,1125 +1,1185 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #include #include #include #include #include "set.h" #include "atom.h" #include "atom_vec.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" #include "atom_vec_body.h" #include "domain.h" #include "region.h" #include "group.h" #include "comm.h" #include "neighbor.h" #include "force.h" #include "pair.h" #include "input.h" #include "variable.h" #include "random_park.h" #include "math_extra.h" #include "math_const.h" #include "memory.h" #include "error.h" using namespace LAMMPS_NS; using namespace MathConst; enum{ATOM_SELECT,MOL_SELECT,TYPE_SELECT,GROUP_SELECT,REGION_SELECT}; + enum{TYPE,TYPE_FRACTION,MOLECULE,X,Y,Z,CHARGE,MASS,SHAPE,LENGTH,TRI, DIPOLE,DIPOLE_RANDOM,QUAT,QUAT_RANDOM,THETA,THETA_RANDOM,ANGMOM,OMEGA, DIAMETER,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER, - MESO_E,MESO_CV,MESO_RHO,SMD_MASS_DENSITY,SMD_CONTACT_RADIUS,DPDTHETA, - INAME,DNAME}; + MESO_E,MESO_CV,MESO_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, + SMD_CONTACT_RADIUS,DPDTHETA,INAME,DNAME}; #define BIG INT_MAX /* ---------------------------------------------------------------------- */ void Set::command(int narg, char **arg) { if (domain->box_exist == 0) error->all(FLERR,"Set command before simulation box is defined"); if (atom->natoms == 0) error->all(FLERR,"Set command with no atoms existing"); if (narg < 3) error->all(FLERR,"Illegal set command"); // style and ID info if (strcmp(arg[0],"atom") == 0) style = ATOM_SELECT; else if (strcmp(arg[0],"mol") == 0) style = MOL_SELECT; else if (strcmp(arg[0],"type") == 0) style = TYPE_SELECT; else if (strcmp(arg[0],"group") == 0) style = GROUP_SELECT; else if (strcmp(arg[0],"region") == 0) style = REGION_SELECT; else error->all(FLERR,"Illegal set command"); int n = strlen(arg[1]) + 1; id = new char[n]; strcpy(id,arg[1]); select = NULL; selection(atom->nlocal); // loop over keyword/value pairs // call appropriate routine to reset attributes if (comm->me == 0 && screen) fprintf(screen,"Setting atom values ...\n"); int allcount,origarg; int iarg = 2; while (iarg < narg) { varflag = varflag1 = varflag2 = varflag3 = varflag4 = 0; count = 0; origarg = iarg; if (strcmp(arg[iarg],"type") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else ivalue = force->inumeric(FLERR,arg[iarg+1]); set(TYPE); iarg += 2; } else if (strcmp(arg[iarg],"type/fraction") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); newtype = force->inumeric(FLERR,arg[iarg+1]); fraction = force->numeric(FLERR,arg[iarg+2]); ivalue = force->inumeric(FLERR,arg[iarg+3]); if (newtype <= 0 || newtype > atom->ntypes) error->all(FLERR,"Invalid value in set command"); if (fraction < 0.0 || fraction > 1.0) error->all(FLERR,"Invalid value in set command"); if (ivalue <= 0) error->all(FLERR,"Invalid random number seed in set command"); setrandom(TYPE_FRACTION); iarg += 4; } else if (strcmp(arg[iarg],"mol") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else ivalue = force->inumeric(FLERR,arg[iarg+1]); if (!atom->molecule_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MOLECULE); iarg += 2; } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); set(X); iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); set(Y); iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); set(Z); iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->q_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(CHARGE); iarg += 2; } else if (strcmp(arg[iarg],"mass") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->rmass_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MASS); iarg += 2; } else if (strcmp(arg[iarg],"shape") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else xvalue = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); else zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->ellipsoid_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(SHAPE); iarg += 4; } else if (strcmp(arg[iarg],"length") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(LENGTH); iarg += 2; } else if (strcmp(arg[iarg],"tri") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->tri_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(TRI); iarg += 2; } else if (strcmp(arg[iarg],"dipole") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else xvalue = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); else zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->mu_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(DIPOLE); iarg += 4; } else if (strcmp(arg[iarg],"dipole/random") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); dvalue = force->numeric(FLERR,arg[iarg+2]); if (!atom->mu_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) error->all(FLERR,"Invalid random number seed in set command"); if (dvalue <= 0.0) error->all(FLERR,"Invalid dipole length in set command"); setrandom(DIPOLE_RANDOM); iarg += 3; } else if (strcmp(arg[iarg],"quat") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else xvalue = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); else zvalue = force->numeric(FLERR,arg[iarg+3]); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4); else wvalue = force->numeric(FLERR,arg[iarg+4]); if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(QUAT); iarg += 5; } else if (strcmp(arg[iarg],"quat/random") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) error->all(FLERR,"Invalid random number seed in set command"); setrandom(QUAT_RANDOM); iarg += 2; } else if (strcmp(arg[iarg],"theta") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { dvalue = force->numeric(FLERR,arg[iarg+1]); dvalue *= MY_PI/180.0; } if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(THETA); iarg += 2; } else if (strcmp(arg[iarg],"theta/random") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) error->all(FLERR,"Invalid random number seed in set command"); set(THETA_RANDOM); iarg += 2; } else if (strcmp(arg[iarg],"angmom") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else xvalue = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); else zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->angmom_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(ANGMOM); iarg += 4; } else if (strcmp(arg[iarg],"omega") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else xvalue = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); else zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->omega_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(OMEGA); iarg += 4; } else if (strcmp(arg[iarg],"diameter") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->radius_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(DIAMETER); iarg += 2; } else if (strcmp(arg[iarg],"density") == 0 || (strcmp(arg[iarg],"density/disc") == 0)) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->rmass_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue <= 0.0) error->all(FLERR,"Invalid density in set command"); discflag = 0; if (strcmp(arg[iarg],"density/disc") == 0) { discflag = 1; if (domain->dimension != 2) error->all(FLERR,"Density/disc option requires 2d simulation"); } set(DENSITY); iarg += 2; } else if (strcmp(arg[iarg],"volume") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->vfrac_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue <= 0.0) error->all(FLERR,"Invalid volume in set command"); set(VOLUME); iarg += 2; } else if (strcmp(arg[iarg],"image") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); ximageflag = yimageflag = zimageflag = 0; if (strcmp(arg[iarg+1],"NULL") != 0) { ximageflag = 1; if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else ximage = force->inumeric(FLERR,arg[iarg+1]); } if (strcmp(arg[iarg+2],"NULL") != 0) { yimageflag = 1; if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); else yimage = force->inumeric(FLERR,arg[iarg+2]); } if (strcmp(arg[iarg+3],"NULL") != 0) { zimageflag = 1; if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); else zimage = force->inumeric(FLERR,arg[iarg+3]); } if (ximageflag && ximage && !domain->xperiodic) error->all(FLERR, "Cannot set non-zero image flag for non-periodic dimension"); if (yimageflag && yimage && !domain->yperiodic) error->all(FLERR, "Cannot set non-zero image flag for non-periodic dimension"); if (zimageflag && zimage && !domain->zperiodic) error->all(FLERR, "Cannot set non-zero image flag for non-periodic dimension"); set(IMAGE); iarg += 4; } else if (strcmp(arg[iarg],"bond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->bonds_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nbondtypes) error->all(FLERR,"Invalid value in set command"); topology(BOND); iarg += 2; } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->angles_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nangletypes) error->all(FLERR,"Invalid value in set command"); topology(ANGLE); iarg += 2; } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->ndihedraltypes) error->all(FLERR,"Invalid value in set command"); topology(DIHEDRAL); iarg += 2; } else if (strcmp(arg[iarg],"improper") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->impropers_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nimpropertypes) error->all(FLERR,"Invalid value in set command"); topology(IMPROPER); iarg += 2; } else if (strcmp(arg[iarg],"meso/e") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->e_flag) error->all(FLERR,"Cannot set meso/e for this atom style"); set(MESO_E); iarg += 2; } else if (strcmp(arg[iarg],"meso/cv") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->cv_flag) error->all(FLERR,"Cannot set meso/cv for this atom style"); set(MESO_CV); iarg += 2; } else if (strcmp(arg[iarg],"meso/rho") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->rho_flag) error->all(FLERR,"Cannot set meso/rho for this atom style"); set(MESO_RHO); iarg += 2; + } else if (strcmp(arg[iarg],"edpd/temp") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; + else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else { + dvalue = force->numeric(FLERR,arg[iarg+1]); + if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); + } + if (!atom->edpd_flag) + error->all(FLERR,"Cannot set edpd/temp for this atom style"); + set(EDPD_TEMP); + iarg += 2; + + } else if (strcmp(arg[iarg],"edpd/cv") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; + else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else { + dvalue = force->numeric(FLERR,arg[iarg+1]); + if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); + } + if (!atom->edpd_flag) + error->all(FLERR,"Cannot set edpd/cv for this atom style"); + set(EDPD_CV); + iarg += 2; + + } else if (strcmp(arg[iarg],"cc") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal set command"); + if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; + else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else { + cc_index = force->inumeric(FLERR,arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+2]); + if (cc_index < 1) error->all(FLERR,"Illegal set command"); + } + if (!atom->tdpd_flag) + error->all(FLERR,"Cannot set cc for this atom style"); + set(CC); + iarg += 3; + } else if (strcmp(arg[iarg],"smd/mass/density") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->smd_flag) error->all(FLERR,"Cannot set smd/mass/density for this atom style"); set(SMD_MASS_DENSITY); iarg += 2; } else if (strcmp(arg[iarg],"smd/contact/radius") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->smd_flag) error->all(FLERR,"Cannot set smd/contact/radius " "for this atom style"); set(SMD_CONTACT_RADIUS); iarg += 2; } else if (strcmp(arg[iarg],"dpd/theta") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { dvalue = force->numeric(FLERR,arg[iarg+1]); if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); } if (!atom->dpd_flag) error->all(FLERR,"Cannot set dpd/theta for this atom style"); set(DPDTHETA); iarg += 2; } else if (strstr(arg[iarg],"i_") == arg[iarg]) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else ivalue = force->inumeric(FLERR,arg[iarg+1]); int flag; index_custom = atom->find_custom(&arg[iarg][2],flag); if (index_custom < 0 || flag != 0) error->all(FLERR,"Set command integer vector does not exist"); set(INAME); iarg += 2; } else if (strstr(arg[iarg],"d_") == arg[iarg]) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else dvalue = force->numeric(FLERR,arg[iarg+1]); int flag; index_custom = atom->find_custom(&arg[iarg][2],flag); if (index_custom < 0 || flag != 1) error->all(FLERR,"Set command floating point vector does not exist"); set(DNAME); iarg += 2; } else error->all(FLERR,"Illegal set command"); // statistics + // for CC option, include species index MPI_Allreduce(&count,&allcount,1,MPI_INT,MPI_SUM,world); if (comm->me == 0) { - if (screen) fprintf(screen," %d settings made for %s\n", - allcount,arg[origarg]); - if (logfile) fprintf(logfile," %d settings made for %s\n", - allcount,arg[origarg]); + + if (screen) { + if (strcmp(arg[origarg],"cc") == 0) + fprintf(screen," %d settings made for %s index %s\n", + allcount,arg[origarg],arg[origarg+1]); + else + fprintf(screen," %d settings made for %s\n", + allcount,arg[origarg]); + } + if (logfile) { + if (strcmp(arg[origarg],"cc") == 0) + fprintf(logfile," %d settings made for %s index %s\n", + allcount,arg[origarg],arg[origarg+1]); + else + fprintf(logfile," %d settings made for %s\n", + allcount,arg[origarg]); + } } } // free local memory delete [] id; delete [] select; } /* ---------------------------------------------------------------------- select atoms according to ATOM, MOLECULE, TYPE, GROUP, REGION style n = nlocal or nlocal+nghost depending on keyword ------------------------------------------------------------------------- */ void Set::selection(int n) { delete [] select; select = new int[n]; int nlo,nhi; if (style == ATOM_SELECT) { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use set atom with no atom IDs defined"); bigint nlobig,nhibig; force->boundsbig(FLERR,id,MAXTAGINT,nlobig,nhibig); tagint *tag = atom->tag; for (int i = 0; i < n; i++) if (tag[i] >= nlobig && tag[i] <= nhibig) select[i] = 1; else select[i] = 0; } else if (style == MOL_SELECT) { if (atom->molecule_flag == 0) error->all(FLERR,"Cannot use set mol with no molecule IDs defined"); bigint nlobig,nhibig; force->boundsbig(FLERR,id,MAXTAGINT,nlobig,nhibig); tagint *molecule = atom->molecule; for (int i = 0; i < n; i++) if (molecule[i] >= nlobig && molecule[i] <= nhibig) select[i] = 1; else select[i] = 0; } else if (style == TYPE_SELECT) { force->bounds(FLERR,id,atom->ntypes,nlo,nhi); int *type = atom->type; for (int i = 0; i < n; i++) if (type[i] >= nlo && type[i] <= nhi) select[i] = 1; else select[i] = 0; } else if (style == GROUP_SELECT) { int igroup = group->find(id); if (igroup == -1) error->all(FLERR,"Could not find set group ID"); int groupbit = group->bitmask[igroup]; int *mask = atom->mask; for (int i = 0; i < n; i++) if (mask[i] & groupbit) select[i] = 1; else select[i] = 0; } else if (style == REGION_SELECT) { int iregion = domain->find_region(id); if (iregion == -1) error->all(FLERR,"Set region ID does not exist"); domain->regions[iregion]->prematch(); double **x = atom->x; for (int i = 0; i < n; i++) if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) select[i] = 1; else select[i] = 0; } } /* ---------------------------------------------------------------------- set owned atom properties directly either scalar or per-atom values from atom-style variable(s) ------------------------------------------------------------------------- */ void Set::set(int keyword) { // evaluate atom-style variable(s) if necessary vec1 = vec2 = vec3 = vec4 = NULL; if (varflag) { int nlocal = atom->nlocal; if (varflag1) { memory->create(vec1,nlocal,"set:vec1"); input->variable->compute_atom(ivar1,0,vec1,1,0); } if (varflag2) { memory->create(vec2,nlocal,"set:vec2"); input->variable->compute_atom(ivar2,0,vec2,1,0); } if (varflag3) { memory->create(vec3,nlocal,"set:vec3"); input->variable->compute_atom(ivar3,0,vec3,1,0); } if (varflag4) { memory->create(vec4,nlocal,"set:vec4"); input->variable->compute_atom(ivar4,0,vec4,1,0); } } // check if properties of atoms in rigid bodies are updated // that are cached as per-body data. switch (keyword) { case X: case Y: case Z: case MOLECULE: case MASS: case ANGMOM: case SHAPE: case DIAMETER: case DENSITY: case QUAT: case IMAGE: if (modify->check_rigid_list_overlap(select)) error->warning(FLERR,"Changing a property of atoms in rigid bodies " "that has no effect unless rigid bodies are rebuild"); break; default: // assume no conflict for all other properties break; } // loop over selected atoms AtomVecEllipsoid *avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body"); int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { if (!select[i]) continue; // overwrite dvalue, ivalue, xyzw value if variables defined // else the input script scalar value remains in place if (varflag) { if (varflag1) { dvalue = xvalue = vec1[i]; ivalue = static_cast (dvalue); } if (varflag2) yvalue = vec2[i]; if (varflag3) zvalue = vec3[i]; if (varflag4) wvalue = vec4[i]; } // set values in per-atom arrays // error check here in case atom-style variables generated bogus value if (keyword == TYPE) { if (ivalue <= 0 || ivalue > atom->ntypes) error->one(FLERR,"Invalid value in set command"); atom->type[i] = ivalue; } else if (keyword == MOLECULE) atom->molecule[i] = ivalue; else if (keyword == X) atom->x[i][0] = dvalue; else if (keyword == Y) atom->x[i][1] = dvalue; else if (keyword == Z) atom->x[i][2] = dvalue; else if (keyword == CHARGE) atom->q[i] = dvalue; else if (keyword == MASS) { if (dvalue <= 0.0) error->one(FLERR,"Invalid mass in set command"); atom->rmass[i] = dvalue; } else if (keyword == DIAMETER) { if (dvalue < 0.0) error->one(FLERR,"Invalid diameter in set command"); atom->radius[i] = 0.5 * dvalue; } else if (keyword == VOLUME) { if (dvalue <= 0.0) error->one(FLERR,"Invalid volume in set command"); atom->vfrac[i] = dvalue; } else if (keyword == MESO_E) atom->e[i] = dvalue; else if (keyword == MESO_CV) atom->cv[i] = dvalue; else if (keyword == MESO_RHO) atom->rho[i] = dvalue; + + else if (keyword == EDPD_TEMP) atom->edpd_temp[i] = dvalue; + else if (keyword == EDPD_CV) atom->edpd_cv[i] = dvalue; + else if (keyword == CC) atom->cc[i][cc_index-1] = dvalue; + else if (keyword == SMD_MASS_DENSITY) { // set mass from volume and supplied mass density atom->rmass[i] = atom->vfrac[i] * dvalue; } else if (keyword == SMD_CONTACT_RADIUS) atom->contact_radius[i] = dvalue; else if (keyword == DPDTHETA) { if (dvalue >= 0.0) atom->dpdTheta[i] = dvalue; else { double onemass; if (atom->rmass) onemass = atom->rmass[i]; else onemass = atom->mass[atom->type[i]]; double vx = atom->v[i][0]; double vy = atom->v[i][1]; double vz = atom->v[i][2]; double tfactor = force->mvv2e / (domain->dimension * force->boltz); atom->dpdTheta[i] = tfactor * onemass * (vx*vx + vy*vy + vz*vz); } } // set shape of ellipsoidal particle else if (keyword == SHAPE) { if (xvalue < 0.0 || yvalue < 0.0 || zvalue < 0.0) error->one(FLERR,"Invalid shape in set command"); if (xvalue > 0.0 || yvalue > 0.0 || zvalue > 0.0) { if (xvalue == 0.0 || yvalue == 0.0 || zvalue == 0.0) error->one(FLERR,"Invalid shape in set command"); } avec_ellipsoid->set_shape(i,0.5*xvalue,0.5*yvalue,0.5*zvalue); } // set length of line particle else if (keyword == LENGTH) { if (dvalue < 0.0) error->one(FLERR,"Invalid length in set command"); avec_line->set_length(i,dvalue); } // set corners of tri particle else if (keyword == TRI) { if (dvalue < 0.0) error->one(FLERR,"Invalid length in set command"); avec_tri->set_equilateral(i,dvalue); } // set rmass via density // if radius > 0.0, treat as sphere or disc // if shape > 0.0, treat as ellipsoid (or ellipse, when uncomment below) // if length > 0.0, treat as line // if area > 0.0, treat as tri // else set rmass to density directly else if (keyword == DENSITY) { if (dvalue <= 0.0) error->one(FLERR,"Invalid density in set command"); if (atom->radius_flag && atom->radius[i] > 0.0) if (discflag) atom->rmass[i] = MY_PI*atom->radius[i]*atom->radius[i] * dvalue; else atom->rmass[i] = 4.0*MY_PI/3.0 * atom->radius[i]*atom->radius[i]*atom->radius[i] * dvalue; else if (atom->ellipsoid_flag && atom->ellipsoid[i] >= 0) { double *shape = avec_ellipsoid->bonus[atom->ellipsoid[i]].shape; // enable 2d ellipse (versus 3d ellipsoid) when time integration // options (fix nve/asphere, fix nh/asphere) are also implemented // if (discflag) // atom->rmass[i] = MY_PI*shape[0]*shape[1] * dvalue; // else atom->rmass[i] = 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2] * dvalue; } else if (atom->line_flag && atom->line[i] >= 0) { double length = avec_line->bonus[atom->line[i]].length; atom->rmass[i] = length * dvalue; } else if (atom->tri_flag && atom->tri[i] >= 0) { double *c1 = avec_tri->bonus[atom->tri[i]].c1; double *c2 = avec_tri->bonus[atom->tri[i]].c2; double *c3 = avec_tri->bonus[atom->tri[i]].c3; double c2mc1[3],c3mc1[3]; MathExtra::sub3(c2,c1,c2mc1); MathExtra::sub3(c3,c1,c3mc1); double norm[3]; MathExtra::cross3(c2mc1,c3mc1,norm); double area = 0.5 * MathExtra::len3(norm); atom->rmass[i] = area * dvalue; } else atom->rmass[i] = dvalue; } // set dipole moment else if (keyword == DIPOLE) { double **mu = atom->mu; mu[i][0] = xvalue; mu[i][1] = yvalue; mu[i][2] = zvalue; mu[i][3] = sqrt(mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]); } // set quaternion orientation of ellipsoid or tri or body particle // enforce quat rotation vector in z dir for 2d systems else if (keyword == QUAT) { double *quat; if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) quat = avec_tri->bonus[atom->tri[i]].quat; else if (avec_body && atom->body[i] >= 0) quat = avec_body->bonus[atom->body[i]].quat; else error->one(FLERR,"Cannot set quaternion for atom that has none"); if (domain->dimension == 2 && (xvalue != 0.0 || yvalue != 0.0)) error->one(FLERR,"Cannot set quaternion with xy components " "for 2d system"); double theta2 = MY_PI2 * wvalue/180.0; double sintheta2 = sin(theta2); quat[0] = cos(theta2); quat[1] = xvalue * sintheta2; quat[2] = yvalue * sintheta2; quat[3] = zvalue * sintheta2; MathExtra::qnormalize(quat); } // set theta of line particle else if (keyword == THETA) { if (atom->line[i] < 0) error->one(FLERR,"Cannot set theta for atom that is not a line"); avec_line->bonus[atom->line[i]].theta = dvalue; } // set angmom or omega of particle else if (keyword == ANGMOM) { atom->angmom[i][0] = xvalue; atom->angmom[i][1] = yvalue; atom->angmom[i][2] = zvalue; } else if (keyword == OMEGA) { atom->omega[i][0] = xvalue; atom->omega[i][1] = yvalue; atom->omega[i][2] = zvalue; } // reset any or all of 3 image flags else if (keyword == IMAGE) { int xbox = (atom->image[i] & IMGMASK) - IMGMAX; int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX; int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX; if (varflag1) ximage = static_cast(xvalue); if (varflag2) yimage = static_cast(yvalue); if (varflag3) zimage = static_cast(zvalue); if (ximageflag) xbox = ximage; if (yimageflag) ybox = yimage; if (zimageflag) zbox = zimage; atom->image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } // set value for custom integer or double vector else if (keyword == INAME) { atom->ivector[index_custom][i] = ivalue; } else if (keyword == DNAME) { atom->dvector[index_custom][i] = dvalue; } count++; } // clear up per-atom memory if allocated memory->destroy(vec1); memory->destroy(vec2); memory->destroy(vec3); memory->destroy(vec4); } /* ---------------------------------------------------------------------- set an owned atom property randomly set seed based on atom coordinates make atom result independent of what proc owns it ------------------------------------------------------------------------- */ void Set::setrandom(int keyword) { int i; AtomVecEllipsoid *avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body"); RanPark *random = new RanPark(lmp,1); double **x = atom->x; int seed = ivalue; // set fraction of atom types to newtype if (keyword == TYPE_FRACTION) { int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) if (select[i]) { random->reset(seed,x[i]); if (random->uniform() > fraction) continue; atom->type[i] = newtype; count++; } // set dipole moments to random orientations in 3d or 2d // dipole length is determined by dipole type array } else if (keyword == DIPOLE_RANDOM) { double **mu = atom->mu; int nlocal = atom->nlocal; double msq,scale; if (domain->dimension == 3) { for (i = 0; i < nlocal; i++) if (select[i]) { random->reset(seed,x[i]); mu[i][0] = random->uniform() - 0.5; mu[i][1] = random->uniform() - 0.5; mu[i][2] = random->uniform() - 0.5; msq = mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]; scale = dvalue/sqrt(msq); mu[i][0] *= scale; mu[i][1] *= scale; mu[i][2] *= scale; mu[i][3] = dvalue; count++; } } else { for (i = 0; i < nlocal; i++) if (select[i]) { random->reset(seed,x[i]); mu[i][0] = random->uniform() - 0.5; mu[i][1] = random->uniform() - 0.5; mu[i][2] = 0.0; msq = mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1]; scale = dvalue/sqrt(msq); mu[i][0] *= scale; mu[i][1] *= scale; mu[i][3] = dvalue; count++; } } // set quaternions to random orientations in 3d and 2d } else if (keyword == QUAT_RANDOM) { int nlocal = atom->nlocal; double *quat; if (domain->dimension == 3) { double s,t1,t2,theta1,theta2; for (i = 0; i < nlocal; i++) if (select[i]) { if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) quat = avec_tri->bonus[atom->tri[i]].quat; else if (avec_body && atom->body[i] >= 0) quat = avec_body->bonus[atom->body[i]].quat; else error->one(FLERR,"Cannot set quaternion for atom that has none"); random->reset(seed,x[i]); s = random->uniform(); t1 = sqrt(1.0-s); t2 = sqrt(s); theta1 = 2.0*MY_PI*random->uniform(); theta2 = 2.0*MY_PI*random->uniform(); quat[0] = cos(theta2)*t2; quat[1] = sin(theta1)*t1; quat[2] = cos(theta1)*t1; quat[3] = sin(theta2)*t2; count++; } } else { double theta2; for (i = 0; i < nlocal; i++) if (select[i]) { if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_body && atom->body[i] >= 0) quat = avec_body->bonus[atom->body[i]].quat; else error->one(FLERR,"Cannot set quaternion for atom that has none"); random->reset(seed,x[i]); theta2 = MY_PI*random->uniform(); quat[0] = cos(theta2); quat[1] = 0.0; quat[2] = 0.0; quat[3] = sin(theta2); count++; } } // set theta to random orientation in 2d } else if (keyword == THETA_RANDOM) { int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { if (select[i]) { if (atom->line[i] < 0) error->one(FLERR,"Cannot set theta for atom that is not a line"); random->reset(seed,x[i]); avec_line->bonus[atom->line[i]].theta = MY_2PI*random->uniform(); count++; } } } delete random; } /* ---------------------------------------------------------------------- */ void Set::topology(int keyword) { int m,atom1,atom2,atom3,atom4; // error check if (atom->molecular == 2) error->all(FLERR,"Cannot set bond topology types for atom style template"); // border swap to acquire ghost atom info // enforce PBC before in case atoms are outside box // init entire system since comm->exchange is done // comm::init needs neighbor::init needs pair::init needs kspace::init, etc if (comm->me == 0 && screen) fprintf(screen," system init for set ...\n"); lmp->init(); if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); domain->reset_box(); comm->setup(); comm->exchange(); comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); // select both owned and ghost atoms selection(atom->nlocal + atom->nghost); // for BOND, each of 2 atoms must be in group if (keyword == BOND) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) for (m = 0; m < atom->num_bond[i]; m++) { atom1 = atom->map(atom->bond_atom[i][m]); if (atom1 == -1) error->one(FLERR,"Bond atom missing in set command"); if (select[i] && select[atom1]) { atom->bond_type[i][m] = ivalue; count++; } } } // for ANGLE, each of 3 atoms must be in group if (keyword == ANGLE) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) for (m = 0; m < atom->num_angle[i]; m++) { atom1 = atom->map(atom->angle_atom1[i][m]); atom2 = atom->map(atom->angle_atom2[i][m]); atom3 = atom->map(atom->angle_atom3[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) error->one(FLERR,"Angle atom missing in set command"); if (select[atom1] && select[atom2] && select[atom3]) { atom->angle_type[i][m] = ivalue; count++; } } } // for DIHEDRAL, each of 4 atoms must be in group if (keyword == DIHEDRAL) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) for (m = 0; m < atom->num_dihedral[i]; m++) { atom1 = atom->map(atom->dihedral_atom1[i][m]); atom2 = atom->map(atom->dihedral_atom2[i][m]); atom3 = atom->map(atom->dihedral_atom3[i][m]); atom4 = atom->map(atom->dihedral_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) error->one(FLERR,"Dihedral atom missing in set command"); if (select[atom1] && select[atom2] && select[atom3] && select[atom4]) { atom->dihedral_type[i][m] = ivalue; count++; } } } // for IMPROPER, each of 4 atoms must be in group if (keyword == IMPROPER) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) for (m = 0; m < atom->num_improper[i]; m++) { atom1 = atom->map(atom->improper_atom1[i][m]); atom2 = atom->map(atom->improper_atom2[i][m]); atom3 = atom->map(atom->improper_atom3[i][m]); atom4 = atom->map(atom->improper_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) error->one(FLERR,"Improper atom missing in set command"); if (select[atom1] && select[atom2] && select[atom3] && select[atom4]) { atom->improper_type[i][m] = ivalue; count++; } } } } /* ---------------------------------------------------------------------- */ void Set::varparse(char *name, int m) { varflag = 1; name = &name[2]; int n = strlen(name) + 1; char *str = new char[n]; strcpy(str,name); int ivar = input->variable->find(str); delete [] str; if (ivar < 0) error->all(FLERR,"Variable name for set command does not exist"); if (!input->variable->atomstyle(ivar)) error->all(FLERR,"Variable for set command is invalid style"); if (m == 1) { varflag1 = 1; ivar1 = ivar; } else if (m == 2) { varflag2 = 1; ivar2 = ivar; } else if (m == 3) { varflag3 = 1; ivar3 = ivar; } else if (m == 4) { varflag4 = 1; ivar4 = ivar; } } diff --git a/src/set.h b/src/set.h index dfb06a2e1..5584e228b 100644 --- a/src/set.h +++ b/src/set.h @@ -1,216 +1,217 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef COMMAND_CLASS CommandStyle(set,Set) #else #ifndef LMP_SET_H #define LMP_SET_H #include "pointers.h" namespace LAMMPS_NS { class Set : protected Pointers { public: Set(class LAMMPS *lmp) : Pointers(lmp) {}; void command(int, char **); private: char *id; int *select; int style,ivalue,newtype,count,index_custom; int ximage,yimage,zimage,ximageflag,yimageflag,zimageflag; double dvalue,xvalue,yvalue,zvalue,wvalue,fraction; - + int cc_index; + int varflag,varflag1,varflag2,varflag3,varflag4; int ivar1,ivar2,ivar3,ivar4; double *vec1,*vec2,*vec3,*vec4; int discflag; void selection(int); void set(int); void setrandom(int); void topology(int); void varparse(char *, int); }; } #endif #endif /* ERROR/WARNING messages: E: Set command before simulation box is defined The set command cannot be used before a read_data, read_restart, or create_box command. E: Set command with no atoms existing No atoms are yet defined so the set command cannot be used. E: Illegal ... command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: Invalid value in set command The value specified for the setting is invalid, likely because it is too small or too large. E: Invalid random number seed in set command Random number seed must be > 0. E: Cannot set this attribute for this atom style The attribute being set does not exist for the defined atom style. E: Invalid dipole length in set command Self-explanatory. E: Invalid density in set command Density must be > 0.0. E: Invalid volume in set command Volume must be > 0.0. E: Cannot set non-zero image flag for non-periodic dimension Self-explanatory. E: Cannot set meso/e for this atom style Self-explanatory. E: Cannot set meso/cv for this atom style Self-explanatory. E: Cannot set meso/rho for this atom style Self-explanatory. E: Cannot set smd/mass/density for this atom style Self-explanatory. E: Cannot set smd/contact/radius for this atom style Self-explanatory. E: Cannot set dpd/theta for this atom style Self-explanatory. E: Set command integer vector does not exist Self-explanatory. E: Set command floating point vector does not exist Self-explanatory. E: Cannot use set atom with no atom IDs defined Atom IDs are not defined, so they cannot be used to identify an atom. E: Cannot use set mol with no molecule IDs defined Self-explanatory. E: Could not find set group ID Group ID specified in set command does not exist. E: Set region ID does not exist Region ID specified in set command does not exist. E: Invalid mass in set command Self-explanatory. E: Invalid diameter in set command Self-explanatory. E: Invalid shape in set command Self-explanatory. E: Invalid length in set command Self-explanatory. E: Cannot set quaternion for atom that has none Self-explanatory. E: Cannot set quaternion with xy components for 2d system Self-explanatory. E: Cannot set theta for atom that is not a line Self-explanatory. E: Cannot set bond topology types for atom style template The bond, angle, etc types cannot be changed for this atom style since they are static settings in the molecule template files. E: Bond atom missing in set command The set command cannot find one or more atoms in a particular bond on a particular processor. The pairwise cutoff is too short or the atoms are too far apart to make a valid bond. E: Angle atom missing in set command The set command cannot find one or more atoms in a particular angle on a particular processor. The pairwise cutoff is too short or the atoms are too far apart to make a valid angle. E: Dihedral atom missing in set command The set command cannot find one or more atoms in a particular dihedral on a particular processor. The pairwise cutoff is too short or the atoms are too far apart to make a valid dihedral. E: Improper atom missing in set command The set command cannot find one or more atoms in a particular improper on a particular processor. The pairwise cutoff is too short or the atoms are too far apart to make a valid improper. E: Variable name for set command does not exist Self-explanatory. E: Variable for set command is invalid style Only atom-style variables can be used. */