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

Error for hidden irreps with l=4 #58

Closed
pfebrer opened this issue Dec 11, 2022 · 6 comments
Closed

Error for hidden irreps with l=4 #58

pfebrer opened this issue Dec 11, 2022 · 6 comments

Comments

@pfebrer
Copy link

pfebrer commented Dec 11, 2022

I'm trying to run a variant of the mace model with hidden irreps of order l=4 (20x0e + 20x1o + 20x2e + 20x3o + 20x4e) and I get an error on the symmetric contraction:

    prod = EquivariantProductBasisBlock(
  File "~/mace/modules/blocks.py", line 114, in __init__
    self.symmetric_contractions = SymmetricContraction(
  File "~/mace/modules/symmetric_contraction.py", line 71, in __init__
    self.contractions[str(irrep_out)] = Contraction(
  File "~/mace/modules/symmetric_contraction.py", line 107, in __init__
    U_matrix = U_matrix_real(
  File "~/mace/tools/cg.py", line 132, in U_matrix_real
    out += [last_ir, stack]
UnboundLocalError: local variable 'last_ir' referenced before assignment

Should I be able to run the model with l=4 hidden irreps?

Thanks!

@ilyes319
Copy link
Contributor

Hey,

Did you make sure to change also --max_ell=4 in the input file. If you do not, no l=4 spherical harmonics will be injected thus the bug.

Best,

Ilyes

@pfebrer
Copy link
Author

pfebrer commented Dec 11, 2022

Thanks! If I increase max_ell to 4, then I get an error from e3nn:

Traceback (most recent call last):
  File "~/myenv/lib/python3.10/site-packages/e3nn/o3/_wigner.py", line 129, in wigner_3j
    out = flat_src[_W3j_indices[(l3, l2, l1)]].reshape(2 * l3 + 1, 2 * l2 + 1, 2 * l1 + 1).transpose(0, 2).mul((-1) ** (l1 + l2 + l3)).clone()
KeyError: (4, 8, 12)

During handling of the above exception, another exception occurred:
    prod = EquivariantProductBasisBlock(
  File "~/mace/modules/blocks.py", line 114, in __init__
    self.symmetric_contractions = SymmetricContraction(
  File "~/mace/modules/symmetric_contraction.py", line 71, in __init__
    self.contractions[str(irrep_out)] = Contraction(
  File "~/mace/modules/symmetric_contraction.py", line 107, in __init__
    U_matrix = U_matrix_real(
  File "~/mace/tools/cg.py", line 116, in U_matrix_real
    wigners = _wigner_nj(irrepss, normalization, filter_ir_mid, dtype)
  File "~/mace/tools/cg.py", line 55, in _wigner_nj
    C = o3.wigner_3j(ir_out.l, ir_left.l, ir.l, dtype=dtype)
  File "~/myenv/lib/python3.10/site-packages/e3nn/o3/_wigner.py", line 135, in wigner_3j
    raise NotImplementedError(f'Wigner 3j symbols maximum l implemented is {max(_W3j_indices.keys())[0]}, send us an email to ask for more')
NotImplementedError: Wigner 3j symbols maximum l implemented is 11, send us an email to ask for more

@ilyes319
Copy link
Contributor

Mmm yes, this should reported on e3nn repo. Usually you never need to go to that high order, it saturates at 3. Could you open an issue there and link it here?

@pfebrer
Copy link
Author

pfebrer commented Dec 11, 2022

Ok, thanks! I would like to open an issue there, the problem is that I don't understand exactly what is going on in the _wigner_nj function, so I don't know how to explain it 😅 E.g. I don't know what order of the Wigner 3j symbols do I need.

@pfebrer
Copy link
Author

pfebrer commented Dec 11, 2022

Forget what I said, in their latest version (e3nn==0.5.0) they already removed this restriction, and the mace model works with hidden irreps l=4 and max_ell=4 👌

@pfebrer pfebrer closed this as completed Dec 11, 2022
@pfebrer
Copy link
Author

pfebrer commented Dec 11, 2022

Thank you very much for the quick replies! :)

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