summaryrefslogtreecommitdiff
path: root/biroli-mezard.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2021-03-23 14:59:51 +0100
committerJaron Kent-Dobias <jaron@kent-dobias.com>2021-03-23 14:59:51 +0100
commit15744ab1864b9ee7b59fbb050afd785bec54f8a8 (patch)
tree5cfc197f510ad29eebd7188b609e69edfebae666 /biroli-mezard.cpp
parentdf9c0050b37c2669a1f70a019a397816eeae6b2d (diff)
downloadlattice_glass-15744ab1864b9ee7b59fbb050afd785bec54f8a8.tar.gz
lattice_glass-15744ab1864b9ee7b59fbb050afd785bec54f8a8.tar.bz2
lattice_glass-15744ab1864b9ee7b59fbb050afd785bec54f8a8.zip
Working Biroli-Mezard clusters.
Diffstat (limited to 'biroli-mezard.cpp')
-rw-r--r--biroli-mezard.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/biroli-mezard.cpp b/biroli-mezard.cpp
new file mode 100644
index 0000000..ac68776
--- /dev/null
+++ b/biroli-mezard.cpp
@@ -0,0 +1,84 @@
+#include <iostream>
+#include <fstream>
+
+#include "glass.hpp"
+
+void print(const BiroliSystem<2>& s) {
+ for (const Vertex<2, BiroliState>& v : s.vertices) {
+ std::cerr << v.state.type;
+
+ if (v.position(0) == s.L - 1) {
+ std::cerr << std::endl;
+ }
+ }
+}
+
+int main() {
+ const unsigned D = 3;
+ unsigned L = 30;
+ unsigned Nmin = 2e2;
+ unsigned Nmax = 2e5;
+ double Tmin = 0.04;
+ double Tmax = 0.2;
+ double δT = 0.02;
+
+ BiroliSystem<D> s(L);
+
+ Rng r;
+
+ double z = exp(1 / 0.2);
+
+ if (!s.compatible()) {
+ std::cerr << "Storted incompatible!" << std::endl;
+ return 1;
+ }
+
+ while (s.density() < 0.57) {
+ s.sweepGrandCanonical(z, r);
+ }
+
+ if (!s.compatible()) {
+ std::cerr << "Not compatible!" << std::endl;
+ return 1;
+ }
+
+ std::cerr << "Found state with appropriate density." << std::endl;
+
+ BiroliSystem<D> s0 = s;
+
+ std::vector<Matrix<D>> ms = generateTorusMatrices<D>();
+
+ std::vector<unsigned> clusterDist(s.size() + 1);
+
+ unsigned n = 1;
+ unsigned i = 0;
+ double nC = 0;
+ while (nC / s.size() < 1e5) {
+ if (n < 20 * log(i + 1)) {
+ n++;
+ std::cout << nC / s.size() << " " << (double)s.overlap(s0) / s.size() << std::endl;
+ }
+ unsigned nn = s.flipCluster(Transformation<D>(L, ms, r), r.pick(s.vertices));
+ nC += nn;
+ clusterDist[nn]++;
+// s.sweepLocal(r);
+// nC += s.size();
+// s.sweepSwap(r);
+// s.swendsenWang(Transformation<D>(L, ms, r), r);
+ i++;
+ }
+
+ if (!s.compatible()) {
+ std::cerr << "Not compatible!" << std::endl;
+ return 1;
+ }
+
+ std::ofstream file("dist.dat");
+ for (unsigned i : clusterDist) {
+ file << i << " ";
+ }
+ file.close();
+
+ return 0;
+}
+