Save and load results
Three functions serve the purpose of saving and loading the results obtained with ComplexMixtures:
Save data to recover it later
save("results.json", results)
where results
is the output data structure of the mddf()
calculation, and results.json
is the output file to be created. The file is written in JSON
format, thus is not naturally human-readable.
ComplexMixtures.save
— Methodsave(filename::String, R::Result)
Function to write the result data structure to a json file.
Load saved data
results = load("results.json")
The load
function reads the output of the save
function above, and restores the results data structure.
ComplexMixtures.load
— Methodload(filename::String, [::Type{Result}=Result])
Function to load the json saved results file into, by default, the Result
data structure. The second parameter is optional for loading Result
objects.
Example
using ComplexMixtures: load
R = load("results.json")
#or
R = load("results.json", Result)
Write data in a human-readable format
If you Want the results to be written as simple ASCII tables such that you can read them with another analysis program, plotting graphic, or just want to inspect the data visually, use:
write("results.dat", results)
Three files will be created by this function:
results.dat
: Contains the main results, as the MDDF and KB-integral data.
results-ATOM_CONTRIB_SOLVENT.dat
: contains the contribution of each atom type of the solvent to the MDDF.
results-ATOM_CONTRIB_SOLUTE.dat
: contains the contribution of each atom type of the solute to the MDDF.
Base.write
— Methodwrite(
R::Result, filename::String;
solute_group_names::AbstractVector{<:AbstractString} = R.solute.group_names,
solvent_group_names::AbstractVector{<:AbstractString} = R.solvent.group_names,
)
Function to write the final results to output files as simple tables that are human-readable and easy to analyze with other software
If the solute and solvent group names are defined in R
, the solute_group_names
and solvent_group_names
arguments are not necessary. If they are not defined, the user can pass the names of the groups as strings in the solute_group_names
and solvent_group_names
arguments.