Exemplo n.º 1
0
  if version in checksums:
    if not checkmd5sum(checksums[version],filename):
      error("Checksum for plumed2 library does not match")

  print("Unpacking plumed2 source tarball ...")
  if os.path.exists("%s/plumed-%s" % (homepath,version)):
    shutil.rmtree("%s/plumed-%s" % (homepath,version))
  if os.path.exists(homedir):
    shutil.rmtree(homedir)
  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
  print("Building plumed ...")
  n_cpus = get_cpus()
  cmd = 'cd %s/plumed-%s; ./configure --prefix=%s --enable-static-patch ; make -j%d ; make install' % (homepath,version,homedir,n_cpus)
  try:
    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    print(txt.decode('UTF-8'))
  except subprocess.CalledProcessError as e:
    print("Make failed with:\n %s" % e.output.decode('UTF-8'))
    sys.exit(1)
 
# create 2 links in lib/plumed to plumed2 installation dir

if linkflag:
  print("Creating links to plumed2 include and lib files")
  if os.path.isfile("includelink") or os.path.islink("includelink"):
    os.remove("includelink")
  if os.path.isfile("liblink") or os.path.islink("liblink"):
Exemplo n.º 2
0
    if version in checksums:
        if not checkmd5sum(checksums[version], filename):
            sys.exit("Checksum for plumed2 library does not match")

    print("Unpacking plumed2 source tarball ...")
    if os.path.exists("%s/plumed-%s" % (homepath, version)):
        shutil.rmtree("%s/plumed-%s" % (homepath, version))
    if os.path.exists(homedir):
        shutil.rmtree(homedir)
    cmd = 'cd "%s"; tar -xzvf %s' % (homepath, filename)
    subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
    os.remove(os.path.join(homepath, filename))

    # build plumed
    print("Building plumed ...")
    n_cpus = get_cpus()
    cmd = 'cd %s/plumed-%s; ./configure --prefix=%s --enable-modules=all --enable-static-patch ; make -j%d ; make install' % (
        homepath, version, homedir, n_cpus)
    try:
        txt = subprocess.check_output(cmd,
                                      stderr=subprocess.STDOUT,
                                      shell=True)
        print(txt.decode('UTF-8'))
    except subprocess.CalledProcessError as e:
        print("Make failed with:\n %s" % e.output.decode('UTF-8'))
        sys.exit(1)

# create 2 links in lib/plumed to plumed2 installation dir

print("Creating links to plumed2 include and lib files")
if os.path.isfile("includelink") or os.path.islink("includelink"):
      sys.exit("Checksum for ScaFaCoS library does not match")

  print("Unpacking ScaFaCoS tarball ...")
  if os.path.exists(scafacospath):
    shutil.rmtree(scafacospath)
  tarname = os.path.join(homepath, "%s.tar.gz" % scafacospath)
  if tarfile.is_tarfile(tarname):
    tgz = tarfile.open(tarname)
    tgz.extractall(path=homepath)
    os.remove(tarname)
  else:
    sys.exit("File %s is not a supported archive" % tarname)

  # build ScaFaCoS
  print("Building ScaFaCoS ...")
  n_cpu = get_cpus()
  cmd = 'cd "%s"; ./configure --prefix="%s" --disable-doc --enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m --with-internal-fftw --with-internal-pfft --with-internal-pnfft CC=mpicc FC=mpif90 CXX=mpicxx F77=; make -j%d; make install' % (scafacospath, os.path.join(homepath, 'build'), n_cpu)
  try:
    txt = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
    print(txt.decode('UTF-8'))
  except subprocess.CalledProcessError as e:
    sys.exit("Make failed with:\n %s" % e.output.decode('UTF-8'))

# create 2 links in lib/scafacos to ScaFaCoS include/lib dirs

print("Creating links to ScaFaCoS include and lib files")
if os.path.isfile("includelink") or os.path.islink("includelink"):
  os.remove("includelink")
if os.path.isfile("liblink") or os.path.islink("liblink"):
  os.remove("liblink")
if buildflag: