Files
lammps/doc/html/Tools.html
2025-01-13 14:55:48 +00:00

1229 lines
89 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>10. Auxiliary tools &mdash; LAMMPS documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/sphinx-design.min.css" type="text/css" />
<link rel="stylesheet" href="_static/css/lammps.css" type="text/css" />
<link rel="shortcut icon" href="_static/lammps.ico"/>
<link rel="canonical" href="https://docs.lammps.org/Tools.html" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/design-tabs.js?v=f930bc37"></script>
<script async="async" src="_static/mathjax/es5/tex-mml-chtml.js?v=cadf963e"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="11. Errors" href="Errors.html" />
<link rel="prev" title="9. Example scripts" href="Examples.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="Manual.html">
<img src="_static/lammps-logo.png" class="logo" alt="Logo"/>
</a>
<div class="lammps_version">Version: <b>19 Nov 2024</b></div>
<div class="lammps_release">git info: </div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">User Guide</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="Intro.html">1. Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="Install.html">2. Install LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Build.html">3. Build LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Run_head.html">4. Run LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Commands.html">5. Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Packages.html">6. Optional packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="Speed.html">7. Accelerate performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="Howto.html">8. Howto discussions</a></li>
<li class="toctree-l1"><a class="reference internal" href="Examples.html">9. Example scripts</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">10. Auxiliary tools</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#pre-processing-tools">10.1. Pre-processing tools</a></li>
<li class="toctree-l2"><a class="reference internal" href="#post-processing-tools">10.2. Post-processing tools</a></li>
<li class="toctree-l2"><a class="reference internal" href="#miscellaneous-tools">10.3. Miscellaneous tools</a></li>
<li class="toctree-l2"><a class="reference internal" href="#tool-descriptions">10.4. Tool descriptions</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#amber2lmp-tool">10.4.1. amber2lmp tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#binary2txt-tool">10.4.2. binary2txt tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#ch2lmp-tool">10.4.3. ch2lmp tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#chain-tool">10.4.4. chain tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#lammps-coding-standard">10.4.5. LAMMPS coding standard</a></li>
<li class="toctree-l3"><a class="reference internal" href="#colvars-tools">10.4.6. colvars tools</a></li>
<li class="toctree-l3"><a class="reference internal" href="#createatoms-tool">10.4.7. createatoms tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#drude-tool">10.4.8. drude tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#eam-database-tool">10.4.9. eam database tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#eam-generate-tool">10.4.10. eam generate tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#eff-tool">10.4.11. eff tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#emacs-tool">10.4.12. emacs tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#fep-tool">10.4.13. fep tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#i-pi-tool">10.4.14. i-PI tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#ipp-tool">10.4.15. ipp tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#kate-tool">10.4.16. kate tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#lammps-gui">10.4.17. LAMMPS-GUI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#lmp2arc-tool">10.4.18. lmp2arc tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#lmp2cfg-tool">10.4.19. lmp2cfg tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#magic-patterns-for-the-file-command">10.4.20. Magic patterns for the “file” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="#matlab-tool">10.4.21. matlab tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#micelle2d-tool">10.4.22. micelle2d tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#moltemplate-tool">10.4.23. moltemplate tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#msi2lmp-tool">10.4.24. msi2lmp tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scripts-for-building-lammps-when-offline">10.4.25. Scripts for building LAMMPS when offline</a></li>
<li class="toctree-l3"><a class="reference internal" href="#phonon-tool">10.4.26. phonon tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#polybond-tool">10.4.27. polybond tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#pymol-asphere-tool">10.4.28. pymol_asphere tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#python-tool">10.4.29. python tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#regression-tester-tool">10.4.30. Regression tester tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#replica-tool">10.4.31. replica tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#smd-tool">10.4.32. smd tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#spin-tool">10.4.33. spin tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#singularity-apptainer-tool">10.4.34. singularity/apptainer tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#stl-bin2txt-tool">10.4.35. stl_bin2txt tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#swig-interface">10.4.36. SWIG interface</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tabulate-tool">10.4.37. tabulate tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tinker-tool">10.4.38. tinker tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#valgrind-tool">10.4.39. valgrind tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#vim-tool">10.4.40. vim tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="#xmgrace-tool">10.4.41. xmgrace tool</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Errors.html">11. Errors</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Programmer Guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="Library.html">1. LAMMPS Library Interfaces</a></li>
<li class="toctree-l1"><a class="reference internal" href="Python_head.html">2. Use Python with LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Modify.html">3. Modifying &amp; extending LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Developer.html">4. Information for Developers</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Command Reference</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="commands_list.html">Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="fixes.html">Fix Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="computes.html">Compute Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="pairs.html">Pair Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="bonds.html">Bond Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="angles.html">Angle Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="dihedrals.html">Dihedral Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="impropers.html">Improper Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="dumps.html">Dump Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="fix_modify_atc_commands.html">fix_modify AtC commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Bibliography.html">Bibliography</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="Manual.html">LAMMPS</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content style-external-links">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="Manual.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active"><span class="section-number">10. </span>Auxiliary tools</li>
<li class="wy-breadcrumbs-aside">
<a href="https://www.lammps.org"><img src="_static/lammps-logo.png" width="64" height="16" alt="LAMMPS Homepage"></a> | <a href="Commands_all.html">Commands</a>
</li>
</ul><div class="rst-breadcrumbs-buttons" role="navigation" aria-label="Sequential page navigation">
<a href="Examples.html" class="btn btn-neutral float-left" title="9. Example scripts" accesskey="p"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="Errors.html" class="btn btn-neutral float-right" title="11. Errors" accesskey="n">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<p><span class="math notranslate nohighlight">\(\renewcommand{\AA}{\text{Å}}\)</span></p>
<section id="auxiliary-tools">
<h1><span class="section-number">10. </span>Auxiliary tools<a class="headerlink" href="#auxiliary-tools" title="Link to this heading"></a></h1>
<p>LAMMPS is designed to be a computational kernel for performing
molecular dynamics computations. Additional pre- and post-processing
steps are often necessary to setup and analyze a simulation. A list
of such tools can be found on the <a class="reference external" href="https://www.lammps.org">LAMMPS webpage</a> at these links:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://www.lammps.org/prepost.html">Pre/Post processing</a></p></li>
<li><p><a class="reference external" href="https://www.lammps.org/external.html">External LAMMPS packages &amp; tools</a></p></li>
<li><p><a class="reference external" href="https://lammps.github.io/pizza">Pizza.py toolkit</a></p></li>
</ul>
<p>The last link for <a class="reference external" href="https://lammps.github.io/pizza">Pizza.py</a> is a Python-based tool developed at
Sandia which provides tools for doing setup, analysis, plotting, and
visualization for LAMMPS simulations.</p>
<p>Additional tools included in the LAMMPS distribution are described on
this page.</p>
<p>Note that many users write their own setup or analysis tools or use
other existing codes and convert their output to a LAMMPS input format
or vice versa. The tools listed here are included in the LAMMPS
distribution as examples of auxiliary tools. Some of them are not
actively supported by the LAMMPS developers, as they were contributed
by LAMMPS users. If you have problems using them, we can direct you
to the authors.</p>
<p>The source code for each of these codes is in the tools subdirectory
of the LAMMPS distribution. There is a Makefile (which you may need
to edit for your platform) which will build several of the tools which
reside in that directory. Most of them are larger packages in their
own subdirectories with their own Makefiles and/or README files.</p>
<hr class="docutils" />
<section id="pre-processing-tools">
<h2><span class="section-number">10.1. </span>Pre-processing tools<a class="headerlink" href="#pre-processing-tools" title="Link to this heading"></a></h2>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#amber"><span class="std std-ref">amber2lmp</span></a></p></td>
<td><p><a class="reference internal" href="#charmm"><span class="std std-ref">ch2lmp</span></a></p></td>
<td><p><a class="reference internal" href="#chain"><span class="std std-ref">chain</span></a></p></td>
<td><p><a class="reference internal" href="#createatoms"><span class="std std-ref">createatoms</span></a></p></td>
<td><p><a class="reference internal" href="#drude"><span class="std std-ref">drude</span></a></p></td>
<td><p><a class="reference internal" href="#eamdb"><span class="std std-ref">eam database</span></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#eamgn"><span class="std std-ref">eam generate</span></a></p></td>
<td><p><a class="reference internal" href="#eff"><span class="std std-ref">eff</span></a></p></td>
<td><p><a class="reference internal" href="#ipp"><span class="std std-ref">ipp</span></a></p></td>
<td><p><a class="reference internal" href="#micelle"><span class="std std-ref">micelle2d</span></a></p></td>
<td><p><a class="reference internal" href="#moltemplate"><span class="std std-ref">moltemplate</span></a></p></td>
<td><p><a class="reference internal" href="#msi"><span class="std std-ref">msi2lmp</span></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#polybond"><span class="std std-ref">polybond</span></a></p></td>
<td><p><a class="reference internal" href="#stlconvert"><span class="std std-ref">stl_bin2txt</span></a></p></td>
<td><p><a class="reference internal" href="#tabulate"><span class="std std-ref">tabulate</span></a></p></td>
<td><p><a class="reference internal" href="#tinker"><span class="std std-ref">tinker</span></a></p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<section id="post-processing-tools">
<h2><span class="section-number">10.2. </span>Post-processing tools<a class="headerlink" href="#post-processing-tools" title="Link to this heading"></a></h2>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#amber"><span class="std std-ref">amber2lmp</span></a></p></td>
<td><p><a class="reference internal" href="#binary"><span class="std std-ref">binary2txt</span></a></p></td>
<td><p><a class="reference internal" href="#charmm"><span class="std std-ref">ch2lmp</span></a></p></td>
<td><p><a class="reference internal" href="#colvars-tools"><span class="std std-ref">colvars</span></a></p></td>
<td><p><a class="reference internal" href="#eff"><span class="std std-ref">eff</span></a></p></td>
<td><p><a class="reference internal" href="#fep"><span class="std std-ref">fep</span></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#arc"><span class="std std-ref">lmp2arc</span></a></p></td>
<td><p><a class="reference internal" href="#cfg"><span class="std std-ref">lmp2cfg</span></a></p></td>
<td><p><a class="reference internal" href="#matlab"><span class="std std-ref">matlab</span></a></p></td>
<td><p><a class="reference internal" href="#phonon"><span class="std std-ref">phonon</span></a></p></td>
<td><p><a class="reference internal" href="#pymol"><span class="std std-ref">pymol_asphere</span></a></p></td>
<td><p><a class="reference internal" href="#pythontools"><span class="std std-ref">python</span></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#replica"><span class="std std-ref">replica</span></a></p></td>
<td><p><a class="reference internal" href="#smd"><span class="std std-ref">smd</span></a></p></td>
<td><p><a class="reference internal" href="#spin"><span class="std std-ref">spin</span></a></p></td>
<td><p><a class="reference internal" href="#xmgrace"><span class="std std-ref">xmgrace</span></a></p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<section id="miscellaneous-tools">
<h2><span class="section-number">10.3. </span>Miscellaneous tools<a class="headerlink" href="#miscellaneous-tools" title="Link to this heading"></a></h2>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#coding-standard"><span class="std std-ref">LAMMPS coding standards</span></a></p></td>
<td><p><a class="reference internal" href="#emacs"><span class="std std-ref">emacs</span></a></p></td>
<td><p><a class="reference internal" href="#ipi"><span class="std std-ref">i-PI</span></a></p></td>
<td><p><a class="reference internal" href="#kate"><span class="std std-ref">kate</span></a></p></td>
<td><p><a class="reference internal" href="#lammps-gui"><span class="std std-ref">LAMMPS-GUI</span></a></p></td>
<td><p><a class="reference internal" href="#magic"><span class="std std-ref">LAMMPS magic patterns for file(1)</span></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#offline"><span class="std std-ref">Offline build tool</span></a></p></td>
<td><p><a class="reference internal" href="#regression"><span class="std std-ref">Regression tester</span></a></p></td>
<td><p><a class="reference internal" href="#singularity-tool"><span class="std std-ref">singularity/apptainer</span></a></p></td>
<td><p><a class="reference internal" href="#swig"><span class="std std-ref">SWIG interface</span></a></p></td>
<td><p><a class="reference internal" href="#valgrind"><span class="std std-ref">valgrind</span></a></p></td>
<td><p><a class="reference internal" href="#vim"><span class="std std-ref">vim</span></a></p></td>
</tr>
</tbody>
</table>
</section>
<hr class="docutils" />
<section id="tool-descriptions">
<h2><span class="section-number">10.4. </span>Tool descriptions<a class="headerlink" href="#tool-descriptions" title="Link to this heading"></a></h2>
<section id="amber2lmp-tool">
<span id="amber"></span><h3><span class="section-number">10.4.1. </span>amber2lmp tool<a class="headerlink" href="#amber2lmp-tool" title="Link to this heading"></a></h3>
<p>The amber2lmp subdirectory contains three Python scripts for converting
files back-and-forth between the AMBER MD code and LAMMPS. See the
README file in amber2lmp for more information.</p>
<p>These tools were written by Keir Novik while he was at Queen Mary
University of London. Keir is no longer there and cannot support
these tools which are out-of-date with respect to the current LAMMPS
version (and maybe with respect to AMBER as well). Since we dont use
these tools at Sandia, you will need to experiment with them and make
necessary modifications yourself.</p>
<hr class="docutils" />
</section>
<section id="binary2txt-tool">
<span id="binary"></span><h3><span class="section-number">10.4.2. </span>binary2txt tool<a class="headerlink" href="#binary2txt-tool" title="Link to this heading"></a></h3>
<p>The file binary2txt.cpp converts one or more binary LAMMPS dump file
into ASCII text files. The syntax for running the tool is</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>binary2txt<span class="w"> </span>file1<span class="w"> </span>file2<span class="w"> </span>...
</pre></div>
</div>
<p>which creates file1.txt, file2.txt, etc. This tool must be compiled
on a platform that can read the binary file created by a LAMMPS run,
since binary files are not compatible across all platforms.</p>
<hr class="docutils" />
</section>
<section id="ch2lmp-tool">
<span id="charmm"></span><h3><span class="section-number">10.4.3. </span>ch2lmp tool<a class="headerlink" href="#ch2lmp-tool" title="Link to this heading"></a></h3>
<p>The ch2lmp subdirectory contains tools for converting files
back-and-forth between the CHARMM MD code and LAMMPS.</p>
<p>They are intended to make it easy to use CHARMM as a builder and as a
post-processor for LAMMPS. Using charmm2lammps.pl, you can convert a
PDB file with associated CHARMM info, including CHARMM force field
data, into its LAMMPS equivalent. Support for the CMAP correction of
CHARMM22 and later is available as an option. This tool can also add
solvent water molecules and Na+ or Cl- ions to the system.
Using lammps2pdb.pl you can convert LAMMPS atom dumps into PDB files.</p>
<p>See the README file in the ch2lmp subdirectory for more information.</p>
<p>These tools were created by Pieter int Veld (pjintve at sandia.gov)
and Paul Crozier (pscrozi at sandia.gov) at Sandia.</p>
<p>CMAP support added and tested by Xiaohu Hu (hux2 at ornl.gov) and
Robert A. Latour (latourr at clemson.edu), David Hyde-Volpe, and
Tigran Abramyan, (Clemson University) and
Chris Lorenz (chris.lorenz at kcl.ac.uk), Kings College London.</p>
<hr class="docutils" />
</section>
<section id="chain-tool">
<span id="chain"></span><h3><span class="section-number">10.4.4. </span>chain tool<a class="headerlink" href="#chain-tool" title="Link to this heading"></a></h3>
<p>The file chain.f90 creates a LAMMPS data file containing bead-spring
polymer chains and/or monomer solvent atoms. It uses a text file
containing chain definition parameters as an input. The created
chains and solvent atoms can strongly overlap, so LAMMPS needs to run
the system initially with a “soft” pair potential to un-overlap it.
The syntax for running the tool is</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>chain<span class="w"> </span>&lt;<span class="w"> </span>def.chain<span class="w"> </span>&gt;<span class="w"> </span>data.file
</pre></div>
</div>
<p>See the def.chain or def.chain.ab files in the tools directory for
examples of definition files. This tool was used to create the system
for the <a class="reference internal" href="Speed_bench.html"><span class="doc">chain benchmark</span></a>.</p>
<hr class="docutils" />
</section>
<section id="lammps-coding-standard">
<span id="coding-standard"></span><h3><span class="section-number">10.4.5. </span>LAMMPS coding standard<a class="headerlink" href="#lammps-coding-standard" title="Link to this heading"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">coding_standard</span></code> folder contains multiple python scripts to
check for and apply some LAMMPS coding conventions. The following
scripts are available:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>permissions.py # detects if sources have executable permissions and scripts have not
whitespace.py # detects TAB characters and trailing whitespace
homepage.py # detects outdated LAMMPS homepage URLs (pointing to sandia.gov instead of lammps.org)
errordocs.py # detects deprecated error docs in header files
versiontags.py # detects .. versionadded:: or .. versionchanged:: with pending version date
</pre></div>
</div>
<p>The tools need to be given the main folder of the LAMMPS distribution
or individual file names as argument and will by default check them
and report any non-compliance. With the optional <code class="docutils literal notranslate"><span class="pre">-f</span></code> argument the
corresponding script will try to change the non-compliant file(s) to
match the conventions.</p>
<p>For convenience this scripts can also be invoked by the make file in
the <code class="docutils literal notranslate"><span class="pre">src</span></code> folder with, <cite>make check-whitespace</cite> or <cite>make fix-whitespace</cite>
to either detect or edit the files. Correspondingly for the other python
scripts. <cite>make check</cite> will run all checks.</p>
<hr class="docutils" />
</section>
<section id="colvars-tools">
<span id="id1"></span><h3><span class="section-number">10.4.6. </span>colvars tools<a class="headerlink" href="#colvars-tools" title="Link to this heading"></a></h3>
<p>The colvars directory contains a collection of tools for post-processing
data produced by the colvars collective variable library.
To compile the tools, edit the makefile for your system and run “make”.</p>
<p>Please report problems and issues the colvars library and its tools
at: <a class="reference external" href="https://github.com/colvars/colvars/issues">https://github.com/colvars/colvars/issues</a></p>
<p>abf_integrate:</p>
<p>MC-based integration of multidimensional free energy gradient
Version 20110511</p>
<pre class="literal-block">./abf_integrate &lt; filename &gt; [-n &lt; nsteps &gt;] [-t &lt; temp &gt;] [-m [0|1] (metadynamics)] [-h &lt; hill_height &gt;] [-f &lt; variable_hill_factor &gt;]</pre>
<p>The LAMMPS interface to the colvars collective variable library, as
well as these tools, were created by Axel Kohlmeyer (akohlmey at
gmail.com) while at ICTP, Italy.</p>
<hr class="docutils" />
</section>
<section id="createatoms-tool">
<span id="createatoms"></span><h3><span class="section-number">10.4.7. </span>createatoms tool<a class="headerlink" href="#createatoms-tool" title="Link to this heading"></a></h3>
<p>The tools/createatoms directory contains a Fortran program called
createAtoms.f which can generate a variety of interesting crystal
structures and geometries and output the resulting list of atom
coordinates in LAMMPS or other formats.</p>
<p>See the included Manual.pdf for details.</p>
<p>The tool is authored by Xiaowang Zhou (Sandia), xzhou at sandia.gov.</p>
<hr class="docutils" />
</section>
<section id="drude-tool">
<span id="drude"></span><h3><span class="section-number">10.4.8. </span>drude tool<a class="headerlink" href="#drude-tool" title="Link to this heading"></a></h3>
<p>The tools/drude directory contains a Python script called
polarizer.py which can add Drude oscillators to a LAMMPS
data file in the required format.</p>
<p>See the header of the polarizer.py file for details.</p>
<p>The tool is authored by Agilio Padua and Alain Dequidt: agilio.padua
at ens-lyon.fr, alain.dequidt at uca.fr</p>
<hr class="docutils" />
</section>
<section id="eam-database-tool">
<span id="eamdb"></span><h3><span class="section-number">10.4.9. </span>eam database tool<a class="headerlink" href="#eam-database-tool" title="Link to this heading"></a></h3>
<p>The tools/eam_database directory contains a Fortran and a Python program
that will generate EAM alloy setfl potential files for any combination
of the 17 elements: Cu, Ag, Au, Ni, Pd, Pt, Al, Pb, Fe, Mo, Ta, W, Mg,
Co, Ti, Zr, Cr. The files can then be used with the <a class="reference internal" href="pair_eam.html"><span class="doc">pair_style
eam/alloy</span></a> command.</p>
<p>The Fortran version of the tool was authored by Xiaowang Zhou (Sandia),
xzhou at sandia.gov, with updates from Lucas Hale (NIST) lucas.hale at
nist.gov and is based on his paper:</p>
<p>X. W. Zhou, R. A. Johnson, and H. N. G. Wadley, Phys. Rev. B, 69,
144113 (2004).</p>
<p>The parameters for Cr were taken from:</p>
<p>Lin Z B, Johnson R A and Zhigilei L V, Phys. Rev. B 77 214108 (2008).</p>
<p>The Python version of the tool was authored by Germain Clavier
(Unicaen) germain.clavier at unicaen.fr</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The parameters in the database are only optimized for individual
elements. The mixed parameters for interactions between different
elements generated by this tool are derived from simple mixing rules
and are thus inferior to parameterizations that are specifically
optimized for specific mixtures and combinations of elements.</p>
</div>
<hr class="docutils" />
</section>
<section id="eam-generate-tool">
<span id="eamgn"></span><h3><span class="section-number">10.4.10. </span>eam generate tool<a class="headerlink" href="#eam-generate-tool" title="Link to this heading"></a></h3>
<p>The tools/eam_generate directory contains several one-file C programs
that convert an analytic formula into a tabulated <a class="reference internal" href="pair_eam.html"><span class="doc">embedded atom
method (EAM)</span></a> setfl potential file. The potentials they
produce are in the potentials directory, and can be used with the
<a class="reference internal" href="pair_eam.html"><span class="doc">pair_style eam/alloy</span></a> command.</p>
<p>The source files and potentials were provided by Gerolf Ziegenhain
(gerolf at ziegenhain.com).</p>
<hr class="docutils" />
</section>
<section id="eff-tool">
<span id="eff"></span><h3><span class="section-number">10.4.11. </span>eff tool<a class="headerlink" href="#eff-tool" title="Link to this heading"></a></h3>
<p>The tools/eff directory contains various scripts for generating
structures and post-processing output for simulations using the
electron force field (eFF).</p>
<p>These tools were provided by Andres Jaramillo-Botero at CalTech
(ajaramil at wag.caltech.edu).</p>
<hr class="docutils" />
</section>
<section id="emacs-tool">
<span id="emacs"></span><h3><span class="section-number">10.4.12. </span>emacs tool<a class="headerlink" href="#emacs-tool" title="Link to this heading"></a></h3>
<p>The tools/emacs directory contains an Emacs Lisp add-on file for GNU Emacs
that enables a lammps-mode for editing input scripts when using GNU Emacs,
with various highlighting options set up.</p>
<p>These tools were provided by Aidan Thompson at Sandia
(athomps at sandia.gov).</p>
<hr class="docutils" />
</section>
<section id="fep-tool">
<span id="fep"></span><h3><span class="section-number">10.4.13. </span>fep tool<a class="headerlink" href="#fep-tool" title="Link to this heading"></a></h3>
<p>The tools/fep directory contains Python scripts useful for
post-processing results from performing free-energy perturbation
simulations using the FEP package.</p>
<p>The scripts were contributed by Agilio Padua (ENS de Lyon), agilio.padua at ens-lyon.fr.</p>
<p>See README file in the tools/fep directory.</p>
<hr class="docutils" />
</section>
<section id="i-pi-tool">
<span id="ipi"></span><h3><span class="section-number">10.4.14. </span>i-PI tool<a class="headerlink" href="#i-pi-tool" title="Link to this heading"></a></h3>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 27June2024.</span></p>
</div>
<p>The tools/i-pi directory used to contain a bundled version of the i-PI
software package for use with LAMMPS. This version, however, was
removed in 06/2024.</p>
<p>The i-PI package was created and is maintained by Michele Ceriotti,
michele.ceriotti at gmail.com, to interface to a variety of molecular
dynamics codes.</p>
<p>i-PI is now available via PyPI using the pip package manager at:
<a class="reference external" href="https://pypi.org/project/ipi/">https://pypi.org/project/ipi/</a></p>
<p>Here are the commands to set up a virtual environment and install
i-PI into it with all its dependencies.</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>venv<span class="w"> </span>ipienv
<span class="nb">source</span><span class="w"> </span>ipienv/bin/activate
pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>pip
pip<span class="w"> </span>install<span class="w"> </span>ipi
</pre></div>
</div>
<p>To install the development version from GitHub, please use:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>git+https://github.com/i-pi/i-pi.git
</pre></div>
</div>
<p>For further information, please consult the [i-PI home
page](<a class="reference external" href="https://ipi-code.org">https://ipi-code.org</a>).</p>
<hr class="docutils" />
</section>
<section id="ipp-tool">
<span id="ipp"></span><h3><span class="section-number">10.4.15. </span>ipp tool<a class="headerlink" href="#ipp-tool" title="Link to this heading"></a></h3>
<p>The tools/ipp directory contains a Perl script ipp which can be used
to facilitate the creation of a complicated file (say, a LAMMPS input
script or tools/createatoms input file) using a template file.</p>
<p>ipp was created and is maintained by Reese Jones (Sandia), rjones at
sandia.gov.</p>
<p>See two examples in the tools/ipp directory. One of them is for the
tools/createatoms tools input file.</p>
<hr class="docutils" />
</section>
<section id="kate-tool">
<span id="kate"></span><h3><span class="section-number">10.4.16. </span>kate tool<a class="headerlink" href="#kate-tool" title="Link to this heading"></a></h3>
<p>The file in the tools/kate directory is an add-on to the Kate editor
in the KDE suite that allow syntax highlighting of LAMMPS input
scripts. See the README.txt file for details.</p>
<p>The file was provided by Alessandro Luigi Sellerio
(alessandro.sellerio at ieni.cnr.it).</p>
<hr class="docutils" />
</section>
<section id="lammps-gui">
<span id="id2"></span><h3><span class="section-number">10.4.17. </span>LAMMPS-GUI<a class="headerlink" href="#lammps-gui" title="Link to this heading"></a></h3>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 2Aug2023.</span></p>
</div>
<section id="overview">
<h4>Overview<a class="headerlink" href="#overview" title="Link to this heading"></a></h4>
<p>LAMMPS-GUI is a graphical text editor customized for editing LAMMPS
input files that is linked to the <a class="reference internal" href="Library.html#lammps-c-api"><span class="std std-ref">LAMMPS C-library</span></a>
and thus can run LAMMPS directly using the contents of the editors text
buffer as input. It can retrieve and display information from LAMMPS
while it is running, display visualizations created with the <a class="reference internal" href="dump_image.html"><span class="doc">dump
image command</span></a>, and is adapted specifically for editing
LAMMPS input files through syntax highlighting, text completion, and
reformatting, and linking to the online LAMMPS documentation for known
LAMMPS commands and styles.</p>
<p>This is similar to what people traditionally would do to run LAMMPS but
all rolled into a single application: that is, using a text editor,
plotting program, and a visualization program to edit the input, run
LAMMPS, process the output into graphs and visualizations from a command
line window. This similarity is a design goal. While making it easy for
beginners to start with LAMMPS, it is also the expectation that
LAMMPS-GUI users will eventually transition to workflows that most
experienced LAMMPS users employ.</p>
<p>All features have been extensively exposed to keyboard shortcuts, so
that there is also appeal for experienced LAMMPS users for prototyping
and testing simulation setups.</p>
</section>
<section id="features">
<h4>Features<a class="headerlink" href="#features" title="Link to this heading"></a></h4>
<p>A detailed discussion and explanation of all features and functionality
are in the <a class="reference internal" href="Howto_lammps_gui.html"><span class="doc">Using LAMMPS-GUI</span></a> tutorial Howto page.</p>
<p>Here are a few highlights of LAMMPS-GUI</p>
<ul class="simple">
<li><p>Text editor with line numbers and syntax highlighting customized for LAMMPS</p></li>
<li><p>Text editor features command completion and auto-indentation for known commands and styles</p></li>
<li><p>Text editor will switch its working directory to folder of file in buffer</p></li>
<li><p>Many adjustable settings and preferences that are persistent including the 5 most recent files</p></li>
<li><p>Context specific LAMMPS command help via online documentation</p></li>
<li><p>LAMMPS is running in a concurrent thread, so the GUI remains responsive</p></li>
<li><p>Progress bar indicates how far a run command is completed</p></li>
<li><p>LAMMPS can be started and stopped with a mouse click or a hotkey</p></li>
<li><p>Screen output is captured in an <em>Output</em> Window</p></li>
<li><p>Thermodynamic output is captured and displayed as line graph in a <em>Chart</em> Window</p></li>
<li><p>Indicator for currently executed command</p></li>
<li><p>Indicator for line that caused an error</p></li>
<li><p>Visualization of current state in Image Viewer (via calling <a class="reference internal" href="dump_image.html"><span class="doc">write_dump image</span></a>)</p></li>
<li><p>Capture of images created via <a class="reference internal" href="dump_image.html"><span class="doc">dump image</span></a> in Slide show window</p></li>
<li><p>Dialog to set variables, similar to the LAMMPS command-line flag -v / -var</p></li>
<li><p>Support for GPU, INTEL, KOKKOS/OpenMP, OPENMAP, and OPT and accelerator packages</p></li>
</ul>
</section>
<section id="parallelization">
<h4>Parallelization<a class="headerlink" href="#parallelization" title="Link to this heading"></a></h4>
<p>Due to its nature as a graphical application, it is not possible to use
the LAMMPS-GUI in parallel with MPI, but OpenMP multi-threading and GPU
acceleration is available and enabled by default.</p>
</section>
<section id="prerequisites-and-portability">
<h4>Prerequisites and portability<a class="headerlink" href="#prerequisites-and-portability" title="Link to this heading"></a></h4>
<p>LAMMPS-GUI is programmed in C++ based on the C++11 standard and using
the <a class="reference external" href="https://www.qt.io/product/framework">Qt GUI framework</a>.
Currently, Qt version 5.12 or later is required; Qt 5.15LTS is
recommended; support for Qt version 6.x is available. Building LAMMPS
with CMake is required.</p>
<p>The LAMMPS-GUI has been successfully compiled and tested on:</p>
<ul class="simple">
<li><p>Ubuntu Linux 20.04LTS x86_64 using GCC 9, Qt version 5.12</p></li>
<li><p>Fedora Linux 40 x86_64 using GCC 14 and Clang 17, Qt version 5.15LTS</p></li>
<li><p>Fedora Linux 40 x86_64 using GCC 14, Qt version 6.7</p></li>
<li><p>Apple macOS 12 (Monterey) and macOS 13 (Ventura) with Xcode on arm64 and x86_64, Qt version 5.15LTS</p></li>
<li><p>Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.36, Qt version 5.15LTS</p></li>
<li><p>Windows 10 and 11 x86_64 with Visual Studio 2022 and Visual C++ 14.40, Qt version 6.7</p></li>
<li><p>Windows 10 and 11 x86_64 with MinGW / GCC 10.0 cross-compiler on Fedora 38, Qt version 5.15LTS</p></li>
</ul>
</section>
<section id="pre-compiled-executables">
<span id="lammps-gui-install"></span><h4>Pre-compiled executables<a class="headerlink" href="#pre-compiled-executables" title="Link to this heading"></a></h4>
<p>Pre-compiled LAMMPS executable packages that include the GUI are
currently available from <a class="reference external" href="https://download.lammps.org/static">https://download.lammps.org/static</a> or
<a class="reference external" href="https://github.com/lammps/lammps/releases">https://github.com/lammps/lammps/releases</a>. For Windows, you need to
download and then run the application installer. For macOS you download
and mount the disk image and then drag the application bundle to the
Applications folder. For Linux (x86_64) you currently have two
options: 1) you can download the tar.gz archive, unpack it and run the
GUI directly in place. The <code class="docutils literal notranslate"><span class="pre">LAMMPS_GUI</span></code> folder may also be moved
around and added to the <code class="docutils literal notranslate"><span class="pre">PATH</span></code> environment variable so the executables
will be found automatically. 2) you can download the <a class="reference external" href="https://www.flatpak.org/">Flatpak file</a> and then install it locally with the
<em>flatpak</em> command: <code class="docutils literal notranslate"><span class="pre">flatpak</span> <span class="pre">install</span> <span class="pre">--user</span>
<span class="pre">LAMMPS-Linux-x86_64-GUI-&lt;version&gt;.flatpak</span></code> and run it with <code class="docutils literal notranslate"><span class="pre">flatpak</span>
<span class="pre">run</span> <span class="pre">org.lammps.lammps-gui</span></code>. The flatpak bundle also includes the
command-line version of LAMMPS and some LAMMPS tools like msi2lmp. The
can be launched by using the <code class="docutils literal notranslate"><span class="pre">--command</span></code> flag. For example to run
LAMMPS directly on the <code class="docutils literal notranslate"><span class="pre">in.lj</span></code> benchmark input you would type in the
<code class="docutils literal notranslate"><span class="pre">bench</span></code> folder: <code class="docutils literal notranslate"><span class="pre">flatpak</span> <span class="pre">run</span> <span class="pre">--command=lmp</span> <span class="pre">-in</span> <span class="pre">in.lj</span></code> The flatpak
version should also appear in the applications menu of standard desktop
environments. The LAMMPS-GUI executable is called <code class="docutils literal notranslate"><span class="pre">lammps-gui</span></code> and
either takes no arguments or attempts to load the first argument as
LAMMPS input file.</p>
</section>
<section id="compilation">
<span id="lammps-gui-compilation"></span><h4>Compilation<a class="headerlink" href="#compilation" title="Link to this heading"></a></h4>
<p>The source for the LAMMPS-GUI is included with the LAMMPS source code
distribution in the folder <code class="docutils literal notranslate"><span class="pre">tools/lammps-gui</span></code> and thus it can be can
be built as part of a regular LAMMPS compilation. <a class="reference internal" href="Howto_cmake.html"><span class="doc">Using CMake</span></a> is required. To enable its compilation, the CMake
variable <code class="docutils literal notranslate"><span class="pre">-D</span> <span class="pre">BUILD_LAMMPS_GUI=on</span></code> must be set when creating the CMake
configuration. All other settings (compiler, flags, compile type) for
LAMMPS-GUI are then inherited from the regular LAMMPS build. If the Qt
library is packaged for Linux distributions, then its location is
typically auto-detected since the required CMake configuration files are
stored in a location where CMake can find them without additional help.
Otherwise, the location of the Qt library installation must be indicated
by setting <code class="docutils literal notranslate"><span class="pre">-D</span> <span class="pre">Qt5_DIR=/path/to/qt5/lib/cmake/Qt5</span></code>, which is a path to
a folder inside the Qt installation that contains the file
<code class="docutils literal notranslate"><span class="pre">Qt5Config.cmake</span></code>. Similarly, for Qt6 the location of the Qt library
installation can be indicated by setting <code class="docutils literal notranslate"><span class="pre">-D</span>
<span class="pre">Qt6_DIR=/path/to/qt6/lib/cmake/Qt6</span></code>, if necessary. When both, Qt5 and
Qt6 are available, Qt6 will be preferred unless <code class="docutils literal notranslate"><span class="pre">-D</span>
<span class="pre">LAMMPS_GUI_USE_QT5=yes</span></code> is set.</p>
<p>It is possible to build the LAMMPS-GUI as a standalone compilation
(e.g. when LAMMPS has been compiled with traditional make). Then the
CMake configuration needs to be told where to find the LAMMPS headers
and the LAMMPS library, via <code class="docutils literal notranslate"><span class="pre">-D</span> <span class="pre">LAMMPS_SOURCE_DIR=/path/to/lammps/src</span></code>.
CMake will try to guess a build folder with the LAMMPS library from that
path, but it can also be set with <code class="docutils literal notranslate"><span class="pre">-D</span> <span class="pre">LAMMPS_LIB_DIR=/path/to/lammps/lib</span></code>.</p>
<section id="plugin-version">
<h5>Plugin version<a class="headerlink" href="#plugin-version" title="Link to this heading"></a></h5>
<p>Rather than linking to the LAMMPS library during compilation, it is also
possible to compile the GUI with a plugin loader that will load the
LAMMPS library dynamically at runtime during the start of the GUI from a
shared library; e.g. <code class="docutils literal notranslate"><span class="pre">liblammps.so</span></code> or <code class="docutils literal notranslate"><span class="pre">liblammps.dylib</span></code> or
<code class="docutils literal notranslate"><span class="pre">liblammps.dll</span></code> (depending on the operating system). This has the
advantage that the LAMMPS library can be built from updated or modified
LAMMPS source without having to recompile the GUI. The ABI of the
LAMMPS C-library interface is very stable and generally backward
compatible. This feature is enabled by setting <code class="docutils literal notranslate"><span class="pre">-D</span>
<span class="pre">LAMMPS_GUI_USE_PLUGIN=on</span></code> and then <code class="docutils literal notranslate"><span class="pre">-D</span>
<span class="pre">LAMMPS_PLUGINLIB_DIR=/path/to/lammps/plugin/loader</span></code>. Typically, this
would be the <code class="docutils literal notranslate"><span class="pre">examples/COUPLE/plugin</span></code> folder of the LAMMPS
distribution.</p>
<p>When compiling LAMMPS-GUI with plugin support, there is an additional
command-line flag (<code class="docutils literal notranslate"><span class="pre">-p</span> <span class="pre">&lt;path&gt;</span></code> or <code class="docutils literal notranslate"><span class="pre">--pluginpath</span> <span class="pre">&lt;path&gt;</span></code>) which
allows to override the path to LAMMPS shared library used by the GUI.
This is usually auto-detected on the first run and can be changed in the
LAMMPS-GUI <em>Preferences</em> dialog. The command-line flag allows to reset
this path to a valid value in case the original setting has become
invalid. An empty path (“”) as argument restores the default setting.</p>
</section>
</section>
<section id="platform-notes">
<h4>Platform notes<a class="headerlink" href="#platform-notes" title="Link to this heading"></a></h4>
<section id="macos">
<h5>macOS<a class="headerlink" href="#macos" title="Link to this heading"></a></h5>
<p>When building on macOS, the build procedure will try to manufacture a
drag-n-drop installer, <code class="docutils literal notranslate"><span class="pre">LAMMPS-macOS-multiarch.dmg</span></code>, when using the
dmg target (i.e. <code class="docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">--build</span> <span class="pre">&lt;build</span> <span class="pre">dir&gt;</span> <span class="pre">--target</span> <span class="pre">dmg</span></code> or <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">dmg</span></code>.</p>
<p>To build multi-arch executables that will run on both, arm64 and x86_64
architectures natively, it is necessary to set the CMake variable <code class="docutils literal notranslate"><span class="pre">-D</span>
<span class="pre">CMAKE_OSX_ARCHITECTURES=arm64;x86_64</span></code>. To achieve wide compatibility
with different macOS versions, you can also set <code class="docutils literal notranslate"><span class="pre">-D</span>
<span class="pre">CMAKE_OSX_DEPLOYMENT_TARGET=11.0</span></code> which will set compatibility to macOS
11 (Big Sur) and later, even if you are compiling on a more recent macOS
version.</p>
</section>
<section id="windows">
<h5>Windows<a class="headerlink" href="#windows" title="Link to this heading"></a></h5>
<p>On Windows either native compilation from within Visual Studio 2022 with
Visual C++ is supported and tested, or compilation with the MinGW / GCC
cross-compiler environment on Fedora Linux.</p>
<p><strong>Visual Studio</strong></p>
<p>Using CMake and Ninja as build system are required. Qt needs to be
installed, tested was a binary package downloaded from
<a class="reference external" href="https://www.qt.io">https://www.qt.io</a>, which installs into the <code class="docutils literal notranslate"><span class="pre">C:\\Qt</span></code> folder by default.
There is a custom <cite>x64-GUI-MSVC</cite> build configuration provided in the
<code class="docutils literal notranslate"><span class="pre">CMakeSettings.json</span></code> file that Visual Studio uses to store different
compilation settings for project. Choosing this configuration will
activate building the <cite>lammps-gui.exe</cite> executable in addition to LAMMPS
through importing package selection from the <code class="docutils literal notranslate"><span class="pre">windows.cmake</span></code> preset
file and enabling building the LAMMPS-GUI and disabling building with MPI.
When requesting an installation from the <cite>Build</cite> menu in Visual Studio,
it will create a compressed <code class="docutils literal notranslate"><span class="pre">LAMMPS-Win10-amd64.zip</span></code> zip file with the
executables and required dependent .dll files. This zip file can be
uncompressed and <code class="docutils literal notranslate"><span class="pre">lammps-gui.exe</span></code> run directly from there. The
uncompressed folder can be added to the <code class="docutils literal notranslate"><span class="pre">PATH</span></code> environment and LAMMPS
and LAMMPS-GUI can be launched from anywhere from the command-line.</p>
<p><strong>MinGW64 Cross-compiler</strong></p>
<p>The standard CMake build procedure can be applied and the
<code class="docutils literal notranslate"><span class="pre">mingw-cross.cmake</span></code> preset used. By using <code class="docutils literal notranslate"><span class="pre">mingw64-cmake</span></code> the CMake
command will automatically include a suitable CMake toolchain file (the
regular cmake command can be used after that to modify the configuration
settings, if needed). After building the libraries and executables,
you can build the target zip (i.e. <code class="docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">--build</span> <span class="pre">&lt;build</span> <span class="pre">dir&gt;</span> <span class="pre">--target</span> <span class="pre">zip</span></code>
or <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">zip</span></code> to stage all installed files into a LAMMPS_GUI folder
and then run a script to copy all required dependencies, some other files,
and create a zip file from it.</p>
</section>
<section id="linux">
<h5>Linux<a class="headerlink" href="#linux" title="Link to this heading"></a></h5>
<p>Version 5.12 or later of the Qt library is required. Those are provided
by, e.g., Ubuntu 20.04LTS. Thus older Linux distributions are not
likely to be supported, while more recent ones will work, even for
pre-compiled executables (see above). After compiling with
<code class="docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">--build</span> <span class="pre">&lt;build</span> <span class="pre">folder&gt;</span></code>, use <code class="docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">--build</span> <span class="pre">&lt;build</span>
<span class="pre">folder&gt;</span> <span class="pre">--target</span> <span class="pre">tgz</span></code> or <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">tgz</span></code> to build a
<code class="docutils literal notranslate"><span class="pre">LAMMPS-Linux-amd64.tar.gz</span></code> file with the executables and their
support libraries.</p>
<p>It is also possible to build a <a class="reference external" href="https://docs.flatpak.org/en/latest/single-file-bundles.html">flatpak bundle</a> which is
a way to distribute applications in a way that is compatible with most
Linux distributions. Use the “flatpak” target to trigger a compile
(<code class="docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">--build</span> <span class="pre">&lt;build</span> <span class="pre">folder&gt;</span> <span class="pre">--target</span> <span class="pre">flatpak</span></code> or <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">flatpak</span></code>).
Please note that this will not build from the local sources but from the
repository and branch listed in the <code class="docutils literal notranslate"><span class="pre">org.lammps.lammps-gui.yml</span></code>
LAMMPS-GUI source folder.</p>
<hr class="docutils" />
</section>
</section>
</section>
<section id="lmp2arc-tool">
<span id="arc"></span><h3><span class="section-number">10.4.18. </span>lmp2arc tool<a class="headerlink" href="#lmp2arc-tool" title="Link to this heading"></a></h3>
<p>The lmp2arc subdirectory contains a tool for converting LAMMPS output
files to the format for Accelrys Insight MD code (formerly
MSI/Biosym and its Discover MD code). See the README file for more
information.</p>
<p>This tool was written by John Carpenter (Cray), Michael Peachey
(Cray), and Steve Lustig (Dupont). John is now at the Mayo Clinic
(jec at mayo.edu), but still fields questions about the tool.</p>
<p>This tool was updated for the current LAMMPS C++ version by Jeff
Greathouse at Sandia (jagreat at sandia.gov).</p>
<hr class="docutils" />
</section>
<section id="lmp2cfg-tool">
<span id="cfg"></span><h3><span class="section-number">10.4.19. </span>lmp2cfg tool<a class="headerlink" href="#lmp2cfg-tool" title="Link to this heading"></a></h3>
<p>The lmp2cfg subdirectory contains a tool for converting LAMMPS output
files into a series of *.cfg files which can be read into the
<a class="reference external" href="http://li.mit.edu/Archive/Graphics/A/">AtomEye</a> visualizer. See
the README file for more information.</p>
<p>This tool was written by Ara Kooser at Sandia (askoose at sandia.gov).</p>
<hr class="docutils" />
</section>
<section id="magic-patterns-for-the-file-command">
<span id="magic"></span><h3><span class="section-number">10.4.20. </span>Magic patterns for the “file” command<a class="headerlink" href="#magic-patterns-for-the-file-command" title="Link to this heading"></a></h3>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 10Mar2021.</span></p>
</div>
<p>The file <code class="docutils literal notranslate"><span class="pre">magic</span></code> contains patterns that are used by the
<a class="reference external" href="https://en.wikipedia.org/wiki/File_(command)">file program</a>
available on most Unix-like operating systems which enables it
to detect various LAMMPS files and print some useful information
about them. To enable these patterns, append or copy the contents
of the file to either the file <code class="docutils literal notranslate"><span class="pre">.magic</span></code> in your home directory
or (as administrator) to <code class="docutils literal notranslate"><span class="pre">/etc/magic</span></code> (for a system-wide
installation). Afterwards the <code class="docutils literal notranslate"><span class="pre">file</span></code> command should be able to
detect most LAMMPS restarts, dump, data and log files. Examples:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>file<span class="w"> </span>*.*
<span class="go">dihedral-quadratic.restart: LAMMPS binary restart file (rev 2), Version 10 Mar 2021, Little Endian</span>
<span class="go">mol-pair-wf_cut.restart: LAMMPS binary restart file (rev 2), Version 24 Dec 2020, Little Endian</span>
<span class="go">atom.bin: LAMMPS atom style binary dump (rev 2), Little Endian, First time step: 445570</span>
<span class="go">custom.bin: LAMMPS custom style binary dump (rev 2), Little Endian, First time step: 100</span>
<span class="go">bn1.lammpstrj: LAMMPS text mode dump, First time step: 5000</span>
<span class="go">data.fourmol: LAMMPS data file written by LAMMPS</span>
<span class="go">pnc.data: LAMMPS data file written by msi2lmp</span>
<span class="go">data.spce: LAMMPS data file written by TopoTools</span>
<span class="go">B.data: LAMMPS data file written by OVITO</span>
<span class="go">log.lammps: LAMMPS log file written by version 10 Feb 2021</span>
</pre></div>
</div>
<hr class="docutils" />
</section>
<section id="matlab-tool">
<span id="matlab"></span><h3><span class="section-number">10.4.21. </span>matlab tool<a class="headerlink" href="#matlab-tool" title="Link to this heading"></a></h3>
<p>The matlab subdirectory contains several <a class="reference external" href="https://www.mathworks.com">MATLAB</a> scripts for
post-processing LAMMPS output. The scripts include readers for log
and dump files, a reader for EAM potential files, and a converter that
reads LAMMPS dump files and produces CFG files that can be visualized
with the <a class="reference external" href="http://li.mit.edu/Archive/Graphics/A/">AtomEye</a>
visualizer.</p>
<p>See the README.pdf file for more information.</p>
<p>These scripts were written by Arun Subramaniyan at Purdue Univ
(asubrama at purdue.edu).</p>
<hr class="docutils" />
</section>
<section id="micelle2d-tool">
<span id="micelle"></span><h3><span class="section-number">10.4.22. </span>micelle2d tool<a class="headerlink" href="#micelle2d-tool" title="Link to this heading"></a></h3>
<p>The file micelle2d.f creates a LAMMPS data file containing short lipid
chains in a monomer solution. It uses a text file containing lipid
definition parameters as an input. The created molecules and solvent
atoms can strongly overlap, so LAMMPS needs to run the system
initially with a “soft” pair potential to un-overlap it. The syntax
for running the tool is</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>micelle2d<span class="w"> </span>&lt;<span class="w"> </span>def.micelle2d<span class="w"> </span>&gt;<span class="w"> </span>data.file
</pre></div>
</div>
<p>See the def.micelle2d file in the tools directory for an example of a
definition file. This tool was used to create the system for the
<a class="reference internal" href="Examples.html"><span class="doc">micelle example</span></a>.</p>
<hr class="docutils" />
</section>
<section id="moltemplate-tool">
<span id="moltemplate"></span><h3><span class="section-number">10.4.23. </span>moltemplate tool<a class="headerlink" href="#moltemplate-tool" title="Link to this heading"></a></h3>
<p>The moltemplate subdirectory contains instructions for installing
moltemplate, a Python-based tool for building molecular systems based
on a text-file description, and creating LAMMPS data files that encode
their molecular topology as lists of bonds, angles, dihedrals, etc.
See the README.txt file for more information.</p>
<p>This tool was written by Andrew Jewett (jewett.aij at gmail.com), who
supports it. It has its own WWW page at
<a class="reference external" href="https://moltemplate.org">https://moltemplate.org</a>.
The latest sources can be found <a class="reference external" href="https://github.com/jewettaij/moltemplate/releases">on its GitHub page</a></p>
<hr class="docutils" />
</section>
<section id="msi2lmp-tool">
<span id="msi"></span><h3><span class="section-number">10.4.24. </span>msi2lmp tool<a class="headerlink" href="#msi2lmp-tool" title="Link to this heading"></a></h3>
<p>The msi2lmp subdirectory contains a tool for creating LAMMPS template
input and data files from BIOVIAs Materias Studio files (formerly
Accelrys Insight MD code, formerly MSI/Biosym and its Discover MD code).</p>
<p>This tool was written by John Carpenter (Cray), Michael Peachey
(Cray), and Steve Lustig (Dupont). Several people contributed changes
to remove bugs and adapt its output to changes in LAMMPS.</p>
<p>This tool has several known limitations and is no longer under active
development, so there are no changes except for the occasional bug fix.</p>
<p>See the README file in the tools/msi2lmp folder for more information.</p>
<hr class="docutils" />
</section>
<section id="scripts-for-building-lammps-when-offline">
<span id="offline"></span><h3><span class="section-number">10.4.25. </span>Scripts for building LAMMPS when offline<a class="headerlink" href="#scripts-for-building-lammps-when-offline" title="Link to this heading"></a></h3>
<p>In some situations it might be necessary to build LAMMPS on a system
without direct internet access. The scripts in <code class="docutils literal notranslate"><span class="pre">tools/offline</span></code> folder
allow you to pre-load external dependencies for both the documentation
build and for building LAMMPS with CMake.</p>
<p>It does so by</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>downloading necessary <code class="docutils literal notranslate"><span class="pre">pip</span></code> packages,</p></li>
<li><p>cloning <code class="docutils literal notranslate"><span class="pre">git</span></code> repositories</p></li>
<li><p>downloading tarballs</p></li>
</ol>
</div></blockquote>
<p>to a designated cache folder.</p>
<p>As of April 2021, all of these downloads make up around 600MB. By
default, the offline scripts will download everything into the
<code class="docutils literal notranslate"><span class="pre">$HOME/.cache/lammps</span></code> folder, but this can be changed by setting the
<code class="docutils literal notranslate"><span class="pre">LAMMPS_CACHING_DIR</span></code> environment variable.</p>
<p>Once the caches have been initialized, they can be used for building the
LAMMPS documentation or compiling LAMMPS using CMake on an offline
system.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">use_caches.sh</span></code> script must be sourced into the current shell
to initialize the offline build environment. Note that it must use
the same <code class="docutils literal notranslate"><span class="pre">LAMMPS_CACHING_DIR</span></code>. This script does the following:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Set up environment variables that modify the behavior of both,
<code class="docutils literal notranslate"><span class="pre">pip</span></code> and <code class="docutils literal notranslate"><span class="pre">git</span></code></p></li>
<li><p>Start a simple local HTTP server using Python to host files for CMake</p></li>
</ol>
</div></blockquote>
<p>Afterwards, it will print out instruction on how to modify the CMake
commands to make sure it uses the local HTTP server.</p>
<p>To undo the environment changes and shutdown the local HTTP server,
run the <code class="docutils literal notranslate"><span class="pre">deactivate_caches</span></code> command.</p>
<section id="examples">
<h4>Examples<a class="headerlink" href="#examples" title="Link to this heading"></a></h4>
<p>For all of the examples below, you first need to create the cache, which
requires an internet connection.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./tools/offline/init_caches.sh
</pre></div>
</div>
<p>Afterwards, you can disconnect or copy the contents of the
<code class="docutils literal notranslate"><span class="pre">LAMMPS_CACHING_DIR</span></code> folder to an offline system.</p>
</section>
<section id="documentation-build">
<h4>Documentation Build<a class="headerlink" href="#documentation-build" title="Link to this heading"></a></h4>
<p>The documentation build will create a new virtual environment that
typically first installs dependencies from <code class="docutils literal notranslate"><span class="pre">pip</span></code>. With the offline
environment loaded, these installations will instead grab the necessary
packages from your local cache.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># if LAMMPS_CACHING_DIR is different from default, make sure to set it first</span>
<span class="c1"># export LAMMPS_CACHING_DIR=path/to/folder</span>
<span class="nb">source</span><span class="w"> </span>tools/offline/use_caches.sh
<span class="nb">cd</span><span class="w"> </span>doc/
make<span class="w"> </span>html
deactivate_caches
</pre></div>
</div>
</section>
<section id="cmake-build">
<h4>CMake Build<a class="headerlink" href="#cmake-build" title="Link to this heading"></a></h4>
<p>When compiling certain packages with external dependencies, the CMake
build system will download necessary files or sources from the web. For
more flexibility the CMake configuration allows users to specify the URL
of each of these dependencies. What the <code class="docutils literal notranslate"><span class="pre">init_caches.sh</span></code> script does
is create a CMake “preset” file, which sets the URLs for all of the known
dependencies and redirects the download to the local cache.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># if LAMMPS_CACHING_DIR is different from default, make sure to set it first</span>
<span class="c1"># export LAMMPS_CACHING_DIR=path/to/folder</span>
<span class="nb">source</span><span class="w"> </span>tools/offline/use_caches.sh
mkdir<span class="w"> </span>build
<span class="nb">cd</span><span class="w"> </span>build
cmake<span class="w"> </span>-D<span class="w"> </span><span class="nv">LAMMPS_DOWNLOADS_URL</span><span class="o">=</span><span class="si">${</span><span class="nv">HTTP_CACHE_URL</span><span class="si">}</span><span class="w"> </span>-C<span class="w"> </span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">LAMMPS_HTTP_CACHE_CONFIG</span><span class="si">}</span><span class="s2">&quot;</span><span class="w"> </span>-C<span class="w"> </span>../cmake/presets/most.cmake<span class="w"> </span>../cmake
make<span class="w"> </span>-j<span class="w"> </span><span class="m">8</span>
deactivate_caches
</pre></div>
</div>
<hr class="docutils" />
</section>
</section>
<section id="phonon-tool">
<span id="phonon"></span><h3><span class="section-number">10.4.26. </span>phonon tool<a class="headerlink" href="#phonon-tool" title="Link to this heading"></a></h3>
<p>The phonon subdirectory contains a post-processing tool, <em>phana</em>, useful
for analyzing the output of the <a class="reference internal" href="fix_phonon.html"><span class="doc">fix phonon</span></a> command
in the PHONON package.</p>
<p>See the README file for instruction on building the tool and what
library it needs. And see the examples/PACKAGES/phonon directory
for example problems that can be post-processed with this tool.</p>
<p>This tool was written by Ling-Ti Kong at Shanghai Jiao Tong
University.</p>
<hr class="docutils" />
</section>
<section id="polybond-tool">
<span id="polybond"></span><h3><span class="section-number">10.4.27. </span>polybond tool<a class="headerlink" href="#polybond-tool" title="Link to this heading"></a></h3>
<p>The polybond subdirectory contains a Python-based tool useful for
performing “programmable polymer bonding”. The Python file
lmpsdata.py provides a “Lmpsdata” class with various methods which can
be invoked by a user-written Python script to create data files with
complex bonding topologies.</p>
<p>See the Manual.pdf for details and example scripts.</p>
<p>This tool was written by Zachary Kraus at Georgia Tech.</p>
<hr class="docutils" />
</section>
<section id="pymol-asphere-tool">
<span id="pymol"></span><h3><span class="section-number">10.4.28. </span>pymol_asphere tool<a class="headerlink" href="#pymol-asphere-tool" title="Link to this heading"></a></h3>
<p>The pymol_asphere subdirectory contains a tool for converting a
LAMMPS dump file that contains orientation info for ellipsoidal
particles into an input file for the <a class="reference external" href="https://www.pymol.org">PyMol visualization package</a> or its <a class="reference external" href="https://github.com/schrodinger/pymol-open-source">open source variant</a>.</p>
<p>Specifically, the tool triangulates the ellipsoids so they can be
viewed as true ellipsoidal particles within PyMol. See the README and
examples directory within pymol_asphere for more information.</p>
<p>This tool was written by Mike Brown at Sandia.</p>
<hr class="docutils" />
</section>
<section id="python-tool">
<span id="pythontools"></span><h3><span class="section-number">10.4.29. </span>python tool<a class="headerlink" href="#python-tool" title="Link to this heading"></a></h3>
<p>The python subdirectory contains several Python scripts
that perform common LAMMPS post-processing tasks, such as:</p>
<ul class="simple">
<li><p>extract thermodynamic info from a log file as columns of numbers</p></li>
<li><p>plot two columns of thermodynamic info from a log file using GnuPlot</p></li>
<li><p>sort the snapshots in a dump file by atom ID</p></li>
<li><p>convert multiple <a class="reference internal" href="neb.html"><span class="doc">NEB</span></a> dump files into one dump file for viz</p></li>
<li><p>convert dump files into XYZ, CFG, or PDB format for viz by other packages</p></li>
</ul>
<p>These are simple scripts built on <a class="reference external" href="https://lammps.github.io/pizza">Pizza.py</a> modules. See the
README for more info on Pizza.py and how to use these scripts.</p>
<hr class="docutils" />
</section>
<section id="regression-tester-tool">
<span id="regression"></span><h3><span class="section-number">10.4.30. </span>Regression tester tool<a class="headerlink" href="#regression-tester-tool" title="Link to this heading"></a></h3>
<p>The regression-tests subdirectory contains a tool for performing
regression tests with a given LAMMPS binary. The tool launches the
LAMMPS binary with any given input script under one of the <cite>examples</cite>
subdirectories, and compares the thermo output in the generated log file
with those in the provided log file with the same number of processors
in the same subdirectory. If the differences between the actual and
reference values are within specified tolerances, the test is considered
passed. For each test batch, that is, a set of example input scripts,
the mpirun command, the LAMMPS command-line arguments, and the
tolerances for individual thermo quantities can be specified in a
configuration file in YAML format.</p>
<p>The tool also reports if and how the run fails, and if a reference log file
is missing. See the README file for more information.</p>
<p>This tool was written by Trung Nguyen at U of Chicago (ndactrung at gmail.com).</p>
<hr class="docutils" />
</section>
<section id="replica-tool">
<span id="replica"></span><h3><span class="section-number">10.4.31. </span>replica tool<a class="headerlink" href="#replica-tool" title="Link to this heading"></a></h3>
<p>The tools/replica directory contains the reorder_remd_traj python script which
can be used to reorder the replica trajectories (resulting from the use of the
temper command) according to temperature. This will produce discontinuous
trajectories with all frames at the same temperature in each trajectory.
Additional options can be used to calculate the canonical configurational
log-weight for each frame at each temperature using the pymbar package. See
the README.md file for further details. Try out the peptide example provided.</p>
<p>This tool was written by (and is maintained by) Tanmoy Sanyal,
while at the Shell lab at UC Santa Barbara. (tanmoy dot 7989 at gmail.com)</p>
<hr class="docutils" />
</section>
<section id="smd-tool">
<span id="smd"></span><h3><span class="section-number">10.4.32. </span>smd tool<a class="headerlink" href="#smd-tool" title="Link to this heading"></a></h3>
<p>The smd subdirectory contains a C++ file dump2vtk_tris.cpp and
Makefile which can be compiled and used to convert triangle output
files created by the Smooth-Mach Dynamics (MACHDYN) package into a
VTK-compatible unstructured grid file. It could then be read in and
visualized by VTK.</p>
<p>See the header of dump2vtk.cpp for more details.</p>
<p>This tool was written by the MACHDYN package author, Georg
Ganzenmuller at the Fraunhofer-Institute for High-Speed Dynamics,
Ernst Mach Institute in Germany (georg.ganzenmueller at emi.fhg.de).</p>
<hr class="docutils" />
</section>
<section id="spin-tool">
<span id="spin"></span><h3><span class="section-number">10.4.33. </span>spin tool<a class="headerlink" href="#spin-tool" title="Link to this heading"></a></h3>
<p>The spin subdirectory contains a C file interpolate.c which can
be compiled and used to perform a cubic polynomial interpolation of
the MEP following a GNEB calculation.</p>
<p>See the README file in tools/spin/interpolate_gneb for more details.</p>
<p>This tool was written by the SPIN package author, Julien
Tranchida at Sandia National Labs (jtranch at sandia.gov, and by Aleksei
Ivanov, at University of Iceland (ali5 at hi.is).</p>
<hr class="docutils" />
</section>
<section id="singularity-apptainer-tool">
<span id="singularity-tool"></span><h3><span class="section-number">10.4.34. </span>singularity/apptainer tool<a class="headerlink" href="#singularity-apptainer-tool" title="Link to this heading"></a></h3>
<p>The singularity subdirectory contains container definitions files that
can be used to build container images for building and testing LAMMPS on
specific OS variants using the <a class="reference external" href="https://apptainer.org">Apptainer</a> or
<a class="reference external" href="https://sylabs.io">Singularity</a> container software. Contributions for
additional variants are welcome. For more details please see the
README.md file in that folder.</p>
<hr class="docutils" />
</section>
<section id="stl-bin2txt-tool">
<span id="stlconvert"></span><h3><span class="section-number">10.4.35. </span>stl_bin2txt tool<a class="headerlink" href="#stl-bin2txt-tool" title="Link to this heading"></a></h3>
<p>The file stl_bin2txt.cpp converts binary STL files - like they are
frequently offered for download on the web - into ASCII format STL files
that LAMMPS can read with the <a class="reference internal" href="create_atoms.html"><span class="doc">create_atoms mesh</span></a> or
the <a class="reference internal" href="fix_smd_wall_surface.html"><span class="doc">fix smd/wall_surface</span></a> commands. The syntax
for running the tool is</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>stl_bin2txt<span class="w"> </span>infile.stl<span class="w"> </span>outfile.stl
</pre></div>
</div>
<p>which creates outfile.stl from infile.stl. This tool must be compiled
on a platform compatible with the byte-ordering that was used to create
the binary file. This usually is a so-called little endian hardware
(like x86).</p>
<hr class="docutils" />
</section>
<section id="swig-interface">
<span id="swig"></span><h3><span class="section-number">10.4.36. </span>SWIG interface<a class="headerlink" href="#swig-interface" title="Link to this heading"></a></h3>
<p>The <a class="reference external" href="https://swig.org">SWIG tool</a> offers a mostly automated way to
incorporate compiled code modules into scripting languages. It
processes the function prototypes in C and generates wrappers for a wide
variety of scripting languages from it. Thus it can also be applied to
the <a class="reference internal" href="Library.html"><span class="doc">C language library interface</span></a> of LAMMPS so that
build a wrapper that allows to call LAMMPS from programming languages
like: C#/Mono, Lua, Java, JavaScript, Perl, Python, R, Ruby, Tcl, and
more.</p>
<section id="what-is-included">
<h4>What is included<a class="headerlink" href="#what-is-included" title="Link to this heading"></a></h4>
<p>We provide here an “interface file”, <code class="docutils literal notranslate"><span class="pre">lammps.i</span></code>, that has the content
of the <code class="docutils literal notranslate"><span class="pre">library.h</span></code> file adapted so SWIG can process it. That will
create wrappers for all the functions that are present in the LAMMPS C
library interface. Please note that not all kinds of C functions can be
automatically translated, so you would have to add custom functions to
be able to utilize those where the automatic translation does not work.
A few functions for converting pointers and accessing arrays are
predefined. We provide the file here on an “as is” basis to help people
getting started, but not as a fully tested and supported feature of the
LAMMPS distribution. Any contributions to complete this are, of course,
welcome. Please also note, that for the case of creating a Python wrapper,
a fully supported <a class="reference internal" href="Python_module.html"><span class="doc">Ctypes based lammps module</span></a>
already exists. That module is designed to be object-oriented while
SWIG will generate a 1:1 translation of the functions in the interface file.</p>
</section>
<section id="building-the-wrapper">
<h4>Building the wrapper<a class="headerlink" href="#building-the-wrapper" title="Link to this heading"></a></h4>
<p>When using CMake, the build steps for building a wrapper
module are integrated for the languages: Java, Lua,
Perl5, Python, Ruby, and Tcl. These require that the
LAMMPS library is build as a shared library and all
necessary development headers and libraries are present.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>-D<span class="w"> </span><span class="nv">WITH_SWIG</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building any SWIG wrapper</span>
-D<span class="w"> </span><span class="nv">BUILD_SWIG_JAVA</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building the Java wrapper</span>
-D<span class="w"> </span><span class="nv">BUILD_SWIG_LUA</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building the Lua wrapper</span>
-D<span class="w"> </span><span class="nv">BUILD_SWIG_PERL5</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building the Perl 5.x wrapper</span>
-D<span class="w"> </span><span class="nv">BUILD_SWIG_PYTHON</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building the Python wrapper</span>
-D<span class="w"> </span><span class="nv">BUILD_SWIG_RUBY</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building the Ruby wrapper</span>
-D<span class="w"> </span><span class="nv">BUILD_SWIG_TCL</span><span class="o">=</span>on<span class="w"> </span><span class="c1"># to enable building the Tcl wrapper</span>
</pre></div>
</div>
<p>Manual building allows a little more flexibility. E.g. one can choose
the name of the module and build and use a dynamically loaded object
for Tcl with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>swig<span class="w"> </span>-tcl<span class="w"> </span>-module<span class="w"> </span>tcllammps<span class="w"> </span>lammps.i
gcc<span class="w"> </span>-fPIC<span class="w"> </span>-shared<span class="w"> </span><span class="k">$(</span>pkg-config<span class="w"> </span>tcl<span class="w"> </span>--cflags<span class="k">)</span><span class="w"> </span>-o<span class="w"> </span>tcllammps.so<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>lammps_wrap.c<span class="w"> </span>-L<span class="w"> </span>../src/<span class="w"> </span>-llammps
tclsh
</pre></div>
</div>
<p>Or one can build an extended Tcl shell command with the wrapped
functions included with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>swig<span class="w"> </span>-tcl<span class="w"> </span>-module<span class="w"> </span>tcllmps<span class="w"> </span>lammps_shell.i
gcc<span class="w"> </span>-o<span class="w"> </span>tcllmpsh<span class="w"> </span>lammps_wrap.c<span class="w"> </span>-Xlinker<span class="w"> </span>-export-dynamic<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>-DHAVE_CONFIG_H<span class="w"> </span><span class="k">$(</span>pkg-config<span class="w"> </span>tcl<span class="w"> </span>--cflags<span class="k">)</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span><span class="k">$(</span>pkg-config<span class="w"> </span>tcl<span class="w"> </span>--libs<span class="k">)</span><span class="w"> </span>-L<span class="w"> </span>../src<span class="w"> </span>-llammps
</pre></div>
</div>
<p>In both cases it is assumed that the LAMMPS library was compiled
as a shared library in the <code class="docutils literal notranslate"><span class="pre">src</span></code> folder. Otherwise the last
part of the commands needs to be adjusted.</p>
</section>
<section id="utility-functions">
<h4>Utility functions<a class="headerlink" href="#utility-functions" title="Link to this heading"></a></h4>
<p>Definitions for several utility functions required to manage and access
data passed or returned as pointers are included in the <code class="docutils literal notranslate"><span class="pre">lammps.i</span></code>
file. So most of the functionality of the library interface should be
accessible. What works and what does not depends a bit on the
individual language for which the wrappers are built and how well SWIG
supports those. The <a class="reference external" href="https://swig.org/doc.html">SWIG documentation</a>
has very detailed instructions and recommendations.</p>
</section>
<section id="usage-examples">
<h4>Usage examples<a class="headerlink" href="#usage-examples" title="Link to this heading"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">tools/swig</span></code> folder has multiple shell scripts, <code class="docutils literal notranslate"><span class="pre">run_&lt;name&gt;_example.sh</span></code>
that will create a small example script and demonstrate how to load
the wrapper and run LAMMPS through it in the corresponding programming
language.</p>
<p>For illustration purposes below is a part of the Tcl example script.</p>
<div class="highlight-tcl notranslate"><div class="highlight"><pre><span></span><span class="nb">load</span><span class="w"> </span>.<span class="o">/</span>tcllammps.so
<span class="k">set</span><span class="w"> </span>lmp<span class="w"> </span><span class="k">[</span><span class="nv">lammps_open_no_mpi</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span>NULL<span class="w"> </span>NULL<span class="k">]</span>
<span class="nv">lammps_command</span><span class="w"> </span><span class="nv">$lmp</span><span class="w"> </span><span class="s2">&quot;units real&quot;</span>
<span class="nv">lammps_command</span><span class="w"> </span><span class="nv">$lmp</span><span class="w"> </span><span class="s2">&quot;lattice fcc 2.5&quot;</span>
<span class="nv">lammps_command</span><span class="w"> </span><span class="nv">$lmp</span><span class="w"> </span><span class="s2">&quot;region box block -5 5 -5 5 -5 5&quot;</span>
<span class="nv">lammps_command</span><span class="w"> </span><span class="nv">$lmp</span><span class="w"> </span><span class="s2">&quot;create_box 1 box&quot;</span>
<span class="nv">lammps_command</span><span class="w"> </span><span class="nv">$lmp</span><span class="w"> </span><span class="s2">&quot;create_atoms 1 box&quot;</span>
<span class="k">set</span><span class="w"> </span>dt<span class="w"> </span><span class="k">[</span><span class="nv">doublep_value</span><span class="w"> </span><span class="k">[</span><span class="nv">voidp_to_doublep</span><span class="w"> </span><span class="k">[</span><span class="nv">lammps_extract_global</span><span class="w"> </span><span class="nv">$lmp</span><span class="w"> </span>dt<span class="k">]]]</span>
<span class="nb">puts</span><span class="w"> </span><span class="s2">&quot;LAMMPS version $ver&quot;</span>
<span class="nb">puts</span><span class="w"> </span><span class="k">[</span><span class="nb">format</span><span class="w"> </span><span class="s2">&quot;Number of created atoms: %g&quot;</span><span class="w"> </span><span class="k">[</span><span class="nv">lammps_get_natoms</span><span class="w"> </span><span class="nv">$lmp</span><span class="k">]]</span>
<span class="nb">puts</span><span class="w"> </span><span class="s2">&quot;Current size of timestep: $dt&quot;</span>
<span class="nb">puts</span><span class="w"> </span><span class="s2">&quot;LAMMPS version: [lammps_version $lmp]&quot;</span>
<span class="nv">lammps_close</span><span class="w"> </span><span class="nv">$lmp</span>
</pre></div>
</div>
<hr class="docutils" />
</section>
</section>
<section id="tabulate-tool">
<span id="tabulate"></span><h3><span class="section-number">10.4.37. </span>tabulate tool<a class="headerlink" href="#tabulate-tool" title="Link to this heading"></a></h3>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 22Dec2022.</span></p>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">tabulate</span></code> folder contains Python scripts scripts to generate tabulated
potential files for LAMMPS. The bulk of the code is in the <code class="docutils literal notranslate"><span class="pre">tabulate</span></code> module
in the <code class="docutils literal notranslate"><span class="pre">tabulate.py</span></code> file. Some example files demonstrating its use are
included. See the README file for more information.</p>
<hr class="docutils" />
</section>
<section id="tinker-tool">
<span id="tinker"></span><h3><span class="section-number">10.4.38. </span>tinker tool<a class="headerlink" href="#tinker-tool" title="Link to this heading"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">tinker</span></code> folder contains Python scripts scripts to convert Tinker input
files to LAMMPS.</p>
<p>See the README file for more information.</p>
<p>Those scripts were written by Steve Plimpton sjplimp at gmail.com</p>
<hr class="docutils" />
</section>
<section id="valgrind-tool">
<span id="valgrind"></span><h3><span class="section-number">10.4.39. </span>valgrind tool<a class="headerlink" href="#valgrind-tool" title="Link to this heading"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">valgrind</span></code> folder contains additional suppressions fur LAMMPS when using
valgrinds memcheck tool to search for memory access violation and memory
leaks. These suppressions are automatically invoked when running tests through
CMake “ctest -T memcheck”. See the provided README file to add these
suppressions when running LAMMPS.</p>
<hr class="docutils" />
</section>
<section id="vim-tool">
<span id="vim"></span><h3><span class="section-number">10.4.40. </span>vim tool<a class="headerlink" href="#vim-tool" title="Link to this heading"></a></h3>
<p>The files in the <code class="docutils literal notranslate"><span class="pre">tools/vim</span></code> directory are add-ons to the VIM editor
that allow easier editing of LAMMPS input scripts. See the <code class="docutils literal notranslate"><span class="pre">README.txt</span></code>
file for details.</p>
<p>These files were provided by Gerolf Ziegenhain (gerolf at
ziegenhain.com)</p>
<hr class="docutils" />
</section>
<section id="xmgrace-tool">
<span id="xmgrace"></span><h3><span class="section-number">10.4.41. </span>xmgrace tool<a class="headerlink" href="#xmgrace-tool" title="Link to this heading"></a></h3>
<p>The files in the tools/xmgrace directory can be used to plot the
thermodynamic data in LAMMPS log files via the xmgrace plotting
package. There are several tools in the directory that can be used in
post-processing mode. The lammpsplot.cpp file can be compiled and
used to create plots from the current state of a running LAMMPS
simulation.</p>
<p>See the README file for details.</p>
<p>These files were provided by Vikas Varshney (vv0210 at gmail.com)</p>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="Examples.html" class="btn btn-neutral float-left" title="9. Example scripts" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="Errors.html" class="btn btn-neutral float-right" title="11. Errors" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2003-2025 Sandia Corporation.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>