Bureaucrats, cc_docs_admin, cc_staff
2,879
edits
(mark for translation) |
(Marked this version for translation) |
||
Line 3: | Line 3: | ||
<translate> | <translate> | ||
<!--T:1--> | |||
''Parent page: [[Biomolecular simulation]]'' | ''Parent page: [[Biomolecular simulation]]'' | ||
= General = | = General = <!--T:2--> | ||
<!--T:3--> | |||
'''LAMMPS''' is a classical molecular dynamics code. The name stands for '''L'''arge-scale '''A'''tomic / '''M'''olecular '''M'''assively '''P'''arallel '''S'''imulator. LAMMPS is distributed by [http://www.sandia.gov/ Sandia National Laboratories], a US Department of Energy laboratory. | '''LAMMPS''' is a classical molecular dynamics code. The name stands for '''L'''arge-scale '''A'''tomic / '''M'''olecular '''M'''assively '''P'''arallel '''S'''imulator. LAMMPS is distributed by [http://www.sandia.gov/ Sandia National Laboratories], a US Department of Energy laboratory. | ||
<!--T:4--> | |||
* Project web site: http://lammps.sandia.gov/ | * Project web site: http://lammps.sandia.gov/ | ||
* Documentation: [http://lammps.sandia.gov/doc/Manual.html Online Manual]. | * Documentation: [http://lammps.sandia.gov/doc/Manual.html Online Manual]. | ||
* Mailing List: http://lammps.sandia.gov/mail.html | * Mailing List: http://lammps.sandia.gov/mail.html | ||
<!--T:5--> | |||
LAMMPS is parallelized with [[MPI]] and [[OpenMP]], and can run on [[Using GPUs with Slurm|GPU]]s. | LAMMPS is parallelized with [[MPI]] and [[OpenMP]], and can run on [[Using GPUs with Slurm|GPU]]s. | ||
= Force fields = | = Force fields = <!--T:6--> | ||
<!--T:7--> | |||
All supported force fields are listed on the [https://lammps.sandia.gov/doc/Intro_features.html#ff package web site], | All supported force fields are listed on the [https://lammps.sandia.gov/doc/Intro_features.html#ff package web site], | ||
classified by functional form (e.g. pairwise potentials, many-body potentials, etc.) | classified by functional form (e.g. pairwise potentials, many-body potentials, etc.) | ||
Line 22: | Line 27: | ||
Here are some types of modelling and force fields suitable for each: | Here are some types of modelling and force fields suitable for each: | ||
<!--T:8--> | |||
* Biomolecules: CHARMM, AMBER, OPLS, COMPASS (class 2), long-range Coulombics via PPPM, point dipoles, ... | * Biomolecules: CHARMM, AMBER, OPLS, COMPASS (class 2), long-range Coulombics via PPPM, point dipoles, ... | ||
* Polymers: all-atom, united-atom, coarse-grain (bead-spring FENE), bond-breaking, … | * Polymers: all-atom, united-atom, coarse-grain (bead-spring FENE), bond-breaking, … | ||
Line 28: | Line 34: | ||
* Mesoscale: granular, DPD, Gay-Berne, colloidal, peri-dynamics, DSMC... | * Mesoscale: granular, DPD, Gay-Berne, colloidal, peri-dynamics, DSMC... | ||
<!--T:9--> | |||
Combinations of potentials can be used for hybrid systems, e.g. water on metal, polymer/semiconductor interfaces, colloids in solution, ... | Combinations of potentials can be used for hybrid systems, e.g. water on metal, polymer/semiconductor interfaces, colloids in solution, ... | ||
= Versions and packages = | = Versions and packages = <!--T:10--> | ||
<!--T:11--> | |||
To see which versions of LAMMPS are installed on Compute Canada systems, run <code>module spider lammps</code>. See [[Using modules]] for more about <code>module</code> subcommands. | To see which versions of LAMMPS are installed on Compute Canada systems, run <code>module spider lammps</code>. See [[Using modules]] for more about <code>module</code> subcommands. | ||
<!--T:12--> | |||
LAMMPS version numbers are based on their release dates, and have the format YYYYMMDD. | LAMMPS version numbers are based on their release dates, and have the format YYYYMMDD. | ||
For each release installed, one or more modules are are available. | For each release installed, one or more modules are are available. | ||
For example, the release of 31 March 2017 has three modules: | For example, the release of 31 March 2017 has three modules: | ||
<!--T:13--> | |||
* Built with MPI: <code>lammps/20170331</code> | * Built with MPI: <code>lammps/20170331</code> | ||
* Built with USER-OMP support: <code>lammps-omp/20170331</code> | * Built with USER-OMP support: <code>lammps-omp/20170331</code> | ||
* Built with USER-INTEL support: <code>lammps-user-intel/20170331</code> | * Built with USER-INTEL support: <code>lammps-user-intel/20170331</code> | ||
<!--T:14--> | |||
These versions are also available with GPU support. | These versions are also available with GPU support. | ||
In order to use the GPU-enabled version, load the [[CUDA]] module before loading the LAMMPS module: | In order to use the GPU-enabled version, load the [[CUDA]] module before loading the LAMMPS module: | ||
$ module load cuda | <!--T:15--> | ||
$ module load cuda | |||
$ module load lammps-omp/20170331 | $ module load lammps-omp/20170331 | ||
<!--T:16--> | |||
The name of the executable may differ from one version to another. All prebuilt versions on Compute Canada clusters have a symbolic link called <code>lmp</code>. It means that no matter which module you pick, you can execute LAMMPS by calling <code>lmp</code>. | The name of the executable may differ from one version to another. All prebuilt versions on Compute Canada clusters have a symbolic link called <code>lmp</code>. It means that no matter which module you pick, you can execute LAMMPS by calling <code>lmp</code>. | ||
<!--T:17--> | |||
If you wish to see the original name of the executable for a given module, list the files in the <code>${EBROOTLAMMPS}/bin</code> directory. For example: | If you wish to see the original name of the executable for a given module, list the files in the <code>${EBROOTLAMMPS}/bin</code> directory. For example: | ||
$ module load lammps-omp/20170331 | <!--T:18--> | ||
$ module load lammps-omp/20170331 | |||
$ ls ${EBROOTLAMMPS}/bin/ | $ ls ${EBROOTLAMMPS}/bin/ | ||
lmp lmp_icc_openmpi | lmp lmp_icc_openmpi | ||
<!--T:19--> | |||
In this example the executable is <code>lmp_icc_openmpi</code>, and <code>lmp</code> is the symbolic link to it. | In this example the executable is <code>lmp_icc_openmpi</code>, and <code>lmp</code> is the symbolic link to it. | ||
<!--T:20--> | |||
The reason there are different modules for the same release is the difference in the ''packages'' included. Recent versions of LAMMPS contain about 60 different packages that can be enabled or disabled when compiling the program. Not all packages can be enabled in a single executable. All [https://lammps.sandia.gov/doc/Packages.html packages] are documented on the official web page. | The reason there are different modules for the same release is the difference in the ''packages'' included. Recent versions of LAMMPS contain about 60 different packages that can be enabled or disabled when compiling the program. Not all packages can be enabled in a single executable. All [https://lammps.sandia.gov/doc/Packages.html packages] are documented on the official web page. | ||
<!--T:21--> | |||
For each LAMMPS module we provide a file <code>list-packages.txt</code> listing the enabled ("Supported") and disabled ("Not Supported") packages. Once you have loaded a particular module, run <code>cat ${EBROOTLAMMPS}/list-packages.txt</code> to see the contents. | For each LAMMPS module we provide a file <code>list-packages.txt</code> listing the enabled ("Supported") and disabled ("Not Supported") packages. Once you have loaded a particular module, run <code>cat ${EBROOTLAMMPS}/list-packages.txt</code> to see the contents. | ||
<!--T:22--> | |||
If your simulation does not work with one module, it may be related to the fact that the necessary package was not included. | If your simulation does not work with one module, it may be related to the fact that the necessary package was not included. | ||
= Example files = | = Example files = <!--T:23--> | ||
<!--T:24--> | |||
The input file below can be used with either of the example job scripts. | The input file below can be used with either of the example job scripts. | ||
<!--T:25--> | |||
<tabs> | <tabs> | ||
<!--T:26--> | |||
<tab name="INPUT"> | <tab name="INPUT"> | ||
{{File | {{File | ||
Line 77: | Line 99: | ||
# 3d Lennard-Jones melt | # 3d Lennard-Jones melt | ||
<!--T:27--> | |||
units lj | units lj | ||
atom_style atomic | atom_style atomic | ||
<!--T:28--> | |||
lattice fcc 0.8442 | lattice fcc 0.8442 | ||
region box block 0 15 0 15 0 15 | region box block 0 15 0 15 0 15 | ||
Line 86: | Line 110: | ||
mass 1 1.0 | mass 1 1.0 | ||
<!--T:29--> | |||
velocity all create 1.44 87287 loop geom | velocity all create 1.44 87287 loop geom | ||
<!--T:30--> | |||
pair_style lj/cut 2.5 | pair_style lj/cut 2.5 | ||
pair_coeff 1 1 1.0 1.0 2.5 | pair_coeff 1 1 1.0 1.0 2.5 | ||
Line 93: | Line 119: | ||
neigh_modify delay 5 every 1 | neigh_modify delay 5 every 1 | ||
<!--T:31--> | |||
fix 1 all nve | fix 1 all nve | ||
thermo 5 | thermo 5 | ||
Line 98: | Line 125: | ||
write_data config.end_sim | write_data config.end_sim | ||
<!--T:32--> | |||
# End of the Input file. | # End of the Input file. | ||
}} | }} | ||
</tab> | </tab> | ||
<!--T:33--> | |||
<tab name="Serial job"> | <tab name="Serial job"> | ||
{{File | {{File | ||
Line 109: | Line 138: | ||
#!/bin/bash | #!/bin/bash | ||
<!--T:34--> | |||
#SBATCH --ntasks=1 | #SBATCH --ntasks=1 | ||
#SBATCH --mem-per-cpu=2500M # memory; default unit is megabytes. | #SBATCH --mem-per-cpu=2500M # memory; default unit is megabytes. | ||
#SBATCH --time=0-00:30 # time (DD-HH:MM). | #SBATCH --time=0-00:30 # time (DD-HH:MM). | ||
<!--T:35--> | |||
# Load the module: | # Load the module: | ||
<!--T:36--> | |||
module load nixpkgs/16.09 intel/2016.4 openmpi/2.1.1 lammps-omp/20170811 | module load nixpkgs/16.09 intel/2016.4 openmpi/2.1.1 lammps-omp/20170811 | ||
<!--T:37--> | |||
echo "Starting run at: `date`" | echo "Starting run at: `date`" | ||
<!--T:38--> | |||
lmp_exec=lmp_icc_openmpi | lmp_exec=lmp_icc_openmpi | ||
lmp_input="lammps.in" | lmp_input="lammps.in" | ||
lmp_output="lammps_lj_output.txt" | lmp_output="lammps_lj_output.txt" | ||
<!--T:39--> | |||
${lmp_exec} < ${lmp_input} > ${lmp_output} | ${lmp_exec} < ${lmp_input} > ${lmp_output} | ||
<!--T:40--> | |||
echo "Program finished with exit code $? at: `date`" | echo "Program finished with exit code $? at: `date`" | ||
}} | }} | ||
</tab> | </tab> | ||
<!--T:41--> | |||
<tab name="MPI job"> | <tab name="MPI job"> | ||
{{File | {{File | ||
Line 136: | Line 173: | ||
#!/bin/bash | #!/bin/bash | ||
<!--T:42--> | |||
#SBATCH --ntasks=4 # number of MPI processes. | #SBATCH --ntasks=4 # number of MPI processes. | ||
#SBATCH --mem-per-cpu=2500M # memory; default unit is megabytes. | #SBATCH --mem-per-cpu=2500M # memory; default unit is megabytes. | ||
#SBATCH --time=0-00:30 # time (DD-HH:MM). | #SBATCH --time=0-00:30 # time (DD-HH:MM). | ||
<!--T:43--> | |||
# Load the module: | # Load the module: | ||
<!--T:44--> | |||
module load nixpkgs/16.09 intel/2016.4 openmpi/2.1.1 lammps-omp/20170811 | module load nixpkgs/16.09 intel/2016.4 openmpi/2.1.1 lammps-omp/20170811 | ||
<!--T:45--> | |||
echo "Starting run at: `date`" | echo "Starting run at: `date`" | ||
<!--T:46--> | |||
lmp_exec=lmp_icc_openmpi | lmp_exec=lmp_icc_openmpi | ||
lmp_input="lammps.in" | lmp_input="lammps.in" | ||
lmp_output="lammps_lj_output.txt" | lmp_output="lammps_lj_output.txt" | ||
<!--T:47--> | |||
srun ${lmp_exec} < ${lmp_input} > ${lmp_output} | srun ${lmp_exec} < ${lmp_input} > ${lmp_output} | ||
<!--T:48--> | |||
echo "Program finished with exit code $? at: `date`" | echo "Program finished with exit code $? at: `date`" | ||
}} | }} | ||
</tab> | </tab> | ||
<!--T:49--> | |||
</tabs> | </tabs> | ||
= Performance = | = Performance = <!--T:50--> | ||
<!--T:51--> | |||
Most of the CPU time for molecular dynamics simulations is spent in computing the pair interactions between particles. LAMMPS uses domain decomposition to split the work among the available processors by assigning a part of the simulation box to each processor. During the computation of the interactions between particles, communication between the processors is required. For a given number of particles, the more processors that are used, the more parts of the simulation box there are which must exchange data. Therefore, the communication time increases with increasing number of processors, eventually leading to low CPU efficiency. | Most of the CPU time for molecular dynamics simulations is spent in computing the pair interactions between particles. LAMMPS uses domain decomposition to split the work among the available processors by assigning a part of the simulation box to each processor. During the computation of the interactions between particles, communication between the processors is required. For a given number of particles, the more processors that are used, the more parts of the simulation box there are which must exchange data. Therefore, the communication time increases with increasing number of processors, eventually leading to low CPU efficiency. | ||
<!--T:52--> | |||
Before running extensive simulations for a given problem size or a size of the simulation box, you should run tests to see how the program's performance changes with the number of cores. Run short tests using different numbers of cores to find a suitable number of cores that will (approximately) maximize the efficiency of the simulation. | Before running extensive simulations for a given problem size or a size of the simulation box, you should run tests to see how the program's performance changes with the number of cores. Run short tests using different numbers of cores to find a suitable number of cores that will (approximately) maximize the efficiency of the simulation. | ||
<!--T:53--> | |||
The following example shows the timing for a simulation of a system of 4000 particles using 12 MPI tasks. This is an example of a very low efficiency: by using 12 cores, the system of 4000 atoms was divided to 12 small boxes. The code spent 46.45% of the time computing pair interactions and 44.5% in communications between the processors. The large number of small boxes for a such small system is responsible for the large fraction of time spent in communication. | The following example shows the timing for a simulation of a system of 4000 particles using 12 MPI tasks. This is an example of a very low efficiency: by using 12 cores, the system of 4000 atoms was divided to 12 small boxes. The code spent 46.45% of the time computing pair interactions and 44.5% in communications between the processors. The large number of small boxes for a such small system is responsible for the large fraction of time spent in communication. | ||
<!--T:54--> | |||
{| class="wikitable" style="text-align: center; border-width: 2px;width: 100%;" | {| class="wikitable" style="text-align: center; border-width: 2px;width: 100%;" | ||
!colspan="6" style="text-align: left;"|Loop time of 15.4965 on 12 procs for 25000 steps with 4000 atoms.<br /> | !colspan="6" style="text-align: left;"|Loop time of 15.4965 on 12 procs for 25000 steps with 4000 atoms.<br /> | ||
Line 221: | Line 270: | ||
|} | |} | ||
<!--T:55--> | |||
In the next example, we compare the time spent in communication and computing the pair interactions for different system sizes: | In the next example, we compare the time spent in communication and computing the pair interactions for different system sizes: | ||
<!--T:56--> | |||
{| class="wikitable" style="text-align: center; border-width: 2px;width: 100%;" | {| class="wikitable" style="text-align: center; border-width: 2px;width: 100%;" | ||
! | ! |