Commit 1c143539 by Francois Gygi

Merge branch 'develop' into hse-dev

Conflicts:
	src/ExchangeOperator.C
	src/ExchangeOperator.h
	src/KPGridConnectivity.C
	src/KPGridConnectivity.h
	src/Species.C
	src/XCPotential.h
	src/Xc.h
	src/notes
	util/cell.plt
	util/econst.plt
	util/econst_cmp.plt
	util/econste.plt
	util/econste_cmp.plt
	util/egap.sh
	util/etotal.plt
	util/etotal_cmp.plt
	util/etotal_int.plt
	util/etotal_int_cmp.plt
	util/force.plt
	util/kpgen/kpgen.C
	util/qbox_msd.py
	util/sigma.plt
	util/temp_ion.plt
	util/volume.plt
parents 453e1ccf e9d66bfe
#-------------------------------------------------------------------------------
#
# bgq.mk
#
#-------------------------------------------------------------------------------
#
PLT=BGQ
#-------------------------------------------------------------------------------
# use the following .soft environment
####~/.soft###
# @default
# +mpiwrapper-xl
CXX=mpic++
LD=$(CXX)
PLTFLAGS += -DUSE_MPI -DSCALAPACK
PLTFLAGS += -D__linux__ -DPLT_BIG_ENDIAN
PLTFLAGS += -DUSE_XERCES
PLTFLAGS += -D_LARGEFILE_SOURCE
PLTFLAGS += -D_FILE_OFFSET_BITS=64
PLTFLAGS += -DMPICH_IGNORE_CXX_SEEK
PLTFLAGS += -DUSE_MASSV
# FFT must be FFTW2, FFTW3, ESSL or NOLIB
FFT=ESSL
ifeq ($(FFT),FFTW2)
PLTFLAGS += -DUSE_FFTW2
PLTFLAGS += -DUSE_DFFTW
PLTFLAGS += -DFFTWMEASURE
FFTWDIR=/soft/libraries/alcf/current/xl/FFTW2
FFTWINCLUDEDIR=$(FFTWDIR)/include
FFTWLIBDIR=$(FFTWDIR)/lib
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -ldfftw
endif
ifeq ($(FFT),FFTW3)
PLTFLAGS += -DUSE_FFTW3
PLTFLAGS += -DFFTWMEASURE
FFTWDIR=/soft/libraries/alcf/current/xl/FFTW3
FFTWINCLUDEDIR=$(FFTWDIR)/include
FFTWLIBDIR=$(FFTWDIR)/lib
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw3
endif
ifeq ($(FFT),ESSL)
PLTFLAGS += -DUSE_ESSL_FFT
#PLTFLAGS += -DUSE_ESSL_2DFFT
endif
ifeq ($(FFT),NOLIB)
PLTFLAGS += -DFFT_NOLIB
endif
XERCESCDIR=$(HOME)/software/xerces/xerces-c-src_2_8_0
XERCESCLIBDIR=$(XERCESCDIR)/lib
SCALAPACKLIBDIR=/soft/libraries/alcf/current/xl/SCALAPACK/lib
SCALAPACKLIB=-lscalapack
LAPACKLIBDIR=/soft/libraries/alcf/current/xl/LAPACK/lib
LAPACKLIB=-llapack
BLASLIBDIR=/soft/libraries/essl/current/lib64
BLASLIB=-lesslsmpbg
INCLUDE += -I$(XERCESCDIR)/include
CXXFLAGS= -g -O3 -qsmp=omp -qarch=qp -qtune=qp \
-D$(PLT) $(INCLUDE) $(PLTFLAGS) $(DFLAGS)
LIBPATH += -L$(XERCESCLIBDIR) -L$(SCALAPACKLIBDIR) \
-L$(LAPACKLIBDIR) -L$(BLASLIBDIR) \
-L${IBM_FCMP}/bglib64 \
-L${IBM_MAIN_DIR}/xlmass/bg/7.3/bglib64 \
-L${IBM_MAIN_DIR}/xlf/bg/14.1/bglib64 \
-L${IBM_MAIN_DIR}/xlsmp/bg/3.1/bglib64 \
-L$(IBM_MAIN_DIR)/xlf/bg/14.1/bglib64
LIBS += $(PLIBS) $(SCALAPACKLIB) $(LAPACKLIB) $(BLASLIB) \
-lmass -lmassv -lxerces-c \
-lxlf90_r -lxlfmath -lxl \
-lxlsmp -lxlomp_ser \
-lpthread -lgomp
LDFLAGS = $(LIBPATH) $(LIBS)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# Copyright (c) 2008-2015 The Regents of the University of California
#
# This file is part of Qbox
#
# Qbox is distributed under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
# See the file COPYING in the root directory of this distribution
# or <http://www.gnu.org/licenses/>.
#
#-------------------------------------------------------------------------------
#
# centos6.mk
#
#-------------------------------------------------------------------------------
# Prerequisites:
# On a Centos-6.6 system, install the following packages:
# yum install xerces-c xerces-c-devel
# yum install openmpi openmpi-devel
# yum install lapack lapack-devel
# yum install fftw fftw-devel
# yum install scalapack-common scalapack-openmpi \
# scalapack-openmpi-devel scalapack-openmpi-static
# yum install libuuid libuuid-devel
#
#-------------------------------------------------------------------------------
PLT=Linux_x8664
#-------------------------------------------------------------------------------
PLTOBJECTS = readTSC.o
SVN_VER :=$(shell svnversion -n)
DFLAGS += -DSVN_VERSION='"$(SVN_VER)"'
CXX=mpicxx
LD=$(CXX)
PLTFLAGS += -DIA32 -D_LARGEFILE_SOURCE \
-D_FILE_OFFSET_BITS=64 -DUSE_MPI -DSCALAPACK -DADD_ \
-DAPP_NO_THREADS -DXML_USE_NO_THREADS -DUSE_XERCES \
-DXERCESC_3 -DMPICH_IGNORE_CXX_SEEK -DUSE_UUID
# FFT must be FFTW2, FFTW3, ESSL or NOLIB
FFT=FFTW3
ifeq ($(FFT),FFTW2)
PLTFLAGS += -DUSE_FFTW2
PLTFLAGS += -DFFTWMEASURE
FFTWDIR=$(HOME)/software/fftw/Linux_x8664/fftw-2.1.5/fftw
FFTWINCLUDEDIR=$(FFTWDIR)
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw
endif
ifeq ($(FFT),FFTW3)
PLTFLAGS += -DUSE_FFTW3
PLTFLAGS += -DFFTWMEASURE
#PLTFLAGS += -DFFTW_TRANSPOSE
PLTFLAGS += -DFFTW3_2D
#FFTWDIR=$(HOME)/software/fftw/fftw-3.3.4
#FFTWINCLUDEDIR=$(FFTWDIR)/api
#FFTWLIBDIR=$(FFTWDIR)/.libs
#INCLUDE += -I$(FFTWINCLUDEDIR)
#LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw3
endif
ifeq ($(FFT),ESSL)
$(error ESSL library not available)
endif
ifeq ($(FFT),NOLIB)
PLTFLAGS += -DFFT_NOLIB
endif
CXXFLAGS= -g -O3 -Wunused -D$(PLT) $(INCLUDE) $(PLTFLAGS) $(DFLAGS)
LIBS += -lpthread -lxerces-c -lscalapack -llapack -lblas -luuid
LDFLAGS = $(LIBPATH) $(LIBS)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# Copyright (c) 2008 The Regents of the University of California
#
# This file is part of Qbox
#
# Qbox is distributed under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
# See the file COPYING in the root directory of this distribution
# or <http://www.gnu.org/licenses/>.
#
#-------------------------------------------------------------------------------
#
# gcc_atlas.mk
#
#-------------------------------------------------------------------------------
PLT=Linux_x8664
#-------------------------------------------------------------------------------
SCALAPACKDIR = $(HOME)/software/scalapack/scalapack-2.0.2
XERCESCDIR=$(HOME)/software/xerces/xerces-c-src_2_8_0
ATLASDIR=/usr/lib64/atlas
PLTOBJECTS = readTSC.o
SVN_VER :=$(shell svnversion -n)
DFLAGS += -DSVN_VERSION='"$(SVN_VER)"'
CXX=mpicxx
LD=$(CXX)
PLTFLAGS += -DIA32 -D_LARGEFILE_SOURCE \
-D_FILE_OFFSET_BITS=64 -DUSE_MPI -DSCALAPACK -DADD_ \
-DAPP_NO_THREADS -DXML_USE_NO_THREADS -DUSE_XERCES \
-DMPICH_IGNORE_CXX_SEEK
# FFT must be FFTW2, FFTW3, ESSL or NOLIB
FFT=FFTW2
ifeq ($(FFT),FFTW2)
PLTFLAGS += -DUSE_FFTW2
PLTFLAGS += -DFFTWMEASURE
FFTWDIR=$(HOME)/software/fftw/Linux_x8664/fftw-2.1.5/fftw
FFTWINCLUDEDIR=$(FFTWDIR)
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw
endif
ifeq ($(FFT),FFTW3)
PLTFLAGS += -DUSE_FFTW3
PLTFLAGS += -DFFTWMEASURE
#PLTFLAGS += -DFFTW_TRANSPOSE
PLTFLAGS += -DFFTW3_2D
FFTWDIR=$(HOME)/software/fftw/fftw-3.3.4
FFTWINCLUDEDIR=$(FFTWDIR)/api
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw3
endif
ifeq ($(FFT),ESSL)
$(error ESSL library not available)
endif
ifeq ($(FFT),NOLIB)
PLTFLAGS += -DFFT_NOLIB
endif
INCLUDE += -I$(XERCESCDIR)/include
CXXFLAGS= -g -O3 -Wunused -D$(PLT) $(INCLUDE) $(PLTFLAGS) $(DFLAGS)
LIBPATH += -L$(XERCESCDIR)/lib \
-L$(ATLASDIR) -L$(SCALAPACKDIR) -L/usr/lib64
LIBS += -lpthread -lxerces-c -lscalapack -llapack -lf77blas -latlas
LDFLAGS = $(LIBPATH) $(LIBS)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# icc_mkl.mk
#
#-------------------------------------------------------------------------------
#
PLT=x86_64
#-------------------------------------------------------------------------------
MPIDIR=/opt/openmpi
XERCESCDIR=/share/apps/xerces/xerces-c-src_2_8_0
PLTOBJECTS = readTSC.o
INCLUDE = -I$(MKLROOT)/include
CXX=icc
LD=mpicxx
PLTFLAGS += -DIA32 -D_LARGEFILE_SOURCE \
-D_FILE_OFFSET_BITS=64 -DUSE_MPI -DSCALAPACK -DADD_ \
-DAPP_NO_THREADS -DXML_USE_NO_THREADS -DUSE_XERCES
# FFT must be FFTW2, FFTW3, ESSL or NOLIB
FFT=FFTW2
ifeq ($(FFT),FFTW2)
PLTFLAGS += -DUSE_FFTW2
PLTFLAGS += -DFFTWMEASURE
FFTWDIR=/share/apps/fftw/fftw-2.1.5/fftw
FFTWINCLUDEDIR=$(FFTWDIR)
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw
endif
ifeq ($(FFT),FFTW3)
PLTFLAGS += -DUSE_FFTW3
PLTFLAGS += -DFFTWMEASURE
#PLTFLAGS += -DFFTW_TRANSPOSE
PLTFLAGS += -DFFTW3_2D
FFTWDIR=$(HOME)/software/fftw/fftw-3.3.4
FFTWINCLUDEDIR=$(FFTWDIR)/api
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw3
endif
ifeq ($(FFT),ESSL)
$(error ESSL library not available)
endif
ifeq ($(FFT),NOLIB)
PLTFLAGS += -DFFT_NOLIB
endif
INCLUDE += -I$(MPIDIR)/include -I$(XERCESCDIR)/include
CXXFLAGS= -g -O3 -vec-report1 -D$(PLT) $(INCLUDE) $(PLTFLAGS) $(DFLAGS)
LIBPATH += -L$(MPIDIR)/lib64 \
-L$(MKLDIR)/lib/intel64 \
-L$(XERCESCDIR)/lib
LIBS += $(PLIBS) \
-lmkl_intel_lp64 \
-lmkl_lapack95_lp64 -lmkl_sequential -lmkl_core \
-lirc -lifcore -lsvml \
-luuid $(XERCESCDIR)/lib/libxerces-c.a -lpthread
# Parallel libraries
PLIBS = -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
LDFLAGS = $(LIBPATH) $(LIBS)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# icc_mkl_omp.mk
#
#-------------------------------------------------------------------------------
#
PLT=x86_64
#-------------------------------------------------------------------------------
MPIDIR=/opt/openmpi
XERCESCDIR=/share/apps/xerces/xerces-c-src_2_8_0
PLTOBJECTS = readTSC.o
CXX=icc
LD=mpicxx
PLTFLAGS += -DIA32 -D_LARGEFILE_SOURCE \
-D_FILE_OFFSET_BITS=64 -DUSE_MPI -DSCALAPACK -DADD_ \
-DAPP_NO_THREADS -DXML_USE_NO_THREADS -DUSE_XERCES
# FFT must be FFTW2, FFTW3, ESSL or NOLIB
FFT=FFTW2
ifeq ($(FFT),FFTW2)
PLTFLAGS += -DUSE_FFTW2
PLTFLAGS += -DFFTWMEASURE
FFTWDIR=/share/apps/fftw/fftw-2.1.5/fftw
FFTWINCLUDEDIR=$(FFTWDIR)
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw
endif
ifeq ($(FFT),FFTW3)
PLTFLAGS += -DUSE_FFTW3
PLTFLAGS += -DFFTWMEASURE
#PLTFLAGS += -DFFTW_TRANSPOSE
PLTFLAGS += -DFFTW3_2D
FFTWDIR=$(HOME)/software/fftw/fftw-3.3.4
FFTWINCLUDEDIR=$(FFTWDIR)/api
FFTWLIBDIR=$(FFTWDIR)/.libs
INCLUDE += -I$(FFTWINCLUDEDIR)
LIBPATH += -L$(FFTWLIBDIR)
LIBS += -lfftw3
endif
ifeq ($(FFT),ESSL)
$(error ESSL library not available)
endif
ifeq ($(FFT),NOLIB)
PLTFLAGS += -DFFT_NOLIB
endif
INCLUDE += -I$(MPIDIR)/include -I$(XERCESCDIR)/include
CXXFLAGS= -g -openmp -O3 -vec-report1 -D$(PLT) \
$(INCLUDE) $(PLTFLAGS) $(DFLAGS)
LIBPATH += -L$(MPIDIR)/lib64 \
-L$(MKLDIR)/lib/intel64 \
-L$(XERCESCDIR)/lib
LIBS += $(PLIBS) \
-lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread \
-lifcoremt -lirc -lsvml \
-luuid $(XERCESCDIR)/lib/libxerces-c.a -liomp5 -lpthread
# Parallel libraries
PLIBS = -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
LDFLAGS = $(LIBPATH) $(LIBS)
#-------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 The Regents of the University of California
//
// This file is part of Qbox
//
// Qbox is distributed under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 2 of
// the License, or (at your option) any later version.
// See the file COPYING in the root directory of this distribution
// or <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
//
// AlphaPBE0.h
//
////////////////////////////////////////////////////////////////////////////////
#ifndef ALPHAPBE0_H
#define ALPHAPBE0_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class AlphaPBE0 : public Var
{
Sample *s;
public:
const char *name ( void ) const { return "alpha_PBE0"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " alpha_PBE0 takes only one value" << endl;
return 1;
}
double v = atof(argv[1]);
if ( v < 0.0 )
{
if ( ui->onpe0() )
cout << " alpha_PBE0 must be non-negative" << endl;
return 1;
}
s->ctrl.alpha_PBE0 = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << s->ctrl.alpha_PBE0;
return st.str();
}
AlphaPBE0(Sample *sample) : s(sample)
{
s->ctrl.alpha_PBE0 = 0.25;
}
};
#endif
......@@ -15,7 +15,6 @@
// AngleCmd.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AngleCmd.h,v 1.5 2008-09-08 15:56:17 fgygi Exp $
#ifndef ANGLECMD_H
#define ANGLECMD_H
......@@ -38,24 +37,48 @@ class AngleCmd : public Cmd
{
return
"\n angle\n\n"
" syntax: angle name1 name2 name3\n\n"
" The angle command prints the angle defined by three atoms.\n\n";
" syntax: angle [-pbc] name1 name2 name3\n\n"
" The angle command prints the angle defined by three atoms.\n"
" If the -pbc option is used, the angle is computed using the\n"
" nearest atoms taking into account periodic boundary conditions.\n\n";
}
int action(int argc, char **argv)
{
if ( argc != 4 )
if ( ! ( argc == 4 || argc == 5 ) )
{
if ( ui->onpe0() )
{
cout << " use: angle name1 name2 name3" << endl;
cout << " use: angle [-pbc] name1 name2 name3" << endl;
}
return 1;
}
string name1(argv[1]);
string name2(argv[2]);
string name3(argv[3]);
string name1, name2, name3;
bool use_pbc = false;
if ( argc == 4 )
{
name1 = argv[1];
name2 = argv[2];
name3 = argv[3];
}
if ( argc == 5 )
{
if ( strcmp(argv[1],"-pbc") )
{
if ( ui->onpe0() )
{
cout << " use: angle [-pbc] name1 name2 name3" << endl;
}
return 1;
}
use_pbc = true;
name1 = argv[2];
name2 = argv[3];
name3 = argv[4];
}
Atom* a1 = s->atoms.findAtom(name1);
Atom* a2 = s->atoms.findAtom(name2);
Atom* a3 = s->atoms.findAtom(name3);
......@@ -83,22 +106,25 @@ class AngleCmd : public Cmd
return 1;
}
D3vector r12(a1->position()-a2->position());
D3vector r32(a3->position()-a2->position());
if ( norm(r12) == 0.0 || norm(r32) == 0.0 )
if ( ui->onpe0() )
{
if ( ui->onpe0() )
D3vector r12(a1->position()-a2->position());
D3vector r32(a3->position()-a2->position());
if ( norm2(r12) == 0.0 || norm2(r32) == 0.0 )
{
cout << " AngleCmd: atoms are too close" << endl;
return 1;
}
return 1;
}
const double sp = normalized(r12) * normalized(r32);
const double c = max(-1.0,min(1.0,sp));
const double a = (180.0/M_PI)*acos(c);
if ( ui->onpe0() )
{
if ( use_pbc )
{
const UnitCell& cell = s->wf.cell();
cell.fold_in_ws(r12);
cell.fold_in_ws(r32);
}
const double sp = normalized(r12) * normalized(r32);
const double c = max(-1.0,min(1.0,sp));
const double a = (180.0/M_PI)*acos(c);
cout.setf(ios::fixed,ios::floatfield);
cout << " angle " << name1 << "-" << name2 << "-" << name3
<< ": "
......
......@@ -12,10 +12,9 @@
//
////////////////////////////////////////////////////////////////////////////////
//
// AngleConstraint.C
// AngleConstraint.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AngleConstraint.C,v 1.6 2008-09-08 15:56:17 fgygi Exp $
#include "AngleConstraint.h"
#include "AtomSet.h"
......@@ -323,8 +322,8 @@ void AngleConstraint::grad_sigma(const D3vector &r1, const D3vector &r2,
{
D3vector r12(r1-r2);
D3vector r32(r3-r2);
assert(norm(r12) > 0.0);
assert(norm(r32) > 0.0);
assert(norm2(r12) > 0.0);
assert(norm2(r32) > 0.0);
D3vector e12(normalized(r12));
D3vector e32(normalized(r32));
const double ss = length(e12^e32);
......@@ -344,7 +343,7 @@ void AngleConstraint::grad_sigma(const D3vector &r1, const D3vector &r2,
{
// choose direction e as e12+e32
D3vector e(e12+e32);
assert(norm(e)>0.0);
assert(norm2(e)>0.0);
e = normalized(e);
const double r12_inv = 1.0/length(r12);
const double r32_inv = 1.0/length(r32);
......@@ -408,9 +407,10 @@ ostream& AngleConstraint::print( ostream &os )
os << name2_ << " " << name3_ << "\"\n";
os.setf(ios::fixed,ios::floatfield);
os.setf(ios::right,ios::adjustfield);
os << " value=\"" << setprecision(6) << angle_;
os << "\" velocity=\"" << setprecision(6) << velocity_ << "\"\n";
os << " force=\"" << setprecision(6) << force_;
os << "\" weight=\"" << setprecision(6) << weight_ << "\"/>";
os << " velocity=\"" << setprecision(6) << velocity_ << "\"";
os << " weight=\"" << setprecision(6) << weight_ << "\">\n";
os << " <value> " << setprecision(6) << angle_ << " </value>";
os << " <force> " << setprecision(6) << force_ << " </force>\n";
os << " </constraint>";
return os;
}