Skip to content
Advertisement

Is it possible to make this function on numpy array more efficient?

Here a is a 1D array of integer indices. To give some context, a is the atom indices of the 1st molecules. The return is the atom indices for n identical molecules, each of which contains step atoms. This function basically applies the same atom selection to many molecules

JavaScript

For example

JavaScript

Advertisement

Answer

It looks like broadcasting should be enough:

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement