Commit 3934d7a1 authored by Torin Stetina's avatar Torin Stetina
Browse files

Merge branch 'release-v0.5.0' into 'master'

Release v0.5.0

See merge request chronusq/chronusq_dev!96
parents 558407e2 81b38880
Pipeline #1886 passed with stage
in 150 minutes
.git
*.*.swp
*build*
external/mxx
external/cxxblacs
external/libint2/include
external/libint2/lib
external/libint2/share
external/libint2/src
external/libint2/tmp
external/openblas/include
external/openblas/lib
external/openblas/src
external/openblas/tmp
external/openblas/bin
external/libxc/include
external/libxc/bin
external/libxc/lib
external/libxc/share
external/libxc/src
external/libxc/tmp
doc
......@@ -16,6 +16,8 @@ external/libxc/lib
external/libxc/share
external/libxc/src
external/libxc/tmp
external/tiledarray/
doc
*.*.swp
*~
stages:
- build
build_docker_images:
stage: build
only:
- master
- docker
before_script:
- docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
script:
- export CQ_VERSION=$(grep "project(ChronusQ" -A 7 CMakeLists.txt | grep "VERSION" | sed 's/ \+VERSION //')
- docker build -t uwligroup/chronusq:$CQ_VERSION .
- docker push uwligroup/chronusq:$CQ_VERSION
- docker tag uwligroup/chronusq:$CQ_VERSION uwligroup/chronusq:latest
- docker push uwligroup/chronusq:latest
after_script:
- docker logout
build_intel:
stage: build
artifacts:
......@@ -12,7 +28,7 @@ build_intel:
- source /home/ci_software/intel-19.1.sh
- mkdir build
- cd build
- cmake -DLibint2_ROOT=/sw/libint/2/5/0/intel/19/1 =-DCMAKE_CXX_FLAGS='-O3' -DCMAKE_C_FLAGS='-O3' -DCMAKE_Fortran_FLAGS='-O3' ..
- cmake -DLibint2_ROOT=/sw/libint/2/5/0/intel/19/1 =-DCMAKE_CXX_FLAGS='-O3' -DCMAKE_C_FLAGS='-O3' -DCMAKE_Fortran_FLAGS='-O3' ..
- make -j5
- ctest
......@@ -42,6 +58,6 @@ build_mpi_gcc:
- source /home/ci_software/gcc-8.2.0_mpich-3.2.1.sh
- mkdir build
- cd build
- cmake -DLibint2_ROOT=/sw/libint/2/5/0/gcc/8/2/0 -DCMAKE_CXX_FLAGS='-O3' -DCMAKE_C_FLAGS='-O3' -DCMAKE_Fortran_FLAGS='-O3' -DCQ_ENABLE_MPI=ON -DCQ_SCALAPACK_LIBRARIES="$SCALAPACK_LIBRARY_DIR/libscalapack.a" -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_BUILD_TYPE=Release ..
- cmake -DLibint2_ROOT=/sw/libint/2/5/0/gcc/8/2/0 -DCMAKE_CXX_FLAGS='-O3' -DCMAKE_C_FLAGS='-O3' -DCMAKE_Fortran_FLAGS='-O3' -DCQ_ENABLE_MPI=ON -DCQ_SCALAPACK_LIBRARIES="$SCALAPACK_LIBRARY_DIR/libscalapack.a" -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_BUILD_TYPE=Release ..
- make -j6
- make test
......@@ -9,6 +9,14 @@
FORMAT: YYYY-MM-DD
- 2020-12-08 0.5.0 (BETA)
- Added Functionality:
- Add Relativistic (X2C) Coupled Cluster Singles and Doubles (MPI only)
- Add Linear Response for two component DFT (X2C/GKS)
- Internal Refactoring:
- Change CI pipelines to build and deploy Docker images to Docker Hub
<br>
- 2020-10-20 0.4.0 (BETA)
- Added Functionality:
- Add Resolution of identity (RI) approximation for all methods
......
......@@ -25,7 +25,7 @@ cmake_minimum_required(VERSION 3.11...3.14 FATAL_ERROR)
project(ChronusQ
VERSION 0.4.0
VERSION 0.5.0
DESCRIPTION
"Chronus Quantum is an ab initio computational chemistry \
software package that focuses on explicitly time-dependent and unconventional \
......@@ -41,6 +41,7 @@ option(CQ_ENABLE_MPI "Enable MPI parallelism" OFF)
option(ENABLE_COVERAGE "Enable coverage and profiling" OFF)
option(CQ_LINALG_USESYSTEM "Use System defaults for LA libs" OFF)
option(CQ_EXTERNAL_OPENMP "Force linking to an external OpenMP library" OFF)
option(CQ_ENABLE_TA "Enable TA" OFF)
# Libint building options
......@@ -159,7 +160,16 @@ list(APPEND CQEX_LINK ChronusQ::HDF5 )
message( "\n\n" )
if( CQ_ENABLE_TA )
if(NOT CQ_ENABLE_MPI)
message(FATAL_ERROR "TiledArray must be compiled with mpi!")
endif()
message("Enable TiledArray")
include(FindTiledArray)
set( CQ_HAS_TA ON )
else()
message("TiledArray will not be compiled, Coupled-Cluster will be disabled.")
endif()
# Compiling with coverage report
if(ENABLE_COVERAGE)
......
FROM centos:7 AS compile_stage
# Container system setting
RUN yum -y update && \
yum -y install centos-release-scl scl-utils epel-release wget make git patch && \
yum-config-manager --enable epel
# Install CQ dependency
## install gcc, g++ and gfortran
RUN yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-gcc-gfortran
SHELL ["/bin/scl", "enable", "devtoolset-8"]
## install cmake,
RUN wget -qO- "https://cmake.org/files/v3.18/cmake-3.18.2-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
## install eigen3 thru epel
RUN yum -y install eigen3
ARG PACKAGE_INSTALL_PATH="/usr/local"
### install hdf5
WORKDIR /opt/
RUN wget -q "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/CMake-hdf5-1.12.0.tar.gz" && \
tar -xzf CMake-hdf5-1.12.0.tar.gz && \
rm CMake-hdf5-1.12.0.tar.gz && \
cd CMake-hdf5-1.12.0 && \
tar -xzf SZip.tar.gz && \
tar -xzf ZLib.tar.gz && \
cd /opt/CMake-hdf5-1.12.0/SZip && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$PACKAGE_INSTALL_PATH .. && cmake --build . --target install && \
cd /opt/CMake-hdf5-1.12.0/ZLib && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$PACKAGE_INSTALL_PATH .. && cmake --build . --target install && \
cd /opt/CMake-hdf5-1.12.0 && ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix,INSTALLDIR=$PACKAGE_INSTALL_PATH -C Release -V -O hdf5.log && \
cd build && cmake --build . --target install && \
cd /opt && rm -rf CMake-hdf5-1.12.0
# Compile libint2 seperately
WORKDIR /opt/
RUN git clone https://urania.chem.washington.edu/chronusq/libint-cq.git && \
cd /opt/libint-cq/ && \
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$PACKAGE_INSTALL_PATH .. && \
cmake --build . --target install -j 5 && \
cd /opt/ && rm -rf libint-cq
# Compile chronusq
COPY . /opt/chronusq_public/
WORKDIR /opt/chronusq_public/
RUN mkdir build && cd build && cmake -DOPENBLAS_DYNAMIC_ARCH=ON -DCMAKE_INSTALL_PREFIX=$PACKAGE_INSTALL_PATH .. && \
cmake --build . --target install -j 5 && \
cd /opt/chronusq_public/ && rm -rf build && rm -rf external
# Copy chornusq to a lighter container
FROM alpine:3.12
COPY --from=compile_stage /opt/chronusq_public/basis /opt/chronusq_public/basis
COPY --from=compile_stage /lib64/ /lib64/
COPY --from=compile_stage /usr/local/lib/libhdf5* /lib64/
COPY --from=compile_stage /usr/local/bin/chronusq /usr/bin/
WORKDIR /home/chronusq/
ENTRYPOINT ["chronusq"]
......@@ -18,7 +18,26 @@ time-dependent and post-SCF quantum mechanical methods.
Installation
------------
### Prerequisites
### Docker Quickstart
ChronusQ is now available as a Docker image so you can quickly and easily test
it on your system! To do so, install
[Docker desktop](https://www.docker.com/get-started) and pull the latest
ChronusQ image:
```
docker pull uwligroup/chronusq
```
You can then run it on an input file by invoking `docker run`:
```
docker run -v ${PWD}:/home/chronusq uwligroup/chronusq <inputfile>
```
For more details about using the Docker image, see the
[getting ChronusQ](../../wikis/getting-chronusq#docker-image) and
[running ChronusQ](../../wikis/running-chronusq#docker-image) wiki pages.
### Prerequisites for compilation
- C++14 compiler
- C compiler (for LibXC)
......@@ -27,7 +46,7 @@ Installation
- [HDF5](https://support.hdfgroup.org/HDF5/)
- [Eigen3](http://eigen.tuxfamily.org)
### Quickstart
### Quick compilation
If you have all the prerequisites above, all you need to do is:
......@@ -42,8 +61,10 @@ To install, you then run
cmake --build . --target install
```
For more details on installation requirements, and running ChronusQ, see the [getting ChronusQ](../../wikis/compilation)
and [running ChronusQ](../../wikis/Running-ChronusQ) wiki pages.
For more details on installation requirements, and running ChronusQ, see the
[getting ChronusQ](../../wikis/getting-chronusq#compilation-from-source)
and [running ChronusQ](../../wikis/Running-ChronusQ#compiled-from-source)
wiki pages.
Citing ChronusQ
......
#
# This file is part of the Chronus Quantum (ChronusQ) software package
#
# Copyright (C) 2014-2020 Li Research Group (University of Washington)
#
# This program is free software; you can redistribute it and/or modify
# it 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Contact the Developers:
# E-Mail: xsli@uw.edu
#
#
#only support openblas built by CQ now.
if(NOT CQ_NEED_OPENBLAS)
message ( FATAL_ERROR "Only OPENBLAS is supported!" )
endif()
include(ExternalProject)
set( TA_PREFIX ${PROJECT_SOURCE_DIR}/external/tiledarray )
set( TA_INCLUDEDIR ${TA_PREFIX}/include )
set( TA_LIBDIR ${TA_PREFIX}/lib )
include_directories("${TA_INCLUDEDIR}")
link_directories("${TA_LIBDIR}")
if( NOT EXISTS "${TA_INCLUDEDIR}/tiledarray.h" )
ExternalProject_Add(tiledarray
PREFIX ${TA_PREFIX}
GIT_REPOSITORY https://github.com/ValeevGroup/tiledarray.git
GIT_TAG 2aef4e6552a9ae5f4b1a4dbdaf1346adf3610abd
CMAKE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DMPI_C_COMPILER=${MPI_C_COMPILER}
-DMPI_CXX_COMPILER=${MPI_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX=${TA_PREFIX}
-DEIGEN3_INCLUDE_DIR=${EIGEN3_INCLUDE_DIR}
-DENABLE_MKL=OFF
-D LAPACK_LIBRARIES="${PROJECT_SOURCE_DIR}/external/openblas/lib/libopenblas.a -lm -lgfortran"
BUILD_IN_SOURCE 1
UPDATE_COMMAND echo 'NO UPDATE'
)
if( TARGET openblas )
add_dependencies( tiledarray openblas )
endif()
list(APPEND CQEX_DEP tiledarray)
message( STATUS "Opting to build a copy of TiledArray")
else()
message( STATUS "Found TiledArray")
endif()
list(APPEND CQEX_LINK ${TA_LIBDIR}/libtiledarray.so)
list(APPEND CQEX_LINK ${TA_LIBDIR}/libMADworld.so)
......@@ -102,7 +102,10 @@ if( CQ_NEED_OPENBLAS )
message( STATUS "---> Allowing OpenBLAS to determine CPU TARGET" )
set(OPENBLAS_BUILD_COMMAND make -j2)
endif()
If(OPENBLAS_DYNAMIC_ARCH)
message(" Turn On Dynamic_ARCH for OpenBlas")
set(OPENBLAS_BUILD_COMMAND ${OPENBLAS_BUILD_COMMAND} DYNAMIC_ARCH=1)
endif()
ExternalProject_Add(openblas
PREFIX ${OPENBLAS_PREFIX}
GIT_REPOSITORY "https://github.com/xianyi/OpenBLAS.git"
......
......@@ -46,7 +46,7 @@
// MPI / ScaLAPACK / BLACS
#cmakedefine CQ_ENABLE_MPI
#cmakedefine CQ_HAS_TA
/*
// Add a fatal preprocessor error if less than ICC 17.0.4
#ifdef __INTEL_COMPILER
......
/*
* This file is part of the Chronus Quantum (ChronusQ) software package
*
* Copyright (C) 2014-2020 Li Research Group (University of Washington)
*
* This program is free software; you can redistribute it and/or modify
* it 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Contact the Developers:
* E-Mail: xsli@uw.edu
*
*/
#ifdef CQ_HAS_TA
#pragma once
#include <singleslater.hpp>
#include <electronintegrals.hpp>
#include <wavefunction.hpp>
#include <chronusq_sys.hpp>
#include <singleslater/hartreefock.hpp>
#include <util/files.hpp>
#include <util/math.hpp>
#include <integrals.hpp>
#include <cerr.hpp>
#include <tiledarray.h>
#include "./coupledcluster/DiskDIIS.hpp"
namespace ChronusQ {
enum class CC_TYPE { CCSD};
struct CoupledClusterSettings {
CC_TYPE cctype = CC_TYPE::CCSD;
double eConv = 1e-8;
double tConv = 1e-6;
int maxiter = 1000;
};
struct CCBase
{
virtual void getCorrEnergy() = 0;
virtual void run() = 0;
bool useDIIS = true;
size_t nDIIS = 8;
CoupledClusterSettings ccSettings;
};
template <typename MatsT, typename IntsT>
class CCSD : public CCBase
{
using TArray = TA::TArray<MatsT>;
protected:
TArray T1_;
TArray T2_;
SingleSlater<MatsT,IntsT>& ref_;
public:
CCSD(SingleSlater<MatsT,IntsT>& ref): ref_(ref){}
~CCSD(){};
std::map<std::string,TArray> antiSymMoints;
std::map<std::string,TArray> fockMatrix_ta;
double CorrE = 0.0;
void getCorrEnergy() override;
void updateT1(const TArray T1_old, const TArray T2_old);
void updateT2(const TArray T1_old, TArray T2_old);
void transformInts();
void run() override ;
void runConventional();
//Auxiliary variables and functions to help initialization of TA tensors
TA::TiledRange1 orange;
TA::TiledRange1 vrange;
std::size_t blksize{4};
void initRanges();
//Singles intermediates and tensors
void formA_1();
void formA_2();
void formA_3();
void formA_4();
TArray A_1;
TArray A_2;
TArray A_3;
TArray A_4;
//Doubles intermediates and tensors
void formB_1();
void formB_2();
void formB_3();
void formB_5();
void formB_6();
TArray B_1;
TArray B_2;
TArray B_3;
TArray B_5;
TArray B_6;
void initIntermediates();
void initAmplitudes();
void initFock();
void doDIIS(size_t t1offset, size_t NT1blks, size_t NT2blks, TArray T1_old, TArray T2_old, std::shared_ptr<DiskDIIS<MatsT>> diis );
};// namespace CCSD
}; // namespace ChronusQ
#endif
This diff is collapsed.
/*
* This file is part of the Chronus Quantum (ChronusQ) software package
*
* Copyright (C) 2014-2020 Li Research Group (University of Washington)
*
* This program is free software; you can redistribute it and/or modify
* it 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Contact the Developers:
* E-Mail: xsli@uw.edu
*
*/
#pragma once
#include <cqlinalg/blas1.hpp>
#include <cqlinalg/solve.hpp>
#include <util/files.hpp>
#include <memmanager.hpp>
namespace ChronusQ {
/**
* \brief A general DIIS class for extrapolations
* based on a series of error metrics stored on disk.
*
*/
template <typename T>
class DiskDIIS{
public:
/**
* DiskDIIS Constructor. Constructs a DiskDIIS object
*
* \param [in] n Dimension of extrapolation space. Two temporary arrays of length n will be created
* \param [in] maxdiis Maximum number of error vectors
* \param [in] savFile File manager
* \param [in] memManager Memory manager
*/
DiskDIIS(int n, int maxdiis, SafeFile savFile, CQMemManager & memManager);
~DiskDIIS();
/**
* getVector. Get current solution
*
* \param [out] vector Pointer to target array
* \param [in] dim Number of elements to be copied to vector
* \param [in] off Offset in full array (if multiple quantities extrapolated simultaneously)
*/
void getVector(T * vector,int dim, int off);
/**
* setVector. Set current solution
*
* \param [in] vector Pointer to current solution
* \param [in] dim Number of elements to be copied to DiskDIIS
* \param [in] off Offset in full array (if multiple quantities extrapolated simultaneously)
*/
void setVector(T * vector,int dim, int off);
/**
* setErrorVector. Set current error vector
*
* \param [in] vector Pointer to current error vector
* \param [in] dim Number of elements to be copied to DiskDIIS
* \param [in] off Offset in full array (if multiple quantities extrapolated simultaneously)
*/
void setErrorVector(T * vector,int dim, int off);
/**
* extrapolate. solve DiskDIIS equations and extrapolation solution
*
* \param [in] vector Pointer to current error vector
* \param [in] dim Number of elements to be copied to DiskDIIS
* \param [in] off Offset in full array (if multiple quantities extrapolated simultaneously)
*/
void extrapolate();
protected:
/// file manager
SafeFile savFile_;
/// memory manager
CQMemManager & memManager_;
/// write current error vector to disk
void write_error_vector(T * vector);
/// write current solution to disk
void write_vector(T * vector);
/// DiskDIIS temporary storage 1
T * tmp1_;
/// DiskDIIS temporary storage 2
T * tmp2_;
/// determine DiskDIIS expansion coefficients
void DIISCoefficients(int nvec);
/// maximum number of vectors
int maxdiis_;
/// array containing DiskDIIS expansion coefficients
T * diisvec_;
/// dimension of the solution/error vector
int dimdiis_;
/// current number of DiskDIIS vectors
int diis_iter_;
/// DiskDIIS vector to be replaced
int replace_diis_iter_;
};
template <typename T>
DiskDIIS<T>::DiskDIIS(int n, int maxdiis, SafeFile savFile, CQMemManager & memManager):
savFile_(savFile), memManager_(memManager)
{
dimdiis_ = n;
maxdiis_ = maxdiis;
diis_iter_ = 0;
replace_diis_iter_ = 1;
diisvec_ = memManager_.template malloc<T>(maxdiis_+1);
tmp1_ = memManager_.template malloc<T>(dimdiis_);
tmp2_ = memManager_.template malloc<T>(dimdiis_);
}
template <typename T>
DiskDIIS<T>::~DiskDIIS(){
memManager_.free(diisvec_);
memManager_.free(tmp1_);
memManager_.free(tmp2_);
}
// Write current solution vector to disk
template <typename T>
void DiskDIIS<T>::write_vector(T * vector){
// Name the entry in according to the current DiskDIIS iteration.
// If we already have maxdiis_ vectors, then replace one.