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 method to create a graph from jumps #325

Merged
merged 13 commits into from
Jun 6, 2024
Merged

Add method to create a graph from jumps #325

merged 13 commits into from
Jun 6, 2024

Conversation

stefsmeets
Copy link
Contributor

@stefsmeets stefsmeets commented Jun 4, 2024

This PR makes an attempt to calculate the activation energy graph from the jumps object. I implemented it as a directed graph, but it can easily be collapsed into a undirected graph.

>>> from gemdat import Trajectory, load_known_material
>>> from gemdat.utils import VASPRUN
>>> 
>>> trajectory = Trajectory.from_vasprun(VASPRUN)
>>> diff_trajectory = trajectory.filter('Li')
>>> 
>>> sites = load_known_material('argyrodite', supercell=(2, 1, 1))
>>> 
>>> transitions = trajectory.transitions_between_sites(
>>>     sites=sites,
>>>     floating_specie='Li',
>>> )
>>> 
>>> jumps = transitions.jumps()
>>> G = jumps.to_graph()
>>> list(G.adjacency())
[(94, {0: {'e_act': 0.08184877863639753}, 86: {'e_act': 0.17199768720154068}}),
 (0, {94: {'e_act': 0.07200775957630277}, 64: {'e_act': 0.20098168979635483}}),
 (86,
  {94: {'e_act': 0.1676656025734321},
   34: {'e_act': 0.09749500858643947},
   78: {'e_act': 0.20649062422834097}}),
 (2,
  {92: {'e_act': 0.19221497535660828},
   66: {'e_act': 0.13067877194389088},
   58: {'e_act': 0.15338995370169942},
   34: {'e_act': 0.19221497535660828}}),

You can also get the activation energy by site:

>>> jumps.activation_energy_between_sites(2, 92)
0.19221497535660828

to_graph() takes the min and max energy:

>>> G = jumps.to_graph(min_e_act=0.1, max_e_act=5.0)
...

Closes #322

@stefsmeets
Copy link
Contributor Author

Hi @SCiarella @v9lgraf could you have a look at this PR and let me know if the implementation looks sensible to you? Also happy to take any other feedback you may have 😁

@stefsmeets stefsmeets requested a review from SCiarella June 4, 2024 13:41
@stefsmeets stefsmeets marked this pull request as ready for review June 5, 2024 09:47
Copy link
Contributor

@SCiarella SCiarella left a comment

Choose a reason for hiding this comment

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

This looks smooth! 👍

I think this fulfills the first two tasks of #322 (excluding the statistical approach to the activation energy), while it can close #272 once we implement the plots (percolating graph+associated energy)

src/gemdat/jumps.py Outdated Show resolved Hide resolved
src/gemdat/jumps.py Outdated Show resolved Hide resolved
src/gemdat/jumps.py Outdated Show resolved Hide resolved
stefsmeets and others added 4 commits June 6, 2024 16:00
Co-authored-by: SCiarella <58949181+SCiarella@users.noreply.github.com>
Co-authored-by: SCiarella <58949181+SCiarella@users.noreply.github.com>
Co-authored-by: SCiarella <58949181+SCiarella@users.noreply.github.com>
@stefsmeets stefsmeets merged commit 493612e into main Jun 6, 2024
4 checks passed
@stefsmeets stefsmeets deleted the percolation-graph branch June 6, 2024 14:07
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.

Approach to percolation with networkx graphs
2 participants