1 #ifndef CASM_enumerator_io_formatter_ConfigEnumIO_impl
2 #define CASM_enumerator_io_formatter_ConfigEnumIO_impl
33 template <
typename EnumeratorType,
typename InitialStateType>
38 return adaptable.configuration;
41 template <
typename EnumeratorType,
typename InitialStateType>
46 return adaptable.configuration.supercell();
51 namespace ConfigEnumIO {
53 template <
typename ConfigEnumDataType>
56 "name",
"Configuration name, if inserted, else \"none\"",
58 if (data.is_excluded_by_filter) {
61 if (data.insert_result.canonical_it ==
62 data.primclex.template db<Configuration>().end()) {
65 return data.insert_result.canonical_it->name();
69 template <
typename ConfigEnumDataType>
72 "selected",
"True if configuration exists in database, else false",
74 if (data.is_excluded_by_filter) {
77 return data.insert_result.canonical_it !=
78 data.primclex.template db<Configuration>().end();
82 template <
typename ConfigEnumDataType>
86 "True if canonical configuration did not exist before insertion. False "
87 "if not checked or was existing before insertion.",
89 if (data.is_excluded_by_filter) {
92 return data.insert_result.insert_canonical;
96 template <
typename ConfigEnumDataType>
100 "True if canonical configuration did exist before insertion. False if "
101 "not checked or not existing before insertion.",
103 if (data.is_excluded_by_filter) {
106 return !data.insert_result.insert_canonical;
110 template <
typename ConfigEnumDataType>
113 "is_excluded_by_filter",
114 "True if configuration was excluded by the filter, else false.",
116 return data.is_excluded_by_filter;
120 template <
typename ConfigEnumDataType>
123 "initial_state_index",
"Initial state index. From 0.",
127 template <
typename ConfigEnumDataType>
130 "initial_state_name",
131 "Initial state name. Typically the initital state configuration name "
132 "plus description of selected sites.",
136 template <
typename ConfigEnumDataType>
140 "initial_state_configname",
"Initial state configuration name.",
142 return data.initial_state.configuration().
name();
146 template <
typename ConfigEnumDataType>
151 "Indices of selected sites in the initial state configuration. JSON "
154 auto const &sites = data.initial_state->sites();
155 return std::vector<Index>{sites.begin(), sites.end()};
159 template <
typename ConfigEnumDataType>
163 "Number of selected sites in the initial state configuration.",
165 return data.initial_state.sites().size();
171 template <
typename EnumeratorType>
173 std::stringstream msg;
174 msg <<
"Error in get_normal_coordinate: Not supported for this enumerator '"
175 << type_name<EnumeratorType>() <<
"'";
176 throw std::runtime_error(msg.str());
179 template <
typename ConfigEnumDataType>
184 "Normal coordinate used to generate DoF value. Supported enumerators "
Represents a supercell of the primitive parent crystal structure.
GenericDatumFormatter< std::string, ConfigEnumDataType > name()
GenericDatumFormatter< std::string, ConfigEnumDataType > initial_state_configname()
GenericDatumFormatter< bool, ConfigEnumDataType > is_new()
GenericDatumFormatter< bool, ConfigEnumDataType > is_existing()
GenericDatumFormatter< Index, ConfigEnumDataType > initial_state_index()
GenericDatumFormatter< std::string, ConfigEnumDataType > initial_state_name()
Generic1DDatumFormatter< std::vector< Index >, ConfigEnumDataType > selected_sites()
Generic1DDatumFormatter< Eigen::VectorXd, ConfigEnumDataType > normal_coordinate()
GenericDatumFormatter< bool, ConfigEnumDataType > selected()
GenericDatumFormatter< Index, ConfigEnumDataType > n_selected_sites()
GenericDatumFormatter< bool, ConfigEnumDataType > is_excluded_by_filter()
Eigen::VectorXd get_normal_coordinate(EnumeratorType const &enumerator)
ConfigEnumData< ConfigEnumSiteDoFs, ConfigEnumInput > ConfigEnumDataType