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

Add displacement plots #9

Merged
merged 12 commits into from
Jun 21, 2023
Merged

Add displacement plots #9

merged 12 commits into from
Jun 21, 2023

Conversation

stefsmeets
Copy link
Contributor

@stefsmeets stefsmeets commented Jun 15, 2023

This PR adds an implementation for the displacement plots (Figure 1-3) using pymatgen. Takes ~1s to calculate displacements for 75k x 104 sites. Could be faster with a better implementation using np.einsum.

Known problems

  • Calculating displacements element wise is SLOW. Better make a huge matrix of all coordinates and perform the operation at once.
  • Account for sites jumping to different unit cells. The matlab codes for whether the jump in fractional coordinates is larger than 0.5.

Todo

  • Vasprun.get_trajectory() is a giant array of all fractional coordinates. Use this as a basis for displacement calculations.

Essentially:

  1. Put all coordinates in giant array (Vasprun.get_trajectories())
  2. Identify cell jumps per time step
  3. Calculate distance between coordinates at t=0 and t=last
    • Use lattice.metric_tensor for generatlized distance calculation between fractional coordinates (Dunitz p227)
    • xyz.T.dot(lattice.metric_tensor).dot(xyz)

Figures

image
image
image

@stefsmeets stefsmeets changed the title Add element displacement plot Add displacement plots Jun 15, 2023
@stefsmeets stefsmeets marked this pull request as ready for review June 20, 2023 14:46
@stefsmeets stefsmeets requested a review from v1kko June 20, 2023 14:53
Copy link
Contributor

@v1kko v1kko left a comment

Choose a reason for hiding this comment

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

Great work, didn't went into the details of all the plots but they look good.

One issue is that I cannot import GEMDAT.plot_xxx or import GEMDAT.analyze_md anymore, but we can fix that later

src/__init__.py Show resolved Hide resolved
src/displacements.py Show resolved Hide resolved
@stefsmeets stefsmeets merged commit df736d7 into main Jun 21, 2023
3 checks passed
@stefsmeets stefsmeets deleted the add-distance-plot branch June 21, 2023 08:34
@stefsmeets stefsmeets mentioned this pull request Jun 15, 2023
14 tasks
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.

None yet

2 participants