spglib: spglib-2.1.0 shows warnings when using `get_spacegroup` method but spglib-2.0.2 does not

The spglib is an useful tool to analysis the symmetry information for giving structure.

Here we want to use the spglib to analysis the symmetry info of given structure by spglib.get_spacegroup and spglib.refine_cell method in some different tolerances including 0.00001, 0.0001, 0.001, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, but in spglib-2.1.0, it shows this:

spglib: No point group was found (line 405, /tmp/pip-install-wo87okks/spglib/src/pointgroup.c).
spglib: Attempt 0 tolerance = 1.000000e-03 failed(line 800, /tmp/pip-install-wo87okks/spglib/src/spacegroup.c).
spglib: No point group was found (line 405, /tmp/pip-install-wo87okks/spglib/src/pointgroup.c).
spglib: Attempt 1 tolerance = 9.500000e-04 failed(line 800, /tmp/pip-install-wo87okks/spglib/src/spacegroup.c).
spglib: No point group was found (line 405, /tmp/pip-install-wo87okks/spglib/src/pointgroup.c).
spglib: Attempt 2 tolerance = 9.025000e-04 failed(line 800, /tmp/pip-install-wo87okks/spglib/src/spacegroup.c).
spglib: No point group was found (line 405, /tmp/pip-install-wo87okks/spglib/src/pointgroup.c).
spglib: Attempt 3 tolerance = 8.573750e-04 failed(line 800, /tmp/pip-install-wo87okks/spglib/src/spacegroup.c).

but in older version such as spglib-2.0.2, this warning does not show

Here is the structure info and test script which can be used to repeat the warning above:

BN
1.0
  2.13478593     -0.00047962     -0.00000019
 -1.06780826      1.84853908     -0.00000019
 -0.00000004     -0.00000007      1.94254452
 B N
 1 1
direct
0.00002343  0.99997657  0.50000000
0.66667658  0.33332342  0.00000000
import spglib as spg
from ase.io import read

version = ".".join(map(str, spg.get_version()))
print(f"spg version: {version}")

atoms = read("POSCAR")
cell = atoms.cell
position = atoms.get_scaled_positions()
number = atoms.get_atomic_numbers()
print(spg.get_spacegroup((cell, position, number)))
print(spg.get_spacegroup((cell, position, number), 0.00001))
print(spg.get_spacegroup((cell, position, number), 0.0001))
print(spg.get_spacegroup((cell, position, number), 0.001))
print(spg.get_spacegroup((cell, position, number), 0.01))
print(spg.get_spacegroup((cell, position, number), 0.1))
print(spg.get_spacegroup((cell, position, number), 0.2))
print(spg.get_spacegroup((cell, position, number), 0.3))
print(spg.get_spacegroup((cell, position, number), 0.4))
print(spg.get_spacegroup((cell, position, number), 0.5))
print(spg.get_spacegroup((cell, position, number), 0.6))
print(spg.get_spacegroup((cell, position, number), 0.7))
print(spg.get_spacegroup((cell, position, number), 0.8))

Is this a bug? or something that i did to occur this?

Looking forward to a reply, thx~

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 17

Most upvoted comments

@wangzyphysics I am working on #457 if you want to have a look at it.

Hey guys, are there any new plans to fix this warning?

Just reviewing if the messages makes sense as warning/debug, or trying it out with pip install pointing to my fork+branch would be very useful feedback.

I have installed spglib from your branch and now the warning/debug is gone! Thanks again!

Yeah the default was changed, because I thought those were used for warnings only, but it was used for debug info as well.

A tip, you can add cmake options to pip install, e.g.

pip install git+https://github.com/spglib/spglib --config-settings=cmake.define.SPGLIB_WARNING=OFF

Hey guys, are there any new plans to fix this warning?

Can you remind me again over the weekend?

I think this is default off, but can be made it on by environment variable.

This is what I expect.

I don’t think I’ve added that for all warnings. Probably should change the macro itself to include such an if statement. At the same time, these are not actual warnings, these are debug messages, so we should go through each one and fix by their intent. Basically:

  • if SPGLIB_WARNINGS=OFF, no warning messages are compiled
  • when SPGLIB_WARNINGS=ON, all messages will be checked by if get_env and only than it should run
  • change the type of message from warning to debug if it’s a debug message and not a warning.

Similarly for SPGLIB_DEBUG

I could reproduce your issue.

The following line emits the warning, but finally Amm2 (38) is found. print(spg.get_spacegroup((cell, position, number), 0.001))

So I think you can safely ignore this warning.

But warning should not be displayed. This is probably due to developer side issue. Thanks for your report!