-2

Does anyone know a complete tutorial to learn about writing Python or TCL scripts? I want to write a script to load a molecule , make 3 representations of it, and change attributes(like coloring method, drawing method, isovalue, etc) of each of them and finally render the image.

I went through this tutorial, but all it teaches to do with a script are to load a molecule and select atoms. http://www.ks.uiuc.edu/Training/Tutorials/vmd/tutorial-html/node4.html

Is there any source to learn to write a script to do more advanced vmd operations?

Gihan
  • 73
  • 6
  • *"Questions asking us to recommend or find a book, tool, software library, **tutorial** or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it."* – jonrsharpe Mar 08 '15 at 22:17
  • What I have been able do so far is just to load and select all the atoms in the molecule as, mol new 000.0000-0001.xsf set gold [atomselect top "all"] – Gihan Mar 08 '15 at 22:25
  • Please see http://stackoverflow.com/help/how-to-ask – jonrsharpe Mar 08 '15 at 22:26

3 Answers3

3

For general learning of Tcl, there's the Tcl Tutorial. For general learning of Python, there's The Python Tutorial (Python 2 version). You'll need to pick what route you use there. Then you'll have enough information to look at the VMD documentation and make your own way, provided you're a bit imaginative about how to go about tackling the problem. You can ask here when you've got a specific problem that you've got stuck on; Stack Overflow is about helping with specific problems, not general “where do I start on this project?!” problems.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
0

One possibility is that you first create your representations, change the attributes etc. Then, when you are done, you save the state into a file (File->Save Visualization State...). The file that has been created in this way is a script that you can edit using a normal text editor. For example, you can search and replace the names of the molecule files you loaded, to apply the same representations to other molecules. You can also add the rendering command at the end of the script file, for example:

render tachyon rendered_image.tga

After editing the file you can load it directly in VMD via File->Load Visualization State... Alternatively you can load it when launching VMD :

vmd -e your_edited_visualization_state_file.vmd
Giannis
  • 389
  • 3
  • 4
0

Check the MDAnalysis library on python. It is covered most of the existing features on TCL scripts. They also have a website containing a full description of the usage of this library.

https://www.mdanalysis.org