6. API¶
This is the Python API for phonoLAMMPS
-
class
phonolammps.
PhonoBase
[source]¶ Base class for PhonoLAMMPS This class is not designed to be called directly. To use it make a subclass and implement the following methods:
- __init__()
- get_forces()
-
get_force_constants
(include_data_set=False)[source]¶ calculate the force constants with phonopy using lammps to calculate forces
Returns: ForceConstants type object containing force constants
-
get_path_using_seek_path
()[source]¶ Obtain the path in reciprocal space to plot the phonon band structure
Returns: dictionary with list of q-points and labels of high symmetry points
-
get_phonopy_phonon
()[source]¶ Return phonopy phonon object with unitcell, primitive cell and the force constants set.
Returns:
-
get_supercell_matrix
()[source]¶ Get the supercell matrix
Return supercell: the supercell 3x3 matrix (list of lists)
-
get_unitcell
()[source]¶ Get unit cell structure
Return unitcell: unit cell 3x3 matrix (lattice vectors in rows)
-
plot_phonon_dispersion_bands
(bands_and_labels=None)[source]¶ Plot phonon band structure using seekpath automatic k-path Warning: The labels may be wrong if the structure is not standarized
Parameters: bands_and_labels – Custom energy band path
-
write_force_constants
(filename='FORCE_CONSTANTS', hdf5=False)[source]¶ Write the force constants in a file in phonopy plain text format
Parameters: filename – Force constants filename
-
class
phonolammps.
PhonoGromacs
(gro_file, supercell_matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), primitive_matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), displacement_distance=0.01, show_log=False, show_progress=False, use_NAC=False, symmetrize=True, gmx_params=None, base_ff='charmm27.ff/forcefield.itp', itp_file=None, silent=True, omp_num_threads=1)[source]¶
-
class
phonolammps.
PhonoTinker
(txyz_input_file, key_input_file, force_field_file, supercell_matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), primitive_matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), displacement_distance=0.01, show_log=False, show_progress=False, use_NAC=False, symmetrize=True)[source]¶
-
class
phonolammps.
Phonolammps
(lammps_input, supercell_matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), primitive_matrix=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), displacement_distance=0.01, show_log=False, show_progress=False, use_NAC=False, symmetrize=True)[source]¶ -
get_forces
(cell_with_disp)[source]¶ Calculate the forces of a supercell using lammps
Parameters: cell_with_disp – supercell from which determine the forces Returns: numpy array matrix with forces of atoms [Natoms x 3]
-
get_units
(commands_list)[source]¶ Get the units label for LAMMPS “units” command from a list of LAMMPS input commands
Parameters: commands_list – list of LAMMPS input commands (strings) Return units: string containing the units
-
optimize_unitcell
(energy_tol=0, force_tol=1e-10, max_iter=1000000, max_eval=1000000)[source]¶ Optimize atoms position of the unitcell using lammps minimizer. Check https://docs.lammps.org/minimize.html for details
Parameters: - energy_tol – stopping tolerance for energ
- force_tol – stopping tolerance for force (force units)
- max_iter – max iterations of minimizer
- max_eval – max number of force/energy evaluations
-
end