CASM  1.1.0
A Clusters Approach to Statistical Mechanics
OccLocation.hh
Go to the documentation of this file.
1 #ifndef CASM_Monte_OccLocation_HH
2 #define CASM_Monte_OccLocation_HH
3 
4 #include <vector>
5 
8 
9 class MTRand;
10 
11 namespace CASM {
12 
13 class Configuration;
14 class ConfigDoF;
15 
16 } // namespace CASM
17 
18 namespace CASM {
19 namespace Monte {
20 
21 class Conversions;
22 struct OccCandidate;
23 class OccSwap;
24 class OccCandidateList;
25 
27 struct Species {
28  Species(xtal::UnitCellCoord _bijk_begin) : bijk_begin(_bijk_begin) {}
29 
34 };
35 
39 struct Mol {
41  Index l;
45  std::vector<Index>
48 };
49 
50 struct OccTransform {
51  Index l;
56 };
57 
59  Index l;
62 };
63 
64 struct SpeciesTraj {
67 };
68 
69 struct OccEvent {
70  std::vector<OccTransform> occ_transform;
71  std::vector<SpeciesTraj> species_traj;
72 };
73 
76 class OccLocation {
77  public:
78  typedef Index size_type;
79 
80  OccLocation(const Conversions &_convert, const OccCandidateList &_cand);
81 
83  void initialize(const Configuration &config);
84 
86  size_type size() const;
87 
88  Mol &mol(Index mol_id);
89 
90  const Mol &mol(Index mol_id) const;
91 
93  size_type cand_size(Index cand_index) const;
94 
96  size_type cand_size(const OccCandidate &cand) const;
97 
99  Index mol_id(Index cand_index, Index loc) const;
100 
102  Index mol_id(const OccCandidate &cand, Index loc) const;
103 
105  Index l_to_mol_id(Index l) const;
106 
109  const std::vector<OccSwap> &canonical_swap,
110  MTRand &mtrand) const;
111 
114  MTRand &mtrand) const;
115 
117  void apply(const OccEvent &e, ConfigDoF &configdof);
118 
119  private:
121  OccEvent &_propose(OccEvent &e, const OccSwap &swap, MTRand &mtrand,
122  Index cand_a, Index cand_b, Index size_a,
123  Index size_b) const;
124 
126  OccEvent &_propose(OccEvent &e, const OccSwap &swap, MTRand &mtrand) const;
127 
129 
131 
134  std::vector<std::vector<Index> > m_loc;
135 
137  std::vector<Species> m_species;
138 
140  std::vector<Mol> m_mol;
141 
143  std::vector<Index> m_l_to_mol;
144 
146  bool m_kmc;
147 
149  std::vector<Mol> m_tmol;
150 
152  mutable std::vector<double> m_tsum;
153 };
154 
155 } // namespace Monte
156 } // namespace CASM
157 
158 #endif
Stores data to enable efficient proposal and update of occupation mutation.
Definition: OccLocation.hh:76
std::vector< Index > m_l_to_mol
l_to_mol[l] -> Mol.id, m_mol.size() otherwise
Definition: OccLocation.hh:143
Index mol_id(Index cand_index, Index loc) const
Mol.id of a particular OccCandidate type.
Definition: OccLocation.cc:90
OccEvent & _propose(OccEvent &e, const OccSwap &swap, MTRand &mtrand, Index cand_a, Index cand_b, Index size_a, Index size_b) const
Canonical propose.
Definition: OccLocation.cc:192
size_type cand_size(Index cand_index) const
Total number of mutating sites, of OccCandidate type, specified by index.
Definition: OccLocation.cc:80
std::vector< Mol > m_mol
Holds Mol objects, one for each mutating site in the configuration.
Definition: OccLocation.hh:140
bool m_kmc
If true, update Species location during apply.
Definition: OccLocation.hh:146
OccEvent & propose_grand_canonical(OccEvent &e, const OccSwap &swap, MTRand &mtrand) const
Propose grand canonical OccEvent.
Definition: OccLocation.cc:128
std::vector< Species > m_species
Holds Monte::Species objects.
Definition: OccLocation.hh:137
const OccCandidateList & m_cand
Definition: OccLocation.hh:130
void apply(const OccEvent &e, ConfigDoF &configdof)
Update configdof and this to reflect that event 'e' occurred.
Definition: OccLocation.cc:147
Index l_to_mol_id(Index l) const
Convert from config index to variable site index.
Definition: OccLocation.cc:100
Mol & mol(Index mol_id)
Definition: OccLocation.cc:75
OccLocation(const Conversions &_convert, const OccCandidateList &_cand)
Definition: OccLocation.cc:11
const Conversions & m_convert
Definition: OccLocation.hh:128
std::vector< std::vector< Index > > m_loc
Definition: OccLocation.hh:134
size_type size() const
Total number of mutating sites.
Definition: OccLocation.cc:73
OccEvent & propose_canonical(OccEvent &e, const std::vector< OccSwap > &canonical_swap, MTRand &mtrand) const
Propose canonical OccEvent.
Definition: OccLocation.cc:103
void initialize(const Configuration &config)
Fill tables with occupation info.
Definition: OccLocation.cc:16
std::vector< double > m_tsum
Data used by propose_canonical.
Definition: OccLocation.hh:152
std::vector< Mol > m_tmol
Data structure used store temporaries during apply.
Definition: OccLocation.hh:149
Store swap type, mutating sites, and info for keeping OccLocation up-to-date.
Definition: OccCandidate.hh:71
Unit Cell Coordinates.
ConfigIO::GenericConfigFormatter< jsonParser > config()
Definition: ConfigIO.cc:777
Main CASM namespace.
Definition: APICommand.hh:8
void swap(ConfigDoF &A, ConfigDoF &B)
Definition: ConfigDoF.cc:260
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Represents the occupant on a site.
Definition: OccLocation.hh:39
Index loc
Location in OccLocation.m_loc.
Definition: OccLocation.hh:47
Index id
Location in OccLocation.m_mol.
Definition: OccLocation.hh:40
std::vector< Index > component
Location of component Specie in OccLocation.m_species.
Definition: OccLocation.hh:46
Index asym
Asym unit index (must be consistent with l)
Definition: OccLocation.hh:42
Index l
Location in config.
Definition: OccLocation.hh:41
std::vector< SpeciesTraj > species_traj
Definition: OccLocation.hh:71
std::vector< OccTransform > occ_transform
Definition: OccLocation.hh:70
Index mol_id
Location in OccLocation.m_mol.
Definition: OccLocation.hh:52
Index from_species
Species index before transformation.
Definition: OccLocation.hh:54
Index asym
Asym index.
Definition: OccLocation.hh:53
Index l
Config occupant that is being transformed.
Definition: OccLocation.hh:51
Index to_species
Species index after transformation.
Definition: OccLocation.hh:55
Represents an indivisible molecule component.
Definition: OccLocation.hh:27
Index id
Location in OccLocation.m_species.
Definition: OccLocation.hh:31
xtal::UnitCellCoord bijk_begin
Saves initial position.
Definition: OccLocation.hh:32
Index mol_comp_begin
Saves initial Mol.component index.
Definition: OccLocation.hh:33
Species(xtal::UnitCellCoord _bijk_begin)
Definition: OccLocation.hh:28
Index species_index
Species type index.
Definition: OccLocation.hh:30
Index mol_comp
Location in mol.components.
Definition: OccLocation.hh:61
Index l
Config occupant that is being transformed.
Definition: OccLocation.hh:59
Index mol_id
Location in OccLocation.m_mol.
Definition: OccLocation.hh:60
SpeciesLocation from
Definition: OccLocation.hh:65
SpeciesLocation to
Definition: OccLocation.hh:66