switch parsed-literal to code-block in Howto files where applicable

This commit is contained in:
Axel Kohlmeyer
2020-02-27 12:45:14 -05:00
parent 06ede499c1
commit 3c277409c2
13 changed files with 111 additions and 112 deletions

View File

@ -12,7 +12,7 @@ create\_atoms command will tile the 3d simulation box with a single z
plane of atoms - e.g.
.. parsed-literal::
.. code-block:: LAMMPS
:doc:`create box <create_box>` 1 -10 10 -10 10 -0.25 0.25

View File

@ -98,7 +98,7 @@ Installing prerequisite packages
First upgrade all existing packages using
.. parsed-literal::
.. code-block:: bash
sudo apt update
sudo apt upgrade -y
@ -107,7 +107,7 @@ Next install the following packages, which include compilers and libraries
needed for various LAMMPS features:
.. parsed-literal::
.. code-block:: bash
sudo apt install -y build-essential ccache gfortran openmpi-bin libopenmpi-dev libfftw3-dev libjpeg-dev libpng12-dev python-dev python-virtualenv libblas-dev liblapack-dev libhdf5-serial-dev hdf5-tools
@ -127,7 +127,7 @@ Option 1: Downloading LAMMPS tarball using wget
"""""""""""""""""""""""""""""""""""""""""""""""
.. parsed-literal::
.. code-block:: bash
wget http://lammps.sandia.gov/tars/lammps-stable.tar.gz
tar xvzf lammps-stable.tar.gz
@ -137,7 +137,7 @@ Option 2: Obtaining LAMMPS code from GitHub
"""""""""""""""""""""""""""""""""""""""""""
.. parsed-literal::
.. code-block:: bash
git clone https://github.com/lammps/lammps.git
cd lammps
@ -151,7 +151,7 @@ Compiling serial version
""""""""""""""""""""""""
.. parsed-literal::
.. code-block:: bash
cd src/
make -j 4 serial
@ -162,7 +162,7 @@ Compiling MPI version
"""""""""""""""""""""
.. parsed-literal::
.. code-block:: bash
cd src/
make -j 4 mpi
@ -176,14 +176,14 @@ This will create an executable called lmp\_mpi in the src/ directory
Finally, please note the absolute path of your src folder. You can get this using
.. parsed-literal::
.. code-block:: bash
pwd
or
.. parsed-literal::
.. code-block:: bash
echo $PWD
@ -191,7 +191,7 @@ To run any examples you need the location of the executable. For now, let us
save this location in a temporary variable
.. parsed-literal::
.. code-block:: bash
LAMMPS_DIR=$PWD
@ -206,7 +206,7 @@ Once compiled you can execute some of the LAMMPS examples. Switch into the
examples/melt folder
.. parsed-literal::
.. code-block:: bash
cd ../examples/melt
@ -215,14 +215,14 @@ version is $LAMMPS\_DIR/lmp\_mpi. You can run the melt example with either
version as follows:
.. parsed-literal::
.. code-block:: bash
$LAMMPS_DIR/lmp_serial -in in.melt
or
.. parsed-literal::
.. code-block:: bash
mpirun -np 4 $LAMMPS_DIR/lmp_mpi -in in.melt
@ -236,21 +236,21 @@ You can avoid having to type the full path of your LAMMPS binary by adding its
parent folder to the PATH environment variable as follows:
.. parsed-literal::
.. code-block:: bash
export PATH=$LAMMPS_DIR:$PATH
Input scripts can then be run like this:
.. parsed-literal::
.. code-block:: bash
lmp_serial -in in.melt
or
.. parsed-literal::
.. code-block:: bash
mpirun -np 4 lmp_mpi -in in.melt
@ -259,7 +259,7 @@ To persist this setting edit the $HOME/.bashrc file using your favorite editor
and add this line
.. parsed-literal::
.. code-block:: bash
export PATH=/full/path/to/your/lammps/src:$PATH
@ -268,14 +268,14 @@ and add this line
For an executable lmp\_serial with a full path
.. parsed-literal::
.. code-block:: bash
/home/richard/lammps/src/lmp_serial
the PATH variable should be
.. parsed-literal::
.. code-block:: bash
export PATH=/home/richard/lammps/src:$PATH

View File

@ -151,7 +151,7 @@ properties:
(1) Average velocity in each of 1000 2d spatial bins:
.. parsed-literal::
.. code-block:: LAMMPS
compute cc1 all chunk/atom bin/2d x 0.0 0.1 y lower 0.01 units reduced
fix 1 all ave/chunk 100 10 1000 cc1 vx vy file tmp.out
@ -160,7 +160,7 @@ properties:
velocity:
.. parsed-literal::
.. code-block:: LAMMPS
compute cc1 all chunk/atom bin/2d x 0.0 0.1 y lower 0.1 units reduced
compute vbias all temp/profile 1 0 0 y 10
@ -169,16 +169,16 @@ velocity:
(3) Center of mass of each molecule:
.. parsed-literal::
.. code-block:: LAMMPS
compute cc1 all chunk/atom molecule
compute myChunk all com/chunk cc1
fix 1 all ave/time 100 1 100 c_myChunk[\*] file tmp.out mode vector
fix 1 all ave/time 100 1 100 c_myChunk[*] file tmp.out mode vector
(4) Total force on each molecule and ave/max across all molecules:
.. parsed-literal::
.. code-block:: LAMMPS
compute cc1 all chunk/atom molecule
fix 1 all ave/chunk 1000 1 1000 cc1 fx fy fz file tmp.out
@ -190,7 +190,7 @@ velocity:
(5) Histogram of cluster sizes:
.. parsed-literal::
.. code-block:: LAMMPS
compute cluster all cluster/atom 1.0
compute cc1 all chunk/atom c_cluster compress yes

View File

@ -135,7 +135,7 @@ together to exchange MPI messages between them.
For message exchange in *file*\ , *zmq*\ , or *mpi/two* modes:
.. parsed-literal::
.. code-block:: bash
% mpirun -np 1 lmp_mpi -log log.client < in.client &
% mpirun -np 2 lmp_mpi -log log.server < in.server
@ -151,7 +151,7 @@ For message exchange in *mpi/one* mode:
Launch both codes in a single mpirun command:
.. parsed-literal::
.. code-block:: bash
mpirun -np 2 lmp_mpi -mpicolor 0 -in in.message.client -log log.client : -np 4 lmp_mpi -mpicolor 1 -in in.message.server -log log.server

View File

@ -88,10 +88,10 @@ For the NaCL example problem, these pair style and bond style settings
are used:
.. parsed-literal::
.. code-block:: LAMMPS
pair_style born/coul/long/cs 20.0 20.0
pair_coeff \* \* 0.0 1.000 0.00 0.00 0.00
pair_coeff * * 0.0 1.000 0.00 0.00 0.00
pair_coeff 3 3 487.0 0.23768 0.00 1.05 0.50 #Na-Na
pair_coeff 3 4 145134.0 0.23768 0.00 6.99 8.70 #Na-Cl
pair_coeff 4 4 405774.0 0.23768 0.00 72.40 145.40 #Cl-Cl
@ -132,7 +132,7 @@ this temperature be output for the overall system.
For the NaCl example, this can be done as follows:
.. parsed-literal::
.. code-block:: LAMMPS
group cores type 1 2
group shells type 3 4
@ -151,7 +151,7 @@ second argument in :doc:`fix modify <fix_modify>` and
:doc:`thermo_modify <thermo_modify>` resulting in:
.. parsed-literal::
.. code-block:: LAMMPS
(...)
compute CSequ all temp/cs cores shells
@ -175,7 +175,7 @@ the pairs. This can be done by using the *bias* keyword of the
:doc:`velocity <velocity>` command, e.g.
.. parsed-literal::
.. code-block:: LAMMPS
velocity all create 1427 134 bias yes temp CSequ
velocity all scale 1427 temp CSequ
@ -212,7 +212,7 @@ pairs as chunks.
For example if core/shell pairs are the only molecules:
.. parsed-literal::
.. code-block:: LAMMPS
read_data NaCl_CS_x0.1_prop.data
compute prop all property/atom molecule
@ -223,7 +223,7 @@ For example if core/shell pairs are the only molecules:
For example if core/shell pairs and other molecules are present:
.. parsed-literal::
.. code-block:: LAMMPS
fix csinfo all property/atom i_CSID # property/atom command
read_data NaCl_CS_x0.1_prop.data fix csinfo NULL CS-Info # atom property added in the data-file

View File

@ -139,7 +139,7 @@ LAMMPS to recognize that you are using Drude oscillators, you should
use the fix *drude*\ . The command is
.. parsed-literal::
.. code-block:: LAMMPS
fix DRUDE all drude C C C N N D D D
@ -160,7 +160,7 @@ space is required. Otherwise LAMMPS crashes and gives the required
value.
.. parsed-literal::
.. code-block:: LAMMPS
read_data data-p.lmp extra/special/per/atom 1
@ -174,7 +174,7 @@ include Coulomb interactions, for instance *lj/cut/coul/long* with
1.e-4:
.. parsed-literal::
.. code-block:: LAMMPS
pair_style lj/cut/coul/long 10.0
kspace_style pppm 1.0e-4
@ -185,14 +185,14 @@ interactions, their *epsilon* is 0. so the only *pair\_coeff* line
that needs to be added is
.. parsed-literal::
.. code-block:: LAMMPS
pair_coeff \* 6\* 0.0 0.0 # All-DPs
pair_coeff * 6* 0.0 0.0 # All-DPs
Now for the thermalization, the simplest choice is to use the :doc:`fix langevin/drude <fix_langevin_drude>`.
.. parsed-literal::
.. code-block:: LAMMPS
fix LANG all langevin/drude 300. 100 12435 1. 20 13977
@ -206,7 +206,7 @@ together with their DC. For this, ghost atoms need to know their
velocities. Thus you need to add the following command:
.. parsed-literal::
.. code-block:: LAMMPS
comm_modify vel yes
@ -218,7 +218,7 @@ If the fix *shake* is used to constrain the C-H bonds, it should be
invoked after the fix *langevin/drude* for more accuracy.
.. parsed-literal::
.. code-block:: LAMMPS
fix SHAKE ATOMS shake 0.0001 20 0 t 4 5
@ -232,7 +232,7 @@ modification of forces but no position/velocity updates), the fix
*nve* should be used in conjunction.
.. parsed-literal::
.. code-block:: LAMMPS
fix NVE all nve
@ -241,7 +241,7 @@ them in a *dump\_modify ... element ...* command, by adding the element
type of the DPs. Here for instance
.. parsed-literal::
.. code-block:: LAMMPS
dump DUMP all custom 10 dump.lammpstrj id mol type element x y z ix iy iz
dump_modify DUMP element C C O H H D D D
@ -255,7 +255,7 @@ temperatures of the DC-DP pair centers of mass and of the DPs relative
to their DCs, you should use the :doc:`compute temp\_drude <compute_temp_drude>`
.. parsed-literal::
.. code-block:: LAMMPS
compute TDRUDE all temp/drude
@ -264,7 +264,7 @@ using *thermo\_style custom* with respectively *c\_TDRUDE[1]* and
*c\_TDRUDE[2]*. These should be close to 300.0 and 1.0 on average.
.. parsed-literal::
.. code-block:: LAMMPS
thermo_style custom step temp c_TDRUDE[1] c_TDRUDE[2]
@ -290,7 +290,7 @@ It is to be used as *hybrid/overlay* with any standard *coul* pair
style. In our example, we would use
.. parsed-literal::
.. code-block:: LAMMPS
pair_style hybrid/overlay lj/cut/coul/long 10.0 thole 2.6 10.0
@ -306,7 +306,7 @@ to complete the *pair\_coeff* section of the input file. In our
example, this will look like:
.. parsed-literal::
.. code-block:: LAMMPS
pair_coeff 1 1 lj/cut/coul/long 0.0700 3.550
pair_coeff 1 2 lj/cut/coul/long 0.0700 3.550
@ -318,8 +318,8 @@ example, this will look like:
pair_coeff 3 3 lj/cut/coul/long 0.1700 3.070
pair_coeff 3 4 lj/cut/coul/long 0.0714 2.745
pair_coeff 4 4 lj/cut/coul/long 0.0300 2.420
pair_coeff \* 5 lj/cut/coul/long 0.0000 0.000
pair_coeff \* 6\* lj/cut/coul/long 0.0000 0.000
pair_coeff * 5 lj/cut/coul/long 0.0000 0.000
pair_coeff * 6* lj/cut/coul/long 0.0000 0.000
pair_coeff 1 1 thole 1.090 2.510
pair_coeff 1 2 thole 1.218 2.510
pair_coeff 1 3 thole 0.829 1.590
@ -371,7 +371,7 @@ Using a Nose-Hoover barostat with the *langevin/drude* thermostat is
straightforward using fix *nph* instead of *nve*\ . For example:
.. parsed-literal::
.. code-block:: LAMMPS
fix NPH all nph iso 1. 1. 500
@ -386,7 +386,7 @@ the reverse transformation. For a NVT simulation, with the DCs and
atoms at 300 K and the DPs at 1 K relative to their DC one would use
.. parsed-literal::
.. code-block:: LAMMPS
fix DIRECT all drude/transform/direct
fix NVT1 ATOMS nvt temp 300. 300. 100
@ -396,7 +396,7 @@ atoms at 300 K and the DPs at 1 K relative to their DC one would use
For our phenol example, the groups would be defined as
.. parsed-literal::
.. code-block:: LAMMPS
group ATOMS type 1 2 3 4 5 # DCs and non-polarizable atoms
group CORES type 1 2 3 # DCs
@ -410,7 +410,7 @@ center of mass of the whole system drifts faster and faster, the *fix
momentum* can be used. For instance:
.. parsed-literal::
.. code-block:: LAMMPS
fix MOMENTUM all momentum 100 linear 1 1 1
@ -425,7 +425,7 @@ the *fix\_modify* command for this. In the end, the block of
instructions for thermostatting and barostatting will look like
.. parsed-literal::
.. code-block:: LAMMPS
compute TATOMS ATOMS temp
fix DIRECT all drude/transform/direct
@ -449,7 +449,7 @@ review the different thermostats and ensemble combinations.
NVT ensemble using Langevin thermostat:
.. parsed-literal::
.. code-block:: LAMMPS
comm_modify vel yes
fix LANG all langevin/drude 300. 100 12435 1. 20 13977
@ -459,7 +459,7 @@ NVT ensemble using Langevin thermostat:
NVT ensemble using Nose-Hoover thermostat:
.. parsed-literal::
.. code-block:: LAMMPS
fix DIRECT all drude/transform/direct
fix RIGID ATOMS rigid/nvt/small molecule temp 300. 300. 100
@ -469,7 +469,7 @@ NVT ensemble using Nose-Hoover thermostat:
NPT ensemble with Langevin thermostat:
.. parsed-literal::
.. code-block:: LAMMPS
comm_modify vel yes
fix LANG all langevin/drude 300. 100 12435 1. 20 13977
@ -479,7 +479,7 @@ NPT ensemble with Langevin thermostat:
NPT ensemble using Nose-Hoover thermostat:
.. parsed-literal::
.. code-block:: LAMMPS
compute TATOM ATOMS temp
fix DIRECT all drude/transform/direct

View File

@ -59,17 +59,17 @@ details.
wish.
.. parsed-literal::
.. code-block:: c
void lammps_open(int, char \*\*, MPI_Comm, void \*\*)
void lammps_open_no_mpi(int, char \*\*, void \*\*)
void lammps_close(void \*)
int lammps_version(void \*)
void lammps_file(void \*, char \*)
char \*lammps_command(void \*, char \*)
void lammps_commands_list(void \*, int, char \*\*)
void lammps_commands_string(void \*, char \*)
void lammps_free(void \*)
void lammps_open(int, char **, MPI_Comm, void **)
void lammps_open_no_mpi(int, char **, void **)
void lammps_close(void *)
int lammps_version(void *)
void lammps_file(void *, char *)
char *lammps_command(void *, char *)
void lammps_commands_list(void *, int, char **)
void lammps_commands_string(void *, char *)
void lammps_free(void *)
The lammps\_open() function is used to initialize LAMMPS, passing in a
list of strings as if they were :doc:`command-line arguments <Run_options>` when LAMMPS is run in stand-alone mode
@ -137,16 +137,16 @@ the documentation in the src/library.cpp file for details, including
which quantities can be queried by name:
.. parsed-literal::
.. code-block:: c
int lammps_extract_setting(void \*, char \*)
void \*lammps_extract_global(void \*, char \*)
void lammps_extract_box(void \*, double \*, double \*,
double \*, double \*, double \*, int \*, int \*)
void \*lammps_extract_atom(void \*, char \*)
void \*lammps_extract_compute(void \*, char \*, int, int)
void \*lammps_extract_fix(void \*, char \*, int, int, int, int)
void \*lammps_extract_variable(void \*, char \*, char \*)
int lammps_extract_setting(void *, char *)
void *lammps_extract_global(void *, char *)
void lammps_extract_box(void *, double *, double *,
double *, double *, double *, int *, int *)
void *lammps_extract_atom(void *, char *)
void *lammps_extract_compute(void *, char *, int, int)
void *lammps_extract_fix(void *, char *, int, int, int, int)
void *lammps_extract_variable(void *, char *, char *)
The extract\_setting() function returns info on the size
of data types (e.g. 32-bit or 64-bit atom IDs) used
@ -164,13 +164,13 @@ storage may be reallocated as LAMMPS runs, so you need to re-call the
function to assure a current pointer or returned value(s).
.. parsed-literal::
.. code-block:: c
double lammps_get_thermo(void \*, char \*)
int lammps_get_natoms(void \*)
double lammps_get_thermo(void *, char *)
int lammps_get_natoms(void *)
int lammps_set_variable(void \*, char \*, char \*)
void lammps_reset_box(void \*, double \*, double \*, double, double, double)
int lammps_set_variable(void *, char *, char *)
void lammps_reset_box(void *, double *, double *, double, double, double)
The lammps\_get\_thermo() function returns the current value of a thermo
keyword as a double precision value.
@ -188,13 +188,13 @@ simulation box, e.g. as part of restoring a previously extracted and
saved state of a simulation.
.. parsed-literal::
.. code-block:: c
void lammps_gather_atoms(void \*, char \*, int, int, void \*)
void lammps_gather_atoms_concat(void \*, char \*, int, int, void \*)
void lammps_gather_atoms_subset(void \*, char \*, int, int, int, int \*, void \*)
void lammps_scatter_atoms(void \*, char \*, int, int, void \*)
void lammps_scatter_atoms_subset(void \*, char \*, int, int, int, int \*, void \*)
void lammps_gather_atoms(void *, char *, int, int, void *)
void lammps_gather_atoms_concat(void *, char *, int, int, void *)
void lammps_gather_atoms_subset(void *, char *, int, int, int, int *, void *)
void lammps_scatter_atoms(void *, char *, int, int, void *)
void lammps_scatter_atoms_subset(void *, char *, int, int, int, int *, void *)
The gather functions collect peratom info of the requested type (atom
coords, atom types, forces, etc) from all processors, and returns the
@ -231,10 +231,10 @@ lammps\_scatter\_atoms\_subset() function takes a subset of IDs as an
argument and only scatters those values to the owning atoms.
.. parsed-literal::
.. code-block:: c
void lammps_create_atoms(void \*, int, tagint \*, int \*, double \*, double \*,
imageint \*, int)
void lammps_create_atoms(void *, int, tagint *, int *, double *, double *,
imageint *, int)
The lammps\_create\_atoms() function takes a list of N atoms as input
with atom types and coords (required), an optionally atom IDs and

View File

@ -9,7 +9,7 @@ more timesteps, then you simply use the :doc:`run <run>` command
multiple times. For example, this script
.. parsed-literal::
.. code-block:: LAMMPS
units lj
atom_style atomic
@ -28,7 +28,7 @@ the :doc:`clear <clear>` command can be used in between them to
re-initialize LAMMPS. For example, this script
.. parsed-literal::
.. code-block:: LAMMPS
units lj
atom_style atomic
@ -49,7 +49,7 @@ multiple times with different settings. For example, this
script, named in.polymer
.. parsed-literal::
.. code-block:: LAMMPS
variable d index run1 run2 run3 run4 run5 run6 run7 run8
shell cd $d
@ -66,7 +66,7 @@ same system at 8 different temperatures, using a temperature variable
and storing the output in different log and dump files, for example
.. parsed-literal::
.. code-block:: LAMMPS
variable a loop 8
variable t index 0.8 0.85 0.9 0.95 1.0 1.05 1.1 1.15

View File

@ -38,7 +38,7 @@ run-time by using the :doc:`-partition command-line switch <Run_options>` to lau
which in this context are the same as replicas. E.g. these commands:
.. parsed-literal::
.. code-block:: bash
mpirun -np 16 lmp_linux -partition 8x2 -in in.temper
mpirun -np 8 lmp_linux -partition 8x1 -in in.neb

View File

@ -22,7 +22,7 @@ of the LAMMPS distribution to see the original script that these 2
scripts are based on. If that script had the line
.. parsed-literal::
.. code-block:: LAMMPS
restart 50 tmp.restart
@ -33,7 +33,7 @@ This script could be used to read the 1st restart file and re-run the
last 50 timesteps:
.. parsed-literal::
.. code-block:: LAMMPS
read_restart tmp.restart.50
@ -63,14 +63,14 @@ As an alternate approach, the restart file could be converted to a data
file as follows:
.. parsed-literal::
.. code-block:: LAMMPS
lmp_g++ -r tmp.restart.50 tmp.restart.data
Then, this script could be used to re-run the last 50 steps:
.. parsed-literal::
.. code-block:: LAMMPS
units lj
atom_style bond

View File

@ -39,7 +39,7 @@ is often used in conjunction with spherical particles, via a command
like
.. parsed-literal::
.. code-block:: LAMMPS
atom_style hybrid sphere dipole

View File

@ -63,7 +63,7 @@ Here is an example input script that calculates the viscosity of
liquid Ar via the GK formalism:
.. parsed-literal::
.. code-block:: LAMMPS
# Sample LAMMPS input script for viscosity of liquid Ar
@ -73,7 +73,7 @@ liquid Ar via the GK formalism:
variable dt equal 4.0
variable p equal 400 # correlation length
variable s equal 5 # sample interval
variable d equal $p\*$s # dump interval
variable d equal $p*$s # dump interval
# convert from LAMMPS real units to SI
@ -81,7 +81,7 @@ liquid Ar via the GK formalism:
variable atm2Pa equal 101325.0
variable A2m equal 1.0e-10
variable fs2s equal 1.0e-15
variable convert equal ${atm2Pa}\*${atm2Pa}\*${fs2s}\*${A2m}\*${A2m}\*${A2m}
variable convert equal ${atm2Pa}*${atm2Pa}*${fs2s}*${A2m}*${A2m}*${A2m}
# setup problem
@ -93,7 +93,7 @@ liquid Ar via the GK formalism:
create_atoms 1 box
mass 1 39.948
pair_style lj/cut 13.0
pair_coeff \* \* 0.2381 3.405
pair_coeff * * 0.2381 3.405
timestep ${dt}
thermo $d
@ -114,15 +114,15 @@ liquid Ar via the GK formalism:
variable pyz equal pyz
fix SS all ave/correlate $s $p $d &
v_pxy v_pxz v_pyz type auto file S0St.dat ave running
variable scale equal ${convert}/(${kB}\*$T)\*$V\*$s\*${dt}
variable v11 equal trap(f_SS[3])\*${scale}
variable v22 equal trap(f_SS[4])\*${scale}
variable v33 equal trap(f_SS[5])\*${scale}
variable scale equal ${convert}/(${kB}*$T)*$V*$s*${dt}
variable v11 equal trap(f_SS[3])*${scale}
variable v22 equal trap(f_SS[4])*${scale}
variable v33 equal trap(f_SS[5])*${scale}
thermo_style custom step temp press v_pxy v_pxz v_pyz v_v11 v_v22 v_v33
run 100000
variable v equal (v_v11+v_v22+v_v33)/3.0
variable ndens equal count(all)/vol
print "average viscosity: $v [Pa.s] @ $T K, ${ndens} /A\^3"
print "average viscosity: $v [Pa.s] @ $T K, ${ndens} /A^3"
The fifth method is related to the above Green-Kubo method,
but uses the Einstein formulation, analogous to the Einstein