for my studies I need to process a lot of data. The data needs to be analyzed by a program called VMD and should finally be stored in an excel sheet. My aim is to automate the whole process instead of copy pasting all the different files.
I am a complete beginner with python and at the very start of writing my own program. I managed to open VMD with a python script with:
import subprocess
result = subprocess.run(['C:Program Files (x86)\\University of Illinois\\VMD\\vmd.exe', "-c", "C:\\Users\\MrTemper\\Documents\\HiWi\\Trajektorien\\Traj_2_5_to_10ps_IFR_MD_298K_1.pdb"], shell=True)
but now I want the program to load the .pdb file into the VMD program. If I run the program an error occurs: "The system could not find the given path".
How do I solve this problem? And what is the general way to control the GUI VMD program with a python script?
Answers in german language are also possible. Thanks.
I had the same problem and created a little program to help me run vmd.
VMD accepts a script when starting with the flag
-e <script>
. So we can use this to pass the routine we need it to do.That means we will have to program in tcl and use python to load our script into vmd. Then vmd can run our analysis and give an output.
In my case I created junks of tcl scripts and loaded them dynamically with python, depending on my problem, to create one analysis script and pass it as an arg. Something like this:
So in your case you will need to create a tcl script where you pass all the information, including the pdb file, that you want vmd to analyze. Then you can call it with python.
Or alternatively, if you don't want to create a script, you can just pass information as stdin to vmd. This was my solution:
Then you can even read it with
grep_stdout.decode()
.Either way you won't escape from programming in tcl, but think of this as another lang on your cv :)