Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::IO Namespace Reference

Input and output. More...

Data Structures

struct  BinaryHandler
 Binary file IO. More...
 
struct  SmilesBondStereo
 Helper class to represent the stereo configuration of a double bond as indicated in a SMILES string. More...
 
class  MoleculeBuilder
 Semantic interpreter of the smiles grammar, constructs molecules from the data accrued by the parser. More...
 
struct  ElementData
 
struct  ChiralData
 
struct  AtomData
 
struct  BondData
 
class  LineNotation
 Provides Molecule instances from line notations of molecules such as SMILES and InChI. More...
 

Functions

std::pair
< Utils::AtomCollection,
Utils::BondOrderCollection
exchangeFormat (const Molecule &molecule, AngstromPositions angstromWrapper)
 Extract exchange format information from a molecule and positional data. More...
 
std::pair
< Utils::AtomCollection,
Utils::BondOrderCollection
exchangeFormat (const Molecule &molecule, const Utils::PositionCollection &positions)
 
std::tuple
< Utils::AtomCollection,
Utils::BondOrderCollection,
std::vector< AtomIndex > > 
shuffle (const Utils::AtomCollection &ac, const Utils::BondOrderCollection &bos)
 Applies a random atom index permutation to exchange data. More...
 
Molecule read (const std::string &filename)
 Read a single molecule from a file. More...
 
std::vector< Moleculesplit (const std::string &filename)
 Read multiple molecules from a file. More...
 
void write (const std::string &filename, const Molecule &molecule, const AngstromPositions &angstromWrapper)
 Writer function for various chemical formats. More...
 
void write (const std::string &filename, const Molecule &molecule, const Utils::PositionCollection &positions)
 
void write (const std::string &filename, const Molecule &molecule)
 Writer function for Molecule serializations and graphviz representations. More...
 

Detailed Description

Input and output.

Function Documentation

std::pair<Utils::AtomCollection, Utils::BondOrderCollection> Scine::Molassembler::IO::exchangeFormat ( const Molecule &  molecule,
AngstromPositions  angstromWrapper 
)

Extract exchange format information from a molecule and positional data.

Complexity \(\Theta(N + B)\)

std::pair<Utils::AtomCollection, Utils::BondOrderCollection> Scine::Molassembler::IO::exchangeFormat ( const Molecule &  molecule,
const Utils::PositionCollection &  positions 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Molecule Scine::Molassembler::IO::read ( const std::string &  filename)

Read a single molecule from a file.

Complexity \(\Theta(N)\) typically

Exceptions
Ifinterpretation of coordinates and connectivity yields multiple molecules.
Note
Interprets file type from extension. mol is a MOLFile, xyz an XYZ file and cbor/bson/json are serializations of Molecule
std::tuple<Utils::AtomCollection, Utils::BondOrderCollection, std::vector<AtomIndex> > Scine::Molassembler::IO::shuffle ( const Utils::AtomCollection &  ac,
const Utils::BondOrderCollection &  bos 
)

Applies a random atom index permutation to exchange data.

Complexity \(\Theta(N + B)\)

std::vector<Molecule> Scine::Molassembler::IO::split ( const std::string &  filename)

Read multiple molecules from a file.

Complexity \(\Theta(N)\) typically

Note
Interprets file format from its extension. See read()
Serializations of Molecules cannot be split, they always contain only a single molecule. Use read() instead.
void Scine::Molassembler::IO::write ( const std::string &  filename,
const Molecule &  molecule,
const AngstromPositions &  angstromWrapper 
)

Writer function for various chemical formats.

For exceptions this might throw,

See Also
Utils::ChemicalFileHandler::write

Complexity \(\Theta(N)\)

Note
Interprets which file type is to be written from filename extension.
Unless the file format is .json or .masm, canonicalization state of Molecule instances is lost.
void Scine::Molassembler::IO::write ( const std::string &  filename,
const Molecule &  molecule,
const Utils::PositionCollection &  positions 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void Scine::Molassembler::IO::write ( const std::string &  filename,
const Molecule &  molecule 
)

Writer function for Molecule serializations and graphviz representations.

Complexity \(\Theta(V + E + A + B)\)

Note
Canonicalization state is retained using the molecule serializations.
Exceptions
std::logic_errorIf the file extension does not match .cbor, .bson, .json, .dot or .svg
std::runtime_errorIf the file extension is .svg but the dot binary is not found in the path