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

Symmetry Operations on Cell not working #182

Closed
atbug opened this issue Jan 23, 2024 · 6 comments
Closed

Symmetry Operations on Cell not working #182

atbug opened this issue Jan 23, 2024 · 6 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@atbug
Copy link

atbug commented Jan 23, 2024

I have already avoided using spglib_jll 2.2.0. The following code is directly copied from tests.

pkg> add Spglib spglib_jll@2.1.0
   Resolving package versions...
  [f761d5c5] + Spglib v0.9.3
⌃ [ac4a9f1e] + spglib_jll v2.1.0+0
⌅ [80545937] + CrystallographyCore v0.3.3
  [f761d5c5] + Spglib v0.9.3
  [6ec83bb0] + StructEquality v2.1.0
  [8e1ec7a9] + SumTypes v0.5.5
⌃ [ac4a9f1e] + spglib_jll v2.1.0+0
        Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
Precompiling project...
  2 dependencies successfully precompiled in 3 seconds. 92 already precompiled.

julia> using Spglib

julia> lattice = [[7.17851431, 0, 0], [0, 3.99943947, 0], [0, 0, 8.57154746]]
3-element Vector{Vector{Float64}}:

 [7.17851431, 0.0, 0.0]
 [0.0, 3.99943947, 0.0]
 [0.0, 0.0, 8.57154746]

julia> positions = [
           [0.0, 0.84688439, 0.1203133],
           [0.0, 0.65311561, 0.6203133],
           [0.0, 0.34688439, 0.3796867],
           [0.0, 0.15311561, 0.8796867],
           [0.5, 0.34688439, 0.1203133],
           [0.5, 0.15311561, 0.6203133],
           [0.5, 0.84688439, 0.3796867],
           [0.5, 0.65311561, 0.8796867],
       ]
8-element Vector{Vector{Float64}}:
 [0.0, 0.84688439, 0.1203133]
 [0.0, 0.65311561, 0.6203133]
 [0.0, 0.34688439, 0.3796867]
 [0.0, 0.15311561, 0.8796867]
 [0.5, 0.34688439, 0.1203133]
 [0.5, 0.15311561, 0.6203133]
 [0.5, 0.84688439, 0.3796867]
 [0.5, 0.65311561, 0.8796867]

julia> atoms = fill(8, length(positions))
8-element Vector{Int64}:
 8
 8
 8
 8
 8
 8
 8
 8

julia> cell = Cell(lattice, positions, atoms)
SpglibCell{Float64, Float64, Int64, Any}
 lattice:
   7.17851431  0.0  0.0
   0.0  3.99943947  0.0
   0.0  0.0  8.57154746
 8 atomic positions:
   0.0  0.84688439  0.1203133
   0.0  0.65311561  0.6203133
   0.0  0.34688439  0.3796867
   0.0  0.15311561  0.8796867
   0.5  0.34688439  0.1203133
   0.5  0.15311561  0.6203133
   0.5  0.84688439  0.3796867
   0.5  0.65311561  0.8796867
 8 atoms:
   8  8  8  8  8  8  8  8


julia> primitive_cell = find_primitive(cell)
Unreachable reached at 0x7fa4b5c87ac3

Julia info:

julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 40 × Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, cascadelake)
  Threads: 1 on 40 virtual cores
Environment:
  JULIA_PKG_USE_CLI_GIT = true
@atbug atbug added the bug Something isn't working label Jan 23, 2024
@singularitti singularitti added the help wanted Extra attention is needed label Jan 23, 2024
@singularitti
Copy link
Owner

singularitti commented Jan 23, 2024

Hi @atbug, I am having no issue running this example:

julia> find_primitive(cell)
SpglibCell{Float64, Float64, Int64, Any}
 lattice:
   3.589257155  3.589257155  0.0
   -1.999719735  1.999719735  0.0
   0.0  0.0  8.57154746
 4 atomic positions:
   0.15311560999999996  0.84688439  0.1203133
   0.34688439000000004  0.65311561  0.6203133
   0.65311561  0.34688439000000004  0.3796867
   0.84688439  0.15311560999999996  0.8796867
 4 atoms:
   8  8  8  8

So I guess it may be some problem with spglib itself. Let use debug it step by step:

  1. Have you tried uninstalling and reinstalling Spglib.jl and spglib_jll.jl?
  2. Have you tried installing the Python Spglib and run the same example?
  3. Can you run julia --bug-report=rr-local <your code script> to let us see the detailed bug report?

You can use this package also for debugging your own Julia code locally. Use --bug-report=rr-local to record a trace, and replay() to replay the latest trace.

For example, if you have a script in a project that you'd like to trace, run julia --bug-report=rr -- --project=foo run.jl.

@atbug
Copy link
Author

atbug commented Jan 23, 2024

  1. I tried again in a clean new environment where only Spglib.jl and spglib_jll.jl were installed and can reproduce what I reported. But I agree that I cannot reproduce the issue on my Mac laptop.

  2. I can use Python version of spglib by PyCall on the machine where the reported issue can be reproduced.

julia> using Cells, PyCall

julia> spglib = pyimport("spglib")
PyObject <module 'spglib' from '/path/to/myhome/.julia/conda/3/lib/python3.9/site-packages/spglib/__init__.py'>

julia> lattice = [[7.17851431, 0, 0], [0, 3.99943947, 0], [0, 0, 8.57154746]]
3-element Vector{Vector{Float64}}:
 [7.17851431, 0.0, 0.0]
 [0.0, 3.99943947, 0.0]
 [0.0, 0.0, 8.57154746]

julia> positions = [
          [0.0, 0.84688439, 0.1203133],
          [0.0, 0.65311561, 0.6203133],
          [0.0, 0.34688439, 0.3796867],
          [0.0, 0.15311561, 0.8796867],
          [0.5, 0.34688439, 0.1203133],
          [0.5, 0.15311561, 0.6203133],
          [0.5, 0.84688439, 0.3796867],
          [0.5, 0.65311561, 0.8796867],
       ]
8-element Vector{Vector{Float64}}:
 [0.0, 0.84688439, 0.1203133]
 [0.0, 0.65311561, 0.6203133]
 [0.0, 0.34688439, 0.3796867]
 [0.0, 0.15311561, 0.8796867]
 [0.5, 0.34688439, 0.1203133]
 [0.5, 0.15311561, 0.6203133]
 [0.5, 0.84688439, 0.3796867]
 [0.5, 0.65311561, 0.8796867]

julia> atoms = [8 for i in 1:length(positions)]
8-element Vector{Int64}:
 8
 8
 8
 8
 8
 8
 8
 8

julia> spglib.get_spacegroup(
           (lattice,
           positions,
           atoms),
           symprec=1.0e-3
       )
"Cmce (64)"
  1. I am trying to get an rr trace, but am now stucked at Downloading artifact: Python. I'll get back to you when I have the trace, probably at a time when the cluster is not crowded and the IO is faster.

Thank you for the quick response.

@atbug
Copy link
Author

atbug commented Jan 24, 2024

Here is the rr trace:
https://julialang-dumps.s3.amazonaws.com/reports/2024-01-24T05-50-27-atbug.tar.zst

I don't really understand how to use rr. Let me know if it is not what you want.

@singularitti
Copy link
Owner

Hi @atbug, may I ask which version of Spglib.jl were you using? Could it be the same bug we are having as in #183? Can you try v0.9.2?

@atbug
Copy link
Author

atbug commented Jan 24, 2024

I was using 0.9.3.

I can now confirm the issue is not reproducible for 0.9.2 and seems to be fixed on current main branch. Thank you.

@atbug atbug closed this as completed Jan 24, 2024
@singularitti
Copy link
Owner

Thank you for your bug report! A new release will be released immediately!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants