Re: [AMBER] bashrc problems

From: Ben Roberts <ben.roberts.geek.nz>
Date: Sun, 13 Nov 2011 22:53:12 -0500

On 4/11/2011, at 2:31 PM, Ross Walker wrote:

> Hi James and Other AMBER Users,
>
> I think it is our opinion as developers, and others can chime in here, that
> one should NOT add $AMBERHOME/bin to the path. This can be dangerous since
> we don't choose executable names to be unique etc. Thus you could
> accidentally run the wrong command by mistake. It also means you might be
> running an older version of the code without realizing it if you don’t check
> what's in the path. A similar problem occurs with Gaussian that uses the
> name 'gv' for Gaussview that clashes with ghostview for example.
>
> My suggestion would be that ALL amber command should be run with the
> $AMBERHOME/bin prefix. That is you would do:
>
> $AMBERHOME/bin/xleap
> ...
> $AMBERHOME/bin/pmemd.cuda
>
> etc. That way if you echo $AMBERHOME before you start you won't get any
> surprises later about running the wrong version by mistake etc. I think this
> is good discipline to have when doing scientific research.

If people are willing to bear with me as I stir this thread again, another option is to have $AMBERHOME not set in the default resource files (such as .bashrc or .bash_profile), but in a separate resource file (called e.g. amber.rc) that is sourced manually by the user when needed:

[user.computer dir]$ source ~/rc/amber.rc

OR

[user.computer dir]$ . ~/rc/amber.rc

(this does, of course, assume that the user has created a directory ~/rc and put the file amber.rc in it. The resource file does not actually have to be in such a place.)

This is the approach I use, and it works quite well. It also allows for multiple installations of Amber on the same machine, and I can select the most appropriate one as I wish. If I want to switch, I just exit out of that particular shell.

Also, if you want to see what commands in $AMBERHOME/bin override other commands already present on your system, you can put code in a resource file to do that. Something like this seems to work on my system:

for bin in ${AMBERHOME}/bin/*
do
    binbase=$(basename ${bin})
    alias=`alias ${binbase} 2>/dev/null`
    overridden=`which ${binbase}`
    if [ "x${alias}" != "x" ]
    then
        echo "warning: ${bin} is masked by ${alias}"
    elif [ "x${overridden}" != "x" ]
    then
        echo "warning: ${bin} overrides ${overridden}"
    fi
done


Hope that helps,

Ben
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sun Nov 13 2011 - 20:00:03 PST
Custom Search