IMLCV.new_yaff namespace#
Submodules#
IMLCV.new_yaff.ff module#
IMLCV.new_yaff.iterative module#
Base class for iterative algorithms
- class IMLCV.new_yaff.iterative.AttributeStateItem(*, key, value)#
Bases:
StateItem- get_value(iterative)#
- replace(**updates)#
Returns a new object replacing the specified fields with new values.
- class IMLCV.new_yaff.iterative.CellStateItem(*, key, value)#
Bases:
StateItem- get_value(iterative)#
- replace(**updates)#
Returns a new object replacing the specified fields with new values.
- class IMLCV.new_yaff.iterative.ConsErrStateItem(*, key, value)#
Bases:
StateItem- get_value(iterative)#
- replace(**updates)#
Returns a new object replacing the specified fields with new values.
- class IMLCV.new_yaff.iterative.Hook(*, name='hook', kind='base', method='none', start=<factory>, step=<factory>)#
Bases:
MyPyTreeNode- expects_call(counter)#
- replace(**updates)#
Returns a new object replacing the specified fields with new values.
IMLCV.new_yaff.npt module#
IMLCV.new_yaff.nvt module#
IMLCV.new_yaff.system module#
- class IMLCV.new_yaff.system.YaffCell(*, rvecs)#
Bases:
MyPyTreeNode- static create(sp)#
- property nvec#
- replace(**updates)#
Returns a new object replacing the specified fields with new values.
- property volume#
IMLCV.new_yaff.utils module#
Auxiliary routines for initial velocities
- IMLCV.new_yaff.utils.angular_moment(pos, vel, masses)#
Compute the angular moment of a set of point particles
Arguments:
- Return type:
- pos
An (N, 3) array with atomic positions.
- vel
An (N, 3) array with atomic velocities.
- masses
An (N,) array with atomic masses.
Returns: a (3,) array with the angular momentum vector.
- IMLCV.new_yaff.utils.angular_velocity(ang_mom, iner_tens, epsilon=1e-10)#
Derive the angular velocity from the angular moment and the inertia tensor
Arguments:
- Return type:
- ang_mom
An (3,) array with angular momenta.
- iner_tens
A (3, 3) array with the inertia tensor.
Optional arguments:
- epsilon
A threshold for the low eigenvalues of the inertia tensor. When an eigenvalue is below this threshold, it is assumed to be zero plus some (irrelevant) numerical noise.
Returns: An (3,) array with the angular velocity vector.
In principle these routine should merely return:
jnp.linalg.solve(inter_tens, ang_mom).
However, when the inertia tensor has zero eigenvalues (linear molecules, single atoms), this routine will use a proper pseudo inverse of the inertia tensor.
- IMLCV.new_yaff.utils.cell_lower(rvecs)#
Transform the cell tensor to its lower diagonal form. The transformation is described here https://lammps.sandia.gov/doc/Howto_triclinic.html, bearing in mind that YAFF stores cell vectors as rows, not columns.
Arguments:
- rvecs
A [3x3] NumPy array representing a cell tensor
Returns:
- newrvecs
A [3x3] NumPy array representing a lower-diagonal form of rvecs
- rot
A [3x3] matrix representing the rotation matrix to go from rvecs to newrvecs
- IMLCV.new_yaff.utils.cell_symmetrize(ff, vector_list=None, tensor_list=None)#
Symmetrizes the unit cell tensor, and updates the position vectors
Arguments:
- ff
A ForceField instance
Optional arguments:
- vector_list
A list of numpy vectors which should be transformed under the symmetrization. Note that the positions are already transformed automatically
- tensor_list
A list of numpy tensors of rank 2 which should be transformed under the symmetrization.
- IMLCV.new_yaff.utils.clean_momenta(pos, vel, masses, cell)#
Remove any relevant external momenta
Arguments:
- pos
An (N, 3) array with atomic positions. This array is not modified.
- vel
An (N, 3) array with atomic velocities. This array is modified in-place.
- masses
An (N,) array with atomic masses
- cell
A Cell instance describing the periodic boundary conditions.
- IMLCV.new_yaff.utils.get_ndof_baro(dim, anisotropic, vol_constraint)#
Calculates the number of degrees of freedom associated with the cell fluctuation
Arguments:
- Return type:
- dim
The dimension of the system
- anisotropic
Boolean value determining whether anisotropic cell fluctuations are allowed
- vol_constraint
Boolean value determining whether the cell volume can change
- IMLCV.new_yaff.utils.get_ndof_internal_md(natom, nper)#
Return the effective number of internal degrees of freedom for MD simulations
Arguments:
- Return type:
- natom
The number of atoms
- nper
The number of periodic boundary conditions (0 for isolated systems)
- IMLCV.new_yaff.utils.get_random_vel(temp0, scalevel0, masses, key, select=None)#
Generate random atomic velocities using a Maxwell-Boltzmann distribution
Arguments:
- Return type:
- temp0
The temperature for the Maxwell-Boltzmann distribution.
- scalevel0
When set to True, the velocities are rescaled such that the instantaneous temperature coincides with temp0.
- masses
An (N,) array with atomic masses.
Optional arguments:
- select
When given, this must be an array of integer indexes. Only for these atoms (masses) initial velocities will be generated.
Returns: An (N, 3) array with random velocities. When the select option is used, the shape of the results is (M, 3), where M is the length of the select array.
- IMLCV.new_yaff.utils.get_random_vel_press(mass, temp, key)#
Generates symmetric tensor of barostat velocities
Arguments:
- Return type:
- mass
The Barostat mass
- temp
The temperature at which the velocities are selected
- IMLCV.new_yaff.utils.inertia_tensor(pos, masses)#
Compute the inertia tensor for a given set of point particles
Arguments:
- Return type:
- pos
An (N, 3) array with atomic positions.
- masses
An (N,) array with atomic masses.
Returns: a (3, 3) array containing the inertia tensor.
- IMLCV.new_yaff.utils.remove_angular_moment(pos, vel, masses)#
Zero the global angular momentum.
Arguments:
- pos
An (N, 3) array with atomic positions. This array is not modified.
- vel
An (N, 3) array with atomic velocities. This array is modified in-place.
- masses
An (N,) array with atomic masses
The zero angular momentum is achieved by subtracting angular rigid body motion from the atomic velocities. (The angular momentum is measured with respect to the center of mass to avoid that this routine reintroduces a linear COM velocity. This is also beneficial for the numerical stability.)
- IMLCV.new_yaff.utils.remove_com_moment(vel, masses)#
Zero the linear center-of-mass momentum.
Arguments:
- Return type:
- vel
An (N, 3) array with atomic velocities. This array is modified in-place.
- masses
An (N,) array with atomic masses
The zero linear COM momentum is achieved by subtracting translational rigid body motion from the atomic velocities.
- IMLCV.new_yaff.utils.rigid_body_angular_velocities(pos, ang_vel)#
Generate the velocities of a set of atoms that move as a rigid body.
Arguments:
- Return type:
- pos
An (N, 3) array with atomic positions.
- ang_vel
An (3,) array with the angular velocity vector of the rigid body.
Returns: An (N, 3) array with atomic velocities in the rigid body. Note that the linear momentum is zero.