FreeBirdIO
Functions
FreeBird.FreeBirdIO — ModuleFreeBirdIOModule for input/output operations in the FreeBird package.
FreeBird.FreeBirdIO.DataSavingStrategy — Typeabstract type DataSavingStrategyAbstract type representing a strategy for saving data.
FreeBird.FreeBirdIO.SaveEveryN — Typestruct SaveEveryN <: DataSavingStrategySaveEveryN is a concrete subtype of DataSavingStrategy that specifies saving data every N steps.
Fields
df_filename::String: The name of the file to save the DataFrame to.wk_filename::String: The name of the file to save the atom walker to.ls_filename::String: The name of the file to save the liveset to.n_traj::Int: The number of steps between each save of the culled walker into a trajectory file.n_snap::Int: The number of steps between each save of the liveset into a snapshot file.n_info::Int: The number of steps between each print of information.
FreeBird.FreeBirdIO.SaveFreePartEveryN — Typestruct SaveFreePartEveryN <: DataSavingStrategySaveFreePartEveryN is a concrete subtype of DataSavingStrategy that specifies saving data every N steps. Only the free particles are saved into the trajectory and snapshot files.
Fields
df_filename::String: The name of the file to save the DataFrame to.wk_filename::String: The name of the file to save the atom walker to.ls_filename::String: The name of the file to save the liveset to.n_traj::Int: The number of steps between each save of the culled walker into a trajectory file.n_snap::Int: The number of steps between each save of the liveset into a snapshot file.n_info::Int: The number of steps between each print of information.
FreeBird.FreeBirdIO.append_system — Methodappend_system(ats1::FlexibleSystem, ats2::FlexibleSystem)Append two FlexibleSystem objects into a single FastSystem object. The first argument is the system to be appended to, and its bounding box and boundary conditions will be used for the new system.
Arguments
ats1::FlexibleSystem: The base system to be appended.ats2::FlexibleSystem: The system to append.
Returns
new_list: A newFastSystemobject containing the appended systems.
FreeBird.FreeBirdIO.append_system — Methodappend_system(ats1::FlexibleSystem, ats2::Vector{FlexibleSystem})Append a FlexibleSystem object to a vector of FlexibleSystem objects. The first argument is the system to be appended to, and its bounding box and boundary conditions will be used for the new systems.
Arguments
ats1::FlexibleSystem: The base system to be appended.ats2::Vector{FlexibleSystem}: A vector ofFlexibleSystemobjects to append.
Returns
configs: A vector ofFastSystemobjects containing the appended systems.
FreeBird.FreeBirdIO.append_walker — Methodappend_walker(filename::String, at::AtomWalker)Append an AtomWalker object to a file.
FreeBird.FreeBirdIO.convert_system_to_walker — Methodconvert_system_to_walker(at::FlexibleSystem, resume::Bool)Converts a FlexibleSystem object to an AtomWalker object.
Arguments
at::FlexibleSystem: TheFlexibleSystemobject to convert.resume::Bool: Whether to resume from previous data.
Returns
AtomWalker: The convertedAtomWalkerobject.
FreeBird.FreeBirdIO.convert_walker_to_system — Methodconvert_walker_to_system(at::AtomWalker)Converts an AtomWalker object to an AbstractSystem object.
Arguments
at::AtomWalker: TheAtomWalkerobject to be converted.
Returns
AbstractSystem: The convertedAbstractSystemobject.
FreeBird.FreeBirdIO.generate_initial_configs — Methodgenerate_initial_configs(num_walkers::Int, volume_per_particle::Float64, num_particle::Int; particle_type::Symbol=:H)Generate initial configurations for a given number of walkers.
Arguments
num_walkers::Int: The number of walkers.volume_per_particle::Float64: The volume per particle.num_particle::Int: The number of particles.particle_type::Symbol=:H: The type of particle (default is :H).
Returns
An array of initial configurations for each walker.
FreeBird.FreeBirdIO.generate_initial_configs — Methodgenerate_initial_configs(num_walkers::Int, volume_per_particle::Float64, num_particle::Vector{Int}; particle_types::Vector{Symbol}=[Symbol(:H), Symbol(:O)])Generate initial configurations for a given number of walkers with multiple particle types.
Arguments
num_walkers::Int: The number of walkers.volume_per_particle::Float64: The volume per particle.num_particle::Vector{Int}: A vector containing the number of particles of each type.particle_types::Vector{Symbol}=[Symbol(:H), Symbol(:O)]: A vector of symbols representing the types of particles (default is hydrogen and oxygen).
Returns
An array of initial configurations for each walker, where each configuration contains particles of the specified types.
FreeBird.FreeBirdIO.generate_multi_type_random_starting_config — Methodgenerate_multi_type_random_starting_config(volume_per_particle::Float64, num_particle::Vector{Int}; particle_types::Vector{Symbol}=[Symbol(:H), Symbol(:O)])Generate a random starting configuration for a system of particles with multiple types.
Arguments
volume_per_particle::Float64: The volume per particle.num_particle::Vector{Int}: The number of particles of each type.particle_types::Vector{Symbol}=[Symbol(:H), Symbol(:O)]: The types of particles.
Returns
FastSystem: A FastSystem object representing the generated system.
FreeBird.FreeBirdIO.generate_random_starting_config — Methodgenerate_random_starting_config(volume_per_particle::Float64, num_particle::Int; particle_type::Symbol=:H)Generate a random starting configuration for a system of particles.
Arguments
volume_per_particle::Float64: The volume per particle.num_particle::Int: The number of particles.particle_type::Symbol=:H: The type of particle (default is hydrogen).
Returns
FastSystem: A FastSystem object representing the generated system.
FreeBird.FreeBirdIO.read_configs — Methodread_configs(filename::String, pbc::Vector)Reads atomic configurations from a file and applies periodic boundary conditions.
Arguments
filename::String: The name of the file containing the atomic configurations.pbc::Vector: A vector specifying the periodic boundary conditions.
Returns
An array of atomic configurations with periodic boundary conditions applied.
FreeBird.FreeBirdIO.read_configs — Methodread_configs(filename::String; pbc::String="TTT")Reads configurations from a file.
Arguments
filename::String: The name of the file to read configurations from.pbc::String="TTT": Periodic boundary conditions. A string of length 3, where each character represents whether the corresponding dimension has periodic boundary conditions ('T') or not ('F').
Returns
- The configurations read from the file.
FreeBird.FreeBirdIO.read_single_config — Methodread_single_config(filename::String, pbc::Vector)Reads a single configuration from the specified file and sets the periodic boundary conditions (PBC) for the atoms.
Arguments
filename::String: The name of the file to read the configuration from.pbc::Vector: A vector specifying the periodic boundary conditions.
Returns
at::Atoms: The atoms with the PBC set.
FreeBird.FreeBirdIO.read_single_config — Methodread_single_config(filename::String; pbc::String="TTT")Reads a single configuration from the specified file.
Arguments
filename::String: The name of the file to read from.pbc::String="TTT": The periodic boundary conditions. Default is "TTT".
Returns
- The configuration read from the file.
FreeBird.FreeBirdIO.read_single_walker — Methodread_single_walker(filename::String; pbc::String="TTT", resume::Bool=true)Reads a single walker from the specified file.
Arguments
filename::String: The path to the file containing the walker data.pbc::String: (optional) The periodic boundary conditions. Default is "TTT".resume::Bool: (optional) Whether to resume reading from a previous checkpoint. Default istrue.
Returns
- The walker object read from the file.
FreeBird.FreeBirdIO.read_walkers — Methodread_walkers(filename::String; pbc::String="TTT", resume::Bool=true)Reads walker configurations from a file.
Arguments
filename::String: The name of the file to read the walker configurations from.pbc::String: A string specifying the periodic boundary conditions. Default is "TTT".resume::Bool: A boolean indicating whether to resume reading from a previous checkpoint. Default istrue.
Returns
An array of walker objects.
FreeBird.FreeBirdIO.set_pbc — Methodset_pbc(at::Atoms, pbc::Vector)Set the periodic boundary conditions for a system of atoms.
Arguments
at::Atoms: The system of atoms.pbc::Vector: A vector of length 3 specifying the periodic boundary conditions for each dimension. Each element can be eithertruefor periodic boundary conditions orfalsefor Dirichlet zero boundary conditions.
Returns
FlexibleSystem: A flexible system with the specified boundary conditions.
FreeBird.FreeBirdIO.write_df — Methodwrite_df(filename::String, df::DataFrame)Write a DataFrame to a CSV/Arrow file.
Arguments
filename::String: The name of the file to write to.df::DataFrame: The DataFrame to write.
FreeBird.FreeBirdIO.write_df_every_n — Methodwrite_df_every_n(df::DataFrame, step::Int, d_strategy::SaveEveryN)Write the DataFrame df to a file specified by d_strategy.filename every d_strategy.n steps.
Arguments
df::DataFrame: The DataFrame to be written.step::Int: The current step number.d_strategy::SaveEveryN: The save strategy specifying the filename and the step interval.
FreeBird.FreeBirdIO.write_ls_every_n — Methodwrite_ls_every_n(ls::AtomWalkers, step::Int, d_strategy::SaveEveryN)Write the liveset ls to file every n steps, as specified by the d_strategy.
Arguments
ls::AbstractLiveSet: The liveset to be written.step::Int: The current step number.d_strategy::SaveEveryN: The save strategy specifying the frequency of writing.
FreeBird.FreeBirdIO.write_single_walker — Methodwrite_single_walker(filename::String, at::AtomWalker, append::Bool)Write a single AtomWalker object to a file. If the file already exists, append the walker to the file.
Arguments
filename::String: The name of the file to write to.at::AtomWalker: The AtomWalker object to write.append::Bool: A boolean indicating whether to append the walker to the file if it already exists.
FreeBird.FreeBirdIO.write_single_walker — Methodwrite_single_walker(filename::String, at::AtomWalker)Write a single AtomWalker object to a file.
Arguments
filename::String: The name of the file to write to.at::AtomWalker: The AtomWalker object to write.
FreeBird.FreeBirdIO.write_walker_every_n — Methodwrite_walker_every_n(wk::AbstractWalker, step::Int, d_strategy::SaveEveryN)Write the walker wk to a file specified by d_strategy.wk_filename every d_strategy.n steps.
Arguments
wk::AbstractWalker: The walker to be written.step::Int: The current step number.d_strategy::SaveEveryN: The save strategy specifying the file name and the interval.
FreeBird.FreeBirdIO.write_walkers — Methodwrite_walkers(filename::String, ats::Vector{AtomWalker})Write a collection of AtomWalker objects to a file.
Arguments
filename::String: The name of the file to write the walkers to.ats::Vector{AtomWalker}: The collection ofAtomWalkerobjects to write.
FreeBird.FreeBirdIO.write_walkers — Methodwrite_walkers(filename::String, ats::Vector{LatticeWalker})Write a collection of LatticeWalker objects to a file.
Arguments
filename::String: The name of the file to write the walkers to.ats::Vector{LatticeWalker}: The collection ofLatticeWalkerobjects to write.