The MSD is a measure of the deviation of the position of an atom
with respect to its reference position over time. At each time value
t, the MSD is defined as an ensemble average over all atoms to be
considered.
Parameters:
frames (list) – a list with all the frames of the molecular dynamics trajectory, where
each one is an exma.core.AtomicSystem.
dt (int or float) – the timestep, how separated the measured frames are from each
other, in the corresponding time units
type_e (int or str, default="all") – the type of the element for which the msd is going to be calculated, by
default it calculates the msd of all atoms.
start (int, default=0) – the initial frame
stop (int, default=-1) – the last frame, by default -1 means the last
step (int, default=1) – the incrementation if it is necessary to skip frames
Notes
The trajectory must be unwrapped outside the simulation cell, if it
is wrapped, the image to which it corresponds each atom must be found
in the trajectory file.
Velocity Autocorrelation Function (VACF) implementation.
The VACF is a measure of the correlation between the velocities of atoms
in a molecular system as a function of time. It is calculated by
multiplying the velocities of the atoms at a given time by the velocities
of the same atoms at a reference time. The average over all atoms is
considered.
Parameters:
frames (list) – a list with all the frames of the molecular dynamics trajectory, where
each one is an exma.core.AtomicSystem and have the velocities
defined.
dt (int or float) – the timestep, how separated the measured frames are from each
other, in the corresponding time units
type_e (int or str, default="all") – the type of the element for which the vacf is going to be calculated,
by default it calculates the vacf of all atoms.
start (int, default=0) – the initial frame
stop (int, default=-1) – the last frame, by default -1 means the last
step (int, default=1) – the incrementation if it is necessary to skip frames
Radial Distribution Function (RDF) implementation.
The RDF is a descriptor of the variation of density of a system in
function of distance from a reference atom. It gives the probability
of finding an atom, relative to an ideal gas, at a given distance.
This microscopic information gives global information about the system,
for example, if in an RDF plot the peaks are well defined, it means that
the system is behaving like a solid; on the other hand, if the peaks are
broadened and decrease in intensity as the distance increases, tending
to oscillate around 1, it means that the system behaves like a liquid;
a straight line at 1 is an ideal gas.
Parameters:
frames (list) – a list with all the frames of the molecular dynamics trajectory, where
each one is an exma.core.AtomicSystem.
type_c (int or str, default="all") – type of central atoms, by default it computes the total rdf
type_i (int or str, default="all") – type of interacting atoms, by default it computes the total rdf
start (int, default=0) – the initial frame
stop (int, default=-1) – the last frame, by default -1 means the last
step (int, default=1) – the incrementation if it is necessary to skip frames
rmax (float, default=10.0) – the maximum distance at which to calculate g(r), should not be
greater than half of the shortest lenght of the box if pbc are
considered
nbin (int, default=100) – number of bins in the histogram
pbc (bool, default=True) – True if periodic boundary conditions must be considered, False if
not.
Notes
The definition of rmax and nbin defines the dr, the width of the
histogram as
The CN, also called ligancy when we are refearing to the first
coordination shell, of a central atom is the number of atoms inside the
empty sphere defined by an outer and an inner cut-off radius.
Parameters:
frames (list) – a list with all the frames of the molecular dynamics trajectory, where
each one is an exma.core.AtomicSystem.
rcut_e (float) – external cut-off radius of the shell
rcut_i (float, default=0.0) – internal cut-off radius of the shell
type_c (int or str, default="all") – type of central atoms, by default it computes the total cn
type_i (int or str, default="all") – type of interacting atoms, by default it computes the total cn
start (int, default=0) – the initial frame
stop (int, default=-1) – the last frame, by default -1 means the last
step (int, default=1) – the incrementation if it is necessary to skip frames
pbc (bool, default=True) – True if periodic boundary conditions must be considered, False if
not.
A one-column DataFrame where for the central atoms the corresponding
coordination number averaged over the frames in which it was
calculated is given and for the interacting atoms (which was not
calculated) a np.nan.
Returns:
df – DataFrame with the coordination number data in the column “cn”.
Emipirical way to describe charge transfer and coordination in solids.
The empirical effective coordination model [2], used to calculate the
effective neighbors, assumes that the interact atoms donate more of its
electron to the closest central atoms. Then, fractions of the interact
atom can be assigned to the various central neighbors atoms [3].
Parameters:
frames (list) – a list with all the frames of the molecular dynamics trajectory, where
each one is an exma.core.AtomicSystem.
type_c (int or str) – type of central atoms
type_i (int or str) – type of interacting atoms
start (int, default=0) – the initial frame
stop (int, default=-1) – the last frame, by default -1 means the last
step (int, default=1) – the incrementation if it is necessary to skip frames
Obtain the labels of the DBSCAN clustering the actual frame.
Parameters:
frame (exma.core.AtomicSystem) – with the information of the atomic system including the box
**kwargs – additional keyword arguments that are passed and are documented
in sklearn.cluster.DBSCAN
Returns:
id_cluster – as explained in sklearn.cluster.DBSCAN. It contains the id
number of the cluster to which belongs the corresponding atom
(the array is sorted). A value of -1 means that the atom is
isolated.
To characterize the short range ordering of amorphous structures, defined
in this work [4], using the itegration of the radial distribution
function for diatomic systems.
This parameter indicates complete randomness if it is equal to zero,
preference for unlike neighbors if it is less than zero, and preference
for similar neighbors (clustering) if is greater than zero.
Parameters:
rdf_x (np.array) – x of the radial distribution function
rdf_y (np.array) – y of the radial distribution function
rcut (float) – cutoff radius
**kwargs – Additional keyword arguments that are passed and are documented in
scipy.integrate.simpson.
where \(N_{ref}\) and \(V_{ref}\) are the number of atoms
of type A and the volume of the reference structure, \(N_x\) and
\(V_x\) are the number of atoms of type A and the volume of the
structure at the \(x\) concentration.
Parameters:
df (pd.DataFrame) – a pd.DataFrame with the values of x (concentrations) in
the first column and then columns with the number of atoms of type A
in each structure, the corresponding equilibrium values of the volume
and, optionally, with its respective error.
reference_atoms (int) – the number of atoms in the reference structure.
reference_volume (float) – the volume, in the corresponding units, of the reference structue.
Returns:
The input pd.DataFrame with extra columns with the fractional volume
change and the respective error if it was possible to calculate, fvc
and err_fvc, respectively.
Return type:
pd.DataFrame
Raises:
KeyError – if the number of atoms of type A or the volume are not defined in
the pd.DataFrame as “natoms_a” and “volume”, respectively.
Notes
The names of the columns in the df must be the following ones:
“x”: x values
“volume”: volume
“natoms_a”: number of atoms of type A
“err_volume”: the error of each “volume” point, optional.
df (pd.DataFrame) – a pd.DataFrame with the values of x (concentrations) in
the first column and then columns with the number of atoms of types
A and the equilibrium values of the potential energy and, optionally,
with its respective error.
reference_energy_a (float) – the pure energy of element A in bulk
reference_energy_b (float) – the pure energy of element B in bulk
fetype (str, default="x") – “x” or “relative”, where the first one is the formation energy as
a function of concentrations and the second one is relative to end
members
Returns:
The input pd.DataFrame with the formation energy corresponding
values, “fe”, and the respective error if it was possible to
calculate, “err_fe”.
Return type:
pd.DataFrame
Notes
The names of the columns in the df must include:
“x” o “mol”: x or mol fraction values
“natoms_a”: number of atoms of type A
“natoms_b”: number of atoms of type B
“epot”: potential energy
“err_epot”: the error of each “epot” point, optional.
This method offers an easy and efficient way to estimate the error of
correlated data by a renormalization groups, as described by
H. Flyvbjerg and H. G. Petersen [1].
A pd.DataFrame with data_size, mean, var and varerr
as columns that gives information about the data size changes,
the mean value of each block, the corresponding variance and the
error of that variance, respectively.
ax (matplotlib.pyplot.Axis, default=None) – current metplotlib axis
errorbar_kws (dict, default={"marker": "o", "ls": ""}) – additional keyword arguments that are passed and are documented
in matplotlib.pyplot.errorbar_kws.
xyztraj (str) – the name of the file with the xyz trajectory.
lammpstrj_name (str) – the name of the file with the lammpstrj trajectory.
cell_info (dict) – with the box, the lenght of the box in each direction, another
dictionary identified with the type key that has within it a
correspondence between the elements present in xyz file with integer
identification numbers, e.g. {“Sn”: 1, “O”: 2}
xyzftype (str, default="xyz") – the ftype of xyz file.
Write an xyz frame to an input data file of LAMMPS.
Parameters:
xyztraj (str) – the name of the file with the xyz trajectory.
inlammps_name (str) – the name of the file to write to.
cell_info (dict) – with the box, the lenght of the box in each direction, another
dictionary identified with the type key that has within it a
correspondence between the elements present in xyz file with integer
identification numbers, e.g. {“Sn”: 1, “O”: 2}
nframe (int, default=-1) – number of the frame to write, by default is -1, that is, the last.
xyzftype (str, default="xyz") – the ftype of xyz file.
Raises:
IndexError – If the number of the frame to write is not in the trajectory file.
filename (str) – name of the file where the trajectories in xyz format are
ftype (str, default="xyz") – the possible values are xyz, property, image and velocity.
xyz if is the usual xyz file. property if in the last
column there is a property. image if in the last three columns
there are the image box of the corresponding atom. velocity if in
the last three columns there are the velocities in each direction of
the corresponding atoms.
Returns:
A list with an exma.core.AtomicSystem for each frame.
filename (str) – name of the file where the trajectories in xyz format are
ftype (str, default="xyz") – the possible values are xyz, property, image and velocity.
xyz if is the usual xyz file. property if in the last
column there is a property. image if in the last three columns
there are the image box of the corresponding atom. velocity if in
the last three columns there are the velocities in each direction of
the corresponding atoms.
Raises:
ValueError – If xyz file type is not among the possible values
frames (list) – A list with an exma.core.AtomicSystem for each frame of
the trajectory.
filename (str) – name of the file where the trajectories in xyz format are
ftype (str, default="xyz") – the possible values are xyz, property and image.
xyz if is the usual xyz file. property if in the last
column there is a property. image if in the last three columns
there are the image box of the corresponding atom.
filename (str) – name of the file where the trajectories in xyz format are going to
be written
ftype (str, default="xyz") – the possible values are xyz, property and image. xyz
if is the usual xyz file. property if in the last column there is
a property. image if in the last three columns there are the image
box of the corresponding atom.
Raises:
ValueError – If xyz file type is not among the possible values
Includes class and functions to define atom positions.
It is primarily developed to generate initial structures returned in the
form of a exma.core.AtomicSystem for writing to output files with the writer
classes/function that serve as initial conditions for simulations.
frame (exma.core.AtomicSystem) – This have all the information of the configurations of the system.
nrf (list) – three integers that must be greater than or equal to 1 and
indicates the replication factor in each x, y, z direction,
respectively. Value equal to 1 means that only the current cell
in that direction is considered.
Returns:
This have all the information of the configurations of the system.
Return type:
exma.core.AtomicSystem
Distances with periodic boundary conditions (PBC distances)
A function to compute the distances between a central and an interact
group of atoms with the minimum image convention, in which each individual
particle inteacts with the closest image of the copies of the system.
Parameters:
frame_c (exma.core.AtomicSystem) – which have the atomic configurations of the central atoms and must
include box not None.
frame_i (exma.core.AtomicSystem) – which have the atomic configurations of the interact atoms and must
include box not None.
type_c (int or str, default="all") – type of central atoms, by default it computes the distances for all
the atoms
type_i (int or str, default="all") – type of interacting atoms, by default it computes the distances for all
the atoms
Returns:
array with the distance matrix where the rows are the central atoms
and the columns the interacting ones.