Merge pull request #1228 from invemichele/fix_plumed_install

Fix bug in lib/plumed/Install.py, some small cleanup and support parallel compile of plumed sources
This commit is contained in:
Axel Kohlmeyer
2018-11-28 16:32:04 -05:00
committed by GitHub

View File

@ -139,6 +139,7 @@ while iarg < nargs:
else: error()
homepath = fullpath(homepath)
homedir = "%s/plumed2" % (homepath)
if (pathflag):
if not os.path.isdir(plumedpath): error("Plumed2 path does not exist")
@ -170,21 +171,24 @@ if buildflag:
if os.path.exists("%s/plumed-%s" % (homepath,version)):
cmd = 'rm -rf "%s/plumed-%s"' % (homepath,version)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
if os.path.exists("%s/plumed2" % (homepath)):
cmd = 'rm -rf "%s/plumed2"' % (homepath)
if os.path.exists(homedir):
cmd = 'rm -rf "%s"' % (homedir)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
cmd = 'cd "%s"; tar -xzvf %s' % (homepath,filename)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
os.remove("%s/%s" % (homepath,filename))
# build plumed
# build plumed
print("Building plumed ...")
try:
import multiprocessing
n_cpus = multiprocessing.cpu_count()
except:
n_cpus = 1
cmd = 'cd %s/plumed-%s; ./configure --prefix=%s --enable-static-patch ; make -j%d ; make install' % (homepath,version,homedir,n_cpus)
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
print(txt.decode('UTF-8'))
if buildflag:
print("Building plumed ...")
cmd = 'cd %s/plumed-%s; ./configure --prefix=%s/plumed2 --enable-static-patch ; make ; make install' % (homepath,version,homepath)
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
print(txt.decode('UTF-8'))
#
# create 2 links in lib/plumed to plumed2 installation dir
if linkflag: