Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3228724
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:43:36+00:00 2026-05-17T16:43:36+00:00

I’m writing a script to extract some useful data about a series of chemical

  • 0

I’m writing a script to extract some useful data about a series of chemical simulations I’ve been running.

To get this data I need (1) a C-program that calculates the density from a file type called *.pdb. I already have (1). And (2) I need to use a program called vmd to get that pdb. In order to accomplish (2) from the command line, I can submit a tcl script, as vmd has a build in tcl interpreter.

These functions — calling the vmd to run the tcl script, then running the compiled c-program — will be the key activities of my wrapper data extraction script.

I would like to eliminate the superfluous TCL script, reducing my count from 2 scripts (wrapper script + tcl script for vmd) down to 1. But I’m not sure quite how to do this. One potentially solution seems to be to embed my TCL script within my wrapper script, if there’s a way to make such an embedded script callable from external programs.

Most of my data collection scripts so far have been in BASH, so ideally I would like to stick to a BASH script as I’m very familiar with bash scripting versus having only beginning knowledge of Python/Perl.

Here are my questions:
1. Can you embed a TCL script inside a Bash script?
2. Can you make this script callable by an external program?
e.g. in pseudocode:

#!/bin/bash
....
tclembed extract {
   #tcl script
   ...
}
...
vmd -dispdev text -e extract.tcl >& extract_results.log #where vmd is 
                                                        #an external program

3. If the answer to #2 is no, can you do this in Python, perhaps with the Minotaur library? I would consider the switch to python, if so…
http://markmail.org/message/6kogjphzqtn4ilch
4. If not, how would you suggest trying to merge these two scripts (a tcl routine and a bash script that calls it) into a single file?
5. If anybody HAS gotten external calls of this nature to work using Minotaur, can you post some explanatory code?

I’ve thought of one non-embedding solution which to #4, which would be to write a function in my Bash script that writes a file with the entire tcl script. That way I would have a single script, but could dump the subscript for use with external programs, later deleting it. I have a feeling this solution is kinda kludgy though I know for sure that it works, vs. embedded solutions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:43:37+00:00Added an answer on May 17, 2026 at 4:43 pm

    There have been several Tcl-Python alloys. As Rafe Kettler’s comment above sketches, the place to start is with a standard Python installation. This includes Tkinter, which builds in a full Tcl interpreter, accessible as described in the Wiki page mentioned. So, yes, it is feasible to “do this in Python”.

    I really don’t get what this has to do with vmd, though. vmd builds in a Tcl interpreter already. While I entirely support the aim of “reduction of moving parts”, so that you have, for example, one script, rather than two, coding something in Python, when vmd already exposes Tcl, doesn’t seem like a step in the direction Jason R. Mick wants to go.

    SOMEWHAT LATER: after an exchange of comments with Jason R. Mick, it occurred to me he might find

    #!/bin/bash
    
    
    echo "Here's a bit of bash-iness."
    
    MYSCRIPT='
    puts "Here I am, inside Tcl."
    puts "See?  I can do calculations:  [expr 3 + 5]."
    exit 0
    '
    
    tclsh << HERE
    $MYSCRIPT
    HERE
    

    suggestive. Its output, of course, is

    Here's a bit of bash-iness.
    Here I am, inside Tcl.
    See?  I can do calculations:  8.
    

    I wrote this in terms of tclsh, but, if I’m keeping up, Jason R. Mick will actually want to use vmd. The appropriate homologue for *vmd is something like

        ...
    vmd -dispdev text -eofexit << HERE > output.log
    $MYSCRIPT
    HERE
    

    While I can think of several other ways to meld bash and Tcl, I believe this one is most in the spirit of the original question.

    I want to note, too, that, from the little I know of vmd, it would be entirely appropriate to do the same with Python in place of Tcl: vmd is equally adept with either.

    Finally, both Python and Tcl are general-purpose languages, with approximately the same power as bash, so yet another direction to take this project would be to write it entirely in Tcl (or Python), rather than bash. Embedding scripts in the way illustrated above is at least as easy in Tcl (or Python) as in bash.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.