Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update volume.py #160

Merged
merged 9 commits into from
Oct 18, 2023
Merged

Update volume.py #160

merged 9 commits into from
Oct 18, 2023

Conversation

AstyLavrinenko
Copy link
Contributor

New function to plot the density of diffusion atoms using plotly

New function to plot the density of diffusion atoms using plotly
@AstyLavrinenko
Copy link
Contributor Author

AstyLavrinenko commented Oct 11, 2023

I have added the function to plot the density of diffusion atoms using plotly and save as .html. However, I didn't integrate it with the class. Please guys check it

@stefsmeets
Copy link
Contributor

Thanks! No worries that it is not integrated, this is something we will take care of. I'll get back to this.

@stefsmeets stefsmeets self-assigned this Oct 12, 2023
@v1kko v1kko linked an issue Oct 12, 2023 that may be closed by this pull request
@stefsmeets stefsmeets marked this pull request as draft October 18, 2023 09:21
@stefsmeets
Copy link
Contributor

stefsmeets commented Oct 18, 2023

I have moved the code to the plots submodule. For the isosurface plot I want to use the Volume we have as input directly. I think a nice way to go about this is to do the marching cubes on the existing volume (which is in fractional coordinate system). And then convert the vertices to cartesian coordinates. This avoids double work, and I think this will be a bit more robust than the current implementation.

Usage

from gemdat import Trajectory
from gemdat.volume import trajectory_to_volume

VASP_XML = '/home/stef/md-analysis-matlab-example-short/vasprun.xml'

equilibration_steps = 1250
diffusing_element = 'Li'

trajectory = Trajectory.from_vasprun(VASP_XML)
trajectory = trajectory[equilibration_steps:]

diff_trajectory = trajectory.filter(diffusing_element)

density_resolution = 0.3

vol = trajectory_to_volume(
    trajectory=diff_trajectory,
    resolution=density_resolution,
)

structure = vol.to_structure()

from gemdat import plots
    
plots.density(vol, structure)

image

Todo

  • Add docstrings
  • Add isosurface plot
  • Check that isosurface aligns well with points
  • Apply gaussian filter (should this be an option?)
  • See if some code can be moved to Volume

Follow-up

  • Add density plot to dashboard
  • Prepare notebook demo-ing plot

@stefsmeets stefsmeets mentioned this pull request Oct 18, 2023
10 tasks
Copy link
Contributor

@stefsmeets stefsmeets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@stefsmeets stefsmeets marked this pull request as ready for review October 18, 2023 14:47
@stefsmeets stefsmeets merged commit deee2a8 into main Oct 18, 2023
@stefsmeets stefsmeets deleted the AstyLavrinenko-patch-1 branch October 18, 2023 15:11
@AstyLavrinenko
Copy link
Contributor Author

Nice! Thank you!

@AstyLavrinenko
Copy link
Contributor Author

AstyLavrinenko commented Oct 20, 2023

If I understand correctly the points are coordinates of Li during simulation now? Because initially the points were coordinates of sites. I probably can load the structure created from .cif to plot points as sites, but then lattice and cart_coord will not match the simulation cell

@stefsmeets
Copy link
Contributor

stefsmeets commented Oct 20, 2023

It can be whatever you want 😅

site_stucture = load_known_material('argyrodite', supercell=(2,1,1))
plots.density(vol, site_structure)

Yeah, that the lattices don't match is an issue I can't do much about. You could create a new structure with the simulation lattice and the coordinates from the cif.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add density plot to dashboard
2 participants