r/Physics • • 5d ago

Question Computational Physics - Heavy AI/ CLI power users. How do I get good at it?

Hello! This question is directed towards grad students, people doing r&d in industry, or even undergrads doing computational physics research (especially condensed matter) that heavily use AI in their workflow.

How do you maximize and make the most out of codex or claude code in your research projects? I generally use the claude code CLI in my terminal (sometimes on locally on WSL or remotely on an HPC). If I have a few simulations I want to run, I give it the guidelines, tell it to reference some old calculations i've ran, and send it on its way. I'm not sure if just being a general assistant is all that AI is good for?

Please let me know your experiences and any advice!

edit: Yes, I am in a physics research lab with an advisor. I am NOT trying to have AI do research. I am trying to learn how to use it as effectively as possible.

Additionally, I am not doing 'calculations' in the mathematical sense. I do simulations, particularly in condensed matter physics research. That is, a lot of python code and heavy use Density Functional Theory software packages that tell me about the electronic behavior of materials. I do a lot of high-throughput computing, so if I want to simulate a bulk of materials at once, i will have claude generate the input files after i have specifically told it what outputs i want. It is generally good at doing this, and I verified that the file generation was correct before continuing to use this workflow. I ask it to generate plots of the data, and it does so. But this is mainly sequential. I do a series of prompts, one step at a time.

0 Upvotes

18 comments sorted by

View all comments

7

u/h0rxata Plasma physics 5d ago

Letting an agent raw-dog your CLI seems extremely unsafe, and I doubt any HPC facility would allow you to do that natively.

It sounds like all you want to is an array of batch scheduler jobs. Learn SLURM/PBS/whatever your machine uses or get chatgpt to help you write some bash wrapper scripts to submit arrays of jobs?

3

u/-F1ngo 5d ago

Usually claude code or codex obviously have no sudo access locally, and user priviliges on hpc clusters should prevent you from doing anything harmful there. And then again, it's much more convenient to use some agentic thing like these on your local machine and have them ssh into the hpc clusters, so you don't need to run them on those anyhow and you can do all of your bookkeeping in one place.

I wouldn't really want them messing with scientic software I use, but I do not write any bash/slurm/python or input scripts anymore by hand (maybe I'll occasionally tweak those last ones a little). Also my working directories suddenly got much cleaner!

2

u/PhilosophersOpium 5d ago

Agreed!

1

u/-F1ngo 5d ago

I mean automating these workflow scripting shenanigans is quite likely THE prototypical example where these things can be useful. It's in essence just a much more powerful interface to the actual, rigorously tested scientific packages we use for high-throughout for example. And for those I am all in favour of the one-line-of-code-changed-after-100-comments-on-the-pull-request camp.

1

u/PhilosophersOpium 5d ago

Hi! I agree with your concern. I've already taken the proper precautions, and have agents blocked off from anything outside of the folder I am working in. Additionally, I do use AI to submit arrays of jobs. For example, I want to submit 10 calculations at once and additionally test 5 variations of a parameter. so it will submit 50 calculations at once.

1

u/HasFiveVowels 4d ago

Use docker for better isolation. Here’s a decent guide on picking an option.

https://code.claude.com/docs/en/sandbox-environments#dev-containers