Running Pymol console commands through Bash script

1.3k views Asked by At

I want to run commands in the pymol console through a bash script.How can i do it? Below is my code but it is not working.

#!/bin/bash
##
## PyMOL startup script
##

# Set PYMOL_PATH to point to this directory
export PYMOL_PATH="$(dirname "$(readlink -f "$0")")"

# other environment variables
export PYTHONHOME=$PYMOL_PATH/ext
export PYTHONPATH=$PYTHONHOME/lib/python2.7:$PYTHONHOME/lib/python2.7 /lib-tk:$PYTHONPATH
export LD_LIBRARY_PATH=$PYMOL_PATH/ext/lib:$LD_LIBRARY_PATH
export LANG=C

# binary executable
exec $PYMOL_PATH/pymol.exe "$@"
exec cmd.load("1a4g.pdb") 
exec cmd.quit()
1

There are 1 answers

0
Mehdi Nellen On

You can just make a PyMOL script in your bash script:

#!/bin/bash

$PROT1="1a4g"
$PROT2="1ogg"

#create the script
echo "fetch $PROT1
fetch $PROT2
select *" > script.pml

# GO!
pymol script.pml

Alternatively, if you want to start a script from within pymol itself (PyMOL wiki)