### Install from source code Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/installation.rst Run this command in the source directory to install phonoLAMMPS as a user. The --prefix= flag is used to avoid system-wide installation. ```rst python setup.py install --user --prefix= ``` -------------------------------- ### Install from PyPI Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/installation.rst Install phonoLAMMPS from the PyPI repository using pip. The --user flag installs it for the current user. ```rst pip install phonoLAMMPS --user ``` -------------------------------- ### Test LAMMPS Python API with in.lammps Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/troubleshooting.rst Run this script inside an example folder containing in.lammps to verify the LAMMPS Python interface. If it fails, there may be an issue with the LAMMPS installation. ```python from lammps import lammps lmp1 = lammps() lmp1.file("in.lammps") lmp1.close() ``` -------------------------------- ### LAMMPS input file example for phonoLAMMPS Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Defines the unit cell and potentials for a LAMMPS simulation. Must not include run or MD-related commands. Uses read_data to define atom coordinates in a separate file. ```rst units metal boundary p p p box tilt large atom_style atomic read_data data.si pair_style tersoff pair_coeff * * SiCGe.tersoff Si(C) neighbor 0.3 bin ``` -------------------------------- ### Python API: calculate force constants and plot DOS and thermal properties Source: https://github.com/abelcarreras/phonolammps/blob/master/README.md Use the Python API to create a Phonolammps object, get the unitcell, force constants, and supercell matrix, then use phonopy to set force constants, calculate and plot the total DOS and thermal properties. ```python from phonolammps import Phonolammps from phonopy import Phonopy phlammps = Phonolammps('in.lammps', supercell_matrix=[[3, 0, 0], [0, 3, 0], [0, 0, 3]]) unitcell = phlammps.get_unitcell() force_constants = phlammps.get_force_constants() supercell_matrix = phlammps.get_supercell_matrix() phonon = Phonopy(unitcell, supercell_matrix) phonon.set_force_constants(force_constants) phonon.set_mesh([20, 20, 20]) phonon.set_total_DOS() phonon.plot_total_DOS().show() phonon.set_thermal_properties() phonon.plot_thermal_properties().show() ``` -------------------------------- ### Calculate finite temperature force constants with -t Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/advanced.rst Runs a molecular dynamics simulation with LAMMPS and uses dynaphopy to obtain renormalized force constants at finite temperature. Requires dynaphopy to be installed. Default MD length is 20 ps with 0.001 ps time step and 5 ps relaxation time, adjustable via --total_time, --relaxation_time, and --relaxation_time flags. ```rst $ phonolammps in.lammps --dim 2 2 2 -pa 0.0 0.5 0.5 0.5 0.0 0.5 0.5 0.5 0.0 -t 300 -p ``` -------------------------------- ### Get data needed for phonopy Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Retrieves the unit cell, force constants, and supercell matrix from the Phonolammps instance for use in phonopy calculations. ```python unitcell = phlammps.get_unitcell() force_constants = phlammps.get_force_constants() supercell_matrix = phlammps.get_supercell_matrix() ``` -------------------------------- ### phonoLAMMPS help output Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Shows all command line options available with -h. Includes flags for supercell dimensions, primitive axis, temperature, optimization, and more. ```rst $ phonolammps -h usage: phonolammps [-h] [-o file] [--dim N N N] [-p] [-c file] [-pa F F F F F F F F F] [-t F] [--optimize] [--force_tol F] [--amplitude F] [--total_time F] [--relaxation_time F] [--timestep F] [--logshow] [--no_symmetrize] [--use_NAC] [--write_force_sets] lammps_file phonoLAMMPS options positional arguments: lammps_file lammps input file optional arguments: -h, --help show this help message and exit -o file force constants output file [default: FORCE_CONSTANTS] --dim N N N dimensions of the supercell -p plot phonon band structure -c file, --cell file generates a POSCAR type file containing the unit cell -pa F F F F F F F F F, --primitive_axis F F F F F F F F F primitive axis -t F temperature in K --optimize optimize atoms position of unitcell --force_tol F forces tolerance for optimization --amplitude F displacement distance [default: 0.01 angstrom] --total_time F total MD time in picoseconds [default: 20 ps] --relaxation_time F MD relaxation time in picoseconds [default: 5 ps] --timestep F MD time step in picoseconds [default: 0.001 ps] --logshow show LAMMPS & dynaphopy log on screen --no_symmetrize deactivate force constant symmetrization --use_NAC include non analytical corrections (Requires BORN file in work directory) --write_force_sets write FORCE_SETS file --version print version ``` -------------------------------- ### Perform phonopy calculations Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Uses the retrieved data to set up a phonopy calculation, set force constants, mesh, and plot total DOS and thermal properties. ```python from phonopy import Phonopy phonon = Phonopy(unitcell, supercell_matrix) phonon.set_force_constants(force_constants) phonon.set_mesh([20, 20, 20]) phonon.set_total_DOS() phonon.plot_total_DOS().show() phonon.set_thermal_properties() phonon.plot_thermal_properties().show() ``` -------------------------------- ### Command line interface: finite temperature force constants at 300 K Source: https://github.com/abelcarreras/phonolammps/blob/master/README.md Run phonoLAMMPS to calculate finite temperature force constants from molecular dynamics using quasiparticle theory. The -t 300 flag sets the temperature to 300 K and requires dynaphopy. ```bash # phonolammps in.lammps --dim 2 2 2 -c POSCAR_unitcell -p -t 300 (at 300 K) ``` -------------------------------- ### Import phonoLAMMPS module Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Loads the Phonolammps class from the phonolammps module. ```python from phonolammps import Phonolammps ``` -------------------------------- ### Command line interface: calculate force constants and preview band structure Source: https://github.com/abelcarreras/phonolammps/blob/master/README.md Run phonoLAMMPS from the command line to calculate 2nd order force constants and generate the unitcell from a LAMMPS input file. The -p flag enables a quick preview of the phonon band structure, which requires seekpath. ```bash # phonolammps in.lammps --dim 2 2 2 -c POSCAR_unitcell -p ``` -------------------------------- ### Create Phonolammps instance from LAMMPS input file Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Creates a Phonolammps object using a LAMMPS input file (in.lammps) with supercell and primitive matrix definitions. The supercell_matrix defines the supercell expansion for finite displacements, and primitive_matrix is optional; if not defined, identity matrix is used. ```python phlammps = Phonolammps('in.lammps', supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]], primitive_matrix=[[0.0, 0.5 ,0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]) ``` -------------------------------- ### phonopy command to read FORCE_CONSTANTS Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Uses phonopy with --readfc to read the FORCE_CONSTANTS file generated by phonoLAMMPS for more advanced calculations. ```rst phonopy --dim="2 2 2" --pa="0.0 0.5 0.5 0.5 0.0 0.5 0.5 0.5 0.0" --readfc -c POSCAR_unitcell band.conf ``` -------------------------------- ### Enable LAMMPS log display with --logshow Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/troubleshooting.rst Use the --logshow flag to display LAMMPS force calculation logs during phonolammps runs. By default, logs are deactivated. ```rst $ phonolammps in.lammps --dim 2 2 2 --logshow ``` -------------------------------- ### Use force constants in phonopy with --readfc Source: https://github.com/abelcarreras/phonolammps/blob/master/README.md Use the obtained FORCE_CONSTANTS and POSCAR_unitcell files in phonopy for more advanced calculations. The --readfc option reads the force constants from file. ```bash # phonopy --dim="2 2 2" --readfc -c POSCAR_unitcell band.conf ``` -------------------------------- ### phonoLAMMPS command for crystalline silicon Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Runs phonoLAMMPS with a 2x2x2 supercell, primitive axis, writes a POSCAR unit cell, and plots the phonon band structure. Outputs FORCE_CONSTANTS file. ```rst phonolammps in.lammps --dim 2 2 2 -pa 0.0 0.5 0.5 0.5 0.0 0.5 0.5 0.5 0.0 -c POSCAR_unitcell -p ``` -------------------------------- ### Create Phonolammps instance from list of LAMMPS commands Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/starting.rst Creates a Phonolammps object using a Python list of LAMMPS input commands, read from a file. This option is handy for generating or modifying LAMMPS commands in a Python script. ```python list_of_commands = open('in.lammps').read().split('\n') phlammps = Phonolammps(list_of_commands, supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]]) primitive_matrix=[[0.0, 0.5 ,0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]) ``` -------------------------------- ### Optimize atomic positions with --optimization and --force_tol Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/advanced.rst Performs a LAMMPS minimize at constant volume to refine atomic positions. The convergence tolerance is set with --force_tol. Best used for refining an already optimized unit cell; for more sophisticated optimization use LAMMPS directly. ```rst $ phonolammps in.lammps --dim 2 2 2 --optimization --force_tol 1e-10 -p ``` -------------------------------- ### Expected output from LAMMPS Python API test Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/troubleshooting.rst If the script works correctly, you should see output similar to this, showing LAMMPS version and simulation details. ```rst LAMMPS (15 May 2019) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:88) using 1 OpenMP thread(s) per MPI task Lattice spacing in x,y,z = 4.785 2.76262 5.189 Created triclinic box = (0 0 0) to (3.19 2.76262 5.189) with tilt (-1.595 0 0) WARNING: Triclinic box skew is large (src/domain.cpp:194) 1 by 1 by 1 MPI processor grid Created 4 atoms create_atoms CPU = 0.00049852 secs Reading potential file GaN.tersoff with DATE: 2007-10-22 Total wall time: 0:00:00 ``` -------------------------------- ### Use NAC in phonon band structure with --use_NAC Source: https://github.com/abelcarreras/phonolammps/blob/master/docs/advanced.rst Activates non-analytical corrections (NAC) during phonon band structure plotting. Requires a BORN file in phonopy format in the working directory. Does not modify FORCE_CONSTANTS and has no effect without the -p flag. ```rst $ phonolammps in.lammps --dim 2 2 2 --use_NAC -p ```