pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Move VolumetricData to io/common and merge cube support

Open nwinner opened this issue 2 years ago • 2 comments

Summary

Migrate VolumetricData to a new io.common module, which can be used by other file formats such as hdf5 and cubes.

Update the vasp output module to use the new class in common.

Only "inelegance" is that a new VaspVolumetricData method had to be defined in io.vasp.outputs because from_file and write_file in the original VolumetricData used logic from io.vasp.inputs.Poscar which creates circular imports if ported to io.common. An elegant solution to this would be a good improvement.

nwinner avatar Sep 27 '22 02:09 nwinner

@shyuep what do you think about this solution?

VolumetricData is now defined in common, but in the vasp.outputs module we import it as BaseVolumetricData and define a new child class called VolumetricData. Its not especially elegant, but this way legacy code will import VolumetricData from the vasp.outputs module and get the expected behavior, but we have a common object for cube and hdf5.

Also it looks like linting fails on parts of the PR unrelated to my code. I guess the main branch doesn't pass all checks?

nwinner avatar Sep 29 '22 18:09 nwinner

Coverage Status

Coverage decreased (-63.6%) to 0.0% when pulling e3c1d93bcbb7dba2cd0c4a9eee0e82196ce022ef on nwinner:volumetric-data-patch into e01d044986d6b321ee0254a6c9c89a5edd693935 on materialsproject:master.

coveralls avatar Oct 04 '22 20:10 coveralls

Just a note that master is failing the tests, not this new feature.

nwinner avatar Oct 19 '22 18:10 nwinner

I think this PR can be better handled if you just do the refactor to io.common and then add the CPMD stuff later.

jmmshn avatar Nov 22 '22 17:11 jmmshn

But the issue is in the average along axis method, so wouldn’t it still be there? That method comes from the current VASP implementation.

(Sent from iPhone)

On Tue, Nov 22, 2022 at 9:53 AM Jimmy Shen @.***> wrote:

I think this PR can be better handled if you just do the refactor to io.common and then add the CPMD stuff later.

— Reply to this email directly, view it on GitHub https://github.com/materialsproject/pymatgen/pull/2667#issuecomment-1324044556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDKYLJFXUYJQSL3CL4NJC3WJUCA7ANCNFSM6AAAAAAQWKVQ7Q . You are receiving this because you were mentioned.Message ID: @.***>

nwinner avatar Nov 22 '22 18:11 nwinner

But the issue is in the average along axis method, so wouldn’t it still be there? That method comes from the current VASP implementation. (Sent from iPhone)

I thought the function was for generating a sphere.

jmmshn avatar Nov 22 '22 18:11 jmmshn

Oh i see. My mistake @jmmshn . The quoted code included the bottom of the get_average_along axis function and I thought that's what you were referring to. I agree that the sphere stuff can be removed until a later date.

nwinner avatar Nov 22 '22 22:11 nwinner

@shyuep It looks like all conversations have been resolved for this. The two checks that failed are failing on

pymatgen/analysis/chemenv/coordination_environments/tests/test_read_write.py:81

which is not related to this PR.

nwinner avatar Dec 13 '22 18:12 nwinner