Package list votca-xtp / e70a901
New upstream version 1.5 Nicholas Breen 2 years ago
511 changed file(s) with 830879 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ---
1 # BasedOnStyle: Google
2 AccessModifierOffset: -1
3 ConstructorInitializerIndentWidth: 4
4 AlignEscapedNewlinesLeft: true
5 AlignTrailingComments: true
6 AllowAllParametersOfDeclarationOnNextLine: true
7 AlwaysBreakTemplateDeclarations: true
8 AlwaysBreakBeforeMultilineStrings: true
9 AllowShortIfStatementsOnASingleLine: true
10 AllowShortLoopsOnASingleLine: true
11 BreakBeforeBinaryOperators: false
12 BreakBeforeTernaryOperators: true
13 BreakConstructorInitializersBeforeComma: false
14 BinPackParameters: true
15 ColumnLimit: 80
16 ConstructorInitializerAllOnOneLineOrOnePerLine: true
17 DerivePointerBinding: true
18 ExperimentalAutoDetectBinPacking: false
19 IndentCaseLabels: true
20 MaxEmptyLinesToKeep: 1
21 NamespaceIndentation: None
22 ObjCSpaceBeforeProtocolList: false
23 PenaltyBreakBeforeFirstCallParameter: 1
24 PenaltyBreakComment: 60
25 PenaltyBreakString: 1000
26 PenaltyBreakFirstLessLess: 120
27 PenaltyExcessCharacter: 1000000
28 PenaltyReturnTypeOnItsOwnLine: 200
29 PointerBindsToType: true
30 SpacesBeforeTrailingComments: 2
31 Cpp11BracedListStyle: true
32 Standard: Auto
33 IndentWidth: 2
34 TabWidth: 8
35 UseTab: Never
36 BreakBeforeBraces: Attach
37 IndentFunctionDeclarationAfterType: true
38 SpacesInParentheses: false
39 SpacesInAngles: false
40 SpaceInEmptyParentheses: false
41 SpacesInCStyleCastParentheses: false
42 SpaceAfterControlStatementKeyword: true
43 SpaceBeforeAssignmentOperators: true
44 ContinuationIndentWidth: 4
45 ...
46
0 *~
1 Makefile
2
3 libvotca*.pc
4 libvotca*.a
5 libvotca*.so
6 libvotca*.so.*
7
8 share/doc/html
9 share/doc/Doxyfile
10
11 include/votca/xtp/votca_config.h
12 src/libxtp/gitversion.h
13 include/votca/xtp/votca_config.h
14
15 src/tools/xtp_dump
16 src/tools/xtp_parallel
17 src/tools/xtp_map
18 src/tools/xtp_run
19 src/tools/xtp_tools
20 src/tools/xtp_overlap
21 src/tools/xtp_kmc_run
22 src/dipro/*.mod
23 src/dipro/*.x
24 src/tools/*.man
25
26 scripts/xtp_dipro.out
27 scripts/xtp_dipro
28 scripts/xtp_update
29 scripts/xtp_update.out
30 scripts/xtp_testsuite
31 scripts/xtp_testsuite.out
32 scripts/xtp_update_exciton
33 scripts/xtp_update_exciton.out
34 scripts/xtp_basisset
35 scripts/xtp_basisset.out
36 scripts/xtp_makeauxbasis
37 scripts/xtp_makeauxbasis.out
38
39 netbeans/*/build
40 .dep.inc
41 */nbproject/private
42 netbeans/libxtp/dist/Debug/*
43 netbeans/libxtp/nbproject/Package-Debug.bash
44 netbeans/libxtp/nbproject/Package-Release.bash
45
46 netbeans/xtp_map/nbproject/Package-Debug.bash
47 netbeans/xtp_map/nbproject/Package-Release.bash
48
49 netbeans/xtp_run/nbproject/Package-Debug.bash
50 netbeans/xtp_run/nbproject/Package-Release.bash
51
52 CMakeFiles
53 cmake_install.cmake
54 CMakeCache.txt
55 install_manifest.txt
56 /netbeans/xtp_app/dist/
57 /netbeans/libxtp/dist/
58 /netbeans/libxtp/nbproject/private/private.xml
59 /netbeans/libxtp/nbproject/Makefile-Release.mk
60 /netbeans/libxtp/nbproject/Makefile-Debug.mk
61 /netbeans/libxtp/nbproject/configurations.xml
62
63
64 /build
0 stages:
1 - canary
2 - build
3
4 .build:
5 retry:
6 max: 2
7 variables:
8 CCACHE_DIR: "${CI_PROJECT_DIR}/ccache"
9 CXXFLAGS: "-Wall -Werror"
10 DISTRO: "latest"
11 image: votca/buildenv:${DISTRO}
12 stage: build
13 cache:
14 paths:
15 - ccache/
16 script:
17 - ccache -z
18 - j="$(grep -c processor /proc/cpuinfo 2>/dev/null)" || j=0; ((j++))
19 - git branch commit_of_build_${CI_BUILD_ID} ${CI_COMMIT_SHA}
20 - cd $HOME
21 - git clone --recursive https://github.com/votca/votca
22 - pushd votca
23 - if [[ ( ${CI_COMMIT_REF_NAME} =~ ^for/([^/]*)/.* || ${CI_COMMIT_REF_NAME} =~ ^(stable)$ ) && ${BASH_REMATCH[1]} != master ]]; then
24 git checkout -b ${BASH_REMATCH[1]} origin/${BASH_REMATCH[1]} && git submodule update --recursive --init;
25 fi
26 - git -C ${CI_PROJECT_NAME} fetch ${CI_PROJECT_DIR} commit_of_build_${CI_BUILD_ID}
27 - git -C ${CI_PROJECT_DIR} branch -d commit_of_build_${CI_BUILD_ID}
28 - git -C ${CI_PROJECT_NAME} checkout -f ${CI_COMMIT_SHA}
29 - mkdir -p build
30 - pushd build
31 - cmake .. -DENABLE_TESTING=ON -DBUILD_XTP=ON -DBUILD_CTP=ON -DBUILD_XTP_MANUAL=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
32 - make -O -k -j${j} -l${j} VERBOSE=1
33 - make test CTEST_OUTPUT_ON_FAILURE=1
34 - make install DESTDIR=${PWD}/install && rm -rf ${PWD}/install/usr && rmdir ${PWD}/install
35 - sudo make install
36 - ccache -s
37
38 Debug GCC:
39 stage: canary
40 variables:
41 CC: "gcc"
42 CXX: "g++"
43 CMAKE_BUILD_TYPE: "Debug"
44 extends: .build
45
46 None GCC:
47 variables:
48 CC: "gcc"
49 CXX: "g++"
50 CMAKE_BUILD_TYPE: ""
51 extends: .build
52
53 None Clang:
54 variables:
55 CC: "clang"
56 CXX: "clang++"
57 CMAKE_BUILD_TYPE: ""
58 extends: .build
59
60 Debug Clang:
61 variables:
62 CC: "clang"
63 CXX: "clang++"
64 CMAKE_BUILD_TYPE: "Debug"
65 extends: .build
66
67 Release GCC:
68 variables:
69 CC: "gcc"
70 CXX: "g++"
71 CMAKE_BUILD_TYPE: "Release"
72 extends: .build
73
74 Release Clang:
75 variables:
76 CC: "clang"
77 CXX: "clang++"
78 CMAKE_BUILD_TYPE: "Release"
79 extends: .build
80
81 Debug GCC Ubuntu:
82 variables:
83 CC: "gcc"
84 CXX: "g++"
85 CMAKE_BUILD_TYPE: "Debug"
86 DISTRO: "ubuntu"
87 extends: .build
88
89 Debug Clang Ubuntu:
90 variables:
91 CC: "clang"
92 CXX: "clang++"
93 CMAKE_BUILD_TYPE: "Debug"
94 DISTRO: "ubuntu"
95 extends: .build
96
97 Release GCC Ubuntu:
98 variables:
99 CC: "gcc"
100 CXX: "g++"
101 CMAKE_BUILD_TYPE: "Release"
102 DISTRO: "ubuntu"
103 extends: .build
104
105 Release Clang Ubuntu:
106 variables:
107 CC: "clang"
108 CXX: "clang++"
109 CMAKE_BUILD_TYPE: "Release"
110 DISTRO: "ubuntu"
111 extends: .build
0 # the original source of this file can be found in votca/votca repository
1 # add changes there!
2 # To update:
3 # wget -O .travis.yml https://raw.githubusercontent.com/votca/votca/master/.travis.yml
4 language: cpp
5
6 sudo: required
7
8 services:
9 - docker
10
11 env:
12 matrix:
13 - ENV=1
14 - ENV=2
15 - ENV=3
16 - ENV=4
17 - ENV=5
18 - ENV=6
19 - ENV=7
20 - ENV=8
21 - ENV=9
22 - ENV=10
23 - ENV=11
24 - ENV=12
25 - ENV=13
26 - ENV=14
27 - ENV=15
28 - ENV=16
29 - ENV=17
30 - ENV=18
31 - ENV=19
32 - ENV=20
33
34 before_script:
35 - git checkout -b current_commit
36 - cd ../../
37 - if [[ ${TRAVIS_REPO_SLUG} = */votca ]]; then
38 if [[ ${TRAVIS_BRANCH} = next ]]; then
39 git -C ${TRAVIS_REPO_SLUG} submodule foreach git checkout master;
40 git -C ${TRAVIS_REPO_SLUG} submodule foreach git pull;
41 fi;
42 cp -vr ${TRAVIS_REPO_SLUG}/docker ${HOME};
43 mv -v ${TRAVIS_REPO_SLUG} $HOME/docker;
44 else
45 git clone --recursive https://github.com/votca/votca.git $HOME/docker/votca;
46 if [[ ${TRAVIS_BRANCH} != master ]]; then
47 git -C ${HOME}/docker/votca checkout -b ${TRAVIS_BRANCH} ${TRAVIS_TAG:-origin/${TRAVIS_BRANCH}} && git -C ${HOME}/docker/votca submodule update --recursive --init;
48 fi;
49 git -C ${HOME}/docker/votca/${TRAVIS_REPO_SLUG#*/} fetch ${PWD}/${TRAVIS_REPO_SLUG} current_commit;
50 git -C ${HOME}/docker/votca/${TRAVIS_REPO_SLUG#*/} checkout -f FETCH_HEAD;
51 cp -vr ${HOME}/docker/votca/docker/* ${HOME}/docker;
52 if [[ -d ${TRAVIS_REPO_SLUG}/docker ]]; then cp -vr ${TRAVIS_REPO_SLUG}/docker/* ${HOME}/docker; fi;
53 fi
54 - source ${HOME}/docker/set_env.sh
55 - cp -r $HOME/.ccache ${HOME}/docker/ccache
56 - sed -i "1s/latest/${DISTRO:-latest}/" ${HOME}/docker/Dockerfile
57 - if [[ ! ${SKIP} ]]; then
58 travis_retry timeout 540 docker pull $(sed -n '1s/FROM //p' ${HOME}/docker/Dockerfile);
59 fi
60
61 script:
62 - if [[ ! ${SKIP} ]]; then
63 travis_retry docker build "${docker_opts[@]}"
64 --build-arg CC=${CC} --build-arg CXX=${CXX} --build-arg CXXFLAGS="-Wall ${WERROR:+-Werror}"
65 --build-arg CI=${CI} --build-arg TRAVIS=${TRAVIS} --build-arg TRAVIS_OS_NAME=${DISTRO:-fedora}
66 --build-arg TRAVIS_BRANCH=${TRAVIS_BRANCH} --build-arg TRAVIS_JOB_NUMBER=${TRAVIS_JOB_NUMBER}
67 --build-arg TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} --build-arg TRAVIS_JOB_ID=${TRAVIS_JOB_ID}
68 --build-arg TRAVIS_TAG=${TRAVIS_TAG} --build-arg TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}
69 --build-arg TRAVIS_COMMIT=${TRAVIS_COMMIT}
70 ${TRAVIS_TAG:+-t votca/votca:${TRAVIS_TAG}}
71 -t votca/votca:latest -t votca/votca:${TRAVIS_BRANCH} ${HOME}/docker/ &&
72 rm -rf $HOME/.ccache &&
73 CON=$(docker run -d votca/votca:${TRAVIS_BRANCH} /bin/bash) &&
74 docker cp ${CON}:/home/votca/.ccache ${HOME}/;
75 fi
76
77 after_success:
78 - shopt -s extglob && [[ ${TRAVIS_BRANCH} = @(master|stable|v1.*) && ${CC} = *gcc* && ${DOCKERHUB} = yes && ! ${SKIP} ]] && DEPLOY=yes
79 - if [[ ${TRAVIS_BRANCH} = master ]]; then DOCKER_TAG=latest; else DOCKER_TAG="${TRAVIS_BRANCH}"; fi
80 - if [[ ${DOCKER_USERNAME} && ${DOCKER_PASSWORD} && ${TRAVIS_PULL_REQUEST} == false && ${DEPLOY} ]]; then
81 docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
82 docker push "${TRAVIS_REPO_SLUG}:${DOCKER_TAG}";
83 fi
84 - if [[ ${DOXYGEN} = yes && ! ${SKIP} ]]; then
85 git clone --depth=1 https://github.com/votca/doxygen.git "$HOME/devdoc";
86 cd $HOME/devdoc;
87 rm -f *;
88 git checkout -- CNAME;
89 docker cp ${CON}:/home/votca/votca/build/share/doc/html . ;
90 mv html/* .; rmdir html;
91 docker cp ${CON}:/home/votca/votca/build/csg-manual/manual.pdf . ;
92 docker cp ${CON}:/home/votca/votca/build/ctp/manual/ctp-manual.pdf . ;
93 docker cp ${CON}:/home/votca/votca/build/xtp/manual/xtp-manual.pdf . ;
94 git add --all .;
95 if [[ ${TRAVIS_BRANCH} = master && ${encrypted_7abbb71c3ba6_key} && ${encrypted_7abbb71c3ba6_iv} && ${TRAVIS_PULL_REQUEST} == false ]]; then
96 git config --global user.name "Automatic Deployment (Travis CI)";
97 git config --global user.email "votca-commits@googlegroups.com";
98 git commit -m "Documentation Update";
99 openssl aes-256-cbc -K $encrypted_7abbb71c3ba6_key -iv $encrypted_7abbb71c3ba6_iv -in keys/deploy3.enc -out ~/.ssh/id_rsa -d;
100 chmod 600 ~/.ssh/id_rsa;
101 git push git@github.com:votca/doxygen.git gh-pages;
102 else
103 git status;
104 git diff --cached --no-color | head -c 1k;
105 fi;
106 fi
107
108 branches:
109 only:
110 - master
111 - development
112 - stable
113 - next
114 - /^v\d+\.\d+(\.\d+|_rc\d+)?$/
115
116 cache:
117 - ccache
118
119 compiler:
120 - gcc
121 - clang
122
123 notifications:
124 email:
125 - votca-commits@googlegroups.com
0 For more detailed information about the changes see the history of the [repository](https://github.com/votca/xtp/commits/master).
1
2 ## Version 1.5 _SuperVictor_ (released 31.01.19)
3 * enable gitlab CI
4
5 ## Version 1.5_rc3 (released 19.01.19)
6 * travis: fixed bug in building tags
7
8 ## Version 1.5_rc2 (released 16.01.19)
9 * fix parallel build of manual
10 * fix usage on inkscape on arm arch
11 * clean up namespace in header
12
13 ## Version 1.5_rc1 (released 28.12.18)
14 * optimized GW-BSE code and integral engine
15 * added closed shell DFT code which supports hybrid functionals
16 * removed ctp dependency
17 * atm no support for site energy calculation
18 * CHELPG fit for ground and excited states
19 * merged igwbse and idft into one calculator
20 * added unit and integration test
21 * improved geometry optimiser
22 * replaced ublas with Eigen3
23 * replaced boost serialisation with hdf5 files
24
25 ## Version 1.4.1 (released 02.09.17)
26 * fix pkg-config file
27
28 ## Version 1.4 (released 29.10.16)
29 * fixed a bug in gwbse
30 * added missing copyright
31 * cmake: fixed underlinking
32
33 ## Version 1.4_rc1 (released 26.09.16)
34 * include manual
35 * an extension of the whole workflow from electrons and holes, to singelt and triplet excitons
36 * a fully functional GW-BSE code optimized for molecular properties, including excited state geometry optimizsation
37 * Inclusion of LIBXC to calculate Exchange correlation matrices, allowing interfacing GW-BSE with many quantum mechanical packages
38 * support for ORCA DFT package
39 * framework to use stochastic models to generate larger system
40 * better performance of larger systems
41 * new calculators: egwbse,igwbse,ewald,.....
42 * support for intel mkl library and compilers for better performance
43 * Aperiodic polarisation embedding to calculate classical configuration energies without cutoffs
44 * xtp_update_exciton to update state file to newest format
45 * integration of moo and kmc into xtp for easier installation
46 * kmc_lifetime calculator to simulate exciton movement with lifetimes
47 * partialcharges to extract atomic charges from qm calculation
48 * renaming from ctp to xtp
49 * many bugfixes
50
51
52
53 ## Version 1.3 (released XX.09.15)
54 * new executables: ctp_tools, ctp_dump, ctp_parallel, xtp_testsuite, xtp_update
55 * ctp_tools wraps light-weight tools that assist e.g. in generating the system mapping file
56 * ctp_dump extracts information from the state file to human-readable format
57 * ctp_parallel wraps heavy-duty job-based calculators, allowing for synchronization across processes
58 * ctp_testsuite provides an easy-to-use environment to run selected tests as well as individual calculators
59 * ctp_update updates an existent state file to the current version
60 * new calculators: edft, idft, pdb2map, xqmultipole, ...
61 * edft / idft (provide interfaces to the GAUSSIAN, TURBOMOLE & NWCHEM packages to compute couplings, internal energies and partial charges)
62 * pdb2map (generates a system mapping file from an input coordinate file)
63 * xqmultipole (computes classical configuration energies of charged clusters embedded in a molecular environment)
64 * enhanced usability via the command-line help, tutorial & test-suite
65 * a GUI tutorial assists with the first practical steps in using VOTCA-CTP
66 * an extended and homogenized help system provides short infos on individual calculator options from the command line
67
68 ## Version 1.0 (released 23.10.11)
69 * parallel evaluation of site energies (Thole model + GDMA) - Tinker no longer required
70 * much clearer input files (and many more checks for input errors)
71 * most of calculators are parallel and can be used on a cluster
72 * bug in zindo/ctp interface fixed
73 * state file now contains the atomistic trajectory, rigid fragments and conjugates segments
74 * support for several MD frames
0 cmake_minimum_required(VERSION 3.1)
1 project(votca-xtp)
2
3
4 set(PROJECT_VERSION "1.5")
5 set(PROJECT_CONTACT "bugs@votca.org")
6 string(REGEX REPLACE "^[1-9]+\\.([1-9]+).*$" "\\1" SOVERSION "${PROJECT_VERSION}")
7 if (NOT ${SOVERSION} MATCHES "[1-9]+")
8 message(FATAL_ERROR "Could not determind SOVERSION from ${PROJECT_VERSION}")
9 endif (NOT ${SOVERSION} MATCHES "[1-9]+")
10
11 # Cmake modules/macros are in a subdirectory to keep this file cleaner
12 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
13
14 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
15 #Release comes with -O3 by default
16 set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
17 endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
18 if(CMAKE_BUILD_TYPE STREQUAL Debug)
19 add_definitions(-DDEBUG)
20 elseif(CMAKE_BUILD_TYPE STREQUAL Release)
21 add_definitions(-DBOOST_UBLAS_NDEBUG)
22 endif()
23
24 enable_language(CXX)
25
26 ######################################################################
27 # compiler tests
28 # these need ot be done early (before further tests).
29 #####################################################################
30
31 include(CheckCXXCompilerFlag)
32 set(CMAKE_CXX_STANDARD 11)
33 set(CMAKE_CXX_STANDARD_REQUIRED ON)
34 set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
35 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND CMAKE_VERSION VERSION_LESS "3.6.0")
36 message(FATAL_ERROR "Using the intel compiler requires cmake 3.6 or higher")
37 endif()
38
39 find_package(OpenMP)
40 if (OPENMP_FOUND)
41 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
42 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
43 endif()
44
45
46
47
48 ########################################################################
49 # User input options #
50 ########################################################################
51 if(GWBSE_DOUBLE)
52 add_definitions(-DGWBSE_DOUBLE)
53 set(GWBSE_DOUBLE_VALUE 1)
54 else()
55 set(GWBSE_DOUBLE_VALUE 0)
56 endif()
57 add_definitions(-DGWBSE_DOUBLE=${GWBSE_DOUBLE_VALUE})
58
59
60 find_package(LIBXC REQUIRED)
61 include_directories(${LIBXC_INCLUDE_DIRS})
62
63 find_package(CERES REQUIRED)
64 include_directories(${CERES_INCLUDE_DIRS})
65
66 find_package(HDF5 1.8 REQUIRED COMPONENTS CXX)
67 include_directories(${HDF5_INCLUDE_DIRS})
68
69 if (${HDF5_VERSION} GREATER 1.8)
70 message(WARNING "HDF5 will be used such that it is compatible with version 1.8.")
71 endif()
72
73
74 option(BUILD_SHARED_LIBS "Build shared libs" ON)
75 include(GNUInstallDirs)
76
77
78 option(ENABLE_TESTING "Build and enable testing stuff" OFF)
79 if(ENABLE_TESTING)
80 enable_testing()
81 endif(ENABLE_TESTING)
82
83 #for votca_config.h
84 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
85 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
86 ########################################################################
87 #Find external packages
88 ########################################################################
89 if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.git)
90 find_package(Git)
91 endif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.git)
92
93 find_package(Boost 1.57.0 REQUIRED COMPONENTS program_options serialization filesystem system timer)
94 include_directories(${Boost_INCLUDE_DIRS})
95 set (BOOST_CFLAGS_PKG "-I${Boost_INCLUDE_DIRS}")
96 set(BOOST_LIBS_PKG "-L${Boost_LIBRARY_DIRS}")
97 foreach(_blib ${Boost_LIBRARIES})
98 string(REGEX REPLACE ".*/lib([^/]*)\\.[^.]*$" "-l\\1" _blib ${_blib})
99 set(BOOST_LIBS_PKG "${BOOST_LIBS_PKG} ${_blib}")
100 endforeach(_blib)
101
102 option(BUILD_MANPAGES "Build manpages (might lead to problem on system without rpath" OFF)
103 #define this target here, so that individual man pages can append to it.
104 if(NOT TARGET manpages)
105 add_custom_target(manpages ALL)
106 endif()
107
108 find_package(VOTCA_TOOLS REQUIRED)
109 include_directories(${VOTCA_TOOLS_INCLUDE_DIRS})
110 find_package(VOTCA_CSG REQUIRED)
111 include_directories(${VOTCA_CSG_INCLUDE_DIRS})
112 ########################################################################
113 # Checks what linear algebra packages are installed #
114 ########################################################################
115
116
117
118 ########################################################################
119 # Basic system tests (standard libraries, headers, functions, types) #
120 ########################################################################
121 include(CheckIncludeFile)
122 foreach(HEADER assert.h)
123 check_include_file(${HEADER} FOUND_${HEADER})
124 if(NOT FOUND_${HEADER})
125 message(FATAL_ERROR "Could not find needed header - ${HEADER}")
126 endif(NOT FOUND_${HEADER})
127 endforeach(HEADER)
128
129 include(CheckIncludeFileCXX)
130 foreach(HEADER algorithm)
131 check_include_file_cxx(${HEADER} FOUND_${HEADER})
132 if(NOT FOUND_${HEADER})
133 message(FATAL_ERROR "Could not find needed header - ${HEADER}")
134 endif(NOT FOUND_${HEADER})
135 endforeach(HEADER)
136
137 set(MATH_LIBRARIES "m" CACHE STRING "math library")
138 mark_as_advanced( MATH_LIBRARIES )
139 include(CheckLibraryExists)
140 foreach(FUNC sqrt)
141 check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES})
142 if(NOT FOUND_${FUNC}_${MATH_LIBRARIES})
143 message(FATAL_ERROR "Could not find needed math function - ${FUNC}")
144 endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES})
145 endforeach(FUNC)
146
147 ######################################
148 # Include the following subdirectory #
149 ######################################
150 add_subdirectory(include/votca/xtp)
151 add_subdirectory(scripts)
152 add_subdirectory(src)
153 add_subdirectory(share)
154
155 option(BUILD_XTP_MANUAL "Build xtp-manual" OFF)
156 if(BUILD_XTP_MANUAL)
157 add_subdirectory(manual)
158 endif()
0 # - Find Ceres library
1 # Find the native Ceres includes and library
2 # This module defines
3 # CERES_INCLUDE_DIRS, where to find ceres.h, Set when
4 # CERES_INCLUDE_DIR is found.
5 # CERES_LIBRARIES, libraries to link against to use Ceres.
6 # CERES_ROOT_DIR, The base directory to search for Ceres.
7 # This can also be an environment variable.
8 # CERES_VERSION will contain the version ceres version.
9 # CERES_FOUND, If false, do not try to use Ceres.
10 #
11 # also defined, but not for general use are
12 # CERES_LIBRARY, where to find the Ceres library.
13
14 # If CERES_ROOT_DIR was defined in the environment, use it.
15 IF(NOT CERES_ROOT_DIR AND NOT $ENV{CERES_ROOT_DIR} STREQUAL "")
16 SET(CERES_ROOT_DIR $ENV{CERES_ROOT_DIR})
17 ENDIF()
18
19 Set(CERES_SEARCH_DIRS
20 ${CERES_ROOT_DIR}
21 /usr/local/
22 /usr/
23 /usr/local/homebrew/ # Mac OS X
24 /opt/local/var/macports/software # Mac OS X.
25 /opt/local/
26 )
27
28 FIND_PATH(CERES_INCLUDE_DIR
29 NAMES
30 ceres/ceres.h
31 HINTS
32 ${CERES_SEARCH_DIRS}
33 PATH_SUFFIXES
34 include
35 )
36
37 FIND_LIBRARY(CERES_LIBRARY
38 NAMES
39 ceres
40 HINTS
41 ${CERES_SEARCH_DIRS}
42 PATH_SUFFIXES
43 lib64 lib
44 )
45
46 # handle the QUIETLY and REQUIRED arguments and set CERES_FOUND to TRUE if
47 # all listed variables are TRUE
48 INCLUDE(FindPackageHandleStandardArgs)
49 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ceres DEFAULT_MSG
50 CERES_LIBRARY CERES_INCLUDE_DIR)
51
52 IF(CERES_FOUND)
53 SET(CERES_LIBRARIES ${CERES_LIBRARY})
54 SET(CERES_INCLUDE_DIRS ${CERES_INCLUDE_DIR})
55 ENDIF(CERES_FOUND)
56
57 IF (CERES_INCLUDE_DIRS)
58 set (CERES_VERSION_FILE ${CERES_INCLUDE_DIRS}/ceres/version.h)
59 IF (NOT EXISTS ${CERES_VERSION_FILE})
60 message (WARNING
61 "Could not find ${CERES_VERSION_FILE}")
62 ELSE (NOT EXISTS ${CERES_VERSION_FILE})
63 FILE (READ ${CERES_VERSION_FILE} CERES_VERSION_FILE_CONTENTS)
64
65 STRING(REGEX MATCH "#define CERES_VERSION_MAJOR [0-9]+"
66 CERES_VERSION_MAJOR ${CERES_VERSION_FILE_CONTENTS})
67 STRING(REPLACE "#define CERES_VERSION_MAJOR " ""
68 CERES_VERSION_MAJOR ${CERES_VERSION_MAJOR})
69
70 STRING(REGEX MATCH "#define CERES_VERSION_MINOR [0-9]+"
71 CERES_VERSION_MINOR ${CERES_VERSION_FILE_CONTENTS})
72 STRING(REPLACE "#define CERES_VERSION_MINOR " ""
73 CERES_VERSION_MINOR ${CERES_VERSION_MINOR})
74
75 STRING(REGEX MATCH "#define CERES_VERSION_REVISION [0-9]+"
76 CERES_VERSION_REVISION ${CERES_VERSION_FILE_CONTENTS})
77 STRING(REGEX REPLACE "#define CERES_VERSION_REVISION " ""
78 CERES_VERSION_REVISION ${CERES_VERSION_REVISION})
79
80 SET(CERES_VERSION ${CERES_VERSION_MAJOR}.${CERES_VERSION_MINOR}.${CERES_VERSION_REVISION})
81 ENDIF(NOT EXISTS ${CERES_VERSION_FILE})
82 ENDIF(CERES_INCLUDE_DIRS)
83
84 INCLUDE(FindPackageHandleStandardArgs)
85
86 FIND_PACKAGE_HANDLE_STANDARD_ARGS(CERES REQUIRED_VARS CERES_INCLUDE_DIRS
87 VERSION_VAR CERES_VERSION)
88
89 MARK_AS_ADVANCED(
90 CERES_INCLUDE_DIR
91 CERES_LIBRARY
92 CERES_VERSION
93 )
0 # - Try to find Eigen3 lib
1 #
2 # This module supports requiring a minimum version, e.g. you can do
3 # find_package(Eigen3 3.1.2)
4 # to require version 3.1.2 or newer of Eigen3.
5 #
6 # Once done this will define
7 #
8 # EIGEN3_FOUND - system has eigen lib with correct version
9 # EIGEN3_INCLUDE_DIR - the eigen include directory
10 # EIGEN3_VERSION - eigen version
11 #
12 # and the following imported target:
13 #
14 # Eigen3::Eigen - The header-only Eigen library
15 #
16 # This module reads hints about search locations from
17 # the following environment variables:
18 #
19 # EIGEN3_ROOT
20 # EIGEN3_ROOT_DIR
21
22 # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
23 # Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
24 # Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
25 # Redistribution and use is allowed according to the terms of the 2-clause BSD license.
26
27 if(NOT Eigen3_FIND_VERSION)
28 if(NOT Eigen3_FIND_VERSION_MAJOR)
29 set(Eigen3_FIND_VERSION_MAJOR 2)
30 endif(NOT Eigen3_FIND_VERSION_MAJOR)
31 if(NOT Eigen3_FIND_VERSION_MINOR)
32 set(Eigen3_FIND_VERSION_MINOR 91)
33 endif(NOT Eigen3_FIND_VERSION_MINOR)
34 if(NOT Eigen3_FIND_VERSION_PATCH)
35 set(Eigen3_FIND_VERSION_PATCH 0)
36 endif(NOT Eigen3_FIND_VERSION_PATCH)
37
38 set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
39 endif(NOT Eigen3_FIND_VERSION)
40
41 macro(_eigen3_check_version)
42 file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
43
44 string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
45 set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
46 string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
47 set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
48 string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
49 set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
50
51 set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
52 if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
53 set(EIGEN3_VERSION_OK FALSE)
54 else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
55 set(EIGEN3_VERSION_OK TRUE)
56 endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
57
58 if(NOT EIGEN3_VERSION_OK)
59
60 message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
61 "but at least version ${Eigen3_FIND_VERSION} is required")
62 endif(NOT EIGEN3_VERSION_OK)
63 endmacro(_eigen3_check_version)
64
65 if (EIGEN3_INCLUDE_DIR)
66
67 # in cache already
68 _eigen3_check_version()
69 set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
70 set(Eigen3_FOUND ${EIGEN3_VERSION_OK})
71
72 else (EIGEN3_INCLUDE_DIR)
73
74 # search first if an Eigen3Config.cmake is available in the system,
75 # if successful this would set EIGEN3_INCLUDE_DIR and the rest of
76 # the script will work as usual
77 find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
78
79 if(NOT EIGEN3_INCLUDE_DIR)
80 find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
81 HINTS
82 ENV EIGEN3_ROOT
83 ENV EIGEN3_ROOT_DIR
84 PATHS
85 ${CMAKE_INSTALL_PREFIX}/include
86 ${KDE4_INCLUDE_DIR}
87 PATH_SUFFIXES eigen3 eigen
88 )
89 endif(NOT EIGEN3_INCLUDE_DIR)
90
91 if(EIGEN3_INCLUDE_DIR)
92 _eigen3_check_version()
93 endif(EIGEN3_INCLUDE_DIR)
94
95 include(FindPackageHandleStandardArgs)
96 find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
97
98 mark_as_advanced(EIGEN3_INCLUDE_DIR)
99
100 endif(EIGEN3_INCLUDE_DIR)
101
102 if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen)
103 add_library(Eigen3::Eigen INTERFACE IMPORTED)
104 set_target_properties(Eigen3::Eigen PROPERTIES
105 INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
106 endif()
0 # - Find libxc
1 # Find the native libxc headers and libraries.
2 #
3 # LIBXC_INCLUDE_DIRS - where to find xc.h, etc.
4 # LIBXC_LIBRARIES - List of libraries when using expat.
5 # LIBXC_FOUND - True if expat found.
6 #
7 # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org)
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 # http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21
22 # check if info is available via PkgConfig
23 find_package(PkgConfig)
24 pkg_check_modules(PC_libxc libxc)
25
26 find_path(LIBXC_INCLUDE_DIR NAMES xc.h HINTS HINTS ${PC_libxc_INCLUDE_DIRS})
27 find_library(LIBXC_LIBRARY NAMES xc HINTS ${PC_libxc_LIBRARY_DIRS} )
28
29
30 set(LIBXC_LIBRARIES "${LIBXC_LIBRARY}" )
31 set(LIBXC_INCLUDE_DIRS "${LIBXC_INCLUDE_DIR}" )
32
33 #include(FindPackageHandleStandardArgs)
34 # handle the QUIETLY and REQUIRED arguments and set LIBXC_FOUND to TRUE
35 # if all listed variables are TRUE
36 find_package_handle_standard_args(LIBXC DEFAULT_MSG LIBXC_LIBRARY LIBXC_INCLUDE_DIR )
37
38
39 mark_as_advanced(LIBXC_INCLUDE_DIR LIBXC_LIBRARY )
0 # CMake script to detect Intel(R) Math Kernel Library (MKL)
1 #
2 # This will try to find Intel MKL libraries, and include path by automatic
3 # search through typical install locations and if failed it will
4 # examine MKLROOT environment variable.
5 # Note, MKLROOT is not set by IPP installer, it should be set manually.
6 #
7 # Usage example:
8 # set(MKL_USE_STATIC_LIBS ON)
9 # find_package(MKL)
10 # if (MKL_FOUND)
11 # include_directories(${MKL_INCLUDE_DIRS})
12 # add_executable(foo foo.cc)
13 # target_link_libraries(foo ${MKL_LIBRARIES})
14 # endif()
15 #
16 # Variables used by this module, they can change the default behaviour and
17 # need to be set before calling find_package:
18 #
19 # MKL_ADDITIONAL_VERSIONS A list of version numbers to use for searching
20 # the MKL include directory.
21 #
22 # MKL_USE_STATIC_LIBS Can be set to ON to force the use of the static
23 # boost libraries. Defaults to OFF.
24 #
25 # MKL_FIND_DEBUG Set this to TRUE to enable debugging output
26 # of FindMKL.cmake if you are having problems.
27 #
28 # On return this will define:
29 # MKL_FOUND Indicates whether MKL was found (True/False)
30 # MKL_INCLUDE_DIRS MKL include folder
31 # MKL_LIBRARY_DIRS MKL libraries folder
32 # MKL_LIBRARIES MKL libraries names
33 #
34 # NOTE: this script has only been tested with Intel(R) Parallel Studio XE 2011
35 # and may need changes for compatibility with older versions.
36 #
37 # Adapted from OpenCV IPP detection script
38 # https://code.ros.org/trac/opencv/browser/trunk/opencv/OpenCVFindIPP.cmake
39 # Many portions taken from FindBoost.cmake
40
41 # TODO:
42 # - caller needs to link with libiomp5md.lib or /Qopenmp...
43 # - runtime DLLs:
44 # <Composer XE directory> -> C:\Program Files\Intel\ComposerXE-2011
45 # redist\ia32\mkl
46 # redist\intel64\mkl
47
48 set(_MKL_IA32 FALSE)
49 set(_MKL_INTEL64 FALSE)
50 if (CMAKE_SIZEOF_VOID_P EQUAL 4)
51 set(_MKL_IA32 TRUE)
52 elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
53 set(_MKL_INTEL64 TRUE)
54 else()
55 message(FATAL_ERROR "Unsupported 'void *' size (${SIZEOF_VOID_P})")
56 endif()
57
58 # Versions should be listed is decreasing order of preference
59 set(_MKL_TEST_VERSIONS ${MKL_ADDITIONAL_VERSIONS}
60 "2011"
61 # alternative form: "2011.xxx.y"
62 # (y is the release-update number and xxx is the package number)
63 )
64
65 if (MKL_FIND_VERSION AND NOT MKL_FIND_QUIETLY)
66 message(WARNING "Requesting a specific version of Intel(R) MKL is not supported")
67 endif()
68
69 # Use environment variables from Intel build scripts, if available
70 if (NOT MKL_ROOT AND NOT $ENV{MKLROOT} STREQUAL "")
71 set(MKL_ROOT $ENV{MKLROOT})
72 endif()
73
74 if (MKL_ROOT)
75 file(TO_CMAKE_PATH ${MKL_ROOT} MKL_ROOT)
76 endif()
77
78 if (NOT INTEL_ROOT AND NOT $ENV{INTELROOT} STREQUAL "")
79 set(INTEL_ROOT $ENV{INTELROOT})
80 endif()
81
82 if (INTEL_ROOT)
83 file(TO_CMAKE_PATH ${INTEL_ROOT} INTEL_ROOT)
84 endif()
85
86 if (MKL_FIND_DEBUG)
87 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
88 "_MKL_TEST_VERSIONS = ${_MKL_TEST_VERSIONS}")
89 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
90 "MKL_ADDITIONAL_VERSIONS = ${MKL_ADDITIONAL_VERSIONS}")
91 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
92 "MKL_USE_STATIC_LIBS = ${MKL_USE_STATIC_LIBS}")
93 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
94 "MKL_ROOT = ${MKL_ROOT}")
95 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
96 "INTEL_ROOT = ${INTEL_ROOT}")
97 endif()
98
99 # Find MKL include directory
100
101 set(_MKL_ROOT_SEARCH_DIRS
102 ${MKL_ROOT}
103 )
104
105 foreach (_MKL_VER ${_MKL_TEST_VERSIONS})
106 if (WIN32)
107 list(APPEND _MKL_ROOT_SEARCH_DIRS "$ENV{ProgramFiles}/Intel/Composer XE/mkl")
108 else()
109 list(APPEND _MKL_ROOT_SEARCH_DIRS "/opt/intel/composerxe-${_MKL_VER}/mkl")
110 endif()
111 endforeach()
112
113 if (MKL_FIND_DEBUG)
114 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
115 "_MKL_ROOT_SEARCH_DIRS = ${_MKL_ROOT_SEARCH_DIRS}")
116 endif()
117
118 find_path(MKL_INCLUDE_DIR
119 NAMES mkl.h
120 PATHS ${_MKL_ROOT_SEARCH_DIRS}
121 PATH_SUFFIXES include
122 DOC "The path to Intel(R) MKL header files"
123 )
124
125 if (MKL_INCLUDE_DIR)
126 if (MKL_FIND_DEBUG)
127 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
128 "location of mkl.h: ${MKL_INCLUDE_DIR}/mkl.h")
129 endif()
130 else()
131 if (MKL_FIND_DEBUG)
132 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
133 "unable to find Intel(R) MKL header files. Please set MKLROOT"
134 " to the root directory containing MKL.")
135 endif()
136 endif()
137
138 # Find MKL library directory
139
140 set(_INTEL_LIBRARY_DIR_SUFFIXES "lib")
141 if (_MKL_IA32)
142 list(APPEND _INTEL_LIBRARY_DIR_SUFFIXES "lib/ia32")
143 elseif (_MKL_INTEL64)
144 list(APPEND _INTEL_LIBRARY_DIR_SUFFIXES "lib/intel64")
145 else()
146 message(FATAL_ERROR "unreachable")
147 endif()
148
149 set(_MKL_LIBRARY_SEARCH_DIRS ${_MKL_ROOT_SEARCH_DIRS})
150 if (MKL_INCLUDE_DIR)
151 list(APPEND _MKL_LIBRARY_SEARCH_DIRS "${MKL_INCLUDE_DIR}/..")
152 endif()
153
154 if (MKL_FIND_DEBUG)
155 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
156 "_INTEL_LIBRARY_DIR_SUFFIXES = ${_INTEL_LIBRARY_DIR_SUFFIXES}")
157 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
158 "_MKL_LIBRARY_SEARCH_DIRS = ${_MKL_LIBRARY_SEARCH_DIRS}")
159 endif()
160
161 set(MKL_LIB_PREFIX "mkl_")
162 if (MKL_USE_STATIC_LIBS)
163 if (_MKL_IA32)
164 if (WIN32)
165 set(_MKL_LIBRARIES intel_c)
166 else()
167 set(_MKL_LIBRARIES intel)
168 endif()
169 elseif (_MKL_INTEL64)
170 set(_MKL_LIBRARIES intel_lp64)
171 else()
172 message(FATAL_ERROR "unreachable")
173 endif()
174
175 list(APPEND _MKL_LIBRARIES intel_thread)
176 list(APPEND _MKL_LIBRARIES core)
177 else()
178 set(_MKL_LIBRARIES rt)
179 endif()
180
181 set(_MKL_MISSING_LIBRARIES "")
182 set(MKL_LIBRARIES "")
183 set(MKL_LIBRARY_DIRS "")
184 # Find MKL libraries
185 foreach (_MKL_LIB_RAW ${_MKL_LIBRARIES})
186 set(_MKL_LIB ${MKL_LIB_PREFIX}${_MKL_LIB_RAW})
187 string(TOUPPER ${_MKL_LIB} _MKL_LIB_UPPER)
188
189 find_library(${_MKL_LIB_UPPER}_LIBRARY
190 NAMES ${_MKL_LIB}
191 PATHS ${_MKL_LIBRARY_SEARCH_DIRS}
192 PATH_SUFFIXES ${_INTEL_LIBRARY_DIR_SUFFIXES}
193 DOC "The path to Intel(R) MKL ${_MKL_LIB_RAW} library"
194 )
195 mark_as_advanced(${_MKL_LIB_UPPER}_LIBRARY)
196
197 if (NOT ${_MKL_LIB_UPPER}_LIBRARY)
198 list(APPEND _MKL_MISSING_LIBRARIES ${_MKL_LIB})
199 else()
200 list(APPEND MKL_LIBRARIES ${${_MKL_LIB_UPPER}_LIBRARY})
201 if (MKL_FIND_DEBUG)
202 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
203 "Found ${_MKL_LIB}: ${${_MKL_LIB_UPPER}_LIBRARY}")
204 endif()
205
206 get_filename_component(_MKL_LIB_PATH "${${_MKL_LIB_UPPER}_LIBRARY}" PATH)
207 list(APPEND MKL_LIBRARY_DIRS ${_MKL_LIB_PATH})
208 endif()
209 endforeach()
210
211 ## Find OpenMP, pthread and math libraries
212
213 set(_INTEL_LIBRARY_SEARCH_DIRS
214 ${INTEL_ROOT}
215 ${INTEL_ROOT}/compiler
216 )
217
218 foreach(_MKL_DIR ${_MKL_ROOT_SEARCH_DIRS})
219 list(APPEND _INTEL_LIBRARY_SEARCH_DIRS "${_MKL_DIR}/..")
220 list(APPEND _INTEL_LIBRARY_SEARCH_DIRS "${_MKL_DIR}/../compiler")
221 endforeach()
222
223 if (MKL_FIND_DEBUG)
224 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
225 "_INTEL_LIBRARY_SEARCH_DIRS = ${_INTEL_LIBRARY_SEARCH_DIRS}")
226 endif()
227
228 if (NOT WIN32)
229 find_library(PTHREAD_LIBRARY pthread DOC "Path to POSIX threads library")
230 endif()
231
232 set(_IOMP5_LIB iomp5)
233 if (WIN32)
234 if (MKL_USE_STATIC_LIBS)
235 list(APPEND _IOMP5_LIB libiomp5mt.lib)
236 else()
237 list(APPEND _IOMP5_LIB libiomp5md.lib)
238 endif()
239 endif()
240
241 find_library(IOMP5_LIBRARY
242 NAMES ${_IOMP5_LIB}
243 PATHS ${_INTEL_LIBRARY_SEARCH_DIRS}
244 PATH_SUFFIXES ${_INTEL_LIBRARY_DIR_SUFFIXES}
245 DOC "Path to OpenMP runtime library"
246 )
247
248 if (NOT IOMP5_LIBRARY)
249 # we could instead fallback to default library (via FindOpenMP.cmake)
250 list(APPEND _MKL_MISSING_LIBRARIES IOMP5)
251 else()
252 list(APPEND MKL_LIBRARIES ${IOMP5_LIBRARY})
253 if (MKL_FIND_DEBUG)
254 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
255 "Found IOMP5_LIBRARY: ${IOMP5_LIBRARY}")
256 endif()
257
258 get_filename_component(_MKL_LIB_PATH "${IOMP5_LIBRARY}" PATH)
259 list(APPEND MKL_LIBRARY_DIRS ${_MKL_LIB_PATH})
260 endif()
261
262 # Optimized math library (optional)
263 set(_MATH_LIB imf) # linked by default with Intel compiler
264 if (WIN32)
265 if (MKL_USE_STATIC_LIBS)
266 list(APPEND _MATH_LIB libmmds.lib) # assumes (/MD) otherwise libmmt.lib (for /MT)
267 else()
268 list(APPEND _MATH_LIB libmmd.lib)
269 endif()
270 endif()
271
272 find_library(MATH_LIBRARY
273 NAMES ${_MATH_LIB}
274 PATHS ${_INTEL_LIBRARY_SEARCH_DIRS}
275 PATH_SUFFIXES ${_INTEL_LIBRARY_DIR_SUFFIXES}
276 DOC "Path to optimized math library"
277 )
278
279 if (NOT MATH_LIBRARY)
280 # we could instead fallback to default library (via FindOpenMP.cmake)
281 list(APPEND _MKL_MISSING_LIBRARIES MATH)
282 else()
283 list(APPEND MKL_LIBRARIES ${MATH_LIBRARY})
284 if (MKL_FIND_DEBUG)
285 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
286 "Found MATH_LIBRARY: ${MATH_LIBRARY}")
287 endif()
288
289 get_filename_component(_MKL_LIB_PATH "${MATH_LIBRARY}" PATH)
290 list(APPEND MKL_LIBRARY_DIRS ${_MKL_LIB_PATH})
291 endif()
292
293 # Check all required libraries are available
294 list(REMOVE_DUPLICATES MKL_LIBRARY_DIRS)
295
296 set(MKL_INCLUDE_DIRS
297 ${MKL_INCLUDE_DIR}
298 )
299
300 set(MKL_FOUND TRUE)
301 if (NOT MKL_INCLUDE_DIR)
302 set(MKL_FOUND FALSE)
303 if (MKL_FIND_DEBUG)
304 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
305 "MKL not found - MKL_INCLUDE_DIR was empty")
306 endif()
307 elseif (_MKL_MISSING_LIBRARIES)
308 set(MKL_FOUND FALSE)
309 if (MKL_FIND_DEBUG)
310 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
311 "MKL not found - the following libraries are missing: "
312 "${_MKL_MISSING_LIBRARIES}")
313 endif()
314 endif()
315
316 if (MKL_FOUND)
317 if (NOT MKL_FIND_QUIETLY OR MKL_FIND_DEBUG)
318 message(STATUS
319 "Intel(R) MKL was found:\n"
320 " MKL_INCLUDE_DIRS: ${MKL_INCLUDE_DIRS}\n"
321 " MKL_LIBRARY_DIRS: ${MKL_LIBRARY_DIRS}\n"
322 " MKL_LIBRARIES: ${MKL_LIBRARIES}"
323 )
324 endif()
325 else()
326 if (MKL_FIND_REQUIRED)
327 message(SEND_ERROR "Intel(R) MKL could not be found.")
328 else()
329 message(STATUS "Intel(R) MKL could not be found.")
330 endif()
331 endif()
332
333 mark_as_advanced(
334 MKL_INCLUDE_DIR
335 MKL_INCLUDE_DIRS
336 MKL_LIBRARY_DIRS
337 )
338
0 # - Find libsqlite3
1 # Find the native libsqlite3 headers and libraries.
2 #
3 # SQLITE3_INCLUDE_DIRS - where to find sqlite3.h, etc
4 # SQLITE3_LIBRARIES - List of libraries when using sqlite3.
5 # SQLITE3_FOUND - True if sqlite3 found.
6 #
7 # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org)
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 # http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21
22 find_package(PkgConfig)
23
24 pkg_check_modules(PC_SQLITE3 sqlite3)
25
26 find_path(SQLITE3_INCLUDE_DIR sqlite3.h HINTS ${PC_SQLITE3_INCLUDE_DIRS})
27 find_library(SQLITE3_LIBRARY NAMES sqlite3 HINTS ${PC_SQLITE3_LIBRARY_DIRS} )
28
29 set(SQLITE3_LIBRARIES "${SQLITE3_LIBRARY}" )
30 set(SQLITE3_INCLUDE_DIRS "${SQLITE3_INCLUDE_DIR}" )
31
32 include(FindPackageHandleStandardArgs)
33 find_package_handle_standard_args(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR )
34
35 mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY )
0 # - Find libvotca_csg
1 # Find the native libvotca_csg headers and libraries.
2 #
3 # VOTCA_CSG_INCLUDE_DIRS - where to find votca/csg/version.h, etc.
4 # VOTCA_CSG_LIBRARIES - List of libraries when using expat.
5 # VOTCA_CSG_FOUND - True if expat found.
6 # VOTCA_CSG_HAS_SQLITE3 - True if votca csg was build with sqlite3 support
7 #
8 # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org)
9 #
10 # Licensed under the Apache License, Version 2.0 (the "License");
11 # you may not use this file except in compliance with the License.
12 # You may obtain a copy of the License at
13 #
14 # http://www.apache.org/licenses/LICENSE-2.0
15 #
16 # Unless required by applicable law or agreed to in writing, software
17 # distributed under the License is distributed on an "AS IS" BASIS,
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21 #
22
23 find_package(PkgConfig)
24
25 pkg_check_modules(PC_VOTCA_CSG libvotca_csg)
26 find_path(VOTCA_CSG_INCLUDE_DIR votca/csg/version.h HINTS ${PC_VOTCA_CSG_INCLUDE_DIRS})
27
28 find_library(VOTCA_CSG_LIBRARY NAMES votca_csg HINTS ${PC_VOTCA_CSG_LIBRARY_DIRS} )
29
30 find_program(VOTCA_CSG_PROPERTY NAMES csg_property HINTS ${VOTCA_CSG_INCLUDE_DIR}/../bin ${PC_VOTCA_CSG_INCLUDE_DIRS}/../bin)
31
32 set(VOTCA_CSG_LIBRARIES "${VOTCA_CSG_LIBRARY}" )
33 set(VOTCA_CSG_INCLUDE_DIRS "${VOTCA_CSG_INCLUDE_DIR}" )
34
35 include(FindPackageHandleStandardArgs)
36 # handle the QUIETLY and REQUIRED arguments and set VOTCA_CSG_FOUND to TRUE
37 # if all listed variables are TRUE
38 find_package_handle_standard_args(VOTCA_CSG DEFAULT_MSG VOTCA_CSG_LIBRARY VOTCA_CSG_INCLUDE_DIR )
39
40 if (VOTCA_CSG_FOUND AND NOT VOTCA_CSG_LIBRARY STREQUAL "votca_csg")
41 include(CheckLibraryExists)
42 check_library_exists("${VOTCA_CSG_LIBRARY}" VotcaCsgFromC "" FOUND_VOTCA_CSG_VERSION)
43 if(NOT FOUND_VOTCA_CSG_VERSION)
44 message(FATAL_ERROR "Could not find VotcaCsgFromC in ${VOTCA_CSG_LIBRARY}, take look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you don't have pkg-config installed you will most likely have to set VOTCA_CSG_LIBRARY by hand, which set votca_csg lib it's dependencies (i.e. -DVOTCA_CSG_LIBRARY='/path/to/libvotca_csg.so;/path/to/libgsl.so;/path/to/libm.so') !")
45 endif(NOT FOUND_VOTCA_CSG_VERSION)
46 endif ()
47
48 mark_as_advanced(VOTCA_CSG_INCLUDE_DIR VOTCA_CSG_LIBRARY )
0 # - Find libvotca_tools
1 # Find the native libvotca_tools headers and libraries.
2 #
3 # VOTCA_TOOLS_INCLUDE_DIRS - where to find votca/tools/version.h, etc.
4 # VOTCA_TOOLS_LIBRARIES - List of libraries when using expat.
5 # VOTCA_TOOLS_FOUND - True if expat found.
6 # VOTCA_TOOLS_HAS_SQLITE3 - True if votca tools was build with sqlite3 support
7 #
8 # Copyright 2009-2018 The VOTCA Development Team (http://www.votca.org)
9 #
10 # Licensed under the Apache License, Version 2.0 (the "License");
11 # you may not use this file except in compliance with the License.
12 # You may obtain a copy of the License at
13 #
14 # http://www.apache.org/licenses/LICENSE-2.0
15 #
16 # Unless required by applicable law or agreed to in writing, software
17 # distributed under the License is distributed on an "AS IS" BASIS,
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21 #
22
23 find_package(PkgConfig)
24
25 pkg_check_modules(PC_VOTCA_TOOLS libvotca_tools)
26 find_path(VOTCA_TOOLS_INCLUDE_DIR votca/tools/version.h HINTS ${PC_VOTCA_TOOLS_INCLUDE_DIRS})
27
28 find_package(Eigen3 3.3.0 REQUIRED)
29 find_package(MKL)
30 if (NOT MKL_FOUND)
31 set(MKL_LIBRARIES)
32 set(MKL_INCLUDE_DIRS)
33 endif()
34
35 find_path(VOTCA_TOOLS_HAS_SQLITE3 votca/tools/database.h HINTS ${VOTCA_TOOLS_INCLUDE_DIR} ${PC_VOTCA_TOOLS_INCLUDE_DIRS})
36 if (VOTCA_TOOLS_HAS_SQLITE3)
37 #due to include <sqlite3.h> in database.h
38 find_package(SQLITE3 REQUIRED)
39 else(VOTCA_TOOLS_HAS_SQLITE3)
40 set(SQLITE3_INCLUDE_DIR)
41 endif (VOTCA_TOOLS_HAS_SQLITE3)
42
43 find_library(VOTCA_TOOLS_LIBRARY NAMES votca_tools HINTS ${PC_VOTCA_TOOLS_LIBRARY_DIRS} )
44
45 set(VOTCA_TOOLS_INCLUDE_DIRS "${VOTCA_TOOLS_INCLUDE_DIR};${SQLITE3_INCLUDE_DIR};${EIGEN3_INCLUDE_DIR};${MKL_INCLUDE_DIRS}" )
46 set(VOTCA_TOOLS_LIBRARIES "${VOTCA_TOOLS_LIBRARY};${MKL_LIBRARIES}" )
47
48 include(FindPackageHandleStandardArgs)
49 # handle the QUIETLY and REQUIRED arguments and set VOTCA_TOOLS_FOUND to TRUE
50 # if all listed variables are TRUE
51 find_package_handle_standard_args(VOTCA_TOOLS DEFAULT_MSG VOTCA_TOOLS_LIBRARY VOTCA_TOOLS_INCLUDE_DIR )
52
53 if (VOTCA_TOOLS_FOUND AND NOT VOTCA_TOOLS_LIBRARY STREQUAL "votca_tools")
54 include(CheckLibraryExists)
55 check_library_exists("${VOTCA_TOOLS_LIBRARY}" VotcaToolsFromC "" FOUND_VOTCA_TOOLS_VERSION)
56 if(NOT FOUND_VOTCA_TOOLS_VERSION)
57 message(FATAL_ERROR "Could not find VotcaToolsFromC in ${VOTCA_TOOLS_LIBRARY}, take look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you don't have pkg-config installed you will most likely have to set VOTCA_TOOLS_LIBRARY by hand, which set votca_tools lib it's dependencies (i.e. -DVOTCA_TOOLS_LIBRARY='/path/to/libvotca_tools.so;/path/to/libgsl.so;/path/to/libm.so') !")
58 endif(NOT FOUND_VOTCA_TOOLS_VERSION)
59 endif ()
60
61 mark_as_advanced(VOTCA_TOOLS_INCLUDE_DIR VOTCA_TOOLS_LIBRARY )
0 if (GIT_EXECUTABLE)
1 # refresh git index
2 execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
3 WORKING_DIRECTORY ${TOP_SOURCE_DIR} TIMEOUT 5 OUTPUT_QUIET
4 ERROR_VARIABLE EXEC_ERR OUTPUT_STRIP_TRAILING_WHITESPACE
5 )
6 #later use git describe here
7 execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
8 WORKING_DIRECTORY ${TOP_SOURCE_DIR}
9 OUTPUT_VARIABLE THIS_GIT_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
10 execute_process( COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD
11 WORKING_DIRECTORY ${TOP_SOURCE_DIR}
12 OUTPUT_VARIABLE _HAS_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
13 if (NOT "${_HAS_CHANGES}" STREQUAL "")
14 set(THIS_GIT_ID "${THIS_GIT_ID} (dirty)")
15 endif()
16 message("Current git revision is ${THIS_GIT_ID}")
17 set(THIS_GIT_ID "gitid: ${THIS_GIT_ID}")
18 else()
19 set (THIS_GIT_ID)
20 endif()
21 file(READ ${INPUT} CONTENT)
22 string(REGEX REPLACE "#CSG_GIT_ID#" "${THIS_GIT_ID}" NEW_CONTENT "${CONTENT}")
23 file(WRITE "${OUTPUT}.tmp" "${NEW_CONTENT}")
24 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OUTPUT}.tmp ${OUTPUT})
25 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${OUTPUT}.tmp)
0 if (GIT_EXECUTABLE)
1 # refresh git index
2 execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
3 WORKING_DIRECTORY ${TOP_SOURCE_DIR} TIMEOUT 5 OUTPUT_QUIET
4 ERROR_VARIABLE EXEC_ERR OUTPUT_STRIP_TRAILING_WHITESPACE
5 )
6 #later use git describe here
7 execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
8 WORKING_DIRECTORY ${TOP_SOURCE_DIR}
9 OUTPUT_VARIABLE THIS_GIT_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
10 execute_process( COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD
11 WORKING_DIRECTORY ${TOP_SOURCE_DIR}
12 OUTPUT_VARIABLE _HAS_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
13 if (NOT "${_HAS_CHANGES}" STREQUAL "")
14 set(THIS_GIT_ID "${THIS_GIT_ID} (dirty)")
15 endif()
16 message("Current git revision is ${THIS_GIT_ID}")
17 set(THIS_GIT_ID "gitid: ${THIS_GIT_ID}")
18 else()
19 set (THIS_GIT_ID)
20 endif()
21
22 set (GIT_HEADER "gitversion.h")
23 set (NEW_GIT_HEADER "new_gitversion.h")
24 file(WRITE ${NEW_GIT_HEADER} "#include<string>\nstatic const std::string gitversion = \"${THIS_GIT_ID}\";\n")
25 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NEW_GIT_HEADER} ${GIT_HEADER})
26 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${NEW_GIT_HEADER})
0 # Contributor Covenant Code of Conduct
1
2 ## Our Pledge
3
4 In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
5
6 ## Our Standards
7
8 Examples of behavior that contributes to creating a positive environment include:
9
10 * Using welcoming and inclusive language
11 * Being respectful of differing viewpoints and experiences
12 * Gracefully accepting constructive criticism
13 * Focusing on what is best for the community
14 * Showing empathy towards other community members
15
16 Examples of unacceptable behavior by participants include:
17
18 * The use of sexualized language or imagery and unwelcome sexual attention or advances
19 * Trolling, insulting/derogatory comments, and personal or political attacks
20 * Public or private harassment
21 * Publishing others' private information, such as a physical or electronic address, without explicit permission
22 * Other conduct which could reasonably be considered inappropriate in a professional setting
23
24 ## Our Responsibilities
25
26 Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
27
28 Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
29
30 ## Scope
31
32 This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
33
34 ## Enforcement
35
36 Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at votca@googlegroups.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
37
38 Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
39
40 ## Attribution
41
42 This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
43
44 [homepage]: http://contributor-covenant.org
45 [version]: http://contributor-covenant.org/version/1/4/
0 Apache License
1 Version 2.0, January 2004
2 http://www.apache.org/licenses/
3
4 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
5
6 1. Definitions.
7
8 "License" shall mean the terms and conditions for use, reproduction,
9 and distribution as defined by Sections 1 through 9 of this document.
10
11 "Licensor" shall mean the copyright owner or entity authorized by
12 the copyright owner that is granting the License.
13
14 "Legal Entity" shall mean the union of the acting entity and all
15 other entities that control, are controlled by, or are under common
16 control with that entity. For the purposes of this definition,
17 "control" means (i) the power, direct or indirect, to cause the
18 direction or management of such entity, whether by contract or
19 otherwise, or (ii) ownership of fifty percent (50%) or more of the
20 outstanding shares, or (iii) beneficial ownership of such entity.
21
22 "You" (or "Your") shall mean an individual or Legal Entity
23 exercising permissions granted by this License.
24
25 "Source" form shall mean the preferred form for making modifications,
26 including but not limited to software source code, documentation
27 source, and configuration files.
28
29 "Object" form shall mean any form resulting from mechanical
30 transformation or translation of a Source form, including but
31 not limited to compiled object code, generated documentation,
32 and conversions to other media types.
33
34 "Work" shall mean the work of authorship, whether in Source or
35 Object form, made available under the License, as indicated by a
36 copyright notice that is included in or attached to the work
37 (an example is provided in the Appendix below).
38
39 "Derivative Works" shall mean any work, whether in Source or Object
40 form, that is based on (or derived from) the Work and for which the
41 editorial revisions, annotations, elaborations, or other modifications
42 represent, as a whole, an original work of authorship. For the purposes
43 of this License, Derivative Works shall not include works that remain
44 separable from, or merely link (or bind by name) to the interfaces of,
45 the Work and Derivative Works thereof.
46
47 "Contribution" shall mean any work of authorship, including
48 the original version of the Work and any modifications or additions
49 to that Work or Derivative Works thereof, that is intentionally
50 submitted to Licensor for inclusion in the Work by the copyright owner
51 or by an individual or Legal Entity authorized to submit on behalf of
52 the copyright owner. For the purposes of this definition, "submitted"
53 means any form of electronic, verbal, or written communication sent
54 to the Licensor or its representatives, including but not limited to
55 communication on electronic mailing lists, source code control systems,
56 and issue tracking systems that are managed by, or on behalf of, the
57 Licensor for the purpose of discussing and improving the Work, but
58 excluding communication that is conspicuously marked or otherwise
59 designated in writing by the copyright owner as "Not a Contribution."
60
61 "Contributor" shall mean Licensor and any individual or Legal Entity
62 on behalf of whom a Contribution has been received by Licensor and
63 subsequently incorporated within the Work.
64
65 2. Grant of Copyright License. Subject to the terms and conditions of
66 this License, each Contributor hereby grants to You a perpetual,
67 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68 copyright license to reproduce, prepare Derivative Works of,
69 publicly display, publicly perform, sublicense, and distribute the
70 Work and such Derivative Works in Source or Object form.
71
72 3. Grant of Patent License. Subject to the terms and conditions of
73 this License, each Contributor hereby grants to You a perpetual,
74 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75 (except as stated in this section) patent license to make, have made,
76 use, offer to sell, sell, import, and otherwise transfer the Work,
77 where such license applies only to those patent claims licensable
78 by such Contributor that are necessarily infringed by their
79 Contribution(s) alone or by combination of their Contribution(s)
80 with the Work to which such Contribution(s) was submitted. If You
81 institute patent litigation against any entity (including a
82 cross-claim or counterclaim in a lawsuit) alleging that the Work
83 or a Contribution incorporated within the Work constitutes direct
84 or contributory patent infringement, then any patent licenses
85 granted to You under this License for that Work shall terminate
86 as of the date such litigation is filed.
87
88 4. Redistribution. You may reproduce and distribute copies of the
89 Work or Derivative Works thereof in any medium, with or without
90 modifications, and in Source or Object form, provided that You
91 meet the following conditions:
92
93 (a) You must give any other recipients of the Work or
94 Derivative Works a copy of this License; and
95
96 (b) You must cause any modified files to carry prominent notices
97 stating that You changed the files; and
98
99 (c) You must retain, in the Source form of any Derivative Works
100 that You distribute, all copyright, patent, trademark, and
101 attribution notices from the Source form of the Work,
102 excluding those notices that do not pertain to any part of
103 the Derivative Works; and
104
105 (d) If the Work includes a "NOTICE" text file as part of its
106 distribution, then any Derivative Works that You distribute must
107 include a readable copy of the attribution notices contained
108 within such NOTICE file, excluding those notices that do not
109 pertain to any part of the Derivative Works, in at least one
110 of the following places: within a NOTICE text file distributed
111 as part of the Derivative Works; within the Source form or
112 documentation, if provided along with the Derivative Works; or,
113 within a display generated by the Derivative Works, if and
114 wherever such third-party notices normally appear. The contents
115 of the NOTICE file are for informational purposes only and
116 do not modify the License. You may add Your own attribution
117 notices within Derivative Works that You distribute, alongside
118 or as an addendum to the NOTICE text from the Work, provided
119 that such additional attribution notices cannot be construed
120 as modifying the License.
121
122 You may add Your own copyright statement to Your modifications and
123 may provide additional or different license terms and conditions
124 for use, reproduction, or distribution of Your modifications, or
125 for any such Derivative Works as a whole, provided Your use,
126 reproduction, and distribution of the Work otherwise complies with
127 the conditions stated in this License.
128
129 5. Submission of Contributions. Unless You explicitly state otherwise,
130 any Contribution intentionally submitted for inclusion in the Work
131 by You to the Licensor shall be under the terms and conditions of
132 this License, without any additional terms or conditions.
133 Notwithstanding the above, nothing herein shall supersede or modify
134 the terms of any separate license agreement you may have executed
135 with Licensor regarding such Contributions.
136
137 6. Trademarks. This License does not grant permission to use the trade
138 names, trademarks, service marks, or product names of the Licensor,
139 except as required for reasonable and customary use in describing the
140 origin of the Work and reproducing the content of the NOTICE file.
141
142 7. Disclaimer of Warranty. Unless required by applicable law or
143 agreed to in writing, Licensor provides the Work (and each
144 Contributor provides its Contributions) on an "AS IS" BASIS,
145 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146 implied, including, without limitation, any warranties or conditions
147 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148 PARTICULAR PURPOSE. You are solely responsible for determining the
149 appropriateness of using or redistributing the Work and assume any
150 risks associated with Your exercise of permissions under this License.
151
152 8. Limitation of Liability. In no event and under no legal theory,
153 whether in tort (including negligence), contract, or otherwise,
154 unless required by applicable law (such as deliberate and grossly
155 negligent acts) or agreed to in writing, shall any Contributor be
156 liable to You for damages, including any direct, indirect, special,
157 incidental, or consequential damages of any character arising as a
158 result of this License or out of the use or inability to use the
159 Work (including but not limited to damages for loss of goodwill,
160 work stoppage, computer failure or malfunction, or any and all
161 other commercial damages or losses), even if such Contributor
162 has been advised of the possibility of such damages.
163
164 9. Accepting Warranty or Additional Liability. While redistributing
165 the Work or Derivative Works thereof, You may choose to offer,
166 and charge a fee for, acceptance of support, warranty, indemnity,
167 or other liability obligations and/or rights consistent with this
168 License. However, in accepting such obligations, You may act only
169 on Your own behalf and on Your sole responsibility, not on behalf
170 of any other Contributor, and only if You agree to indemnify,
171 defend, and hold each Contributor harmless for any liability
172 incurred by, or claims asserted against, such Contributor by reason
173 of your accepting any such warranty or additional liability.
174
175 END OF TERMS AND CONDITIONS
176
177 APPENDIX: How to apply the Apache License to your work.
178
179 To apply the Apache License to your work, attach the following
180 boilerplate notice, with the fields enclosed by brackets "{}"
181 replaced with your own identifying information. (Don't include
182 the brackets!) The text should be enclosed in the appropriate
183 comment syntax for the file format. We also recommend that a
184 file or class name and description of purpose be included on the
185 same "printed page" as the copyright notice for easier
186 identification within third-party archives.
187
188 Copyright {yyyy} {name of copyright owner}
189
190 Licensed under the Apache License, Version 2.0 (the "License");
191 you may not use this file except in compliance with the License.
192 You may obtain a copy of the License at
193
194 http://www.apache.org/licenses/LICENSE-2.0
195
196 Unless required by applicable law or agreed to in writing, software
197 distributed under the License is distributed on an "AS IS" BASIS,
198 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199 See the License for the specific language governing permissions and
200 limitations under the License.
0 Versatile Object-oriented Toolkit for Coarse-graining Applications
1 Copyright 2009-2011 The VOTCA Development Team
2
3 This product includes software developed at
4 The VOTCA Development Team (http://www.votca.org).
5
6 This software contains code, which was
7 derived from VOTCA KMC, MOO and CTP project.
0 For developers and installation all relevant information can be found [here](https://github.com/votca/votca/blob/master/share/doc/INSTALL.md)
1
2 For other questions, we provide an email list:
3
4 [google group](https://groups.google.com/forum/?hl=de#!forum/votca-xtp)
5
6 and a slack channel:
7
8 [Slack](https://votca.slack.com/messages/C7XVBE9EG/?)
9
10 At the moment we are also working on a manual:
11
12 [Manual](http://doc.votca.org/xtp-manual.pdf)
13
14 The development of VOTCA is mainly funded by academic research grants.
15 If you use this package, please cite the VOTCA papers:
16
17 * Microscopic simulations of charge transport in disordered organic semiconductors
18 V. Ruehle, A. Lukyanov, F. May, M. Schrader, T. Vehoff, J. Kirkpatrick, B. Baumeier and D. Andrienko
19 J. Chem. Theo. Comp. 7, 3335-3345 (2011)
20
21 * Versatile Object-oriented Toolkit for Coarse-graining Applications,
22 V.Ruehle, C. Junghans, A. Lukyanov, K. Kremer, D. Andrienko,
23 J. Chem. Theo. Comp. 5 (12), 3211 (2009)
24
25 In case of questions, please post them in the google discussion group
26 for votca at http://groups.google.com/group/votca-xtp
27
28 You can contact the VOTCA Development Team at devs@votca.org.
29
30
31
0 configure_file(votca_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/votca_config.h)
1
2 file(GLOB_RECURSE VOTCA_HEADERS *.h ${CMAKE_CURRENT_BINARY_DIR}/votca_config.h)
3 install(FILES ${VOTCA_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/votca/xtp)
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_ERIS_H
20 #define VOTCA_XTP_ERIS_H
21
22
23 #include <votca/xtp/threecenter.h>
24 #include <votca/xtp/fourcenter.h>
25
26 namespace votca { namespace xtp {
27
28 /**
29 * \brief Takes a density matrix and and an auxillary basis set and calculates the electron repulsion integrals.
30 *
31 *
32 *
33 */
34 class ERIs{
35
36 public:
37
38 void Initialize(AOBasis &_dftbasis, AOBasis &_auxbasis, const Eigen::MatrixXd& inverse_Coulomb);
39 void Initialize_4c_small_molecule(AOBasis &_dftbasis);
40 void Initialize_4c_screening(AOBasis &_dftbasis, double eps); // Pre-screening
41
42 const Eigen::MatrixXd& getEXX() const{return _EXXs;}
43
44 const Eigen::MatrixXd& getERIs() const{return _ERIs;}
45 double& getERIsenergy(){return _ERIsenergy;}
46 double& getEXXsenergy(){return _EXXsenergy;}
47
48 void CalculateERIs(const Eigen::MatrixXd &DMAT);
49 void CalculateEXX(const Eigen::MatrixXd &DMAT);
50 void CalculateEXX(const Eigen::Block<Eigen::MatrixXd>& occMos,const Eigen::MatrixXd &DMAT);
51 void CalculateERIs_4c_small_molecule(const Eigen::MatrixXd &DMAT);
52 void CalculateEXX_4c_small_molecule(const Eigen::MatrixXd &DMAT);
53
54 void CalculateERIs_4c_direct(const AOBasis& dftbasis, const Eigen::MatrixXd& DMAT);
55
56 int getSize1(){return _ERIs.rows();}
57 int getSize2(){return _ERIs.cols();}
58
59 void printERIs();
60
61 private:
62
63 bool _with_screening = false;
64 double _screening_eps;
65 Eigen::MatrixXd _diagonals; // Square matrix containing <ab|ab> for all basis functions a, b
66
67 void CalculateERIsDiagonals(const AOBasis& dftbasis);
68
69 bool CheckScreen(double eps,
70 const AOShell& shell_1, const AOShell& shell_2,
71 const AOShell& shell_3, const AOShell& shell_4);
72
73 TCMatrix_dft _threecenter;
74 FCMatrix _fourcenter;
75
76 Eigen::MatrixXd _ERIs;
77 Eigen::MatrixXd _EXXs;
78
79 double _ERIsenergy;
80 double _EXXsenergy;
81
82 void CalculateEnergy(const Eigen::MatrixXd &DMAT);
83 void CalculateEXXEnergy(const Eigen::MatrixXd &DMAT);
84
85 void FillERIsBlock(Eigen::MatrixXd& ERIsCur, const Eigen::MatrixXd& DMAT,
86 const tensor4d& block,
87 const AOShell& shell_1, const AOShell& shell_2,
88 const AOShell& shell_3, const AOShell& shell_4);
89
90 };
91
92 }}
93
94 #endif // VOTCA_XTP_ERIS_H
95
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_MD2QMENGINE_H
20 #define VOTCA_XTP_MD2QMENGINE_H
21
22 #include <votca/xtp/calculatorfactory.h>
23 #include <votca/tools/property.h>
24 #include <votca/xtp/statesaversqlite.h>
25 #include <votca/xtp/topology.h>
26 #include <votca/csg/topology.h>
27
28 namespace XTP = votca::xtp;
29 namespace CSG = votca::csg;
30 namespace TOOLS = votca::tools;
31
32 namespace votca{
33 namespace xtp{
34
35
36 class Md2QmEngine
37 {
38 public:
39
40 Md2QmEngine() { };
41 ~Md2QmEngine();
42
43 void Initialize(const std::string &xmlfile);
44 void PrintInfo();
45
46 // Converts atomistic to QM topology
47 void Md2Qm(csg::Topology *mdtop, Topology *qmtop);
48 // Creates an QM molecule container based on MD molecule and the xml std::map
49 Molecule *MoleculeFactory(csg::Molecule *molMDTemplate);
50 // Partitions the QM molecule on segments and fragments
51 Molecule *ExportMolecule(Molecule *molQM, Topology *qmtop);
52
53 private:
54
55 tools::Property _typology;
56
57 // Type std::vectors
58 std::vector < Molecule* > _molecule_types;
59 std::vector < Segment* > _segment_types;
60 std::vector < SegmentType* > _qmUnits;
61 std::vector < Fragment* > _fragment_types;
62 std::vector < Atom* > _atom_types;
63
64 // MD <-> QM Maps
65 std::map < std::string, std::map < int, std::map < std::string, Atom* > > >
66 _map_mol_resNr_atm_atmType;
67 std::map < std::string, Molecule* > _map_MoleculeName_MoleculeType;
68 std::map < std::string, std::string > _map_MoleculeMDName_MoleculeName;
69 std::map < int, Segment* > _map_id_segment;
70
71
72 // Type Creators
73 Molecule *AddMoleculeType(int molecule_id, tools::Property *property);
74 Segment *AddSegmentType(int segment_id, tools::Property *property);
75 SegmentType *AddQMUnit(int unit_id, tools::Property *property);
76 Fragment *AddFragmentType(int fragment_id, tools::Property *property);
77 Atom *AddAtomType(Molecule *owner,
78 std::string residue_name, int residue_number,
79 std::string md_atom_name, int md_atom_id,
80 bool hasQMPart, int qm_atom_id,
81 tools::vec qmpos, std::string element,
82 double weight);
83
84
85
86 const std::string &getMoleculeName(const std::string &mdname);
87 Molecule *getMoleculeType(const std::string &name);
88 Atom *getAtomType(const std::string &molMdName,
89 int resNr, const std::string &mdAtomName);
90 void ReadXYZFile(std::string &file,
91 std::map<int, std::pair<std::string,tools::vec> > &intCoords);
92
93
94 };
95
96 }
97 }
98
99
100 #endif // VOTCA_XTP_MD2QMENGINE_H
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef _VOTCA_XTP_ADIIS__H
20 #define _VOTCA_XTP_ADIIS__H
21
22
23
24 #include <votca/xtp/eigen.h>
25 #include <vector>
26
27 namespace votca { namespace xtp {
28
29
30
31 class ADIIS{
32 public:
33
34 ADIIS():success(true) {};
35 ~ADIIS() {};
36
37 Eigen::VectorXd CalcCoeff(const std::vector< Eigen::MatrixXd* >& _dmathist,const std::vector< Eigen::MatrixXd* >& _mathist);
38
39
40 bool Info(){return success;}
41 private:
42
43 bool success;
44
45 };
46
47 }}
48
49 #endif
50
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_ADIIS_COSTFUNCTION_H
20 #define VOTCA_XTP_ADIIS_COSTFUNCTION_H
21
22
23 #include <votca/xtp/optimiser_costfunction.h>
24
25
26 namespace votca {
27 namespace xtp {
28
29 class ADIIS_costfunction : public Optimiser_costfunction {
30 public:
31
32 ADIIS_costfunction(Eigen::VectorXd DiF, Eigen::MatrixXd DiFj) {
33 _DiF = DiF;
34 _DiFj = DiFj;
35 }
36
37 double EvaluateCost(const Eigen::VectorXd& parameters){
38 Eigen::VectorXd c = parameters.cwiseAbs2();
39 double xnorm = c.sum();
40 c /= xnorm;
41 return (2 * c.transpose() * _DiF + c.transpose() * _DiFj * c).value();
42 }
43
44 Eigen::VectorXd EvaluateGradient(const Eigen::VectorXd& parameters){
45 Eigen::VectorXd c = parameters.cwiseAbs2();
46 double xnorm = c.sum();
47 c /= xnorm;
48 Eigen::VectorXd dEdc = 2.0 * _DiF + _DiFj * c + _DiFj.transpose() * c;
49 Eigen::MatrixXd jac = Eigen::MatrixXd::Zero(c.size(), c.size());
50 for (int i = 0; i < jac.rows(); i++) {
51 for (int j = 0; j < jac.cols(); j++) {
52 jac(i, j) = -c(i)*2.0 * parameters(j) / xnorm;
53 }
54 // Extra term on diagonal
55 jac(i, i) += 2.0 * parameters(i) / xnorm;
56 }
57 return jac.transpose() * dEdc;
58 }
59
60 int NumParameters() const {
61 return _DiF.size();
62 }
63
64 bool Converged(const Eigen::VectorXd& delta_parameters,
65 double delta_cost, const Eigen::VectorXd& gradient){
66 return gradient.cwiseAbs().maxCoeff()<1.e-7;
67 }
68
69
70 private:
71 Eigen::VectorXd _DiF;
72 Eigen::MatrixXd _DiFj;
73
74
75 };
76
77 }
78 }
79 #endif // VOTCA_XTP_ADIIS_COSTFUNCTION_H
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_AOBASIS_H
20 #define VOTCA_XTP_AOBASIS_H
21
22
23 #include <boost/math/constants/constants.hpp>
24 #include <votca/xtp/basisset.h>
25 #include <votca/xtp/qmmolecule.h>
26 #include <votca/xtp/eigen.h>
27 #include <votca/xtp/aoshell.h>
28
29
30 namespace votca { namespace xtp {
31
32 /**
33 * \brief Container to hold Basisfunctions for all atoms
34 *
35 * It is constructed from a vector of QMAtoms and a BasisSet.
36 */
37 class AOBasis
38 {
39 public:
40
41 void ReorderMOs(Eigen::MatrixXd &v,const std::string& start, const std::string& target );
42
43 void ReorderMatrix(Eigen::MatrixXd &v,const std::string& start,const std::string& target );
44
45 void AOBasisFill( const BasisSet& bs , const QMMolecule& atoms, int fragbreak = -1);
46
47 //returns element names for which no ecp was found
48 std::vector<std::string> ECPFill( const BasisSet& bs , QMMolecule& atoms);
49
50 int AOBasisSize() const {return _AOBasisSize; }
51
52 typedef std::vector< AOShell >::const_iterator AOShellIterator;
53 AOShellIterator begin() const{ return _aoshells.begin(); }
54 AOShellIterator end() const{ return _aoshells.end(); }
55
56 Eigen::MatrixXd getTransformationCartToSpherical(const std::string& package);
57
58 const AOShell& getShell( int idx )const{ return _aoshells[idx] ;}
59
60 const std::vector<const AOShell*> getShellsofAtom(int AtomId)const;
61
62 int getNumofShells() const{return _aoshells.size();}
63
64 int getAOBasisFragA() const{return _AOBasisFragA;}
65
66 int getAOBasisFragB() const{return _AOBasisFragB;}
67
68 int getFuncOfAtom(int AtomIndex)const{return _FuncperAtom[AtomIndex];}
69
70 const std::vector<int>& getFuncPerAtom()const {return _FuncperAtom;}
71
72 const AOShell& back()const{return _aoshells.back();}
73
74 private:
75
76 AOShell& addShell( const Shell& shell, const QMAtom& atom, int startIndex );
77
78 AOShell& addECPShell( const Shell& shell, const QMAtom& atom, int startIndex,bool nonlocal);
79
80 void MultiplyMOs(Eigen::MatrixXd &v, std::vector<int> const &multiplier );
81
82
83
84 std::vector<int> invertOrder(const std::vector<int>& order );
85
86 std::vector<int> getReorderVector(const std::string& start,const std::string& target );
87
88 void addReorderShell(const std::string& start,const std::string& target,const std::string& shell, std::vector<int>& neworder );
89
90 std::vector<int> getMultiplierVector(const std::string& start,const std::string& target );
91
92 void addMultiplierShell(const std::string& start,const std::string& target,const std::string& shell, std::vector<int>& multiplier );
93
94 void addTrafoCartShell( const AOShell& shell , Eigen::Block<Eigen::MatrixXd>& submatrix );
95 std::vector<AOShell> _aoshells;
96
97 std::vector<int> _FuncperAtom;
98
99 int _AOBasisFragA;
100 int _AOBasisFragB;
101 int _AOBasisSize;
102
103 };
104
105
106
107 }}
108
109 #endif // VOTCA_XTP_AOBASIS_H
110
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_AOMATRIX_H
20 #define VOTCA_XTP_AOMATRIX_H
21
22 #include <votca/xtp/aobasis.h>
23 #include <votca/xtp/aoshell.h>
24 #include <votca/xtp/mmregion.h>
25 #include <votca/xtp/multiarray.h>
26
27 namespace votca { namespace xtp {
28
29 namespace Cart {
30 enum Index {
31 s, // s
32 x, y, z, // p
33 xx, xy, xz, yy, yz, zz, // d
34 xxx, xxy, xxz, xyy, xyz, xzz, yyy, yyz, yzz, zzz, // f
35 xxxx, xxxy, xxxz, xxyy, xxyz, xxzz, xyyy, xyyz, xyzz, xzzz, yyyy, yyyz, yyzz, yzzz, zzzz, // g
36 xxxxx, xxxxy, xxxxz, xxxyy, xxxyz, xxxzz, xxyyy, xxyyz, xxyzz, xxzzz, xyyyy, xyyyz, xyyzz, xyzzz, xzzzz, yyyyy, yyyyz, yyyzz, yyzzz, yzzzz, zzzzz, // h
37
38 xxxxxx, xxxxxy, xxxxxz, xxxxyy, xxxxyz, xxxxzz, xxxyyy, xxxyyz, xxxyzz, xxxzzz, xxyyyy, xxyyyz, xxyyzz, xxyzzz, // i
39 xxzzzz, xyyyyy, xyyyyz, xyyyzz, xyyzzz, xyzzzz, xzzzzz, yyyyyy, yyyyyz, yyyyzz, yyyzzz, yyzzzz, yzzzzz, zzzzzz,
40
41 xxxxxxx, xxxxxxy, xxxxxxz, xxxxxyy, xxxxxyz, xxxxxzz, xxxxyyy, xxxxyyz, xxxxyzz, xxxxzzz, xxxyyyy, xxxyyyz, // j
42 xxxyyzz, xxxyzzz, xxxzzzz, xxyyyyy, xxyyyyz, xxyyyzz, xxyyzzz, xxyzzzz, xxzzzzz, xyyyyyy, xyyyyyz, xyyyyzz,
43 xyyyzzz, xyyzzzz, xyzzzzz, xzzzzzz, yyyyyyy, yyyyyyz, yyyyyzz, yyyyzzz, yyyzzzz, yyzzzzz, yzzzzzz, zzzzzzz,
44
45 xxxxxxxx, xxxxxxxy, xxxxxxxz, xxxxxxyy, xxxxxxyz, xxxxxxzz, xxxxxyyy, xxxxxyyz, xxxxxyzz, xxxxxzzz, xxxxyyyy, xxxxyyyz, xxxxyyzz, xxxxyzzz, xxxxzzzz, // k
46 xxxyyyyy, xxxyyyyz, xxxyyyzz, xxxyyzzz, xxxyzzzz, xxxzzzzz, xxyyyyyy, xxyyyyyz, xxyyyyzz, xxyyyzzz, xxyyzzzz, xxyzzzzz, xxzzzzzz, xyyyyyyy, xyyyyyyz,
47 xyyyyyzz, xyyyyzzz, xyyyzzzz, xyyzzzzz, xyzzzzzz, xzzzzzzz, yyyyyyyy, yyyyyyyz, yyyyyyzz, yyyyyzzz, yyyyzzzz, yyyzzzzz, yyzzzzzz, yzzzzzzz, zzzzzzzz,
48 };
49 }
50
51
52 /* "superclass" AOSuperMatrix contains all common functionality for
53 * atomic orbital matrix types
54 */
55 class AOSuperMatrix{
56 public:
57 static int getBlockSize( int _lmax );
58 static Eigen::MatrixXd getTrafo( const AOGaussianPrimitive& gaussian);
59 void PrintIndexToFunction(const AOBasis& aobasis);
60 };
61
62
63 // base class for 1D atomic orbital matrix types (overlap, Coulomb, ESP)
64 template< class T>
65 class AOMatrix : public AOSuperMatrix {
66 public:
67 // Access functions
68 int Dimension(){ return _aomatrix.rows();}
69 const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &Matrix() const{ return _aomatrix ;}
70 void Fill(const AOBasis& aobasis);
71 void Print( std::string ident);
72 void FreeMatrix(){
73 _aomatrix.resize(0,0);
74 }
75 // integrate F
76 static std::vector<double> XIntegrate( int size, double U );
77 protected:
78 virtual void FillBlock(Eigen::Block< Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >&matrix,const AOShell& shell_row,const AOShell& shell_col)=0 ;
79 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> _aomatrix;
80 };
81
82
83
84 /* base class class for 3D atomic orbital matrix types
85 * (in principle, we could make nD and 1D and 3D are just special types)
86 */
87 class AOMatrix3D : public AOSuperMatrix {
88 public:
89 const std::array<Eigen::MatrixXd,3 > &Matrix() const{ return _aomatrix ;}
90 void Print( std::string _ident);
91 void Fill(const AOBasis& aobasis );
92 // block fill prototype
93 void FreeMatrix();
94 protected:
95 std::array<Eigen::MatrixXd,3 > _aomatrix;
96 virtual void FillBlock(std::vector<Eigen::Block<Eigen::MatrixXd> >& matrix,const AOShell& shell_row,const AOShell& shell_col)=0 ;
97 };
98
99
100
101 /* derived class for atomic orbital gradient matrices, required for
102 * momentum transition dipoles
103 */
104 class AOMomentum : public AOMatrix3D {
105 protected:
106 void FillBlock(std::vector< Eigen::Block<Eigen::MatrixXd> >& matrix,const AOShell& shell_row,const AOShell& shell_col);
107 };
108
109 /* derived class for atomic orbital electrical dipole matrices, required for
110 * electical transition dipoles
111 */
112 class AODipole : public AOMatrix3D {
113 public:
114 void setCenter(const Eigen::Vector3d& r){ _r=r;}// definition of a center around which the moment should be calculated
115 protected:
116 void FillBlock(std::vector< Eigen::Block<Eigen::MatrixXd> >& matrix,const AOShell& shell_row,const AOShell& shell_col);
117 private:
118 Eigen::Vector3d _r=Eigen::Vector3d::Zero();
119 };
120
121 // derived class for atomic orbital nuclear potential
122 class AOESP : public AOMatrix<double>{
123 public:
124
125 void Fillnucpotential(const AOBasis& aobasis,const QMMolecule& atoms);
126 void Fillextpotential(const AOBasis& aobasis, const std::shared_ptr<MMRegion> & sites);
127 const Eigen::MatrixXd &getNuclearpotential()const{ return _nuclearpotential;}
128 const Eigen::MatrixXd &getExternalpotential()const{ return _externalpotential;}
129 void setPosition(const Eigen::Vector3d& r){ _r=r;};
130 protected:
131 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix ,const AOShell& shell_row,const AOShell& shell_col);
132 private:
133
134 Eigen::Vector3d _r;
135 Eigen::MatrixXd _nuclearpotential;
136 Eigen::MatrixXd _externalpotential;
137 };
138
139 // derived class for Effective Core Potentials
140 class AOECP : public AOMatrix<double>{
141 public:
142 void setECP(const AOBasis* ecp){_ecp=ecp;}
143 protected:
144 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix,const AOShell& shell_row,const AOShell& shell_col);
145 private:
146
147 const AOBasis* _ecp;
148 Eigen::MatrixXd calcVNLmatrix(int _lmax_ecp,const Eigen::Vector3d& posC,
149 const AOGaussianPrimitive& _g_row,const AOGaussianPrimitive& _g_col,
150 const Eigen::Matrix<int,4,5>& power_ecp,const Eigen::Matrix<double,4,5>& gamma_ecp,
151 const Eigen::Matrix<double,4,5>& pref_ecp );
152
153 void getBLMCOF(int lmax_ecp, int lmax_dft, const Eigen::Vector3d& pos, tensor3d& BLC, tensor3d& C );
154 Eigen::VectorXd CalcNorms( double decay,int size);
155 Eigen::VectorXd CalcInt_r_exp( int nmax, double decay );
156 };
157
158 // derived class for kinetic energy
159 class AOKinetic : public AOMatrix<double>{
160 protected:
161 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix , const AOShell& shell_row, const AOShell& shell_col);
162 };
163
164
165 // derived class for atomic orbital overlap
166 class AOOverlap : public AOMatrix<double>{
167 public:
168 Eigen::MatrixXd FillShell(const AOShell& shell);
169 int Removedfunctions()const{return removedfunctions;}
170 double SmallestEigenValue()const{return smallestEigenvalue;}
171
172 Eigen::MatrixXd Pseudo_InvSqrt(double etol);
173 Eigen::MatrixXd Sqrt();
174 protected:
175 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix,const AOShell& shell_row,const AOShell& shell_col);
176 private:
177 int removedfunctions;
178 double smallestEigenvalue;
179 };
180
181 class AODipole_Potential : public AOMatrix<double>{
182 public:
183 void Fillextpotential(const AOBasis& aobasis, const std::shared_ptr<MMRegion> & sites);
184 Eigen::MatrixXd &getExternalpotential(){ return _externalpotential;}
185 const Eigen::MatrixXd &getExternalpotential()const{ return _externalpotential;}
186 protected:
187 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix,const AOShell& shell_row,const AOShell& shell_col);
188 private:
189 void setPolarSite(const PolarSite* site){polarsite=site;};
190 const PolarSite* polarsite;
191 Eigen::MatrixXd _externalpotential;
192 };
193
194 class AOQuadrupole_Potential : public AOMatrix<double>{
195 public:
196 void Fillextpotential(const AOBasis& aobasis, const std::shared_ptr<MMRegion> & sites);
197 Eigen::MatrixXd &getExternalpotential(){ return _externalpotential;}
198 const Eigen::MatrixXd &getExternalpotential()const{ return _externalpotential;}
199 protected:
200 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix,const AOShell& shell_row,const AOShell& shell_col);
201 private:
202 void setPolarSite(const PolarSite* site){polarsite=site;};
203
204 const PolarSite* polarsite;
205 Eigen::MatrixXd _externalpotential;
206 };
207
208 //derived class for atomic orbital Coulomb interaction
209 class AOCoulomb : public AOMatrix<double>{
210 public:
211 Eigen::MatrixXd Pseudo_InvSqrt_GWBSE(const AOOverlap& auxoverlap,double etol);
212 Eigen::MatrixXd Pseudo_InvSqrt(double etol);
213 int Removedfunctions(){return removedfunctions;}
214 protected:
215 void FillBlock( Eigen::Block<Eigen::MatrixXd>& matrix,const AOShell& shell_row,const AOShell& shell_col);
216 private:
217 int removedfunctions;
218 };
219
220 class AOPlanewave : public AOMatrix<std::complex<double> >{
221 public:
222 void Fillextpotential(const AOBasis& aobasis, const std::vector< Eigen::Vector3d>& kpoints);
223 Eigen::MatrixXd getExternalpotential(){ return _externalpotential.real();}
224 protected:
225 void FillBlock(Eigen::Block<Eigen::MatrixXcd>& matrix,
226 const AOShell& shell_row, const AOShell& shell_col);
227 private:
228 void setkVector(const Eigen::Vector3d& k){_k=k;};
229 Eigen::Vector3d _k;
230 Eigen::MatrixXcd _externalpotential;
231 };
232
233
234 }}
235
236 #endif // VOTCA_XTP_AOMATRIX_H
237
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_AOSHELL_H
20 #define VOTCA_XTP_AOSHELL_H
21
22
23 #include <boost/math/constants/constants.hpp>
24 #include <votca/xtp/eigen.h>
25 #include <votca/tools/constants.h>
26
27 #include <votca/xtp/basisset.h>
28 #include "qmatom.h"
29
30 namespace votca { namespace xtp {
31
32 class AOBasis;
33 class AOShell;
34
35 class AOGaussianPrimitive
36 {
37 friend class AOShell;
38 public:
39
40 double getPowfactor()const {return _powfactor;}
41 int getPower()const{return _power;}
42 double getDecay()const {return _decay;}
43 const std::vector<double>& getContraction()const {return _contraction;}
44 const AOShell& getShell() const{return _aoshell;}
45 private:
46
47 int _power; // used in pseudopotenials only
48 double _decay;
49 std::vector<double> _contraction;
50 const AOShell& _aoshell;
51 double _powfactor;//used in evalspace to speed up DFT
52 // private constructor, only a shell can create a primitive
53 AOGaussianPrimitive( const GaussianPrimitive& gaussian, const AOShell& aoshell )
54 : _power(gaussian._power),
55 _decay(gaussian._decay),
56 _contraction(gaussian._contraction),
57 _aoshell(aoshell) {_powfactor=std::pow(2.0 * _decay / boost::math::constants::pi<double>(), 0.75) ; }
58
59 AOGaussianPrimitive( const AOGaussianPrimitive& gaussian, const AOShell &aoshell )
60 : _power(gaussian._power),
61 _decay(gaussian._decay),
62 _contraction(gaussian._contraction),
63 _aoshell(aoshell),
64 _powfactor(gaussian._powfactor){;}
65
66 };
67
68 /*
69 * shells in a Gaussian-basis expansion
70 */
71 class AOShell
72 {
73 friend class AOBasis;
74 public:
75
76 AOShell(const AOShell& shell){
77
78 _type= shell._type;
79 _Lmax= shell._Lmax;
80 _scale= shell._scale;
81 _numFunc= shell._numFunc;
82 _mindecay= shell._mindecay;
83 _startIndex= shell._startIndex;
84 _offset= shell._offset;
85 _pos= shell._pos;
86 _atomindex=shell._atomindex;
87 _nonlocal=shell._nonlocal;
88 _gaussians.reserve(shell._gaussians.size());
89 for(const auto& gaus:shell._gaussians){
90 _gaussians.push_back(AOGaussianPrimitive(gaus,*this));
91 }
92
93 }
94
95 const std::string& getType() const{ return _type; }
96 int getNumFunc() const{ return _numFunc ;}
97 int getStartIndex() const{ return _startIndex ;}
98 int getOffset() const{ return _offset ;}
99 int getAtomIndex() const{ return _atomindex;}
100
101 int getLmax() const{ return _Lmax;}
102
103 bool isCombined()const{
104 return _type.length()>1;
105 }
106
107 bool isNonLocal( ) const{ return _nonlocal;}
108
109 const Eigen::Vector3d& getPos() const{ return _pos; }
110 double getScale() const{ return _scale; }
111
112 int getSize() const{ return _gaussians.size(); }
113
114 void CalcMinDecay(){
115 _mindecay=std::numeric_limits<double>::max();
116 for(auto& gaussian:_gaussians){
117 if(gaussian.getDecay()<_mindecay){
118 _mindecay=gaussian.getDecay();
119 }
120 }
121 return;
122 }
123
124 double getMinDecay() const{return _mindecay;}
125
126
127 void EvalAOspace(Eigen::VectorBlock<Eigen::VectorXd>& AOvalues, const Eigen::Vector3d& grid_pos ) const;
128 void EvalAOspace(Eigen::VectorBlock<Eigen::VectorXd>& AOvalues,Eigen::Block< Eigen::MatrixX3d >& AODervalues, const Eigen::Vector3d& grid_pos ) const;
129
130 // iterator over pairs (decay constant; contraction coefficient)
131 typedef std::vector< AOGaussianPrimitive >::const_iterator GaussianIterator;
132 GaussianIterator begin() const{ return _gaussians.begin(); }
133 GaussianIterator end()const{ return _gaussians.end(); }
134
135 // adds a Gaussian
136 void addGaussian( const GaussianPrimitive& gaussian ){
137 AOGaussianPrimitive aogaussian = AOGaussianPrimitive(gaussian, *this);
138 _gaussians.emplace_back( aogaussian );
139 return;
140 }
141
142 void normalizeContraction();
143
144 friend std::ostream &operator<<(std::ostream &out, const AOShell& shell);
145
146 private:
147
148 // only class aobasis can construct shells
149 AOShell( const Shell& shell, const QMAtom & atom, int startIndex)
150 : _type(shell.getType()),_Lmax(shell.getLmax()),
151 _scale(shell.getScale()), _numFunc(shell.getnumofFunc()),
152 _startIndex(startIndex), _offset(shell.getOffset()), _pos(atom.getPos()) ,
153 _atomindex(atom.getAtomID()) { ; }
154 // for ECPs
155 AOShell( const Shell& shell, const QMAtom & atom, int startIndex, bool nonlocal)
156 : _type(shell.getType()),_Lmax(shell.getLmax()),
157 _scale(shell.getScale()), _numFunc(shell.getnumofFunc()),
158 _startIndex(startIndex), _offset(shell.getOffset()), _pos(atom.getPos()) ,
159 _atomindex(atom.getAtomID()),_nonlocal(nonlocal) { ; }
160
161
162
163 // shell type (S, P, D))
164 std::string _type;
165 int _Lmax;
166 // scaling factor
167 double _scale;
168 // number of functions in shell
169 int _numFunc;
170 double _mindecay;
171 int _startIndex;
172 int _offset;
173 Eigen::Vector3d _pos;
174 int _atomindex;
175 //used for ecp calculations
176 bool _nonlocal;
177
178 // vector of pairs of decay constants and contraction coefficients
179 std::vector< AOGaussianPrimitive > _gaussians;
180
181 };
182
183
184 }}
185
186 #endif // VOTCA_XTP_AOSHELL_H
187
188
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18 /// For earlier commit history see ctp commit 77795ea591b29e664153f9404c8655ba28dc14e9
19
20 #ifndef VOTCA_XTP_ATOM_H
21 #define VOTCA_XTP_ATOM_H
22
23 #include <string>
24 #include <map>
25 #include <votca/tools/vec.h>
26 #include <votca/tools/matrix.h>
27 #include <exception>
28 #include <map>
29
30 namespace votca {
31 namespace xtp {
32
33 class Topology;
34 class Molecule;
35 class Segment;
36 class Fragment;
37
38 /**
39 \brief information about an atom
40
41 The Atom class stores atom id, name, type, mass, charge, residue number
42
43 */
44 class Atom {
45 public:
46 Atom(Molecule *owner, std::string residue_name, int resnr,
47 std::string md_atom_name, int md_atom_id, bool hasQMPart, int qm_atom_id,
48 tools::vec qmPos, std::string element, double weight)
49 : _id(md_atom_id),
50 _name(md_atom_name),
51 _mol(owner),
52 _resnr(resnr),
53 _resname(residue_name),
54 _weight(weight),
55 _bPos(false),
56 _hasQM(hasQMPart),
57 _qmId(qm_atom_id),
58 _qmPos(qmPos),
59 _element(element) {}
60
61 Atom(int atom_id, std::string atom_name)
62 : _id(atom_id), _name(atom_name), _hasQM(false), _qmId(-1) {}
63
64 // TODO This should be replaced from a constructor to an overloaded = operator
65 Atom(Atom *stencil)
66 : _id(stencil->getId()),
67 _name(stencil->getName() + "_ghost"),
68 _top(NULL),
69 _mol(NULL),
70 _resnr(stencil->getResnr()),
71 _resname(stencil->getResname()),
72 _weight(stencil->getWeight()),
73 _pos(stencil->getPos()),
74 _bPos(true),
75 _hasQM(stencil->HasQMPart()),
76 _qmId(stencil->getQMId()),
77 _qmPos(stencil->getQMPos()),
78 _element(stencil->getElement()) {}
79
80 Atom() {};
81 ~Atom() { _Q.clear(); }
82
83 const int &getId() const { return _id; }
84 const std::string &getName() const { return _name; }
85 const std::string &getType() const { return _type; }
86 const int &getResnr() const { return _resnr; }
87
88 inline void setTopology(Topology *container) { _top = container; }
89 inline void setMolecule(Molecule *container) { _mol = container; }
90 inline void setSegment(Segment *container) { _seg = container; }
91 inline void setFragment(Fragment *container) { _frag = container; }
92
93 Topology *getTopology() { return _top; }
94 Molecule *getMolecule() { return _mol; }
95 Segment *getSegment() { return _seg; }
96 Fragment *getFragment() { return _frag; }
97
98 inline void setResnr(const int &resnr) { _resnr = resnr; }
99 inline void setResname(const std::string &resname) { _resname = resname; }
100 inline void setWeight(const double &weight) { _weight = weight; }
101 inline void setQMPart(const int &qmid, tools::vec qmPos);
102 inline void setQMPos(const tools::vec &qmPos) { _qmPos = qmPos; }
103 inline void setElement(const std::string &element) { _element = element; }
104 inline void TranslateBy(const tools::vec &shift) {
105 _pos = _pos + shift;
106 }
107
108 inline const int &getResnr() { return _resnr; }
109 inline const std::string &getResname() { return _resname; }
110 inline const double &getWeight() { return _weight; }
111 inline const int &getQMId() { return _qmId; }
112 inline const tools::vec &getQMPos() { return _qmPos; }
113 inline const std::string &getElement() { return _element; }
114
115 inline const double &getQ(int state) { return _Q.at(state); }
116 inline const double &getQ() { return _q->second; }
117 inline void setQ(std::map<int, double> Q) { _Q = Q; }
118 void chrg(int state) { _q = _Q.find(state); }
119
120 inline void setPTensor(tools::matrix &ptensor) { _ptensor = ptensor; }
121 const tools::matrix &getPTensor() { return _ptensor; }
122
123 /**
124 * get the position of the atom
125 * \return atom position
126 */
127 const tools::vec &getPos() const;
128 /**
129 * set the position of the atom
130 * \param r atom position
131 */
132 void setPos(const tools::vec &r);
133 /**
134 * direct access (read/write) to the position of the atom
135 * \return reference to position
136 */
137 tools::vec &Pos() { return _pos; }
138 /** does this configuration store positions? */
139 bool HasPos() { return _bPos; }
140 /** dose the bead store a position */
141 void HasPos(bool b);
142
143 bool HasQMPart() { return _hasQM; }
144 /**
145 * molecule the bead belongs to
146 * \return Molecule object
147 */
148
149 protected:
150 int _id;
151 std::string _name;
152
153 Topology *_top;
154 Molecule *_mol;
155 Segment *_seg;
156 Fragment *_frag;
157
158 std::string _type;
159 int _resnr;
160 std::string _resname;
161 double _weight;
162 tools::vec _pos;
163 bool _bPos;
164
165 bool _hasQM;
166 int _qmId;
167 tools::vec _qmPos;
168 std::string _element;
169
170 // charge state of segment => partial charge
171 std::map<int, double> _Q;
172 std::map<int, double>::iterator _q;
173 tools::matrix _ptensor;
174 };
175
176 inline void Atom::setPos(const tools::vec &r) {
177 _bPos = true;
178 _pos = r;
179 }
180
181 inline const tools::vec &Atom::getPos() const {
182 if (!_bPos) throw std::runtime_error("Position has not yet been set");
183 return _pos;
184 }
185
186 inline void Atom::HasPos(bool b) { _bPos = b; }
187
188 inline void Atom::setQMPart(const int &qmid, tools::vec qmPos) {
189 if (qmid > -1) {
190 _hasQM = true;
191 _qmId = qmid;
192 _qmPos = qmPos;
193 } else {
194 _hasQM = false;
195 _qmId = -1;
196 }
197 }
198 }
199 }
200
201 #endif // VOTCA_XTP_ATOM_H
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_ATOMCONTAINER_H
20 #define VOTCA_XTP_ATOMCONTAINER_H
21 #include <votca/xtp/eigen.h>
22 #include <votca/tools/elements.h>
23 #include <votca/xtp/checkpoint.h>
24 #include <limits>
25
26 /**
27 * \brief Basic Container for QMAtoms,PolarSites and Atoms
28 *
29 *
30 *
31 */
32
33 namespace votca { namespace xtp {
34
35 template<class T> class AtomContainer{
36 public:
37
38 AtomContainer(std::string name,int id):_name(name),_id(id),_position_valid(false){};
39
40 const std::string& getName()const{return _name;}
41
42 int getId()const{return _id;}
43
44 int size()const{return _atomlist.size();}
45
46 void push_back(const T& atom){_atomlist.push_back(atom);_position_valid=false;}
47 void push_back(T&& atom){_atomlist.push_back(atom);_position_valid=false;}
48
49 const T& at(int index)const{return _atomlist.at(index);}
50 T& at(int index){return _atomlist.at(index);}
51
52 const T& operator[](int index)const{return _atomlist[index];}
53 T& operator[](int index){return _atomlist[index];}
54
55 typename std::vector<T>::iterator begin(){return _atomlist.begin();}
56 typename std::vector<T>::iterator end(){return _atomlist.end();}
57
58 typename std::vector<T>::const_iterator begin()const{return _atomlist.begin();}
59 typename std::vector<T>::const_iterator end()const{return _atomlist.end();}
60
61
62
63 const Eigen::Vector3d& getPos()const{
64 if(!_position_valid){calcPos();}
65 return _pos;
66 }
67
68 //calculates the lowest and highest point in the cube, sorrounding the molecule
69 std::pair<Eigen::Vector3d,Eigen::Vector3d> CalcSpatialMinMax() const{
70 std::pair<Eigen::Vector3d,Eigen::Vector3d> result;
71 Eigen::Vector3d min=std::numeric_limits<double>::max()*Eigen::Vector3d::Ones();
72 Eigen::Vector3d max=std::numeric_limits<double>::min()*Eigen::Vector3d::Ones();
73 for (const T& atom : _atomlist){
74 const Eigen::Vector3d& pos=atom.getPos();
75 if (pos.x()<min.x()) min.x()=pos.x();
76 if (pos.x()>max.x()) max.x()=pos.x();
77 if (pos.y()<min.y()) min.y()=pos.y();
78 if (pos.y()>max.y()) max.y()=pos.y();
79 if (pos.z()<min.z()) min.z()=pos.z();
80 if (pos.z()>max.z()) max.z()=pos.z();
81 }
82 result.first=min;
83 result.second=max;
84 return result;
85 }
86
87 std::vector<std::string> FindUniqueElements()const{
88 std::vector<std::string> result;
89 for (const T& atom : _atomlist){
90 if(std::find(result.begin(), result.end(), atom.getElement()) == result.end()) {
91 result.push_back(atom.getElement());
92 }
93 }
94 return result;
95 }
96
97
98 void Translate(const Eigen::Vector3d& shift){
99 for(const T& atom:_atomlist){
100 atom.Translate(shift);
101 }
102 calcPos();
103 }
104
105 void Rotate(const Eigen::Matrix3d& R, const Eigen::Vector3d& ref_pos){
106 for(const T& atom:_atomlist){
107 atom.Rotate(R,ref_pos);
108 }
109 calcPos();
110 }
111
112 void WriteToCpt(CheckpointWriter& w)const{
113 w(_name,"name");
114 w(_id,"id");
115 for (unsigned i=0;i<_atomlist.size();i++) {
116 CheckpointWriter s = w.openChild( T::Identify() + std::to_string(i));
117 _atomlist[i].WriteToCpt(s);
118 }
119 }
120
121 void ReadFromCpt(CheckpointReader& r){
122 r(_name,"name");
123 r(_id,"id");
124 size_t count = r.getNumDataSets();
125 _atomlist.clear();
126 _atomlist.reserve(count);
127 for (size_t i = 0; i < count; ++i) {
128 CheckpointReader c = r.openChild( T::Identify() + std::to_string(i));
129 _atomlist.emplace_back(T(c));
130 }
131 }
132
133 protected:
134
135 std::vector<T> _atomlist;
136 std::string _name;
137 int _id;
138
139 private:
140 mutable bool _position_valid;
141 mutable Eigen::Vector3d _pos;
142
143 void calcPos() const{
144 tools::Elements element;
145 _pos=Eigen::Vector3d::Zero();
146 double totalmass=0.0;
147 for (const T& atom:_atomlist){
148 double mass=element.getMass(atom.getElement());
149 totalmass+=mass;
150 _pos+=mass*atom.getPos();
151 }
152 _pos/=totalmass;
153 _position_valid=true;
154 }
155
156 };
157
158
159 }}
160
161 #endif // VOTCA_XTP_ATOMCONTAINER_H
0 /*
1 * Copyright 2009-2018 The VOTCA Development Team
2 * (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 *
6 * You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef VOTCA_XTP_BASISSET_H
20 #define VOTCA_XTP_BASISSET_H
21
22 #include <string>
23 #include <map>
24 #include <vector>
25 #include <memory>
26 #include <iostream>
27
28
29
30 namespace votca { namespace xtp {
31 // shell type (S, P, D))
32
33
34
35 int FindLmax(const std::string& type);
36
37 int FindLmin(const std::string& type);
38
39 int OffsetFuncShell(const std::string& shell_type);
40
41 int NumFuncShell(const std::string& shell_type);
42 int NumFuncShell_cartesian(const std::string& shell_type);
43
44 int OffsetFuncShell_cartesian(const std::string& shell_type);
45
46 std::vector<int> NumFuncSubShell(const std::string& shell_type);
47
48
49
50 class Shell;
51 class Element;
52 class BasisSet;
53
54 // Gaussian function: contraction*exp(-decay*r^2)
55 class GaussianPrimitive
56 {
57 friend class Shell;
58 public:
59 int _power; // used in pseudopotenials only
60 double _decay;
61 std::vector<double> _contraction;
62 private:
63 // private constructor, only a shell can create a primitive
64 GaussianPrimitive( double decay, std::vector<double> contraction )
65 : _decay(decay),
66 _contraction(contraction){ ; }
67
68 GaussianPrimitive( int power, double decay, std::vector<double> contraction )
69 : _power(power),
70 _decay(decay),
71 _contraction(contraction){ ; }
72 };
73
74
75 class Shell
76 {
77 friend class Element;
78 public:
79
80 const std::string& getType() const{ return _type; }
81
82 bool isCombined()const{
83 return (_type.length()>1);
84 }
85
86 int getLmax() const{
87 return FindLmax(_type);
88 }
89
90 int getnumofFunc() const{
91 return NumFuncShell(_type);
92 };
93
94 int getOffset()const{
95 return OffsetFuncShell(_type);
96 }
97
98 double getScale() const{ return _scale; }
99
100 int getSize() const{ return _gaussians.size(); }
101
102 std::vector< GaussianPrimitive >::const_iterator begin() const{ return _gaussians.begin(); }
103 std::vector< GaussianPrimitive >::const_iterator end() const{ return _gaussians.end(); }
104
105 // adds a Gaussian
106 GaussianPrimitive& addGaussian( double decay, std::vector<double> contraction );
107
108
109 // adds a Gaussian of a pseudopotential
110 GaussianPrimitive& addGaussian( int power, double decay, std::vector<double> contraction );
111
112
113 friend std::ostream &operator<<(std::ostream &out, const Shell& shell);
114 private:
115
116 // only class Element can construct shells
117 Shell( std::string type, double scale) : _type(type), _scale(scale) { ; }
118
119 std::string _type;
120 // scaling factor
121 double _scale;
122
123 // vector of pairs of decay constants and contraction coefficients
124 std::vector< GaussianPrimitive > _gaussians;
125
126 };
127
128 /*
129 * A collection of shells associated with a specific element
130 */
131 class Element
132 {
133 friend class BasisSet;
134 public:
135
136 typedef std::vector< Shell >::const_iterator ShellIterator;
137 ShellIterator begin() const{ return _shells.begin(); }
138 ShellIterator end() const{ return _shells.end(); }
139
140 const std::string& getType()const{ return _type; }
141
142 int getLmax() const{ return _lmax; }
143
144 int getNcore() const{ return _ncore; }
145
146