arm61 / pylj

Teaching Utility for Classical Atomistic Simulation.
https://pythoninchemistry.org/pylj
MIT License
29 stars 20 forks source link

Animations not working? #55

Open markperri opened 2 years ago

markperri commented 2 years ago

Describe the bug I'm working through the ideal_gas_law example. I have a feeling the plot of atoms should animate them moving around the box, but there's no display until the calculation is over, then it just shows what I think is the last frame.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'ideal_gas_law example notebook'
  2. Click on 'simulation1 = md_simulation(4, 100., 100, 10000, sample.JustCell)'
  3. Scroll down to 'plot'
  4. Nothing displays until the calculation is over, then it's just a static plot.

Expected behavior From the instructions it seems like it should be animated?.

Screenshots image

Desktop (please complete the following information):

Additional context

arm61 commented 2 years ago

Thanks for opening this issue. Before we get into things are you using a Jupyter Notebook or JupyterLab?

arm61 commented 2 years ago

I have tested this locally on a Jupyter Notebook (I don't think that JupyterLab works) and could reproduce, adding

%matplotlib notebook

to the first cell seemed to get things moving again.

(n.b. this package is only supported in legacy mode currently, my career has moved away from teaching but I would like the chance to get it running nicely again!)

markperri commented 2 years ago

Thanks, that worked! I'm using the classic notebook as well. Hopefully they retain that, I know they want to move only to Lab at some point.

arm61 commented 2 years ago

Great! Glad to hear it works. I will keep the issue open to remind me to fix the notebooks.