use colored::{ColoredString, Colorize};
use std::collections::HashSet;
use std::path::Path;
use thiserror::Error;
use crate::auxiliary::{GRO_MAX_COORDINATE, GRO_MIN_COORDINATE, PDB_MAX_COORDINATE, PDB_MIN_COORDINATE};
use crate::system::guess::{BondsGuessInfo, ElementGuessInfo, PropertiesGuessInfo};
use crate::files::FileType;
fn path_to_yellow(path: &Path) -> ColoredString {
path.to_str().unwrap().yellow()
}
fn unpack_set(set: &HashSet<String>) -> ColoredString {
let mut output = String::new();
let len = set.len();
output.push('\n');
for (i, key) in set.iter().enumerate() {
output.push_str(key);
output.push('\n');
if i >= 9 && len != i + 1 {
let and_more = format!("...and {} more...", len - i - 1);
output.push_str(&and_more);
break;
}
}
output.yellow()
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParseFileError {
#[error("{} file '{}' has an unknown or unsupported file extension", "error:".red().bold(), path_to_yellow(.0))]
UnknownExtension(Box<Path>),
#[error("{} the requested operation is not supported for file type '{}'", "error:".red().bold(), .0.to_string().yellow())]
UnsupportedFileType(FileType),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParseGroError {
#[error("{} file '{}' was not found", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} file '{}' ended unexpectedly", "error:".red().bold(), path_to_yellow(.0))]
LineNotFound(Box<Path>),
#[error("{} could not parse line '{}'", "error:".red().bold(), .0.yellow())]
ParseLineErr(String),
#[error("{} could not parse line '{}' as atom", "error:".red().bold(), .0.yellow())]
ParseAtomLineErr(String),
#[error("{} could not parse line '{}' as box dimensions", "error:".red().bold(), .0.yellow())]
ParseBoxLineErr(String),
#[error("{} simulation box on line '{}' is not supported (4th, 5th, and 7th element must be zero)", "error:".red().bold(), .0.yellow())]
UnsupportedBox(String),
#[error("{} could not parse line '{}' because it contains an invalid floating point number", "error:".red().bold(), .0.yellow())]
InvalidFloat(String),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParsePdbError {
#[error("{} file '{}' was not found", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} file '{}' ended unexpectedly", "error:".red().bold(), path_to_yellow(.0))]
LineNotFound(Box<Path>),
#[error("{} could not parse line '{}'", "error:".red().bold(), .0.yellow())]
ParseLineErr(String),
#[error("{} could not parse line '{}' as atom", "error:".red().bold(), .0.yellow())]
ParseAtomLineErr(String),
#[error("{} could not parse line '{}' as box dimensions", "error:".red().bold(), .0.yellow())]
ParseBoxLineErr(String),
#[error("{} could not parse line '{}' as title", "error:".red().bold(), .0.yellow())]
ParseTitleLineErr(String),
#[error("{} could not parse line '{}' because it contains an invalid floating point number", "error:".red().bold(), .0.yellow())]
InvalidFloat(String),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParsePdbConnectivityError {
#[error("{} file '{}' was not found", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} file '{}' ended unexpectedly", "error:".red().bold(), path_to_yellow(.0))]
LineNotFound(Box<Path>),
#[error("{} could not parse line '{}' as connectivity information", "error:".red().bold(), .0.yellow())]
ParseConectLineErr(String),
#[error("{} atom number '{}' mentioned on line '{}' does not exist", "error:".red().bold(), .0.to_string().yellow(), .1.yellow())]
AtomNotFound(usize, String),
#[error("{} multiple atoms have the same number in the system and connectivity is thus ambiguous", "error:".red().bold())]
DuplicateAtomNumbers,
#[error("{} atom '{}' claims to be bonded to itself which does not make sense", "error:".red().bold(), .0.to_string().yellow())]
SelfBonding(usize),
#[error("{} no bonds have been found in the PDB file '{}'", "warning:".yellow().bold(), path_to_yellow(.0))]
NoBondsWarning(Box<Path>),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WriteGroError {
#[error("{} file '{}' could not be created", "error:".red().bold(), path_to_yellow(.0))]
CouldNotCreate(Box<Path>),
#[error("{} could not write line into file", "error:".red().bold())]
CouldNotWrite,
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.yellow())]
GroupNotFound(String),
#[error("{} a coordinate is too large to be written in GRO format (supported range: {} to {} nm)", "error:".red().bold(), GRO_MIN_COORDINATE, GRO_MAX_COORDINATE)]
CoordinateTooLarge,
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WritePdbError {
#[error("{} file '{}' could not be created", "error:".red().bold(), path_to_yellow(.0))]
CouldNotCreate(Box<Path>),
#[error("{} could not write line into file", "error:".red().bold())]
CouldNotWrite,
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.yellow())]
GroupNotFound(String),
#[error("{} system is too large ('{}' atoms) for PDB connectivity section", "error:".red().bold(), .0.to_string().yellow())]
ConectTooLarge(usize),
#[error("{} multiple atoms have the same number in the system and connectivity is thus ambiguous", "error:".red().bold())]
ConectDuplicateAtomNumbers,
#[error("{} atom number '{}' is too high for PDB connectivity section and can not be wrapped", "error:".red().bold(), .0.to_string().yellow())]
ConectInvalidNumber(usize),
#[error("{} a coordinate is too large to be written in PDB format (supported range: {} to {} nm)", "error:".red().bold(), PDB_MIN_COORDINATE, PDB_MAX_COORDINATE)]
CoordinateTooLarge,
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParsePqrError {
#[error("{} file '{}' was not found", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} file '{}' ended unexpectedly", "error:".red().bold(), path_to_yellow(.0))]
LineNotFound(Box<Path>),
#[error("{} could not parse line '{}'", "error:".red().bold(), .0.yellow())]
ParseLineErr(String),
#[error("{} could not parse line '{}' as atom", "error:".red().bold(), .0.yellow())]
ParseAtomLineErr(String),
#[error("{} could not parse line '{}' as box dimensions", "error:".red().bold(), .0.yellow())]
ParseBoxLineErr(String),
#[error("{} could not parse line '{}' as title", "error:".red().bold(), .0.yellow())]
ParseTitleLineErr(String),
#[error("{} could not parse line '{}' because it contains an invalid floating point number", "error:".red().bold(), .0.yellow())]
InvalidFloat(String),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WritePqrError {
#[error("{} file '{}' could not be created", "error:".red().bold(), path_to_yellow(.0))]
CouldNotCreate(Box<Path>),
#[error("{} could not write line into file", "error:".red().bold())]
CouldNotWrite,
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.yellow())]
GroupNotFound(String),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParseTprError {
#[error("{}", .0)]
CouldNotRead(String),
#[error("{} bond could not be created between atoms '{}' and '{}' (the same atom)", "error:".red().bold(), .0.to_string().yellow(), .1.to_string().yellow())]
InvalidBond(usize, usize),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum GroupError {
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.yellow())]
NotFound(String),
#[error("{} group '{}' already existed and has been overwritten", "warning:".yellow().bold(), .0.yellow())]
AlreadyExistsWarning(String),
#[error("{} following groups already existed and have been overwritten: {}", "warning:".yellow().bold(), unpack_set(.0))]
MultipleAlreadyExistWarning(Box<HashSet<String>>),
#[error("{} name '{}' contains invalid characters", "error:".red().bold(), .0.yellow())]
InvalidName(String),
#[error("{}", .0)]
InvalidQuery(SelectError),
#[error("{}", .0)]
InvalidSimBox(SimBoxError),
#[error("{}", .0)]
InvalidPosition(PositionError),
#[error("{}", .0)]
InvalidMass(MassError),
#[error("{} group '{}' contains no atoms", "error:".red().bold(), .0.yellow())]
EmptyGroup(String),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum AtomLabelError {
#[error("{} atom with index '{}' could not be labeled: index out of range", "error:".red().bold(), .0.to_string().yellow())]
IndexOutOfRange(usize),
#[error("{} label '{}' already existed and has been reassigned from atom '{}' to atom '{}'",
"warning:".yellow().bold(),
.0.yellow(),
.1.to_string().yellow(),
.2.to_string().yellow())
]
AlreadyExistsWarning(String, usize, usize),
#[error("{} label '{}' contains invalid characters", "error:".red().bold(), .0.yellow())]
InvalidLabel(String),
#[error("{} label '{}' does not exist", "error:".red().bold(), .0.yellow())]
NotFound(String),
#[error("{}", .0)]
InvalidQuery(SelectError),
#[error("{} invalid number of atoms selected for labeling: expected '{}', got '{}'", "error:".red().bold(), "1".yellow(), .0.to_string().yellow())]
InvalidNumberOfAtoms(usize),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum AtomError {
#[error("{} atom index '{}' is out of range", "error:".red().bold(), .0.to_string().yellow())]
OutOfRange(usize),
#[error("{} bond could not be created between atoms '{}' and '{}'", "error:".red().bold(), .0.to_string().yellow(), .1.to_string().yellow())]
InvalidBond(usize, usize),
#[error("{}", .0)]
InvalidSimBox(SimBoxError),
#[error("{}", .0)]
InvalidPosition(PositionError),
#[error("{}", .0)]
InvalidMass(MassError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParseNdxError {
#[error("{} file '{}' was not found", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} file '{}' ended unexpectedly", "error:".red().bold(), path_to_yellow(.0))]
LineNotFound(Box<Path>),
#[error("{} could not parse line '{}' as group name", "error:".red().bold(), .0.yellow())]
ParseGroupNameErr(String),
#[error("{} could not parse line '{}'", "error:".red().bold(), .0.yellow())]
ParseLineErr(String),
#[error("{} atom index '{}' does not exist in the system", "error:".red().bold(), .0.to_string().yellow())]
InvalidAtomIndex(usize),
#[error("{} duplicate groups detected: {}", "warning:".yellow().bold(), unpack_set(.0))]
DuplicateGroupsWarning(Box<HashSet<String>>),
#[error("{} ignored the following groups with invalid names: {}", "warning:".yellow().bold(), unpack_set(.0))]
InvalidNamesWarning(Box<HashSet<String>>),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WriteNdxError {
#[error("{} file '{}' could not be created", "error:".red().bold(), path_to_yellow(.0))]
CouldNotCreate(Box<Path>),
#[error("{} could not write line into file", "error:".red().bold())]
CouldNotWrite,
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum TrajError {
#[error("{} unable to work with path '{}'", "error:".red().bold(), path_to_yellow(.0))]
InvalidPath(Box<Path>),
#[error("{} file '{}' could not be opened or created", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ReadTrajError {
#[error("{} unable to work with path '{}'", "error:".red().bold(), path_to_yellow(.0))]
InvalidPath(Box<Path>),
#[error("{} file '{}' was not found or could not be read as a trajectory file", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} could not read frame in a trajectory file", "error:".red().bold())]
FrameNotFound,
#[error("{} number of atoms in the trajectory file '{}' does not match the number of atoms in the system", "error:".red().bold(), path_to_yellow(.0))]
AtomsNumberMismatch(Box<Path>),
#[error("{} invalid time range (starting time '{}' ps is higher than the ending time '{}' ps)", "error:".red().bold(), .0.yellow(), .1.yellow())]
InvalidTimeRange(String, String),
#[error("{} start time ('{}' ps) exceeds the time of all frames in the trajectory file", "error:".red().bold(), .0.yellow())]
StartNotFound(String),
#[error("{} negative time ('{}' ps) is not allowed in a time range", "error:".red().bold(), .0.yellow())]
TimeRangeNegative(String),
#[error("{} could not skip a frame in a trajectory file", "error:".red().bold())]
SkipFailed,
#[error("{} unsupported iteration step '{}' - must be > 0", "error:".red().bold(), .0.to_string().yellow())]
InvalidStep(usize),
#[error("{} simulation box is invalid", "error:".red().bold())]
InvalidSimBox,
#[error("{} no trajectories provided for concatenation", "error:".red().bold())]
CatNoTrajectories,
#[error("{} could not construct a parallel trajectory iterator for file '{}'", "error:".red().bold(), path_to_yellow(.0))]
InvalidParallelIteration(Box<Path>),
#[error("{} could not get length of the trajectory '{}'", "error:".red().bold(), path_to_yellow(.0))]
CouldNotGetTrajLen(Box<Path>),
#[error("{} could not read frame in a trajectory file (molly error: '{}')", "error:".red().bold(), .0)]
MollyXtcError(String),
#[error("{} could not read magic number from a trajectory file (the file is empty?)", "error:".red().bold())]
CouldNotReadMagic,
#[error("{} file '{}' is not an xtc file (invalid magic number)", "error:".red().bold(), path_to_yellow(.0))]
NotXtc(Box<Path>),
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.yellow())]
GroupNotFound(String),
#[cfg(feature = "chemfiles")]
#[error("{} trajectory reading error: {}", "error:".red().bold(), .0)]
ChemfilesError(chemfiles::Error),
#[error("{} an unknown error occured when reading a trajectory: '{}'", "error:".red().bold(), .0.yellow())]
UnknownError(String),
#[error("{}", .0)]
GroSpecificError(ParseGroError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WriteTrajError {
#[error("{} writer to file '{}' is not associated with the system", "error:".red().bold(), .0.yellow())]
WriterNotFound(String),
#[error("{} writer to file '{}' is already associated with the system", "error:".red().bold(), .0.yellow())]
WriterAlreadyExists(String),
#[error("{} unable to work with path '{}'", "error:".red().bold(), path_to_yellow(.0))]
InvalidPath(Box<Path>),
#[error("{} file '{}' could not be created", "error:".red().bold(), path_to_yellow(.0))]
CouldNotCreate(Box<Path>),
#[error("{} could not write frame to a trajectory file", "error:".red().bold())]
CouldNotWrite,
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.yellow())]
GroupNotFound(String),
#[error("{} a coordinate is too large to be written in GRO format (supported range: {} to {} nm)", "error:".red().bold(), GRO_MIN_COORDINATE, GRO_MAX_COORDINATE)]
CoordinateTooLarge,
#[error("{} file '{}' has an unknown or unsupported file extension", "error:".red().bold(), path_to_yellow(.0))]
UnknownExtension(Box<Path>),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum SelectError {
#[error("{} the provided query is empty", "error:".red().bold())]
EmptyQuery,
#[error("{} invalid operator detected in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
InvalidOperator(String),
#[error("{} missing argument in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
MissingArgument(String),
#[error("{} empty argument in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
EmptyArgument(String),
#[error("{} unmatching parentheses in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
InvalidParentheses(String),
#[error("{} unmatching number of quotes in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
InvalidQuotes(String),
#[error("{} invalid token following or preceeding parentheses in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
InvalidTokenParentheses(String),
#[error("{} could not understand the residue/atom numbers in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
InvalidNumber(String),
#[error("{} group '{}' does not exist", "error:".red().bold(), .0.to_string().yellow())]
GroupNotFound(String),
#[error("{} label '{} does not exist", "error:".red().bold(), .0.to_string().yellow())]
LabelNotFound(String),
#[error("{} invalid chain identifier(s) in query '{}'", "error:".red().bold(), .0.to_string().yellow())]
InvalidChainId(String),
#[error("{} string '{}' is not a valid regular expression", "error:".red().bold(), .0.to_string().yellow())]
InvalidRegex(String),
#[error("{} regular expression '{}' matches no atom groups/labels in the system", "error:".red().bold(), .0.to_string().yellow())]
NoRegexMatch(String),
#[error("{} {}", "error:".red().bold(), .0)]
DeprecatedKeyword(&'static str),
#[error("{} the provided query '{}' could not be understood for unknown reason", "error:".red().bold(), .0.to_string().yellow())]
UnknownError(String),
}
#[derive(Error, Debug)]
pub enum ParseElementError {
#[error("{} file '{}' was not found", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} file '{}' could not be read", "error:".red().bold(), path_to_yellow(.0))]
FileCouldNotBeRead(Box<Path>),
#[error("{} could not parse yaml input as elements ({})", "error:".red().bold(), .0.to_string().yellow())]
CouldNotParseYaml(serde_yaml::Error),
#[error("{} element symbol '{}' corresponds to both '{}' and '{}'", "error:".red().bold(), .0.yellow(), .1.yellow(), .2.yellow())]
DuplicateSymbol(String, String, String),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ElementError {
#[error("{} (this error occured when guessing elements)", .0)]
InvalidQuery(SelectError),
#[error("{} when guessing elements, following concerns have been raised:\n{}", "warning:".yellow().bold(), .0.to_string())]
ElementGuessWarning(Box<ElementGuessInfo>),
#[error("{} when guessing properties, following concerns have been raised:\n{}", "warning:".yellow().bold(), .0.to_string())]
PropertiesGuessWarning(Box<PropertiesGuessInfo>),
#[error("{} when guessing bonds, following concerns have been raised:\n{}", "warning:".yellow().bold(), .0.to_string())]
BondsGuessWarning(Box<BondsGuessInfo>),
#[error("{} (this error occured when guessing bonds)", .0)]
BondGuessError(CellGridError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum SimBoxError {
#[error("{} system has no simulation box", "error:".red().bold())]
DoesNotExist,
#[error("{} simulation box is not orthogonal but is required to be", "error:".red().bold())]
NotOrthogonal,
#[error("{} all dimensions of the simulation box are zero", "error".red().bold())]
AllDimensionsZero,
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum PositionError {
#[error("{} atom with index '{}' has undefined position", "error:".red().bold(), .0.to_string().yellow())]
NoPosition(usize),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum MassError {
#[error("{} atom with index '{}' has undefined mass", "error:".red().bold(), .0.to_string().yellow())]
NoMass(usize),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum GridMapError {
#[error("{} grid map could not be created: invalid span", "error:".red().bold())]
InvalidSpan,
#[error("{} grid map could not be created: invalid grid tile dimensions", "error:".red().bold())]
InvalidGridTile,
#[error("{} grid map could not be written into output stream", "error:".red().bold())]
CouldNotWrite,
#[error("{} could not find grid map input file '{}'", "error:".red().bold(), path_to_yellow(.0))]
FileNotFound(Box<Path>),
#[error("{} could not read line in grid map input file '{}'", "error:".red().bold(), path_to_yellow(.0))]
CouldNotReadLine(Box<Path>),
#[error("{} could not parse line ('{}') in grid map input file '{}'", "error:".red().bold(), .0.yellow(), path_to_yellow(.1))]
CouldNotParseLine(String, Box<Path>),
#[error("{} grid map contains no grid tiles", "error:".red().bold())]
EmptyGridMap,
#[error("{} grid map expected '{}' values, got '{}' values", "error:".red().bold(), .0.to_string().yellow(), .1.to_string().yellow())]
InvalidMapDimensions(usize, usize),
#[error("{} invalid or inconsistent coordinates of a grid map: unexpected coordinate '{}'", "error:".red().bold(), .0.yellow())]
InvalidCoordinates(String),
#[error("{} coordinates of a grid map not specified in increasing order ('{}' is lower than '{}')", "error:".red().bold(), .0.yellow(), .1.yellow())]
NotIncreasing(String, String),
#[error("{} point with coordinates '{},{}' is defined multiple times", "error:".red().bold(), .0.yellow(), .1.yellow())]
PointDefinedMultipleTimes(String, String)
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum RMSDError {
#[error("{} group '{}' does not exist in the current or reference system", "error:".red().bold(), .0.yellow())]
NonexistentGroup(String),
#[error("{} group '{}' has an inconsistent number of atoms ('{}' atoms in reference, '{}' atoms in current)",
"error:".red().bold(),
.0.yellow(),
.1.to_string().yellow(),
.2.to_string().yellow())]
InconsistentGroup(String, usize, usize),
#[error("{} group '{}' is empty (RMSD can not be calculated)", "error:".red().bold(), .0.yellow())]
EmptyGroup(String),
#[error("{}", .0)]
InvalidPosition(PositionError),
#[error("{}", .0)]
InvalidSimBox(SimBoxError),
#[error("{}", .0)]
InvalidMass(MassError),
#[error("{}", .0)]
TrajectoryError(ReadTrajError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum HBondError {
#[error("{}", .0)]
SelectError(SelectError),
#[error("{}", .0)]
CellGridError(CellGridError),
#[error("{}", .0)]
AtomError(AtomError),
#[error("{}", .0)]
InvalidSimBox(SimBoxError),
#[error("{} no acceptor and no donor atoms detected for chain; chain can form no hydrogen bonds", "error:".red().bold())]
EmptyChain,
#[error("{} chain index '{}' requested for analysis of hydrogen bonds does not exist", "error:".red().bold(), .0.to_string().yellow())]
NonexistentChain(usize),
#[error("{} analysis of hydrogen bonds between chains '{}' and '{}' requested multiple times", "error:".red().bold(), .0.to_string().yellow(), .1.to_string().yellow())]
PairSpecifiedMultipleTimes(usize, usize),
#[error("{} not all chains specified for the analysis of hydrogen bonds are used", "error:".red().bold())]
UnusedChain,
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum TrajConvertError<ConvertError: std::error::Error> {
#[error("{}", .0)]
InvalidConverter(ConvertError),
#[error("{}", .0)]
ReadingError(ReadTrajError),
#[error("{}", .0)]
ConversionError(ConvertError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum TrajAnalysisError<AnalyzerError: std::error::Error> {
#[error("{}", .0)]
InvalidAnalyzer(AnalyzerError),
#[error("{}", .0)]
ReadingError(ReadTrajError),
#[error("{}", .0)]
AnalysisError(AnalyzerError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum TrajConvertAnalysisError<ConvertAnalyzerError: std::error::Error> {
#[error("{}", .0)]
InvalidConverterAnalyzer(ConvertAnalyzerError),
#[error("{}", .0)]
ReadingError(ReadTrajError),
#[error("{}", .0)]
ConversionAnalysisError(ConvertAnalyzerError),
}
#[derive(Error, Debug, PartialEq, Eq)]
pub enum CellGridError {
#[error("{}", .0)]
SimBoxError(SimBoxError),
#[error("{}", .0)]
GroupError(GroupError),
#[error("{}", .0)]
AtomError(AtomError),
#[error("{} minimal cell size for a cell grid must be larger than 0.0, not `{}`", "error:".red().bold(), .0.yellow())]
InvalidCellSize(String)
}