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

Pathological structure #43

Open
janosh opened this issue Jan 9, 2025 · 1 comment
Open

Pathological structure #43

janosh opened this issue Jan 9, 2025 · 1 comment
Assignees

Comments

@janosh
Copy link

janosh commented Jan 9, 2025

I have a contrived example where moyopy consumes huge amounts of memory (observed 50+GB) and eventually crashes the python process that called it.

import moyopy
import numpy as np
from pymatgen.core import Structure


unary_cubic = Structure(np.eye(3) * 4.0, ["Fe", "Fe"], [[0, 0, 0], [0.5, 0.5, 0.5]])

cell = moyopy.Cell(
    unary_cubic.lattice.matrix, unary_cubic.frac_coords, unary_cubic.atomic_numbers
)
dataset = moyopy.MoyoDataset(cell, symprec=0.1, angle_tolerance=1.0)
assert dataset.number == 229, f"{dataset.number=}, expected 229"

this seems to happen regardless of which elements are in the structure or which symprec is used (tried 0.1, 0.01 and 1e-5)

Screenshot 2025-01-09 at 15 08 59

@lan496
Copy link
Member

lan496 commented Jan 9, 2025

It seems angle_tolerance is too large for moyopy. Moyopy reads angle_tolerance in radian unlike spglib:

moyo/moyopy/src/lib.rs

Lines 27 to 31 in 0951fb6

let angle_tolerance = if let Some(angle_tolerance) = angle_tolerance {
AngleTolerance::Radian(angle_tolerance)
} else {
AngleTolerance::Default
};

Can you try using a smaller value or angle_tolerance=None?

Anyway, the docstring should be fixed to state the unit of angle_tolerance, and such a huge memory consumption should not happen 😞.
I will look into it. Thank you for your report!

@lan496 lan496 self-assigned this Jan 9, 2025
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