What would be the best approach to create pressure from the left side of my simulation, to increase the rate of diffusion of the gas (helium) through the solid (glass)?
This simulation is for teaching purposes and not meant to be accurate to reality. The criteria for success is how easily a person can observe the diffusion process, and as of right now, I don’t think the results are very easy to see on first glance.
If what you need is an animation, then … make an animation.
You don’t need LAMMPS for that. Modern AI is much faster at stealing code and violating license writing boilerplate JavaScript than humans. I generated this with a few prompts (in dropdowns below) in Claude (Sonnet 3.5) in about 5 minutes:
Create an interactive animation showing how particles will diffuse from one side of a partition with a small gap to the other side in ReactJS. There should be sliders to control the initial number of particles on either side and buttons to start, pause, and restart the animation.
Add a line graph on the bottom to show the numbers of particles on both sides of the partition over time, and another slider to control the width of the gap
Please make the gap slider control the height of the gap and not the width. Add one more slider to control the particles’ initial average speed.
I had tried some other AI approaches but the results were not even close. The script I have now was written by ChatGPT and then tweaked by me. Perplexity had a harder time getting the LAMMPS script to work at all.
I want this illustration to show how the gas particles migrate through the solid, so I think the simulation results are very close to what I need. Given that this result is so close to the objective, I think it makes the most sense to stick with this approach rather than scrap it and start from scratch.
I’ll add two general comments – but it’s not easy to see how to help you unless you can make a more specific request for help.
My first comment is that all models are wrong, and most models are useless. (Call it Xob’s Reflection.) Dynamic visualisations are dangerous for giving students (and scientists!) a false sense of competence unless clear visual model changes, theoretical quantitative predictions, and experimental verification are all aligned.
In your first post you said
but … what exactly do you want the students to see that is currently not being seen? Is there a number (or visual impression of a number) that doesn’t look right? A qualitative trend that doesn’t carry through to the simulations? We can’t help with a problem if you don’t define it.
My second comment is that molecular models, in particular, are very tricky to use in teaching students physical chemistry, and that is because molecular models are often far too small for the usual physical chemistry models to apply.
Last year I spent a while building a LAMMPS “piston and thermal gas” for illustrating the ideal gas law. It really … didn’t work. Any system that is small enough to show the atomic nature of individual gas-piston collision is also small enough that fast changes are severely dissipative while slow changes exceed the equilibration time, and thus PV = nRT is not obeyed. (They’re fantastic models for third year students to reflect on the irreversibility of finite-time protocols!)
So be very, very aware that demonstrating most phys chem results through atom-wise animations is very fraught. I can barely get an animated reactor to properly display zeroth-order and second-order kinetics.
Beyond that, I’ll be happy to help further if you have specific things you want to try doing and are not sure how to.
Most AIs can generate meaningful JavaScript because it is widely taught and used, including simple particle animations with specular reflections.
As such, the JavaScript code base is sufficiently large for brute-force statistical training to extract meaningful trends.
The set of “all LAMMPS scripts ever written” is much, much smaller. Meanwhile, LAMMPS scripts are (usually) not as complex as actual program code but they are significantly more structurally diverse than, say, GROMACS or VASP inputs. So the language training challenge is much harder, and I would not trust a language model to get very far in the next few years.
That is not surprising because MD driven diffusion through solids is extremely slow, which also applies to people trying to do science on this topic. One method to speed up the diffusion would be to switch from pure MD to a hybrid MD/MC method which you regularly do MC displacement moves (e.g. via fix gcmc without insertions/deletions) or via swapping atoms (e.g. via fix atom/swap), but of course this modifies your time axis in difficult to determine ways.
I was able to get something satisfactory by simply applying a force (left to right) to my gas particles after the first 1,000 time steps.
My problem with the previous setup was that, for the benefit of the viewer’s perception, the diffusion process is too fast in the first frames of the video and too slow in the final frames. This is probably physically correct but for my audience it impedes their ability to see how gas particles migrate through a solid, exhibiting Brownian motion. That’s really all I’m trying to show.
The viewers are a general audience, not students. If this were for science students, then I would focus more on physical correctness.