Conversation
LecrisUT
left a comment
There was a problem hiding this comment.
I think we should use the IDE navigation and see how the functions are called. If they end up in a top-level err, if they are recovered, etc.
| info_print("Inconsistent MSG type:\n"); | ||
| info_print(" From FSG and XSG: %d\n", type); | ||
| info_print(" From DB matching: %d\n", msgtype.type); | ||
| goto err; |
There was a problem hiding this comment.
Is this an info or a warning? There are other goto err including ones with malloc issues.
This depends on how msg_identify_magnetic_space_group_type is meant to be used and if any issue is recoverable, expected, etc.
There was a problem hiding this comment.
This is an unreachable situation without something floating-point error. So, I guess this will be info.
There was a problem hiding this comment.
If it's unreachable like an assert it should be warning. Assuming the floating point error is not a dynamic tolerance
There was a problem hiding this comment.
I will leave whether info or warning to you, but let me put more context.
If the parameters symprec and mag_symprec are sufficiently small, this is like the assert. But if these are too large, this assertion may fail. In that case, I recommend to decrease these parameter values.
There was a problem hiding this comment.
Since these are tied to a user input, these would not be classified as assert (assert is only for debug if you are sure that users would not encounter it, that is why it is gated by NDEBUG), but as runtime try-except-like functionality.
It seems it could be either info or warning, but these are quite hard to detangle, so I am not sure how to classify either, since some are in a for loop, some are not. Ultimately we are mostly limited by the C language that we cannot use libraries like spdlog, which would make these issues obsolete (since we can dynamically enable/disable/redirect logging, including having python native logs)
There was a problem hiding this comment.
Let's go with info.
| warning_print("spglib: Attempt %d tolerance = %f failed.", attempt, | ||
| tolerance); | ||
| warning_print(" (line %d, %s).\n", __LINE__, __FILE__); | ||
| info_print("spglib: Attempt %d tolerance = %f failed.", attempt, |
There was a problem hiding this comment.
For these tolerance, I will move them to debug and have only one info when it exits
| @@ -1121,8 +1121,8 @@ static void layer_check_and_sort_axes(int axes[3], int const aperiodic_axis) { | |||
| } else { | |||
| // Warning when rot_axes[axes[i]][aperiodic_axis] == -2, -3, 2, 3 | |||
| // I am not sure if this would ever happen. | |||
There was a problem hiding this comment.
Comment above seems to indicate it is a proper warning that at least we should know about if it happens
There was a problem hiding this comment.
This code is introduced for layer group, but we will not want to expose the feature for users since we should reconsider the algorithm, and the implementation will be redesigned. This will be a work not only the code redesign but require some scientific discussion. The code lines for the layer group implementation were inserted in many places and the refactoring will need some effort and take time. So I just have been leaving it untouched.
| @@ -908,9 +908,9 @@ static VecDBL *get_changed_pure_translations(double const tmat[3][3], | |||
|
|
|||
| /* Sanity check */ | |||
| if (count != size) { | |||
There was a problem hiding this comment.
This part is conflicting with the comment above
There was a problem hiding this comment.
This function transforms the basis but when the distortion of the input crystal structure is large and with naive choice of the tolerance, this fails. count == size is a minimum check that should satisfy the condition. So the comment says Sanity check. Could you recommend a better word?
| det = mat_get_determinant_d3(a); | ||
| if (mat_Dabs(det) < precision) { | ||
| warning_print("spglib: No inverse matrix (det=%f)\n", det); | ||
| info_print("spglib: No inverse matrix (det=%f)\n", det); |
There was a problem hiding this comment.
Maybe this is a debug_print?
There was a problem hiding this comment.
So if I see this message, I will see that the crystal structure is distorted. But as you commented, it is not possible to see it from the local piece of the code.
|
Close this PR because #457 was merged |
Currently spglib has two levels of messaging:
debug_printandwarning_print. This PR introduces another levelinfo_print.Most of
warning_printwere replaced byinfo_print.debug_printSPGDEBUGSPGLIB_DEBUGwarning_printSPGWARNINGSPGLIB_WARNINGinfo_printSPGINFOSPGLIB_INFOResolve #338