schrodinger.application.matsci.mlip.utils module¶
Utility functions and trackers for the MLIP nanoreactor MD engine.
Provides unit conversions, velocity initialization, autograd debugging, and simulation tracking.
Copyright Schrodinger, LLC. All rights reserved.
- schrodinger.application.matsci.mlip.utils.z_to_masses(z_tensor)¶
Convert atomic numbers of shape (M, N) to atomic masses in amu.
- Parameters:
z_tensor (torch.Tensor) – Atomic numbers of shape (M, N)
- Return type:
torch.Tensor- Returns:
Atomic masses of shape (M, N) in amu
- schrodinger.application.matsci.mlip.utils.z_to_symbols(z_tensor, as_nested_list=True)¶
Convert atomic numbers of shape (M, N) to element symbols.
- Parameters:
z_tensor (torch.Tensor) – Atomic numbers of shape (M, N)
as_nested_list (bool) – If True, return nested lists. If False, return a numpy array.
- Return type:
list or
numpy.ndarray- Returns:
Element symbols with shape (M, N)
- schrodinger.application.matsci.mlip.utils.maxwell_boltzmann_velocities(masses, temperature, remove_com=False, random_seed_generator=None)¶
Sample Maxwell-Boltzmann velocities for a batch of systems.
sqrt(kB*T/m) has units of sqrt(eV/amu), which is Ang./fs in ASE convention where fs = Ang. * sqrt(amu/eV).
- Parameters:
masses (torch.Tensor) – Atomic masses of shape (M, N) in amu
temperature (float) – Target temperature in Kelvin
remove_com (bool) – Whether to remove per-system center-of-mass velocity
random_seed_generator (torch.Generator or None) – PyTorch random number generator for reproducibility
- Return type:
torch.Tensor- Returns:
Velocities tensor of shape (M, N, 3) in Ang./fs
- class schrodinger.application.matsci.mlip.utils.Tracker¶
Bases:
objectBase tracker class for logging simulation quantities.
Subclasses should override __call__ to compute and return a dict of quantities to log.