Skip to content

Add flag to set all occupancies to 1 #362

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

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/gemdat/transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(
events: pd.DataFrame,
states: np.ndarray,
inner_states: np.ndarray,
set_partial_occupancies_to_1: bool = False,
):
"""Store event data for jumps and transitions between sites.

Expand All @@ -67,16 +68,25 @@ def __init__(
Input states
inner_states : np.ndarray
Input states for inner sites
set_partial_occupancies_to_1 : bool
Change partial occupancies in the disordered sites and set them to 1.
"""
if not (sites.is_ordered):
warn(
'Input `sites` are disordered! '
'Although the code may work, it was written under the assumption '
'that an ordered structure would be passed. '
'Use `set_partial_occupancies_to_1=True` to set all occupancies to 1.'
'See https://github.com/GEMDAT-repos/GEMDAT/issues/339 for more information.',
stacklevel=2,
)

if set_partial_occupancies_to_1:
for idx, site in enumerate(sites):
if site.is_ordered:
continue
sites.replace(idx=idx, species=site.species.elements[0], label=site.label)

self.sites = sites
self.trajectory = trajectory
self.diff_trajectory = diff_trajectory
Expand Down