Adding a set of files for a single-particle orbital set using the einspline B-spline library.

git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@2147 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
Ken Esler 2007-08-04 15:40:54 +00:00
parent 1ffd1072e4
commit 74fa0a0a23
7 changed files with 510 additions and 29 deletions

View File

@ -1,41 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>qmcpack-dev</name>
<name>qmcPACK</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.make.core.makeBuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>org.eclipse.cdt.make.core.build.arguments</key>
<value></value>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.core.errorOutputParser</key>
<value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.environment</key>
<key>org.eclipse.cdt.make.core.build.arguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.inc</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.full</key>
<value>clean all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.auto</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.location</key>
<value>${container_loc}/${project_path}/build</value>
@ -44,30 +49,30 @@
<key>org.eclipse.cdt.make.core.build.command</key>
<value>${container_loc}/${project_path}/build.sh</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.environment</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.clean</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.inc</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.auto</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>

132
CMake/FindPkgConfig.cmake Normal file
View File

@ -0,0 +1,132 @@
## FindPkgConfig.cmake
## by Albert Strasheim <http://students . ee . sun . ac . za/~albert/>
## and Alex Brooks (a.brooks at acfr . usyd . edu . au)
##
## This module finds packages using pkg-config, which retrieves
## information about packages from special metadata files.
##
## See http://www . freedesktop . org/Software/pkgconfig/
##
## -------------------------------------------------------------------
##
## Usage:
##
## INCLUDE( ${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)
##
## IF ( CMAKE_PKGCONFIG_EXECUTABLE )
##
## # Find all the librtk stuff with pkg-config
## PKGCONFIG( "librtk >= 2.0" HAVE_RTK RTK_INCLUDE_DIRS RTK_DEFINES RTK_LINK_DIRS RTK_LIBS )
##
## ELSE ( CMAKE_PKGCONFIG_EXECUTABLE )
##
## # Can't find pkg-config -- have to find librtk somehow else
##
## ENDIF ( CMAKE_PKGCONFIG_EXECUTABLE )
##
##
## Notes:
##
## You can set the PKG_CONFIG_PATH environment variable to tell
## pkg-config where to search for .pc files. See pkg-config(1) for
## more information.
##
#
# FIXME: IF(WIN32) pkg-config --msvc-syntax ENDIF(WIN32) ???
#
# FIXME: Parsing of pkg-config output is specific to gnu-style flags
#
FIND_PROGRAM(CMAKE_PKGCONFIG_EXECUTABLE pkg-config)
MARK_AS_ADVANCED(CMAKE_PKGCONFIG_EXECUTABLE)
########################################
MACRO(PKGCONFIG_PARSE_FLAGS FLAGS INCLUDES DEFINES)
#MESSAGE("DEBUG: FLAGS: ${FLAGS}")
STRING(REGEX MATCHALL "-I[^ ]*" ${INCLUDES} "${FLAGS}")
STRING(REGEX REPLACE "-I" "" ${INCLUDES} "${${INCLUDES}}")
#MESSAGE("DEBUG: INCLUDES: ${${INCLUDES}}")
STRING(REGEX REPLACE "-I[^ ]*" "" ${DEFINES} "${FLAGS}")
#MESSAGE("DEBUG: DEFINES: ${${DEFINES}}")
ENDMACRO(PKGCONFIG_PARSE_FLAGS)
########################################
MACRO(PKGCONFIG_PARSE_LIBS LIBS LINKDIRS LINKLIBS)
#MESSAGE("DEBUG: LIBS: ${LIBS}")
STRING(REGEX MATCHALL "-L[^ ]*" ${LINKDIRS} "${LIBS}")
STRING(REGEX REPLACE "-L" "" ${LINKDIRS} "${${LINKDIRS}}")
#MESSAGE("DEBUG: LINKDIRS: ${${LINKDIRS}}")
STRING(REGEX MATCHALL "-l[^ ]*" ${LINKLIBS} "${LIBS}")
STRING(REGEX REPLACE "-l" "" ${LINKLIBS} "${${LINKLIBS}}")
#MESSAGE("DEBUG: LINKLIBS: ${${LINKLIBS}}")
ENDMACRO(PKGCONFIG_PARSE_LIBS)
########################################
MACRO(PKGCONFIG LIBRARY FOUND INCLUDE_DIRS DEFINES LINKDIRS LINKLIBS)
SET(${FOUND} 0)
MESSAGE("-- Looking for ${LIBRARY}")
IF(CMAKE_PKGCONFIG_EXECUTABLE)
# MESSAGE("DEBUG: pkg-config executable found")
EXEC_PROGRAM(${CMAKE_PKGCONFIG_EXECUTABLE}
ARGS "'${LIBRARY}'"
OUTPUT_VARIABLE PKGCONFIG_OUTPUT
RETURN_VALUE PKGCONFIG_RETURN)
IF(NOT PKGCONFIG_RETURN)
# set C_FLAGS and CXX_FLAGS
EXEC_PROGRAM(${CMAKE_PKGCONFIG_EXECUTABLE}
ARGS "--cflags '${LIBRARY}'"
OUTPUT_VARIABLE CMAKE_PKGCONFIG_C_FLAGS)
#SET(CMAKE_PKGCONFIG_CXX_FLAGS "${CMAKE_PKGCONFIG_C_FLAGS}")
PKGCONFIG_PARSE_FLAGS( "${CMAKE_PKGCONFIG_C_FLAGS}" ${INCLUDE_DIRS} ${DEFINES} )
# set LIBRARIES
EXEC_PROGRAM(${CMAKE_PKGCONFIG_EXECUTABLE}
ARGS "--libs '${LIBRARY}'"
OUTPUT_VARIABLE CMAKE_PKGCONFIG_LIBRARIES)
PKGCONFIG_PARSE_LIBS ( "${CMAKE_PKGCONFIG_LIBRARIES}" ${LINKDIRS} ${LINKLIBS} )
SET(${FOUND} 1)
MESSAGE("-- Looking for ${LIBRARY} -- found")
ELSE(NOT PKGCONFIG_RETURN)
MESSAGE("-- Looking for ${LIBRARY} -- not found")
SET(CMAKE_PKGCONFIG_C_FLAGS "")
SET(CMAKE_PKGCONFIG_CXX_FLAGS "")
SET(CMAKE_PKGCONFIG_LIBRARIES "")
SET(${INCLUDE_DIRS} "")
SET(${DEFINES} "")
SET(${LINKDIRS} "")
SET(${LINKLIBS} "")
ENDIF(NOT PKGCONFIG_RETURN)
ELSE(CMAKE_PKGCONFIG_EXECUTABLE)
MESSAGE("-- pkg-config executable NOT FOUND")
ENDIF(CMAKE_PKGCONFIG_EXECUTABLE)
#MESSAGE("Have ${LIBRARY} : ${${FOUND}}")
#MESSAGE("${LIBRARY} include dirs: ${${INCLUDE_DIRS}}")
#MESSAGE("${LIBRARY} defines : ${${DEFINES}}")
#MESSAGE("${LIBRARY} link dirs : ${${LINKDIRS}}")
#MESSAGE("${LIBRARY} link libs : ${${LINKLIBS}}")
ENDMACRO(PKGCONFIG)

View File

@ -147,8 +147,19 @@ INCLUDE(${PROJECT_CMAKE}/FindLibxml2.cmake)
INCLUDE(${PROJECT_CMAKE}/FindLapack.cmake)
INCLUDE(${PROJECT_CMAKE}/FindHDF5.cmake)
INCLUDE(${PROJECT_CMAKE}/FindBoost.cmake)
INCLUDE(${PROJECT_CMAKE}/FindPkgConfig.cmake)
#INCLUDE(${PROJECT_CMAKE}/FindFFTW.cmake)
IF ( CMAKE_PKGCONFIG_EXECUTABLE )
# Find all the librtk stuff with pkg-config
PKGCONFIG( "einspline >= 0.7" HAVE_EINSPLINE EINSPLINE_INCLUDE_DIRS EINSPLINE_DEFINES EINSPLINE_LINK_DIRS EINSPLINE_LIBS )
INCLUDE_DIRECTORIES(${EINSPLINE_INCLUDE_DIRS})
ADD_DEFINITIONS (${EINSPLINE_DEFINES})
ELSE ( CMAKE_PKGCONFIG_EXECUTABLE )
# Can't find pkg-config -- have to find libeinspline somehow else
ENDIF ( CMAKE_PKGCONFIG_EXECUTABLE )
IF(QMC_MPI)
IF(MPIP_PROFILE)
LINK_LIBRARIES("/usr/apps/tools/mpip/lib/cmpi/libmpiP.a")

View File

@ -39,6 +39,8 @@ SET(FERMION_SRCS
MolecularOrbitals/STOBuilder.cpp
MolecularOrbitals/GTOBuilder.cpp
MolecularOrbitals/NGOBuilder.cpp
EinsplineSet.h
EinsplineSet.cpp
)
IF(QMC_COMPLEX)

View File

@ -0,0 +1,149 @@
//////////////////////////////////////////////////////////////////
// (c) Copyright 2006- by Jeongnim Kim and Ken Esler //
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// National Center for Supercomputing Applications & //
// Materials Computation Center //
// University of Illinois, Urbana-Champaign //
// Urbana, IL 61801 //
// e-mail: jnkim@ncsa.uiuc.edu //
// Tel: 217-244-6319 (NCSA) 217-333-3324 (MCC) //
// //
// Supported by //
// National Center for Supercomputing Applications, UIUC //
// Materials Computation Center, UIUC //
//////////////////////////////////////////////////////////////////
#ifndef QMCPLUSPLUS_EINSPLINE_ORB_H
#define QMCPLUSPLUS_EINSPLINE_ORB_H
#include <einspline/bspline.h>
#include "Configuration.h"
namespace qmcplusplus {
template<typename T, int N>
class EinsplineOrb : public QMCTraits
{
public:
PosType Center;
RealType Radius;
inline void evaluate (PosType r, T &psi);
inline void evaluate (PosType r, T &psi, TinyVector<T,N> &grad, T &lapl);
inline void evaluate (PosType r, T &psi, TinyVector<T,N> &grad,
Tensor<T,N> &hess);
};
template<>
class EinsplineOrb<double,2> : public QMCTraits
{
public:
PosType Center;
RealType Radius;
UBspline_2d_d *Spline;
inline void evaluate (PosType r, double &psi)
{
eval_UBspline_2d_d (Spline, r[0], r[1], &psi);
}
inline void evaluate (PosType r, double &psi, TinyVector<double,2> &grad,
double &lapl)
{
eval_UBspline_2d_d_vgl (Spline, r[0], r[1], &psi, &(grad[0]), &lapl);
}
inline void evaluate (PosType r, double &psi, TinyVector<double,2> &grad,
Tensor<double,2> &hess)
{
eval_UBspline_2d_d_vgh (Spline, r[0], r[1], &psi, &(grad[0]), &(hess(0,0)));
}
};
template<>
class EinsplineOrb<complex<double>,2> : public QMCTraits
{
public:
PosType Center;
RealType Radius;
UBspline_2d_z *Spline;
inline void evaluate (PosType r, complex<double> &psi)
{
eval_UBspline_2d_z (Spline, r[0], r[1], &psi);
}
inline void evaluate (PosType r, complex<double> &psi,
TinyVector<complex<double>,3> &grad,
complex<double> &lapl)
{
eval_UBspline_2d_z_vgl (Spline, r[0], r[1],
&psi, &(grad[0]), &lapl);
}
inline void evaluate (PosType r, complex<double> &psi,
TinyVector<complex<double>,2> &grad,
Tensor<complex<double>,2> &hess)
{
eval_UBspline_2d_z_vgh (Spline, r[0], r[1],
&psi, &(grad[0]), &(hess(0,0)));
}
};
template<>
class EinsplineOrb<double,3> : public QMCTraits
{
public:
PosType Center;
RealType Radius;
UBspline_3d_d *Spline;
inline void evaluate (PosType r, double &psi)
{
eval_UBspline_3d_d (Spline, r[0], r[1], r[2], &psi);
}
inline void evaluate (PosType r, double &psi, TinyVector<double,3> &grad,
double &lapl)
{
eval_UBspline_3d_d_vgl (Spline, r[0], r[1], r[2],
&psi, &(grad[0]), &lapl);
}
inline void evaluate (PosType r, double &psi, TinyVector<double,3> &grad,
Tensor<double,3> &hess)
{
eval_UBspline_3d_d_vgh (Spline, r[0], r[1], r[2],
&psi, &(grad[0]), &(hess(0,0)));
}
};
template<>
class EinsplineOrb<complex<double>,3> : public QMCTraits
{
public:
PosType Center;
RealType Radius;
UBspline_3d_z *Spline;
inline void evaluate (PosType r, complex<double> &psi)
{
eval_UBspline_3d_z (Spline, r[0], r[1], r[2], &psi);
}
inline void evaluate (PosType r, complex<double> &psi,
TinyVector<complex<double>,3> &grad,
complex<double> &lapl)
{
eval_UBspline_3d_z_vgl (Spline, r[0], r[1], r[2],
&psi, &(grad[0]), &lapl);
}
inline void evaluate (PosType r, complex<double> &psi,
TinyVector<complex<double>,3> &grad,
Tensor<complex<double>,3> &hess)
{
eval_UBspline_3d_z_vgh (Spline, r[0], r[1], r[2],
&psi, &(grad[0]), &(hess(0,0)));
}
};
}
#endif

View File

@ -0,0 +1,85 @@
//////////////////////////////////////////////////////////////////
// (c) Copyright 2006- by Jeongnim Kim and Ken Esler //
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// National Center for Supercomputing Applications & //
// Materials Computation Center //
// University of Illinois, Urbana-Champaign //
// Urbana, IL 61801 //
// e-mail: jnkim@ncsa.uiuc.edu //
// Tel: 217-244-6319 (NCSA) 217-333-3324 (MCC) //
// //
// Supported by //
// National Center for Supercomputing Applications, UIUC //
// Materials Computation Center, UIUC //
//////////////////////////////////////////////////////////////////
#include "QMCWaveFunctions/EinsplineSet.h"
namespace qmcplusplus {
EinsplineSetBase::UnitCellType
EinsplineSetBase::GetLattice()
{
}
void
EinsplineSetBase::resetParameters(VarRegistry<RealType>& vlist)
{
}
void
EinsplineSetBase::resetTargetParticleSet(ParticleSet& e)
{
}
void
EinsplineSetBase:: setOrbitalSetSize(int norbs)
{
}
void
EinsplineSetExtended::evaluate (const ParticleSet& P, int iat,
ValueVector_t& psi)
{
}
void
EinsplineSetExtended::evaluate (const ParticleSet& P, int iat,
ValueVector_t& psi, GradVector_t& dpsi,
ValueVector_t& d2psi)
{
}
void
EinsplineSetExtended::evaluate (const ParticleSet& P, int first, int last,
ValueMatrix_t& logdet, GradMatrix_t& dlogdet,
ValueMatrix_t& d2logdet)
{
}
void
EinsplineSetLocalized::evaluate (const ParticleSet& P, int iat,
ValueVector_t& psi)
{
}
void
EinsplineSetLocalized::evaluate (const ParticleSet& P, int iat,
ValueVector_t& psi, GradVector_t& dpsi,
ValueVector_t& d2psi)
{
}
void
EinsplineSetLocalized::evaluate (const ParticleSet& P, int first, int last,
ValueMatrix_t& logdet, GradMatrix_t& dlogdet,
ValueMatrix_t& d2logdet)
{
}
}

View File

@ -0,0 +1,97 @@
//////////////////////////////////////////////////////////////////
// (c) Copyright 2006- by Jeongnim Kim and Ken Esler //
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// National Center for Supercomputing Applications & //
// Materials Computation Center //
// University of Illinois, Urbana-Champaign //
// Urbana, IL 61801 //
// e-mail: jnkim@ncsa.uiuc.edu //
// Tel: 217-244-6319 (NCSA) 217-333-3324 (MCC) //
// //
// Supported by //
// National Center for Supercomputing Applications, UIUC //
// Materials Computation Center, UIUC //
//////////////////////////////////////////////////////////////////
#ifndef QMCPLUSPLUS_EINSPLINE_SET_H
#define QMCPLUSPLUS_EINSPLINE_SET_H
#include <einspline/bspline.h>
#include "Configuration.h"
#include "QMCWaveFunctions/BasisSetBase.h"
#include "QMCWaveFunctions/SPOSetBase.h"
#include "Optimize/VarList.h"
#include "QMCWaveFunctions/EinsplineOrb.h"
namespace qmcplusplus {
class EinsplineSetBase : public SPOSetBase
{
protected:
//////////////////////
// Type definitions //
//////////////////////
typedef CrystalLattice<RealType,OHMMS_DIM> UnitCellType;
///////////
// Flags //
///////////
/// True if all Lattice is diagonal, i.e. 90 degree angles
bool Orthorhombic;
/// True if we are using localize orbitals
bool Localized;
/// True if we are tiling the primitive cell
bool Tiling;
//////////////////////////
// Lattice and geometry //
//////////////////////////
TinyVector<int,3> TileFactor;
UnitCellType SuperLattice, PrimLattice, PrimLatticeInv;
/// The "Twist" variables are in reduced coords, i.e. from 0 to1.
/// The "k" variables are in Cartesian coordinates.
PosType TwistVector, kVector;
/// metric tensor to handle generic unitcell
Tensor<RealType,OHMMS_DIM> GGt;
/////////////////////
// Orbital storage //
/////////////////////
/// Store the orbital objects. Using template class allows us to
/// avoid making separate real and complex versions of this class.
std::vector<EinsplineOrb<ValueType,OHMMS_DIM> > Orbitals;
public:
UnitCellType GetLattice();
void resetParameters(VarRegistry<RealType>& vlist);
void resetTargetParticleSet(ParticleSet& e);
void setOrbitalSetSize(int norbs);
};
class EinsplineSetExtended : public EinsplineSetBase
{
public:
void evaluate(const ParticleSet& P, int iat, ValueVector_t& psi);
void evaluate(const ParticleSet& P, int iat,
ValueVector_t& psi, GradVector_t& dpsi, ValueVector_t& d2psi);
void evaluate(const ParticleSet& P, int first, int last,
ValueMatrix_t& logdet, GradMatrix_t& dlogdet,
ValueMatrix_t& d2logdet);
};
class EinsplineSetLocalized : public EinsplineSetBase
{
public:
void evaluate(const ParticleSet& P, int iat, ValueVector_t& psi);
void evaluate(const ParticleSet& P, int iat,
ValueVector_t& psi, GradVector_t& dpsi, ValueVector_t& d2psi);
void evaluate(const ParticleSet& P, int first, int last,
ValueMatrix_t& logdet, GradMatrix_t& dlogdet,
ValueMatrix_t& d2logdet);
};
}
#endif