Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of generated_group is unclear #11

Open
Spuriosity1 opened this issue Jul 22, 2024 · 1 comment
Open

Use of generated_group is unclear #11

Spuriosity1 opened this issue Jul 22, 2024 · 1 comment

Comments

@Spuriosity1
Copy link
Contributor

#include <xdiag/all.hpp>
#include <xdiag/blocks/spinhalf/spinhalf.hpp>
#include <xdiag/common.hpp>
#include <xdiag/symmetries/generated_group.hpp>
#include <xdiag/symmetries/representation.hpp>
#include <xdiag/utils/logger.hpp>
#include "geometry.hpp"

using namespace xdiag;


const int N_SITES = 7;

/* Set up the spins in opposing pyramids:
 *      1
 *     2 3 
 *
 *      0
 *
 *     6 5
 *      4
 *
 *  Top View:
 *
 *       1
 *  6         5
 *       0
 *  2         3
 *       4
 *
 */
const std::vector<std::pair<int, int>> cluster_bonds = {
  {1,2},
  {2,3},
  {3,1},
  {0,1},
  {0,2},
  {0,3},
  {0,4},
  {0,5},
  {0,6},
  {4,5},
  {5,6},
  {6,4}
};


int main(int argc, char* argv[]) try {
 
  BondList bonds;

  // Generate all the bonds
  for (auto& [i1, i2] : cluster_bonds) {
    bonds << Bond("HB", "J", {i1, i2});
  }

  bonds["J"] = 1.0; // Sets bond strength of bondspec "J"

  // generate the symmetries
  std::vector<Permutation> perm_generators = {
    //                             {0, 1, 2, 3, 4, 5, 6}
      Permutation(std::vector<int>({0, 2, 3, 1, 5, 6, 4})),
      Permutation(std::vector<int>({0, 1, 3, 2, 4, 6, 5})),
      Permutation(std::vector<int>({0, 4, 5, 6, 1, 2, 3}))
      };

  set_verbosity(3);
    
  // Create the symmetry group
  auto group = generated_group(perm_generators);
  auto irrep = Representation(static_cast<std::vector<complex>>(symmetry::irreps_D3d[argv[1]]));

  auto block = Spinhalf(N_SITES, group, irrep);
  double e0 = eigval0(bonds, block);
  Log("e0: {}", e0);

} catch (Error e) {
  error_trace(e);
}

Running this code yields the log
Error constructing PermutationGroup: group multiplication not closed
which is clearly untrue, since $D_{3d}$ is a perfectly well defined group. Where is the mistake here?

For reference, I'm running
XDiag Version: 0.2.0
Git hash : 4891db9

@awietek
Copy link
Owner

awietek commented Jul 23, 2024

Thank you for filing the issue. I am amazed you found the function generated_group, but probably it was somewhere in the examples. This function will be deleted soon, as I think it is a bit opaque what it does and doesn't really serve a good purpose. Still, It's weird you got an error here.

What I would suggest is that you explicitly build the whole group. You can actually multiply Permutations with the "*" operator and you can compute inverses, see https://awietek.github.io/xdiag/documentation/symmetries/permutation/

I would suggest that you explicitly build the group with multiplication and using inverses. One also needs to add the identity element. Could you give that a try and let me know if you still have the same issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants