CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
Relates to the CASM API.
All primary CASM functionality is included in the CASM library 'libcasm'.
The CASM API refers to the actions that can be performed by passing string commands through the extern "C" function casm_capi which in turn calls functions in libcasm. The casm_capi function and a limited set of others that allow for constructing PrimClex objects and input/output streams are available in the library 'libccasm'.
The CASM API is primarily intended to be used via the command line executable 'casm', which provides documentation of the allowed options, or the 'casm' Python package, but can be also be accessed directly to enable integration with other software.
Classes | |
struct | CASM::CommandArgs |
Data structure holding basic CASM command info. More... | |
class | CASM::InterfaceBase< OptionType > |
Base class for generic use of algorithms through the API. More... | |
Typedefs | |
typedef std::function< int(const CommandArgs &)> | CASM::Command |
typedef std::map< std::string, Command > | CASM::CommandMap |
template<typename OptionType > | |
using | CASM::InterfaceMap = notstd::unique_cloneable_map< std::string, InterfaceBase< OptionType > > |
Used to hold a list of all algorithms that may be accessed via the API. More... | |
Functions | |
CommandMap & | CASM::command_map () |
Return static CommandMap containing all CASM API commands. More... | |
int | CASM::casm_api (const CommandArgs &args) |
Executes CASM commands specified by args. More... | |
PrimClex & | CASM::make_primclex_if_not (const CommandArgs &args, std::unique_ptr< PrimClex > &uniq_primclex) |
If !_primclex, construct new PrimClex stored in uniq_primclex, then return reference to existing or constructed PrimClex. More... | |
std::ostream & | CASM::make_ostream_if (bool output, std::ostream &sout, std::unique_ptr< std::ostream > &fout, fs::path out_path, bool gzip) |
Return a reference to proper std::ostream. More... | |
int | CASM::help_command (const CommandArgs &args) |
Print CASM help info to log() More... | |
int | CASM::version_command (const CommandArgs &args) |
template<typename OptionType > | |
std::unique_ptr< InterfaceMap< OptionType > > | CASM::make_interface_map () |
Use to construct an InterfaceMap. More... | |
typedef struct cPrimClex | cPrimClex |
For CASM::PrimClex*. More... | |
typedef struct costream | costream |
For std::ostream*. More... | |
costream * | casm_STDOUT () |
costream * | casm_STDERR () |
costream * | casm_nullstream_new () |
costream * | casm_ostringstream_new () |
void | casm_ostringstream_delete (costream *ptr) |
unsigned long | casm_ostringstream_size (costream *ptr) |
char * | casm_ostringstream_strcpy (costream *ptr, char *c_str) |
cPrimClex * | casm_primclex_null () |
cPrimClex * | casm_primclex_new (char *path, costream *log, costream *err_log) |
void | casm_primclex_delete (cPrimClex *ptr) |
void | casm_primclex_refresh (cPrimClex *ptr, costream *log, costream *err_log, bool read_settings, bool read_composition, bool read_chem_ref, bool read_configs, bool clear_clex) |
void | casm_command_list (costream *ostringstream_log) |
Print to log the recognized casm commands as a JSON array. More... | |
int | casm_capi (char *args, cPrimClex *primclex, char *root, costream *log, costream *err_log) |
typedef std::function<int(const CommandArgs &)> CASM::Command |
Definition at line 85 of file casm_functions.hh.
typedef std::map<std::string, Command> CASM::CommandMap |
Definition at line 86 of file casm_functions.hh.
For CASM::PrimClex*.
using CASM::InterfaceMap = typedef notstd::unique_cloneable_map<std::string, InterfaceBase<OptionType> > |
Used to hold a list of all algorithms that may be accessed via the API.
Definition at line 114 of file casm_functions.hh.
int CASM::casm_api | ( | const CommandArgs & | args | ) |
Executes CASM commands specified by args.
Definition at line 201 of file casm_functions.cc.
void casm_command_list | ( | costream * | ostringstream_log | ) |
costream* casm_nullstream_new | ( | ) |
char* casm_ostringstream_strcpy | ( | costream * | ptr, |
char * | c_str | ||
) |
CommandMap & CASM::command_map | ( | ) |
Return static CommandMap containing all CASM API commands.
Definition at line 115 of file casm_functions.cc.
int CASM::help_command | ( | const CommandArgs & | args | ) |
Definition at line 277 of file casm_functions.cc.
std::unique_ptr<InterfaceMap<OptionType> > CASM::make_interface_map | ( | ) |
Use to construct an InterfaceMap.
Definition at line 142 of file casm_functions.hh.
std::ostream & CASM::make_ostream_if | ( | bool | output, |
std::ostream & | sout, | ||
std::unique_ptr< std::ostream > & | fout, | ||
fs::path | out_path, | ||
bool | gzip | ||
) |
Return a reference to proper std::ostream.
output | Output mode: False: use 'sout', True: check 'out_path' and 'gzip' to decide |
sout | stream to use if not writing to file |
fout | will be given an open file if writing to file |
out_path,where | to write if 'output': if "STDOUT", use 'sout'; otherwise filename |
gzip | if true, write to gzip file |
Definition at line 254 of file casm_functions.cc.
PrimClex & CASM::make_primclex_if_not | ( | const CommandArgs & | args, |
std::unique_ptr< PrimClex > & | uniq_primclex | ||
) |
If !_primclex, construct new PrimClex stored in uniq_primclex, then return reference to existing or constructed PrimClex.
args | CommandArgs reference |
uniq_primclex | Reference to null std::unique_ptr<PrimClex> to manage PrimClex, if it is constructed |
Definition at line 235 of file casm_functions.cc.
int CASM::version_command | ( | const CommandArgs & | args | ) |
Definition at line 308 of file casm_functions.cc.