From da3f96751b0f874a66cbee12b29b77d4c8a1e11d Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Thu, 3 Apr 2025 16:01:56 +0200 Subject: [PATCH] Add flag to set all occupancies to 1 --- src/gemdat/transitions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gemdat/transitions.py b/src/gemdat/transitions.py index a560986..86ea695 100644 --- a/src/gemdat/transitions.py +++ b/src/gemdat/transitions.py @@ -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. @@ -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