pax_global_header00006660000000000000000000000064137771212170014522gustar00rootroot0000000000000052 comment=cd0e8d07da15cfd94dfb4ae78d7c3cc54c419598 gau2grid-2.0.7/000077500000000000000000000000001377712121700132345ustar00rootroot00000000000000gau2grid-2.0.7/.clang-format000066400000000000000000000001271377712121700156070ustar00rootroot00000000000000Language: Cpp BasedOnStyle: Google IndentWidth: 4 ColumnLimit: 120 SortIncludes: false gau2grid-2.0.7/.codecov.yml000066400000000000000000000003161377712121700154570ustar00rootroot00000000000000coverage: status: patch: false project: default: threshold: 50% comment: layout: "header" require_changes: false branches: null behavior: default flags: null paths: null gau2grid-2.0.7/.gitignore000066400000000000000000000027201377712121700152250ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # dotenv .env # virtualenv .venv venv/ ENV/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ # Files resulting from compilation *.o *.a *.so *.d .idea *.swp # Compilation directories that people use obj* *objdir config build* debug debug_latest *.sh TEST */test.py */test.dat *.dylib *.so # Files resulting from running PSI4 ijk.dat output.dat input.py.dat *.out *.32 *.clean *timer.dat *.molden *.cube dfh.* *.npz *.zip gau2grid-2.0.7/.lgtm.yml000066400000000000000000000006111377712121700147760ustar00rootroot00000000000000# Configure LGTM for this package extraction: python: # Configure Python python_setup: # Configure the setup version: 3 # Specify Version 3 cpp: prepare: packages: - python3-numpy path_classifiers: test: - scripts/* library: - versioneer.py # Set Versioneer.py to an external "library" (3rd party code) generated: - gau2grid/_version.py gau2grid-2.0.7/.travis.yml000066400000000000000000000047011377712121700153470ustar00rootroot00000000000000# After changing this file, check it on: # http://lint.travis-ci.org/ language: generic sudo: false dist: xenial matrix: include: # MacOS Builds - os: osx env: - MATRIX_EVAL='brew update &> /dev/null && brew install gcc@8' - C_COMPILER='gcc-8' - PYTHON_VER='3.6' - BUILD_TYPE='release' - os: osx osx_image: xcode8 env: - C_COMPILER='gcc' - PYTHON_VER='3.6' - BUILD_TYPE='release' - os: osx osx_image: xcode10.1 env: - C_COMPILER='clang' - PYTHON_VER='3.6' - BUILD_TYPE='release' # Linux Builds - os: linux compiler: clang addons: apt: packages: - clang-3.6 env: - C_COMPILER='clang-3.6' - PYTHON_VER='3.7' - BUILD_TYPE='release' - os: linux compiler: clang addons: apt: packages: - clang-6.0 env: - C_COMPILER='clang-6.0' - PYTHON_VER='3.6' - BUILD_TYPE='release' - os: linux compiler: gcc addons: apt: packages: - gcc-4.9 env: - C_COMPILER='gcc-4.9' - PYTHON_VER='3.7' - BUILD_TYPE='release' - os: linux compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test packages: - gcc-6 env: - C_COMPILER='gcc-6' - PYTHON_VER='3.8' - BUILD_TYPE='release' - os: linux compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test packages: - gcc-7 env: - C_COMPILER='gcc-7' - PYTHON_VER='3.6' - BUILD_TYPE='release' before_install: - uname -a - df -h - ulimit -a # Setup python environment - source devtools/travis-ci/before_install.sh - python -V # Eval matrix evaluations if needed - sh -c '[ -z "$MATRIX_EVAL" ] || eval "${MATRIX_EVAL}"' install: - python devtools/scripts/conda_env.py -n=test -p=$PYTHON_VER devtools/conda-envs/base.yaml - source activate test - > python setup.py install -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} before_script: - python -V - conda list - python -c 'import numpy; print(numpy.version.version)' script: - export GAU2GRID_FORCE_C_TEST=1 - export SPDIR=`python -c 'from distutils import sysconfig as s; print(s.get_python_lib(plat_specific=True))'` - pytest -rws -v --durations=5 --cov=${SPDIR}/gau2grid/ --pyargs gau2grid notifications: email: false after_success: - codecov gau2grid-2.0.7/CMakeLists.txt000066400000000000000000000221671377712121700160040ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(gau2grid VERSION 2.0.7 LANGUAGES C) set(gau2grid_AUTHORS "Daniel G. A. Smith") set(gau2grid_DESCRIPTION "Fast computation of a gaussian and its derivative on a grid") set(gau2grid_URL "https://github.com/dgasmith/gau2grid") set(gau2grid_LICENSE "BSD 3-clause") list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) ############################# Options: Build How? ############################# include(psi4OptionsTools) option_with_default(MAX_AM "The maximum gaussian angular momentum to compile" 8) option_with_default(CMAKE_BUILD_TYPE "Build type (Release or Debug)" Release) if(CMAKE_CXX_COMPILER_ID MATCHES Intel) option_with_flags(ENABLE_XHOST "Enables processor-specific optimization (with MSVC, it enables AVX2 instructions)" ON "-xHost" "-march=native" "/arch:AVX2") else() option_with_flags(ENABLE_XHOST "Enables processor-specific optimization (with MSVC, it enables AVX2 instructions)" ON "-march=native" "-xHost" "/arch:AVX2") endif() option_with_default(BUILD_FPIC "Libraries will be compiled with position independent code" ON) option_with_print(BUILD_SHARED_LIBS "Build final library as shared, not static" ON) option_with_default(ENABLE_GENERIC "Enables mostly static linking of system libraries for shared library" OFF) option_with_default(DISABLE_PRAGMA "Disable certain pragma optimizations, appends _GG_NO_PRAGMA to compile flags" OFF ) # Warnings if((${BUILD_SHARED_LIBS}) AND NOT ${BUILD_FPIC}) message(FATAL_ERROR "BUILD_SHARED_LIBS ON and BUILD_FPIC OFF are incompatible, as shared library requires position independent code") endif() # Install option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed" lib) option_with_default(PYMOD_INSTALL_LIBDIR "Location within CMAKE_INSTALL_LIBDIR to which python modules are installed Must start with: / . Used to imitate python install: /python3.6/site-packages ." /) option_with_print(INSTALL_PYMOD "Additionally installs as independent python module in PYMOD_INSTALL_LIBDIR" OFF) option_with_default(NATIVE_PYTHON_INSTALL "For INSTALL_PYMOD=ON, install in Python manner to PYTHON_EXECUTABLE's site-packages rather than Linux manner to prefix. Overrides CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_LIBDIR, PYMOD_INSTALL_LIBDIR. Only Py module installed." OFF) option_with_print(NATIVE_PYTHON_INSTALL_WITH_LIB "Same as NATIVE_PYTHON_INSTALL except installs library, too, _without_ overriding CMAKE_INSTALL_* options." OFF) ######################## Process & Validate Options ########################## include(autocmake_safeguards) include(custom_color_messages) include(custom_static_library) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "/usr/local/gau2grid" CACHE PATH "Install path" FORCE) endif() message(STATUS "gau2grid install: ${CMAKE_INSTALL_PREFIX}") # << Python >> set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5) # adjust with CMake minimum FindPythonInterp find_package(PythonLibsNew 3.6 REQUIRED) message(STATUS "${Cyan}Found Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}${ColourReset}: ${PYTHON_EXECUTABLE} (found version ${PYTHON_VERSION_STRING})") ################################ Main Project ################################ add_custom_command( OUTPUT gau2grid/gau2grid.h gau2grid_orbital.c gau2grid_phi.c gau2grid_deriv1.c gau2grid_deriv2.c gau2grid_deriv3.c gau2grid_transform.c gau2grid_helper.c COMMAND ${PYTHON_EXECUTABLE} -c "import sys; \ sys.path.append('${PROJECT_SOURCE_DIR}'); \ import gau2grid as gg; \ gg.c_gen.generate_c_gau2grid(${MAX_AM}, path='${CMAKE_CURRENT_BINARY_DIR}')" DEPENDS gau2grid/c_generator.py gau2grid/c_generator.py gau2grid/codegen.py gau2grid/c_pragma.py gau2grid/c_util_generator.py gau2grid/c_wrapper.py gau2grid/docs_generator.py gau2grid/order.py gau2grid/python_reference.py gau2grid/RSH.py gau2grid/utility.py VERBATIM) set(sources_list ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_phi.c ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_orbital.c ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_deriv1.c ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_deriv2.c ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_deriv3.c ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_transform.c ${CMAKE_CURRENT_BINARY_DIR}/gau2grid_helper.c) add_library(gg ${sources_list}) if ("${CMAKE_C_COMPILER_ID}" STREQUAL "PGI") set_target_properties(gg PROPERTIES COMPILE_FLAGS "-c11") else() set_target_properties(gg PROPERTIES COMPILE_FLAGS "-std=c11") endif() set_target_properties(gg PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_FPIC} SOVERSION 2) # bump whenever interface has changes or removals if( DISABLE_PRAGMA ) target_compile_definitions( gg PRIVATE $ ) endif() find_package(StandardMathLibraryC) target_link_libraries(gg PRIVATE ${STANDARD_MATH_LIBRARY}) if(${BUILD_SHARED_LIBS}) target_link_libraries(gg PRIVATE ${LIBC_INTERJECT}) endif() ################################### Install ################################## include(GNUInstallDirs) include(CMakePackageConfigHelpers) set(PN ${PROJECT_NAME}) # Alias to allow for consistent manipulation as a subproject add_library( ${PN}::gg ALIAS gg ) target_include_directories(gg PUBLIC $ $) # GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share". set(CMAKECONFIG_INSTALL_DIR "share/cmake/${PN}") configure_package_config_file(cmake/${PN}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}) write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake VERSION ${${PN}_VERSION} COMPATIBILITY SameMajorVersion) # Install our files if(${NATIVE_PYTHON_INSTALL_WITH_LIB} OR (NOT(${INSTALL_PYMOD} AND ${NATIVE_PYTHON_INSTALL}))) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gau2grid/gau2grid.h ${CMAKE_CURRENT_BINARY_DIR}/gau2grid/gau2grid_pragma.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PN}) install(TARGETS gg EXPORT "${PN}Targets" ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR}) install(EXPORT "${PN}Targets" NAMESPACE "${PN}::" DESTINATION ${CMAKECONFIG_INSTALL_DIR}) export(EXPORT "${PN}Targets" NAMESPACE "${PN}::" FILE "${PROJECT_BINARY_DIR}/${PN}Targets.cmake") endif() if(${INSTALL_PYMOD}) if(${NATIVE_PYTHON_INSTALL}) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; print(sys.prefix);" OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig as s; import os; import sys; cmake_install_prefix = sys.prefix; prefix_lib = s.get_config_var('LIBDIR'); print(prefix_lib.replace(os.path.commonpath([prefix_lib, cmake_install_prefix]), '').strip('/'));" OUTPUT_VARIABLE CMAKE_INSTALL_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig as s; import os; prefix_lib = s.get_config_var('LIBDIR'); spdir = s.get_python_lib(plat_specific=True); print(spdir.replace(os.path.commonpath([prefix_lib, spdir]), ''));" OUTPUT_VARIABLE PYMOD_INSTALL_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE) endif() execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from numpy import distutils; print(distutils.misc_util.get_shared_lib_extension(is_python_ext=False))" OUTPUT_VARIABLE PYLIB_EXTENSION OUTPUT_STRIP_TRAILING_WHITESPACE) install(DIRECTORY gau2grid DESTINATION ${CMAKE_INSTALL_LIBDIR}${PYMOD_INSTALL_LIBDIR} USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*.py") install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR}${PYMOD_INSTALL_LIBDIR}/gau2grid RENAME "gg${PYLIB_EXTENSION}") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_LIBDIR}${PYMOD_INSTALL_LIBDIR}/gau2grid) endif() gau2grid-2.0.7/LICENSE000066400000000000000000000027501377712121700142450ustar00rootroot00000000000000BSD 3-Clause License Copyright (c) 2017, Daniel Smith All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. gau2grid-2.0.7/MANIFEST.in000066400000000000000000000002341377712121700147710ustar00rootroot00000000000000recursive-include gau2grid *.py include setup.py include README.md include LICENSE include MANIFEST.in include versioneer.py include gau2grid/_version.py gau2grid-2.0.7/README.md000066400000000000000000000070321377712121700145150ustar00rootroot00000000000000

Travis CI Appveyor Codecov Documentation Status

# gau2grid A collocation code for computing gaussians on a grid of the form: ``` out_Lp = x^l y^m z^n \sum_i coeff_i e^(exponent_i * (|center - p|)^2) ``` Where the returned matrix dimension are the angular momentum (L) by number of requested points (p). ```python import gau2grid import numpy as np # Build coordinates along the Z axis >>> xyz = np.zeros((3, 5)) >>> xyz[2] = np.arange(5) # Compute a 's' gaussian with a scaling and exponent of one at the origin >>> ret = gau2grid.collocation(xyz, 0, [1], [1], [0, 0, 0]) >>> print(ret["PHI"]) [[ 1.00000e+00 3.67879e-01 1.83156e-02 1.23409e-04 1.12535e-07]] # Compute a 'p' gaussian with a scaling and exponent of one at the origin >>> ret = gau2grid.collocation(xyz, 1, [1], [1], [0, 0, 0], spherical=False) >>> print(ret["PHI"]) [[ 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00] [ 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00] [ 0.00000e+00 3.67879e-01 3.66312e-02 3.70229e-04 4.50140e-07]] # Note that the X and Y components are zero as they are orthogonal to our Z vector. ``` The returned matrix can be in either cartesian or regular solid harmonics. There are currently three algorithms in which to compute these collocation matrices: - Optimize C: A autogenerated C library that optimizes for cache, vectorization, and sparsity. Fastest, requires compilation, found at `gau2grid.collocation`. - Optimized/Generated NumPy: A exploratory tool to examine the sparsity in the gaussians. No compilation required, found at `gau2grid.np_gen.collocation`. - NumPy Reference: A simple NumPy-based loop code. No compilation required, found at `gau2grid.ref.collocation`. See the [documentation](https://gau2grid.readthedocs.io/en/latest/?badge=latest) for more information! ## Building Gau2Grid The C library is built with CMake and has C no required dependancies other than the standard library. A CMake and build example can found below: ```bash cmake -H. -Bobjdir cd objdir; make -j2 ``` Several common CMake options are as follow: - `-DPYTHON_EXECUTABLE` - Path to the desired Python executable - `-DMAX_AM` - Maximum angular momentum to compile to, default 6 - `-DCMAKE_INSTALL_PREFIX` - Installation directory ## Python installation The gau2grid program (without the optimized C library) can be installed using the canonical `setup.py` script, ``` python setup.py install ``` # Authors This code was inspired by a number of folks and quite a few provided excellent advice. - Daniel G. A. Smith - Code author - Rob M. Parrish - Author of the Psi4 section which contains the original equations - Lori A. Burns - CMake, building, and library linking - Andy C. Simmonett - RSH coefficients - Ben Pritchard - Generator and vectorization recommendations gau2grid-2.0.7/appveyor.yml000066400000000000000000000015741377712121700156330ustar00rootroot00000000000000image: Visual Studio 2017 clone_depth: 5 install: - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - C:\Miniconda36-x64\Scripts\activate base - conda install --yes numpy pytest - conda list before_build: - set SOURCE_FOLDER=%APPVEYOR_BUILD_FOLDER% - set BUILD_FOLDER=%SOURCE_FOLDER%\build - set INSTALL_FOLDER=%SOURCE_FOLDER%\install - mkdir %BUILD_FOLDER% & cd %BUILD_FOLDER% - cmake -A x64 -DCMAKE_C_FLAGS="/wd4018 /wd4101 /wd4996" -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=true -DCMAKE_INSTALL_PREFIX=%INSTALL_FOLDER% -DINSTALL_PYMOD=ON .. build_script: - cmake --build . after_build: - cmake --build . --target install before_test: - cd .. - set PYTHONPATH=%INSTALL_FOLDER%\lib test_script: - set GAU2GRID_FORCE_C_TEST=1 - pytest -rws -v %INSTALL_FOLDER% gau2grid-2.0.7/cmake/000077500000000000000000000000001377712121700143145ustar00rootroot00000000000000gau2grid-2.0.7/cmake/FindPythonLibsNew.cmake000066400000000000000000000174761377712121700207030ustar00rootroot00000000000000# - Find python libraries # This module finds the libraries corresponding to the Python interpeter # FindPythonInterp provides. # This code sets the following variables: # # PYTHONLIBS_FOUND - have the Python libs been found # PYTHON_PREFIX - path to the Python installation # PYTHON_LIBRARIES - path to the python library # PYTHON_INCLUDE_DIRS - path to where Python.h is found # PYTHON_MODULE_EXTENSION - lib extension, e.g. '.so' or '.pyd' # PYTHON_MODULE_PREFIX - lib name prefix: usually an empty string # PYTHON_SITE_PACKAGES - path to installation site-packages # PYTHON_IS_DEBUG - whether the Python interpreter is a debug build # # Thanks to talljimbo for the patch adding the 'LDVERSION' config # variable usage. #============================================================================= # Copyright 2001-2009 Kitware, Inc. # Copyright 2012 Continuum Analytics, Inc. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # * Neither the names of Kitware, Inc., the Insight Software Consortium, # nor the names of their contributors may be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= if(PYTHONLIBS_FOUND) return() endif() # Use the Python interpreter to find the libs. if(PythonLibsNew_FIND_REQUIRED) find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED) else() find_package(PythonInterp ${PythonLibsNew_FIND_VERSION}) endif() if(NOT PYTHONINTERP_FOUND) set(PYTHONLIBS_FOUND FALSE) return() endif() # According to http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter # testing whether sys has the gettotalrefcount function is a reliable, cross-platform # way to detect a CPython debug interpreter. # # The library suffix is from the config var LDVERSION sometimes, otherwise # VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows. execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "from distutils import sysconfig as s;import sys;import struct; print('.'.join(str(v) for v in sys.version_info)); print(sys.prefix); print(s.get_python_inc(plat_specific=True)); print(s.get_python_lib(plat_specific=True)); print(s.get_config_var('SO')); print(hasattr(sys, 'gettotalrefcount')+0); print(struct.calcsize('@P')); print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION')); print(s.get_config_var('LIBDIR') or ''); print(s.get_config_var('MULTIARCH') or ''); " RESULT_VARIABLE _PYTHON_SUCCESS OUTPUT_VARIABLE _PYTHON_VALUES ERROR_VARIABLE _PYTHON_ERROR_VALUE) if(NOT _PYTHON_SUCCESS MATCHES 0) if(PythonLibsNew_FIND_REQUIRED) message(FATAL_ERROR "Python config failure:\n${_PYTHON_ERROR_VALUE}") endif() set(PYTHONLIBS_FOUND FALSE) return() endif() # Convert the process output into a list string(REGEX REPLACE ";" "\\\\;" _PYTHON_VALUES ${_PYTHON_VALUES}) string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES}) list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST) list(GET _PYTHON_VALUES 1 PYTHON_PREFIX) list(GET _PYTHON_VALUES 2 PYTHON_INCLUDE_DIR) list(GET _PYTHON_VALUES 3 PYTHON_SITE_PACKAGES) list(GET _PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION) list(GET _PYTHON_VALUES 5 PYTHON_IS_DEBUG) list(GET _PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P) list(GET _PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX) list(GET _PYTHON_VALUES 8 PYTHON_LIBDIR) list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH) # Make sure the Python has the same pointer-size as the chosen compiler # Skip if CMAKE_SIZEOF_VOID_P is not defined if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")) if(PythonLibsNew_FIND_REQUIRED) math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") message(FATAL_ERROR "Python config failure: Python is ${_PYTHON_BITS}-bit, " "chosen compiler is ${_CMAKE_BITS}-bit") endif() set(PYTHONLIBS_FOUND FALSE) return() endif() # The built-in FindPython didn't always give the version numbers string(REGEX REPLACE "\\." ";" _PYTHON_VERSION_LIST ${_PYTHON_VERSION_LIST}) list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR) list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR) list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH) # Make sure all directory separators are '/' string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX ${PYTHON_PREFIX}) string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES}) if(CMAKE_HOST_WIN32) set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") # when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the # original python installation. They may be found relative to PYTHON_INCLUDE_DIR. if(NOT EXISTS "${PYTHON_LIBRARY}") get_filename_component(_PYTHON_ROOT ${PYTHON_INCLUDE_DIR} DIRECTORY) set(PYTHON_LIBRARY "${_PYTHON_ROOT}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") endif() # raise an error if the python libs are still not found. if(NOT EXISTS "${PYTHON_LIBRARY}") message(FATAL_ERROR "Python libraries not found") endif() else() if(PYTHON_MULTIARCH) set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}/${PYTHON_MULTIARCH}" "${PYTHON_LIBDIR}") else() set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}") endif() #message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}") # Probably this needs to be more involved. It would be nice if the config # information the python interpreter itself gave us were more complete. find_library(PYTHON_LIBRARY NAMES "python${PYTHON_LIBRARY_SUFFIX}" PATHS ${_PYTHON_LIBS_SEARCH} NO_DEFAULT_PATH) # If all else fails, just set the name/version and let the linker figure out the path. if(NOT PYTHON_LIBRARY) set(PYTHON_LIBRARY python${PYTHON_LIBRARY_SUFFIX}) endif() endif() MARK_AS_ADVANCED( PYTHON_LIBRARY PYTHON_INCLUDE_DIR ) # We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the # cache entries because they are meant to specify the location of a single # library. We now set the variables listed by the documentation for this # module. SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARY}" "${PYTHON_EXECUTABLE}${PYTHON_VERSION}") set(PYTHONLIBS_FOUND TRUE) gau2grid-2.0.7/cmake/FindStandardMathLibraryC.cmake000066400000000000000000000046221377712121700221250ustar00rootroot00000000000000# * downloaded Nov 2016 from https://android.googlesource.com/platform/external/eigen/+/master/cmake/FindStandardMathLibrary.cmake # * changed CXX to C # * note that full path to libm *not* detected # - Try to find how to link to the standard math library, if anything at all is needed to do. # On most platforms this is automatic, but for example it's not automatic on QNX. # # Once done this will define # # STANDARD_MATH_LIBRARY_FOUND - we found how to successfully link to the standard math library # STANDARD_MATH_LIBRARY - the name of the standard library that one has to link to. # -- this will be left empty if it's automatic (most platforms). # -- this will be set to "m" on platforms where one must explicitly # pass the "-lm" linker flag. # # Copyright (c) 2010 Benoit Jacob # Redistribution and use is allowed according to the terms of the 2-clause BSD license. include(CheckCSourceCompiles) # a little test program for c++ math functions. # notice the std:: is required on some platforms such as QNX set(find_standard_math_library_test_program "#include int main() { sin(0.0); log(0.0f); }") # C++ test program # "#include # int main() { std::sin(0.0); std::log(0.0f); }") # first try compiling/linking the test program without any linker flags set(CMAKE_REQUIRED_FLAGS "") set(CMAKE_REQUIRED_LIBRARIES "") CHECK_C_SOURCE_COMPILES( "${find_standard_math_library_test_program}" standard_math_library_linked_to_automatically ) if(standard_math_library_linked_to_automatically) # the test program linked successfully without any linker flag. set(STANDARD_MATH_LIBRARY "") set(STANDARD_MATH_LIBRARY_FOUND TRUE) else() # the test program did not link successfully without any linker flag. # This is a very uncommon case that so far we only saw on QNX. The next try is the # standard name 'm' for the standard math library. set(CMAKE_REQUIRED_LIBRARIES "m") CHECK_C_SOURCE_COMPILES( "${find_standard_math_library_test_program}" standard_math_library_linked_to_as_m) if(standard_math_library_linked_to_as_m) # the test program linked successfully when linking to the 'm' library set(STANDARD_MATH_LIBRARY "m") set(STANDARD_MATH_LIBRARY_FOUND TRUE) else() # the test program still doesn't link successfully set(STANDARD_MATH_LIBRARY_FOUND FALSE) endif() endif() gau2grid-2.0.7/cmake/autocmake_safeguards.cmake000066400000000000000000000017071377712121700215000ustar00rootroot00000000000000# Downloaded from # https://github.com/coderefinery/autocmake/blob/master/modules/safeguards.cmake # * changed text of in-source message #.rst: # # Provides safeguards against in-source builds and bad build types. # # Variables used:: # # PROJECT_SOURCE_DIR # PROJECT_BINARY_DIR # CMAKE_BUILD_TYPE if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR}) message(FATAL_ERROR "In-source builds not allowed. Please run CMake from top directory and specify a build directory (e.g., cmake -H. -Bbuild).") endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower) string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper) if(NOT cmake_build_type_tolower STREQUAL "debug" AND NOT cmake_build_type_tolower STREQUAL "release" AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") endif() gau2grid-2.0.7/cmake/custom_color_messages.cmake000066400000000000000000000025241377712121700217200ustar00rootroot00000000000000# http://stackoverflow.com/a/19578320 if(NOT WIN32) string(ASCII 27 Esc) set(ColourReset "${Esc}[m") set(ColourBold "${Esc}[1m") set(Red "${Esc}[31m") set(Green "${Esc}[32m") set(Yellow "${Esc}[33m") set(Blue "${Esc}[34m") set(Magenta "${Esc}[35m") set(Cyan "${Esc}[36m") set(White "${Esc}[37m") set(BoldRed "${Esc}[1;31m") set(BoldGreen "${Esc}[1;32m") set(BoldYellow "${Esc}[1;33m") set(BoldBlue "${Esc}[1;34m") set(BoldMagenta "${Esc}[1;35m") set(BoldCyan "${Esc}[1;36m") set(BoldWhite "${Esc}[1;37m") endif() #message("This is normal") #message("${Red}This is Red${ColourReset}") #message("${Green}This is Green${ColourReset}") #message("${Yellow}This is Yellow${ColourReset}") #message("${Blue}This is Blue${ColourReset}") #message("${Magenta}This is Magenta${ColourReset}") #message("${Cyan}This is Cyan${ColourReset}") #message("${White}This is White${ColourReset}") #message("${BoldRed}This is BoldRed${ColourReset}") #message("${BoldGreen}This is BoldGreen${ColourReset}") #message("${BoldYellow}This is BoldYellow${ColourReset}") #message("${BoldBlue}This is BoldBlue${ColourReset}") #message("${BoldMagenta}This is BoldMagenta${ColourReset}") #message("${BoldCyan}This is BoldCyan${ColourReset}") #message("${BoldWhite}This is BoldWhite\n\n${ColourReset}") gau2grid-2.0.7/cmake/custom_static_library.cmake000066400000000000000000000037431377712121700217320ustar00rootroot00000000000000# Downloaded from # https://github.com/PCMSolver/pcmsolver/blob/release/1.Y/cmake/custom/static_library.cmake # * suppressed STATIC_LIBRARY_ONLY # * moved option up # * corrected CXX block matches statements from C --> CXX compiler #.rst: # # Enables creation of static library. # If the shared library is created, make it as static as possible. # # Variables modified (provided the corresponding language is enabled):: # # CMAKE_Fortran_FLAGS # CMAKE_C_FLAGS # CMAKE_CXX_FLAGS # # autocmake.cfg configuration:: # # docopt: --static Create only the static library [default: False]. # define: '-DSTATIC_LIBRARY_ONLY=%s' % arguments['--static'] if(ENABLE_GENERIC) if(DEFINED CMAKE_Fortran_COMPILER_ID) if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-libgfortran") endif() if(CMAKE_Fortran_COMPILER_ID MATCHES Intel) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-libgcc -static-intel") endif() endif() if(DEFINED CMAKE_C_COMPILER_ID) if(CMAKE_C_COMPILER_ID MATCHES GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -fpic") endif() if(CMAKE_C_COMPILER_ID MATCHES Intel) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static-intel -wd10237") endif() if(CMAKE_C_COMPILER_ID MATCHES Clang) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic") endif() endif() if(DEFINED CMAKE_CXX_COMPILER_ID) if(CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc") endif() if(CMAKE_CXX_COMPILER_ID MATCHES Intel) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed -static-libstdc++ -static-libgcc -static-intel -wd10237") endif() if(CMAKE_CXX_COMPILER_ID MATCHES Clang) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++") endif() endif() endif() gau2grid-2.0.7/cmake/gau2gridConfig.cmake.in000066400000000000000000000045721377712121700205650ustar00rootroot00000000000000# gau2gridConfig.cmake # -------------------- # # GAU2GRID cmake module. # This module sets the following variables in your project:: # # gau2grid_FOUND - true if gau2grid and all required components found on the system # gau2grid_VERSION - gau2grid version in format Major.Minor.Release # gau2grid_INCLUDE_DIRS - Directory where gau2grid header is located. # gau2grid_INCLUDE_DIR - same as DIRS # gau2grid_LIBRARIES - gau2grid library to link against. # gau2grid_LIBRARY - same as LIBRARIES # # # Available components: # # shared - search for only shared library # static - search for only static library # # # Exported targets:: # # If gau2grid is found, this module defines the following :prop_tgt:`IMPORTED` # target. Target is shared _or_ static, so, for both, use separate, not # overlapping, installations. :: # # gau2grid::gg - the main gau2grid library with header attached. # # # Suggested usage:: # # find_package(gau2grid) # find_package(gau2grid 1.0.1 EXACT CONFIG REQUIRED) # # # The following variables can be set to guide the search for this package:: # # gau2grid_DIR - CMake variable, set to directory containing this Config file # CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package ## PATH - environment variable, set to bin directory of this package # CMAKE_DISABLE_FIND_PACKAGE_gau2grid - CMake variable, disables # find_package(gau2grid) when not REQUIRED, perhaps to force internal build @PACKAGE_INIT@ set(PN gau2grid) if(@BUILD_SHARED_LIBS@) set(${PN}_shared_FOUND 1) else() set(${PN}_static_FOUND 1) endif() check_required_components(${PN}) #----------------------------------------------------------------------------- # Don't include targets if this file is being picked up by another # project which has already built this as a subproject #----------------------------------------------------------------------------- if(NOT TARGET ${PN}::gg) include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake") get_property(_loc TARGET ${PN}::gg PROPERTY LOCATION) set(${PN}_LIBRARY ${_loc}) get_property(_ill TARGET ${PN}::gg PROPERTY INTERFACE_LINK_LIBRARIES) set(${PN}_LIBRARIES ${_ill}) get_property(_id TARGET ${PN}::gg PROPERTY INCLUDE_DIRECTORIES) set(${PN}_INCLUDE_DIR ${_id}) get_property(_iid TARGET ${PN}::gg PROPERTY INTERFACE_INCLUDE_DIRECTORIES) set(${PN}_INCLUDE_DIRS ${_iid}) endif() gau2grid-2.0.7/cmake/psi4OptionsTools.cmake000066400000000000000000000203631377712121700205760ustar00rootroot00000000000000###This file contains functions used throughout the Psi4 build. Like source ###code, the build system should be factored and common code extracted out into ###functions/macros. If you find repetitive code throughout the build scripts ###this is the place to add it (make sure you document it too). #Macro for printing an option in a consistent manner # #Syntax: print_option(