-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
In template_iterator.py, in the BaseTemplateIterator class, in the function get_template_scattering potential, there is an issue with the get_a_param function call
MOSAICS/src/mosaics/template_iterator.py
Lines 346 to 364 in 1b8e188
| def get_template_scattering_potential( | |
| self, atom_idxs: torch.Tensor | np.ndarray = None | |
| ) -> float: | |
| """Get the mass (in amu) of a template structure given atom indexes.""" | |
| if atom_idxs is None: | |
| atom_idxs = np.arange(len(self.structure_df)) | |
| if isinstance(atom_idxs, torch.Tensor): | |
| atom_idxs = atom_idxs.numpy() | |
| total_scattering_potential = 0 | |
| atom_counts = self.structure_df.iloc[atom_idxs]["element"].value_counts() | |
| for atom, count in atom_counts.items(): | |
| atom = atom.upper() | |
| potentials = get_a_param(atom) | |
| potentials = torch.sum(potentials).item() | |
| total_scattering_potential += potentials * count | |
| return total_scattering_potential |
because this function takes a list of atoms as input, passing a multi-character string (for example, the string "Mg" meaning magnesium) will have the simulator get the scattering parameter for M and then g, neither of which are atoms name.
a simple fix that I have implemented in my fork is turning the atom name into a length-1 list
potentials = get_a_param([atom])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels