CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
API

Detailed Description

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...
 

Macros

#define ERR_INVALID_ARG   1
 
#define ERR_UNKNOWN   2
 
#define ERR_NO_PROJ   3
 
#define ERR_INVALID_INPUT_FILE   4
 
#define ERR_MISSING_INPUT_FILE   5
 
#define ERR_EXISTING_FILE   6
 
#define ERR_MISSING_DEPENDS   7
 
#define ERR_OTHER_PROJ   8
 

Typedefs

typedef std::function< int(const
CommandArgs &)> 
CASM::Command
 
typedef std::map< std::string,
Command > 
CASM::CommandMap
 

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...
 
PrimClex & CASM::make_primclex_if_not (const CommandArgs &args, std::unique_ptr< PrimClex > &uniq_primclex, Log &status_log)
 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 args.log. More...
 
int CASM::bset_command (const CommandArgs &args)
 
int CASM::composition_command (const CommandArgs &args)
 
int CASM::enum_command (const CommandArgs &args)
 
int CASM::files_command (const CommandArgs &args)
 
int CASM::format_command (const CommandArgs &args)
 
int CASM::import_command (const CommandArgs &args)
 
int CASM::init_command (const CommandArgs &args)
 
int CASM::monte_command (const CommandArgs &args)
 
int CASM::perturb_command (const CommandArgs &args)
 
int CASM::query_command (const CommandArgs &args)
 
int CASM::ref_command (const CommandArgs &args)
 
int CASM::rm_command (const CommandArgs &args)
 
int CASM::run_command (const CommandArgs &args)
 
int CASM::select_command (const CommandArgs &args)
 
int CASM::settings_command (const CommandArgs &args)
 
int CASM::status_command (const CommandArgs &args)
 
int CASM::super_command (const CommandArgs &args)
 
int CASM::sym_command (const CommandArgs &args)
 
int CASM::update_command (const CommandArgs &args)
 
int CASM::version_command (const CommandArgs &args)
 
int CASM::view_command (const CommandArgs &args)
 
typedef struct cPrimClex cPrimClex
 For CASM::PrimClex*. More...
 
typedef struct costream costream
 For std::ostream*. More...
 
costreamcasm_STDOUT ()
 
costreamcasm_STDERR ()
 
costreamcasm_nullstream_new ()
 
costreamcasm_ostringstream_new ()
 
void casm_ostringstream_delete (costream *ptr)
 
unsigned long casm_ostringstream_size (costream *ptr)
 
char * casm_ostringstream_strcpy (costream *ptr, char *c_str)
 
cPrimClexcasm_primclex_null ()
 
cPrimClexcasm_primclex_new (char *path, costream *log, costream *debug_log, costream *err_log)
 
void casm_primclex_delete (cPrimClex *ptr)
 
void casm_primclex_refresh (cPrimClex *ptr, bool read_settings, bool read_composition, bool read_chem_ref, bool read_configs, bool clear_clex)
 
void casm_command_list (costream *ostringstream_log)
 
int casm_capi (char *args, cPrimClex *primclex, char *root, costream *log, costream *debug_log, costream *err_log)
 

Macro Definition Documentation

#define ERR_EXISTING_FILE   6

Definition at line 45 of file casm_functions.hh.

#define ERR_INVALID_ARG   1

Definition at line 30 of file casm_functions.hh.

#define ERR_INVALID_INPUT_FILE   4

Definition at line 39 of file casm_functions.hh.

#define ERR_MISSING_DEPENDS   7

Definition at line 49 of file casm_functions.hh.

#define ERR_MISSING_INPUT_FILE   5

Definition at line 42 of file casm_functions.hh.

#define ERR_NO_PROJ   3

Definition at line 36 of file casm_functions.hh.

#define ERR_OTHER_PROJ   8

Definition at line 52 of file casm_functions.hh.

#define ERR_UNKNOWN   2

Definition at line 33 of file casm_functions.hh.

Typedef Documentation

typedef std::function<int (const CommandArgs &)> CASM::Command

Definition at line 135 of file casm_functions.hh.

typedef std::map<std::string, Command> CASM::CommandMap

Definition at line 136 of file casm_functions.hh.

typedef struct costream costream

For std::ostream*.

Definition at line 12 of file api.hh.

typedef struct cPrimClex cPrimClex

For CASM::PrimClex*.

Definition at line 9 of file api.hh.

Function Documentation

int CASM::bset_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 36 of file bset.cc.

int CASM::casm_api ( const CommandArgs &  args)

Executes CASM commands specified by args.

Definition at line 199 of file casm_functions.cc.

int casm_capi ( char *  args,
cPrimClex primclex,
char *  root,
costream log,
costream debug_log,
costream err_log 
)

Definition at line 85 of file api.cc.

void casm_command_list ( costream ostringstream_log)

Definition at line 73 of file api.cc.

costream* casm_nullstream_new ( )
void casm_ostringstream_delete ( costream ptr)

Definition at line 32 of file api.cc.

costream* casm_ostringstream_new ( )

Definition at line 28 of file api.cc.

unsigned long casm_ostringstream_size ( costream ptr)

Definition at line 36 of file api.cc.

char* casm_ostringstream_strcpy ( costream ptr,
char *  c_str 
)

Definition at line 41 of file api.cc.

void casm_primclex_delete ( cPrimClex ptr)

Definition at line 59 of file api.cc.

cPrimClex* casm_primclex_new ( char *  path,
costream log,
costream debug_log,
costream err_log 
)

Definition at line 51 of file api.cc.

cPrimClex* casm_primclex_null ( )

Definition at line 47 of file api.cc.

void casm_primclex_refresh ( cPrimClex ptr,
bool  read_settings,
bool  read_composition,
bool  read_chem_ref,
bool  read_configs,
bool  clear_clex 
)

Definition at line 63 of file api.cc.

costream* casm_STDERR ( )

Definition at line 18 of file api.cc.

costream* casm_STDOUT ( )

Definition at line 14 of file api.cc.

CommandMap & CASM::command_map ( )

Return static CommandMap containing all CASM API commands.

Definition at line 111 of file casm_functions.cc.

int CASM::composition_command ( const CommandArgs &  args)

–help option

–help option

Definition at line 69 of file composition.cc.

int CASM::enum_command ( const CommandArgs &  args)

–help option

–help option

Definition at line 51 of file enum.cc.

int CASM::files_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 47 of file files.cc.

int CASM::format_command ( const CommandArgs &  args)

–help option

–help option

Definition at line 44 of file format.cc.

int CASM::help_command ( const CommandArgs &  args)

Print CASM help info to args.log.

Definition at line 311 of file casm_functions.cc.

int CASM::import_command ( const CommandArgs &  args)

Import proceeds in two steps. 1) read each file, map it onto a Configuration of the PrimClex

  • record relaxation data for each one

2) If data import was requested, iterate over each import record and do the following:

  • if multiple imported structures map onto a configuration for which there is no calculation data, import calculation data from the structure with the lowest mapping cost
  • if one or more imported structuress map onto a configuration for which calculation data already exist, do not import any new data
  • if data is imported, the corresponding properties.calc.json file is copied into the directory of the mapped configuration. A structure file, relaxed_structure.vasp is also written to the directory.
  • relaxed_structure.vasp gives the relaxed structure in a setting and orientation that matches the generated POS file

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 95 of file import.cc.

int CASM::init_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Check if PRIM is primitive

Check that the PRIM is in reduced form:

Set command line options using boost program_options

–help option

Check if PRIM is primitive

Check that the PRIM is in reduced form:

Definition at line 28 of file init.cc.

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.

Parameters
outputOutput mode: False: use 'sout', True: check 'out_path' and 'gzip' to decide
soutstream to use if not writing to file
foutwill be given an open file if writing to file
out_path,whereto write if 'output': if "STDOUT", use 'sout'; otherwise filename
gzipif true, write to gzip file
Returns
reference to stream to use

Definition at line 287 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.

Parameters
argsCommandArgs reference
uniq_primclexReference to null std::unique_ptr<PrimClex> to manage PrimClex, if it is constructed
Returns
reference to PrimClex (either newly constructed managed by uniq_primclex, or existing pointed at by args.primclex)

Definition at line 255 of file casm_functions.cc.

PrimClex & CASM::make_primclex_if_not ( const CommandArgs &  args,
std::unique_ptr< PrimClex > &  uniq_primclex,
Log &  status_log 
)

If !_primclex, construct new PrimClex stored in uniq_primclex, then return reference to existing or constructed PrimClex.

Parameters
argsCommandArgs reference
uniq_primclexReference to null std::unique_ptr<PrimClex> to manage PrimClex, if it is constructed
status_logwhere to print PrimClex construction messages
Returns
reference to PrimClex (either newly constructed managed by uniq_primclex, or existing pointed at by args.primclex)

Definition at line 269 of file casm_functions.cc.

int CASM::monte_command ( const CommandArgs &  args)

–help option

–help option

Definition at line 106 of file monte.cc.

int CASM::perturb_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 35 of file perturb.cc.

int CASM::query_command ( const CommandArgs &  args)

Start –help option

Finish –help option

Start –help option

Finish –help option

Definition at line 81 of file query.cc.

int CASM::ref_command ( const CommandArgs &  args)

–help option

–help option

Definition at line 161 of file ref.cc.

int CASM::rm_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 44 of file rm.cc.

int CASM::run_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 35 of file run.cc.

int CASM::select_command ( const CommandArgs &  args)

Set command line options using boost program_options

Only write selection to disk past this point

Set command line options using boost program_options

Only write selection to disk past this point

Definition at line 168 of file select.cc.

int CASM::settings_command ( const CommandArgs &  args)

Set command line options using boost program_options

Set command line options using boost program_options

Definition at line 257 of file settings.cc.

int CASM::status_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

1) Check if a project exists

2) Composition axes

3) Configuration generation

4) Calculate configuration properties

5) Choose chemical reference

6) Generate basis functions:

7) Fit effective cluster interactions (ECI):

7) Monte Carlo

Set command line options using boost program_options

–help option

1) Check if a project exists

2) Composition axes

3) Configuration generation

4) Calculate configuration properties

5) Choose chemical reference

6) Generate basis functions:

7) Fit effective cluster interactions (ECI):

7) Monte Carlo

Definition at line 389 of file status.cc.

int CASM::super_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

enforce a minimum volume

enforce a minimum volume

Set command line options using boost program_options

–help option

enforce a minimum volume

enforce a minimum volume

Definition at line 103 of file super.cc.

int CASM::sym_command ( const CommandArgs &  args)

Set command line options using boost program_options

–help option

Set command line options using boost program_options

–help option

Definition at line 32 of file sym.cc.

int CASM::update_command ( const CommandArgs &  args)

–help option

Read properties.calc.json file containing externally calculated properties location: casmroot/supercells/SCEL_NAME/CONFIG_ID/CURR_CALCTYPE/properties.calc.json

Will read as many curr_property as found in properties.calc.json

properties.calc.json: contains calculated properties Currently only loading those properties that have references

–help option

Read properties.calc.json file containing externally calculated properties location: casmroot/supercells/SCEL_NAME/CONFIG_ID/CURR_CALCTYPE/properties.calc.json

Will read as many curr_property as found in properties.calc.json

properties.calc.json: contains calculated properties Currently only loading those properties that have references

Definition at line 62 of file update.cc.

int CASM::version_command ( const CommandArgs &  args)

Definition at line 339 of file casm_functions.cc.

int CASM::view_command ( const CommandArgs &  args)

–help option

–help option

Definition at line 26 of file view.cc.