Unverified Commit 9702899d authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

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
parents c0ab126e 22e774ad
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -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
 
if buildflag:
  print("Building plumed ...")
   cmd = 'cd %s/plumed-%s; ./configure --prefix=%s/plumed2 --enable-static-patch ; make ; make install' % (homepath,version,homepath)
  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'))
# 
 
# create 2 links in lib/plumed to plumed2 installation dir

if linkflag: