-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·56 lines (45 loc) · 1.62 KB
/
setup.sh
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
#!/bin/bash -i
source deactivate > /dev/null 2>&1
exists='True'
source activate barriers || exists='False' > /dev/null 2>&1
source deactivate > /dev/null 2>&1
if [ "$exists" == "True" ]; then
echo 'Barriers conda environment already exists; skipping environment installation'
else
# upgrade conda
conda upgrade conda -y
# install environment
conda env create -f environment.yml
fi
# display environment in jupyter
python -m ipykernel install --user --name barriers --display-name "Python [conda env:barriers"]
barrier_dir=$(pwd)
# install NFF
cd ..
if [ -d "NeuralForceField" ]; then
echo 'NeuralForceField directory already exists; skipping installation'
else
git clone [email protected]:learningmatter-mit/NeuralForceField.git || echo 'FAILED to clone NFF. Please check your ssh permissions and then run `cd .. && git clone [email protected]:learningmatter-mit/NeuralForceField.git`'
fi
nff_dir=$(pwd)/NeuralForceField
cd -
# export paths to bashrc or bash_profile
text='export BARRIERS='$barrier_dir'
export PYTHONPATH=$BARRIERS:$PYTHONPATH
export NFFDIR='$nff_dir'
export PYTHONPATH=$NFFDIR:$PYTHONPATH'
if [ -f -a ~/.bashrc ]; then
echo "Found ~/.bashrc. Exporting path."
bash_path="$HOME/.bashrc"
elif [ -f -a ~/.bash_profile ]; then
echo "Found ~/.bash_profile. Exporting path."
bash_path="$HOME/.bash_profile"
fi
if [ ! -z "${bash_path}" ]; then
while IFS= read -r line; do
grep "$line" $bash_path || echo "$line" >> $bash_path
done <<< "$text"
echo "Done!"
else
echo "Couldn't find ~/.bashrc or ~/.bash_profile. Please export paths manually, as described in `setup.md`"
fi