MDFrame

This type represents a snapshot of a molecular simulation.

MolecularDynamicsFiles.MDFrameType
struct MDFrame

Represents a snapshot of the molecular simulation.

Particles are stored in a table (DataFrame) with rows representing particles and columns representing particle properties.

Column names are in LAMMPS notation (see dump command documentation).

The particle table is sorted by the column with name :id, if it exists.

Commonly used particle properties can be accessed by specific MDFrame methods. The properties are (in LAMMPS notation): :id, :mol, :type, :x, :y, :z, :xs, :ys, :zs, :xu, :yu, :zu, :xsu, :ysu, :zsu, :ix, :iy, :iz, :vx, :vy, :vz, :element, :mass. Any other properties are considered 'extra' and are accessed by using the method extra_scalars.

Some of the methods for accessing particle properties generate the data if it's not present in the frame, for example: particle types may be generated from particle elements or masses.

Fields:

  • timestep: Timestep of the snapshot
  • box: Simulation box specification
  • particles: Table containing particle data.
  • system_properties: Dict containing other arbitrary system properties, like 'units' and 'time' of LAMMPS Dump or 'A' and 'R' of CFG.
source
MolecularDynamicsFiles.MDFrameMethod
MDFrame(
    timestep::Int64,
    box::SimulationBox,
    particles::DataFrame,
    system_properties::Dict{Symbol}
) -> MDFrame

Construct a MDFrame.

source
Base.lengthMethod
length(frame::MDFrame) -> Int64

Return the number of particles in the system.

source
MolecularDynamicsFiles.particle_typesFunction
particle_types(frame::MDFrame) -> Vector{Int64}

Return particle types.

Corresponds to property :type. If there's no particle type data in the frame, attempts to generate from 1) elements of particles 2) masses of particles.

source
MolecularDynamicsFiles.positionsFunction
positions(frame::MDFrame) -> Vector{SVector{3, Float64}}

Return unscaled wrapped positions of particles in the system.

Corresponds to properties :x, :y, :z. Performs conversion from other coordinate representations if needed and possible.

source
MolecularDynamicsFiles.scaled_positionsFunction
scaled_positions(
    frame::MDFrame
) -> Vector{SVector{3, Float64}}

Return scaled wrapped positions of particles in the system.

Corresponds to properties :xs, :ys, :zs. Performs conversion from other coordinate representations if needed and possible.

source
MolecularDynamicsFiles.unwrapped_positionsFunction
unwrapped_positions(
    frame::MDFrame
) -> Vector{SVector{3, Float64}}

Return unscaled unwrapped positions of particles in the system.

Corresponds to properties :xu, :yu, :zu. Performs conversion from other coordinate representations if needed and possible.

source
MolecularDynamicsFiles.scaled_unwrapped_positionsFunction
scaled_unwrapped_positions(
    frame::MDFrame
) -> Vector{SVector{3, Float64}}

Return scaled unwrapped positions of particles in the system.

Corresponds to properties :xsu, :ysu, :zsu. Performs conversion from other coordinate representations if needed and possible.

source
MolecularDynamicsFiles.imagesFunction
images(frame::MDFrame) -> Vector{SVector{3, Int16}}

Return image coordinates of particles in the system.

Corresponds to properties :ix, :iy, :iz. Generates images from unwrapped coordinates if needed and possible.

source
MolecularDynamicsFiles.velocitiesFunction
velocities(frame::MDFrame) -> Vector{SVector{3, Float64}}

Return velocities of particles in the system.

Corresponds to properties :vx, :vy, :vz.

source
MolecularDynamicsFiles.extra_scalarsFunction
extra_scalars(frame::MDFrame) -> Dict{Symbol, Vector}

Return extra scalar properties of the particles.

Properties are considered 'extra' if none of the other MDFrame methods return that property. The properties not considered 'extra' are: :id, :mol, :type, :x, :y, :z, :xs, :ys, :zs, :xu, :yu, :zu, :xsu, :ysu, :zsu, :ix, :iy, :iz, :vx, :vy, :vz, :element, :mass

source
MolecularDynamicsFiles.add_extra_scalar!Function
add_extra_scalar!(
    frame::MDFrame,
    name::Symbol,
    values::AbstractVector{Float64}
) -> AbstractVector{Float64}

Add an extra scalar particle property.

name may not be one of :id, :mol, :type, :x, :y, :z, :xs, :ys, :zs, :xu, :yu, :zu, :xsu, :ysu, :zsu, :ix, :iy, :iz, :vx, :vy, :vz, :element, :mass. values must be of length length(frame). values[i] corresponds to the value of the added property of particle with id id_tags(frame)[i].

source
MolecularDynamicsFiles.boxvectorsFunction
boxvectors(frame::MDFrame) -> SMatrix{3, 3, Float64}

Return the basis vectors of the simulation box as a matrix. Simulation cell vectors are in the columns.

source