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

MULTIBATH constructor difficult to use #182

Open
pultar opened this issue Feb 15, 2022 · 2 comments
Open

MULTIBATH constructor difficult to use #182

pultar opened this issue Feb 15, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@pultar
Copy link
Collaborator

pultar commented Feb 15, 2022

The constructor of MULTIBATH is not very convenient to use and requires initialization of many variables. Some of these variables are often identical (like COMBATH and IRBATH) or can be derived (like DOFSET):

def __init__(self, ALGORITHM: int=0, NBATHS: int=0, TEMP0: List[float]=[], TAU: List[float]=[], DOFSET: int=0, LAST: List[int]=[],
             COMBATH: List[int]=[],
             IRBATH: List[int]=[], NUM: int = None, content=None):

Initialization happens like that:

ALGORITHM = 1 # Nosé-Hoover scheme
NBATHS = len(self._temperature_baths)
TEMP0 = [self.temperature] * NBATHS
TAU = [0.1] * NBATHS
DOFSET = len(self._temperature_baths)
LAST = list(self._temperature_baths.keys())
COMBATH = list(self._temperature_baths.values())
IRBATH = list(self._temperature_baths.values())
self._system.imd.add_block(
    block=MULTIBATH(ALGORITHM, NBATHS, TEMP0, TAU, DOFSET, LAST, COMBATH, IRBATH)
)

How about we take an approach as taken here? For example, T and TAU can be a list or floats (as they are often the same for several baths). Also, I like the dictionary approach for last_atoms_bath.

def adapt_multibath(self, last_atoms_bath: Dict[int, int], algorithm: int = None, num: int = None, T: (float, List[float]) = None,
                        TAU: float = None) -> None:

Ideally, we would implement this in a way that does not break things.

@pultar pultar added the enhancement New feature or request label Feb 15, 2022
@MTLehner
Copy link
Collaborator

I like this idea. Convenience functions are always useful!

@MTLehner
Copy link
Collaborator

@pultar does this need to be in release3? The way I see it this is not a major restructuring, but rather a addition we can add later if actually needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants