137 int scel_volume = scel.
volume();
140 int prim_basis = scel.
prim().
basis().size();
141 std::vector<std::string> allowed_components =
145 for (
Index prim_basis_site = 0; prim_basis_site < prim_basis;
149 const auto &allowed =
150 scel.
prim().
basis()[prim_basis_site].allowed_occupants();
151 std::vector<std::string> site_allowed_occ(allowed.cbegin(), allowed.cend());
153 if (site_allowed_occ.size() > 1) {
156 std::vector<std::vector<int> > single_possible_swap;
160 std::vector<int> single_site_to_mol;
164 for (
int possible_curr_occ = 0;
165 possible_curr_occ < site_allowed_occ.size(); possible_curr_occ++) {
168 std::vector<int> swaps;
172 for (
int other_curr_occ = 0; other_curr_occ < site_allowed_occ.size();
174 if (possible_curr_occ != other_curr_occ) {
175 swaps.push_back(other_curr_occ);
181 single_possible_swap.push_back(swaps);
186 std::find(allowed_components.cbegin(), allowed_components.cend(),
187 site_allowed_occ[possible_curr_occ]) -
188 allowed_components.cbegin();
191 if (mol_ind == allowed_components.size()) {
192 std::cerr <<
"ERROR in Monte::populate_occ_exchange_tables"
194 std::cerr <<
"The possible components are " << allowed_components
196 std::cerr <<
"Could not find "
197 << allowed_components[possible_curr_occ]
198 <<
" in the allowed components of the PrimClex prim."
204 single_site_to_mol.push_back(mol_ind);
221 for (
int variable_site = prim_basis_site * scel_volume;
222 variable_site < prim_basis_site * scel_volume + scel_volume;
229 m_sublat.push_back(prim_basis_site);
238 std::vector<int> single_site_to_mol;
241 std::string only_site_occ =
242 scel.
prim().
basis()[prim_basis_site].allowed_occupants()[0];
246 int mol_ind =
std::find(allowed_components.cbegin(),
247 allowed_components.cend(), only_site_occ) -
248 allowed_components.cbegin();
249 if (mol_ind == allowed_components.size()) {
250 std::cerr <<
"ERROR in Monte::populate_occ_exchange_tables"
252 std::cerr <<
"The possible components are " << allowed_components
254 std::cerr <<
"Could not find " << only_site_occ
255 <<
" in the allowed components of the PrimClex prim."
262 std::vector<std::vector<int> > single_possible_swap;
266 single_site_to_mol.push_back(mol_ind);
std::vector< std::string > components() const
The order of components in mol composition vectors.
std::vector< int > m_sublat
m_sublat[i] is the sublattice index for site m_variable_sites[i]
SiteExchanger(const Supercell &scel)
Constructor determine possible swaps in the given Supercell.
std::vector< Index > m_variable_sites
std::vector of indices into occupation array of m_confdof that have more than one allowed occupant
std::vector< std::vector< int > > m_sublat_to_mol
Map the integer values from the possible swaps or variable sites arrays into actual species m_sublat_...
std::vector< std::vector< std::vector< int > > > m_possible_swap
For a given sublattice with a particular occupant, show what OTHER occupants it could be m_possible_s...
const std::vector< xtal::Site > & basis() const
Represents a supercell of the primitive parent crystal structure.
const PrimClex & primclex() const
Use while transitioning Supercell to no longer need a PrimClex const *
Index volume() const
Return number of primitive cells that fit inside of *this.
const Structure & prim() const
const CompositionConverter & composition_axes() const
const Access CompositionConverter object
Iterator find(Iterator begin, Iterator end, const T &value, BinaryCompare q)
Equivalent to std::find(begin, end, value), but with custom comparison.
INDEX_TYPE Index
For long integer indexing: