CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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>
7 
8 class MTRand;
9 
10 namespace CASM {
11 
12  class Configuration;
13  class ConfigDoF;
14 
15  namespace Monte {
16 
17  class Conversions;
18  struct OccCandidate;
19  class OccSwap;
20  class OccCandidateList;
21 
23  struct Species {
28  };
29 
33  struct Mol {
35  Index l;
38  std::vector<Index> component;
40  };
41 
42  struct OccTransform {
43  Index l;
48  };
49 
50  struct SpecieLocation {
51  Index l;
54  };
55 
56  struct SpecieTraj {
59  };
60 
61  struct OccEvent {
62  std::vector<OccTransform> occ_transform;
63  std::vector<SpecieTraj> species_traj;
64  };
65 
66 
68  class OccLocation {
69 
70  public:
71 
72  typedef Index size_type;
73 
74  OccLocation(const Conversions &_convert, const OccCandidateList &_cand);
75 
77  void initialize(const Configuration &config);
78 
80  size_type size() const;
81 
82  Mol &mol(Index mol_id);
83 
84  const Mol &mol(Index mol_id) const;
85 
87  size_type cand_size(Index cand_index) const;
88 
90  size_type cand_size(const OccCandidate &cand) const;
91 
93  Index mol_id(Index cand_index, Index loc) const;
94 
96  Index mol_id(const OccCandidate &cand, Index loc) const;
97 
99  Index l_to_mol_id(Index l) const;
100 
102  OccEvent &propose_canonical(OccEvent &e, const std::vector<OccSwap> &canonical_swap, MTRand &mtrand) const;
103 
105  OccEvent &propose_grand_canonical(OccEvent &e, const OccSwap &swap, MTRand &mtrand) const;
106 
108  void apply(const OccEvent &e, ConfigDoF &configdof);
109 
110  private:
111 
113  OccEvent &_propose(OccEvent &e, const OccSwap &swap, MTRand &mtrand, Index cand_a, Index cand_b, Index size_a, Index size_b) const;
114 
116  OccEvent &_propose(OccEvent &e, const OccSwap &swap, MTRand &mtrand) const;
117 
119 
121 
124  std::vector<std::vector<Index> > m_loc;
125 
127  std::vector<Species> m_species;
128 
130  std::vector<Mol> m_mol;
131 
133  std::vector<Index> m_l_to_mol;
134 
136  bool m_kmc;
137 
139  std::vector<Mol> m_tmol;
140 
142  mutable std::vector<double> m_tsum;
143  };
144  }
145 }
146 
147 #endif
Index l
Config occupant that is being transformed.
Definition: OccLocation.hh:43
void initialize(const Configuration &config)
Fill tables with occupation info.
Definition: OccLocation.cc:18
const OccCandidateList & m_cand
Definition: OccLocation.hh:120
std::vector< Mol > m_mol
Holds Mol objects, one for each mutating site in the configuration.
Definition: OccLocation.hh:130
Mol & mol(Index mol_id)
Definition: OccLocation.cc:82
Index species_index
Species type index (must be consistent with config.occ(l))
Definition: OccLocation.hh:37
std::vector< double > m_tsum
Data used by propose_canonical.
Definition: OccLocation.hh:142
SpecieLocation from
Definition: OccLocation.hh:57
Unit Cell Coordinates.
std::vector< SpecieTraj > species_traj
Definition: OccLocation.hh:63
OccEvent & propose_grand_canonical(OccEvent &e, const OccSwap &swap, MTRand &mtrand) const
Propose grand canonical OccEvent.
Definition: OccLocation.cc:143
Index asym
Asym index.
Definition: OccLocation.hh:45
Index l_to_mol_id(Index l) const
Convert from config index to variable site index.
Definition: OccLocation.cc:111
Main CASM namespace.
Definition: complete.cpp:8
Index mol_id
Location in OccLocation.m_mol.
Definition: OccLocation.hh:44
Index l
Location in config.
Definition: OccLocation.hh:35
UnitCellCoord bijk_begin
Saves initial position.
Definition: OccLocation.hh:26
Index asym
Asym unit index (must be consistent with l)
Definition: OccLocation.hh:36
Index mol_id(Index cand_index, Index loc) const
Mol.id of a particular OccCandidate type.
Definition: OccLocation.cc:101
std::vector< OccTransform > occ_transform
Definition: OccLocation.hh:62
const Conversions & m_convert
Definition: OccLocation.hh:118
std::vector< Index > component
Location of component Specie in OccLocation.m_species.
Definition: OccLocation.hh:38
size_type cand_size(Index cand_index) const
Total number of mutating sites, of OccCandidate type, specified by index.
Definition: OccLocation.cc:91
void swap(ConfigDoF &A, ConfigDoF &B)
Definition: ConfigDoF.cc:195
std::vector< Species > m_species
Holds Monte::Species objects.
Definition: OccLocation.hh:127
Index id
Location in OccLocation.m_species.
Definition: OccLocation.hh:25
std::vector< std::vector< Index > > m_loc
Definition: OccLocation.hh:124
EigenIndex Index
For long integer indexing:
Store swap type, mutating sites, and info for keeping OccLocation up-to-date.
Definition: OccCandidate.hh:51
A container class for the different degrees of freedom a Configuration might have.
Definition: ConfigDoF.hh:27
Represents the occupant on a site.
Definition: OccLocation.hh:33
void apply(const OccEvent &e, ConfigDoF &configdof)
Update configdof and this to reflect that event 'e' occurred.
Definition: OccLocation.cc:161
Index id
Location in OccLocation.m_mol.
Definition: OccLocation.hh:34
Represents an indivisible molecule component.
Definition: OccLocation.hh:23
Index mol_comp
Location in mol.components.
Definition: OccLocation.hh:53
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:207
List of asym / species_index pairs indicating allowed variable occupation dof.
Index loc
Location in OccLocation.m_loc.
Definition: OccLocation.hh:39
OccEvent & propose_canonical(OccEvent &e, const std::vector< OccSwap > &canonical_swap, MTRand &mtrand) const
Propose canonical OccEvent.
Definition: OccLocation.cc:116
Index l
Config occupant that is being transformed.
Definition: OccLocation.hh:51
Index mol_id
Location in OccLocation.m_mol.
Definition: OccLocation.hh:52
bool m_kmc
If true, update Species location during apply.
Definition: OccLocation.hh:136
Index mol_comp_begin
Saves initial Mol.component index.
Definition: OccLocation.hh:27
Index to_species
Species index after transformation.
Definition: OccLocation.hh:47
size_type size() const
Total number of mutating sites.
Definition: OccLocation.cc:78
std::vector< Mol > m_tmol
Data structure used store temporaries during apply.
Definition: OccLocation.hh:139
Stores data to enable efficient proposal and update of occupation mutation.
Definition: OccLocation.hh:68
Index species_index
Species type index.
Definition: OccLocation.hh:24
Index from_species
Species index before transformation.
Definition: OccLocation.hh:46
A Configuration represents the values of all degrees of freedom in a Supercell.
OccLocation(const Conversions &_convert, const OccCandidateList &_cand)
Definition: OccLocation.cc:11
std::vector< Index > m_l_to_mol
l_to_mol[l] -> Mol.id, m_mol.size() otherwise
Definition: OccLocation.hh:133