EwaldSiteEnergy gives different answers whether an integer or a list is passed as argument

Hello,

I am playing with the matminer.featurizers.site and realize the EwaldSiteEnergy featurizer gives different results whether I pass an integer as the index of the site or a list of integer. The problem seems to be caused by the get_site_energy method in the pymatgen.analysis.ewald.EwaldSummation class of Pymatgen. For example, for the structure mp-9657, if I do:

‘print(EwaldSiteEnergy(5).featurize(oxi_struc, 0), EwaldSiteEnergy(5).featurize(oxi_struc, 1))’, I got: [-9.023723992737116] [-9.023723992737107]

However, if I do print(EwaldSiteEnergy(5).featurize(oxi_struc, [0, 1])), I got: [array([-13.75357558, -13.75357558])]

I’m not sure what is the cause of this weird behavior. Any suggestion will be greatly appreciated.

Best,

Seiha.

You should follow the docs and only put an integer as the argument, not a list. If you want the energy of multiple sites, you need to call the function multiple times.

If you look at the code for how the pymatgen Ewald energy is implemented, you’ll see why putting a list is problematic and not the correct behavior.

···

On Wed, Apr 17, 2019 at 1:04 PM [email protected] wrote:

Hello,

I am playing with the matminer.featurizers.site and realize the EwaldSiteEnergy featurizer gives different results whether I pass an integer as the index of the site or a list of integer. The problem seems to be caused by the get_site_energy method in the pymatgen.analysis.ewald.EwaldSummation class of Pymatgen. For example, for the structure mp-9657, if I do:

‘print(EwaldSiteEnergy(5).featurize(oxi_struc, 0), EwaldSiteEnergy(5).featurize(oxi_struc, 1))’, I got: [-9.023723992737116] [-9.023723992737107]

However, if I do print(EwaldSiteEnergy(5).featurize(oxi_struc, [0, 1])), I got: [array([-13.75357558, -13.75357558])]

I’m not sure what is the cause of this weird behavior. Any suggestion will be greatly appreciated.

Best,

Seiha.

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

For more options, visit https://groups.google.com/d/optout.


Best,
Anubhav