Utilities for Molecular Dynamics

Utility functions for various tasks.

flare.utils.md_helper.get_random_velocities(noa: int, temperature: float, mass: float)

Draw velocities from the Maxwell-Boltzmann distribution, assuming a fixed mass for all particles in amu.

Parameters:
  • noa (int) – Number of atoms in the system.
  • temperature (float) – Temperature of the system.
  • mass (float) – Mass of each particle in amu.
Returns:

Particle velocities, corrected to give zero center of mass motion.

Return type:

np.ndarray

flare.utils.md_helper.get_supercell_positions(sc_size: int, cell: <sphinx.ext.autodoc.importer._MockObject object at 0x7f53bea53610>, positions: <sphinx.ext.autodoc.importer._MockObject object at 0x7f53bea53b10>)

Returns the positions of a supercell of atoms, with the number of cells in each direction fixed.

Parameters:
  • sc_size (int) – Size of the supercell.
  • cell (np.ndarray) – 3x3 array of cell vectors.
  • positions (np.ndarray) – Positions of atoms in the unit cell.
Returns:

Positions of atoms in the supercell.

Return type:

np.ndarray

flare.utils.md_helper.multicomponent_velocities(temperature: float, masses: List[float])

Draw velocities from the Maxwell-Boltzmann distribution for particles of varying mass.

Parameters:
  • temperature (float) – Temperature of the system.
  • masses (List[float]) – Particle masses in amu.
Returns:

Particle velocities, corrected to give zero center of mass motion.

Return type:

np.ndarray

flare.utils.md_helper.supercell_custom(cell: <sphinx.ext.autodoc.importer._MockObject object at 0x7f53bea536d0>, positions: <sphinx.ext.autodoc.importer._MockObject object at 0x7f53bea53f90>, size1: int, size2: int, size3: int)

Returns the positions of a supercell of atoms with a chosen number of cells in each direction.

Parameters:
  • cell (np.ndarray) – 3x3 array of cell vectors.
  • positions (np.ndarray) – Positions of atoms in the unit cell.
  • size1 (int) – Number of cells along the first cell vector.
  • size2 (int) – Number of cells along the second cell vector.
  • size3 (int) – Number of cells along the third cell vector.
Returns:

Positions of atoms in the supercell.

Return type:

np.ndarray