-
Notifications
You must be signed in to change notification settings - Fork 1
/
cosmovar.zsh
executable file
·67 lines (61 loc) · 1.8 KB
/
cosmovar.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This script must be sourced reference should not have ".." e.g. ./../path
#--------------DETERMINE LOCATION OF SOURCED SCRIPT------------
MYLOCATION=$0
#the following commad finds the directory of sourced script
#if below protects from filename being used instead of directory
if [ -f "$MYLOCATION" ]
then
FULLPATH=$(pwd)
else
FULLPATH=$(echo "$MYLOCATION" | sed "s|\.|$(pwd)|")
fi
#----------LOCATION IS DETERMINED------------------
#----------SET PATH VARIABLE DEPENDING ON ARGUMENT-----------
if [ -d "$1" ];
then
export COSMO=$1
#use parameter to set path
else
export COSMO=$FULLPATH
fi
if [ -d "$COSMO" ]
then
#ls -d $PWD/*
echo "Shell Model Path:" $COSMO
#make sure we bave bin path
if [ ! -d "$COSMO/bin" ]; then
mkdir -p "$COSMO/bin";
fi
#export path
export PATH="$COSMO/bin:$PATH"
#export
if [ ! -d "$COSMO/interactions" ]; then
echo "--------Problem---------"
echo "Interactions are expected in $COSMO/interactions"
echo "but were not found, most defaults will not work"
echo "SMINTPATH variable is not set"
echo "-------------------------"
else
SMINTPATH=$(ls -d $COSMO/interactions/*/ | awk '{printf ":"$0}' | sed '1s/^.//')
export SMINTPATH="$COSMO/interactions:$SMINTPATH"
fi
export JISPPATH="$COSMO/JISPintFiles"
if [ -f "$COSMO/Makefile" ]; then
export MAKEFILES="$COSMO/Makefile"
echo "Default Makefile:" $MAKEFILES
else
echo "Default Makefile is unchanged"
#advise on makefile
if [ -f "$COSMO/Makefile_template" ]; then
echo "--------Notice---------"
echo "If you are running for the first time consider "
echo "copying Makefile_template to Makefile "
echo "and setting CXX to and flags to match your system"
echo "-----------------------"
fi
fi
else
echo "No valid direcoty is found"
echo "Either run script by providing a full path to it or use an argument"
echo "Argument: $1"
fi