From 639552a2649139ba14363f30daa20786532b21b0 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 23 Jul 2018 13:51:13 -0400 Subject: implemented the discrete gaussian model for roughening --- lib/dihedral_inf.h | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 lib/dihedral_inf.h (limited to 'lib/dihedral_inf.h') diff --git a/lib/dihedral_inf.h b/lib/dihedral_inf.h new file mode 100644 index 0000000..f7c4297 --- /dev/null +++ b/lib/dihedral_inf.h @@ -0,0 +1,78 @@ + +#include "types.h" +#include +#include "height.h" + +template +struct dihedral_inf_t { bool is_reflection; T x; }; + +template +void init(dihedral_inf_t *ptr) { + ptr->is_reflection = false; + ptr->x = (T)0; +} + +template +dihedral_inf_t copy(dihedral_inf_t r) { + return r; +} + +template +void free_spin(dihedral_inf_t r) { + // do nothing! +} + +template +height_t act(dihedral_inf_t r, height_t h) { + height_t h2; + if (r.is_reflection) { + h2.x = r.x - h.x; + } else { + h2.x = r.x + h.x; + } + + return h2; +} + +template +dihedral_inf_t act(dihedral_inf_t r1, dihedral_inf_t r2) { + dihedral_inf_t r3; + + if (r1.is_reflection) { + r3.is_reflection = !(r2.is_reflection); + r3.x = r1.x - r2.x; + } else { + r3.is_reflection = r2.is_reflection; + r3.x = r1.x + r2.x; + } + + return r3; +} + +template +height_t act_inverse(dihedral_inf_t r, height_t h) { + height_t h2; + if (r.is_reflection) { + h2.x = r.x - h.x; + } else { + h2.x = h.x - r.x; + } + + return h2; +} + +template +dihedral_inf_t act_inverse(dihedral_inf_t r1, dihedral_inf_t r2) { + dihedral_inf_t r3; + + if (r1.is_reflection) { + r3.is_reflection = !(r2.is_reflection); + r3.x = r1.x - r2.x; + } else { + r3.is_reflection = r2.is_reflection; + r3.x = r2.x - r1.x; + } + + return r3; +} + -- cgit v1.2.3-70-g09d2