-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
80 lines (70 loc) · 2.45 KB
/
setup.py
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
67
68
69
70
71
72
73
74
75
76
77
78
79
import unittest,os
from pathlib import Path
import pkg_resources
#_REQUIREMENTS_PATH = Path(__file__).parent.with_name("requirements.txt")
class TestRequirements(unittest.TestCase):
def test_requirements(self):
requirements = pkg_resources.parse_requirements("requirements.txt")
for requirement in requirements:
requirement = str(requirement)
with self.subTest(requirement=requirement):
pkg_resources.require(requirement)
#checking whether GROMACS is working or not.
GROtest=False
print("Testing whether GROMACS is installed")
for x in "gmx_mpi" "gmx" "gmx_mpi_d" "gmx_gpu":
os.system(x+" -h > test")
with open('test') as f:
ln=f.read()
if 'Executable' in ln:
GROtest=True
GROpath=ln.strip().split()[1]
print("Modify the GROMACS command in parameter.py file with "+GROpath)
break
else:
print(x+" : failed ...")
pwd=os.getcwd()
GROtest=False
if GROtest==False:
os.system("wget http://ftp.gromacs.org/pub/gromacs/gromacs-2021.1.tar.gz ")
os.system("tar -xvzf gromacs-2021.1.tar.gz ")
os.system("mkdir gromacs-2021.1/build")
os.system("mkdir soft")
os.system("mkdir soft/gromacs")
#os.chdir("gromacs-2019.6/build")
os.system("cmake -S "+pwd+"/gromacs-2021.1 -B "+pwd+"/gromacs-2021.1/build -DCMAKE_INSTALL_PREFIX="+pwd+"/soft/gromacs -DGMX_FFT_LIBRARY=fftw3 -DGMX_BUILD_OWN_FFTW=ON -DGMX_MPI=ON -DGMX_GPU=CUDA; ")
os.chdir(pwd+"/gromacs-2021.1/build")
os.system("make -j4; make install")
os.chdir(pwd)
#checking whether AMBER is working or not.
print("Testing whether tleap, amb2gro_top_gro.py in AMBERTools package is installed")
tleaptest=False
for x in "tleap":
os.system(x+" -h > test")
with open('test') as f:
ln=f.read()
if 'Usage' in ln:
tleaptest=True
tleappath=ln.strip().split()[1]
else:
print(x+" : failed ...")
#clean trash
os.system("rm -r test")
amb2grotest=False
for x in "tleap":
os.system(x+" -h > test")
with open('test') as f:
ln=f.read()
if 'Usage' in ln:
amb2grotest=True
amb2gropath=ln.strip().split()[1]
else:
print(x+" : failed ...")
#clean trash
os.system("rm -r test")
pwd=os.getcwd()
ambertooltest=amb2grotest or tleap
if ambertooltest==False:
os.system("conda install -c conda-forge ambertools=20 ")
#clean trash
os.system("rm -r test")