diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-01 00:52:31 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-01 00:52:31 -0400 |
commit | 90ae915b5a7961a36e6a33509b16229244c6615a (patch) | |
tree | 16c6642868b9bb998864918ba2d86fefc648dc91 /lib/dihedral.c | |
parent | 78d8de381f0b1e99ad98364709cbf876689628b2 (diff) | |
download | c++-90ae915b5a7961a36e6a33509b16229244c6615a.tar.gz c++-90ae915b5a7961a36e6a33509b16229244c6615a.tar.bz2 c++-90ae915b5a7961a36e6a33509b16229244c6615a.zip |
fixed both the system for determining bond energy and how global state is tracked
Diffstat (limited to 'lib/dihedral.c')
-rw-r--r-- | lib/dihedral.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/dihedral.c b/lib/dihedral.c index ac74a23..8158b43 100644 --- a/lib/dihedral.c +++ b/lib/dihedral.c @@ -11,10 +11,14 @@ dihedral_t *dihedral_compose(q_t q, q_t g1i, const dihedral_t *g2) { return g3; } -q_t dihedral_act(q_t q, q_t gi, q_t s) { +q_t dihedral_act(q_t q, q_t gi, bool r, q_t s) { // we only need to consider the action of reflections - return (gi + q - s) % q; + if (r) { + return (gi + q - s) % q; + } else { + return (gi + s) % q; + } } q_t dihedral_inverse_act(q_t q, const dihedral_t *g, q_t s) { @@ -26,15 +30,26 @@ q_t dihedral_inverse_act(q_t q, const dihedral_t *g, q_t s) { } q_t *dihedral_gen_transformations(q_t q) { - q_t *transformations = (q_t *)malloc(q * q * sizeof(q_t)); + q_t *transformations = (q_t *)malloc(2 * q * q * sizeof(q_t)); for (q_t i = 0; i < q; i++) { for (q_t j = 0; j < q; j++) { - transformations[q * i + j] = dihedral_act(q, i, j); + transformations[q * i + j] = dihedral_act(q, i, false, j); + transformations[q * q + q * i + j] = dihedral_act(q, i, true, j); } } return transformations; } +R_t *dihedral_gen_involutions(q_t q) { + R_t *transformations = (R_t *)malloc(q * sizeof(R_t)); + + for (q_t i = 0; i < q; i++) { + transformations[i] = q + i; + } + + return transformations; +} + |