Re: [AMBER] Question about AmberTools14/15 installation

From: Jason Swails <jason.swails.gmail.com>
Date: Mon, 8 Feb 2016 08:15:05 -0500

On Mon, Feb 8, 2016 at 3:15 AM, A kS <aks25121986.gmail.com> wrote:

> Dear AMBER user,
>
> I am new to AMBER. I am trying to install the AmberTools14 and AmberTools15
> in Ubuntu 12.04 64 bit system. After reading the Jason Swails installation
> instruction and doing some trials with both the AmberTools I found that the
> amber.sh file have these lines :
>
>
>
> *********************************************************************************************************in
> AmberTools14:*
>
> if [ -z "${LD_LIBRARY_PATH}" ]; then
> export LD_LIBRARY_PATH="${AMBERHOME}/lib"
> else
> export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${AMBERHOME}/lib"
> fi
>
> *in AmberTools15*:
>
> if [ -z "$PYTHONPATH" ]; then
> export PYTHONPATH="${AMBERHOME}/lib/python2.7/site-packages"
> else
> export
> PYTHONPATH="${AMBERHOME}/lib/python2.7/site-packages:${PYTHONPATH}"
> fi
> if [ -z "${LD_LIBRARY_PATH}" ]; then
> export LD_LIBRARY_PATH="${AMBERHOME}/lib"
> else
> export LD_LIBRARY_PATH="${AMBERHOME}/lib:${LD_LIBRARY_PATH}"
> fi
>
>
> *******************************************************************************************************************
>
> *Instruction says that after doing ./configure we can do "source amber.sh"
> and after make install "echo "source $AMBERHOME/amber.sh" >> ~/.bashrc"*
>
> My problems are:
>
> 1. I am unable to clearly understand the meaning of that "if else loop".
> What I found out that, if [ -z "something" ] means: if "something" is
> absent then do task1 else task2. So when I source that amber.sh in terminal
> how exactly it add all paths to my .bashrc file, at least the syntax.
>

​There are two scenarios that can happen with an environment variable that
specifies a path -- it can either be set or it can be *not* set. The "if [
-z $VARIABLE ]" is true if the variable is *not* set. So what that logic
is doing is testing to see if LD_LIBRARY_PATH or PYTHONPATH (which are
environment variables controlling where the ld loader looks for shared
libraries at runtime and where Python looks for modules at runtime,
respectively) are set. If they are *not* set, they get set to the values
that Amber needs. If they *are* set, we don't want to overwrite their
original values, so the values that Amber needs are prepended to the list.
The main difference between what that script does and the lines in your
.bashrc file:

export LD_LIBRARY_PATH=${AMBERHOME}/lib:$LD_LIBRARY_PATH

is that if LD_LIBRARY_PATH is *not* set at that time, the resulting value
is "/path/to/amber14:", with a trailing :. It doesn't ruin things, but I
don't like stuff like that which is why I implemented that logic in
amber.sh and amber.csh


> 2. Doing "*echo "source $AMBERHOME/amber.sh" >> ~/.bashrc*" will add the
> "source $AMBERHOME/amber.sh" line to .bashrc and how it will help to run
> AMBER in future.
>

​If your main shell is bash, then login shells source the commands in your
.bashrc (or .profile/.bash_profile) file. So that command will put the
line "source /path/to/amber14/amber.sh" in your .bashrc file, making sure
that when you start a new shell that file is sourced. ("sourcing" a file
is the logical equivalent of copying the contents of the sourced file at
the point where it is sourced).​
​​

3. I learned little bit of old style of adding path to .bashrc. So I add
> these lines to .bashrc for all the AmberTools
>
>
> *********************************************************************************
> export AMBERHOME=/home/a/application/ambertools15
> #export AMBERHOME=/home/a/application/ambertools14
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AMBERHOME/lib
> export PATH=$AMBERHOME/bin:$PATH
> export DO_PARALLEL='mpiexec.hydra -n 8'
>
> **************************************************************************************
>

​This is *exactly* what "source $AMBERHOME/amber.sh" would do, except it
would do a better job. First of all, the fact that you didn't add the
PYTHONPATH part means that Python programs (like MMPBSA.py) won't work.
Second, DO_PARALLEL is *not* an environment variable that Amber requires.
It's only used for *parallel* tests, and could cause problems when trying
to run serial tests. You should remove the declaration of that environment
variable and only set it when it is specifically needed.

I highly recommend running the above-mentioned command:

echo "source $AMBERHOME/amber.sh" >> ~/.bashrc

and removing the lines you mentioned above from your .bashrc file.

so that whenever I need any of the amberttools (i know its silly cause now
> AmberTools15 have all the features of its previous version) I just comment
> the other AMBERHOME containing line.
> Is it correct one??
>

​I'm not exactly sure what you're asking here. Changes to your .bashrc
file will only affect terminals that you open *after* saving those
changes. If you change your .bashrc, it won't affect any shells that are
already running. So just "commenting out" a line in your .bashrc​

​won't affect terminal windows that are already open.

If you have the amber.sh file sourced in your .bashrc, you will be able to
use Amber in any terminal you start.

HTH,
Jason

-- 
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Feb 08 2016 - 05:30:03 PST
Custom Search