Git Product home page Git Product logo

cellcutoff's Introduction

https://travis-ci.com/theochem/cellcutoff.svg?branch=master

CellCutoff is a library for periodic boundary conditions and real-space cutoff calculations.

Installation

When you are interested in using cellcutoff (without needing to modify it), you can install cellcutoff with conda. After installing and activating a miniconda environment, run:

conda install -c theochem cellcutoff python-cellcutoff

If you are interesed in working on the development of cellcutoff, you first need to check out the latest version from the git repository

git clone [email protected]:theochem/cellcutoff.git
cd cellcutoff

Then install Roberto and run it in the root of the repository:

pip install --user --upgrade 'roberto<2.0.0'
rob quality

This will build cellcutoff in-place and run all tests. More details for potential contributors are given in CONTRIBUTING.rst.

cellcutoff's People

Contributors

theochem-ci-bot avatar tovrstra avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

farnazh tovrstra

cellcutoff's Issues

conda cmake

Not sure if it's really worth it here (maybe for consistency's sake) but we need the cmake from conda if we want to be able find_library to work with conda packages.

I'm not sure if there's simply a way to add the conda paths to the existing cmake and gcc instead of having to use the versions packaged in Conda?

(on the other hand, it'll give us some build/run consistency...)

Building of conda packages breaks on OSX

Somehow the -isystem option is not used when compiling cellcutoff (the cpp part) during the conda package build. The debug build does include this option. It is not clear at this stage why these two builds differ in this way.

Python 3 compatibility

To get this started: make a PR in which tests on Python 3 are enabled on Travis-CI and observe how they break. Then things can be fixed where needed.

Add random unit cell feature

Code to generate random unit cell should become part of public API, now it is only present in the testing code.

OSX builds don't have gcov

Since the OSX builds are using clang now, gcov doesn't work anymore and can't be linked in (the library doesn't even exist on OSX).

We'll have to switch to llvm-cov if we want to have the same functionality. That is done with the compile flag --coverage. The cmake scripts should be updated to reflect this.

clang builds fail

@tovrstra I think there's some code which breaks when compiled with clang (it works fine in GCC). I can reproduce it on an osx box (painful) and I've played around with the build flags as well to no avail. We're going to have this fix this to have successful conda deploys in the future. The recent versions of conda disallows gcc builds on OSX. Also, this is blocking theochem/cgrid#31

I'll paste the error messages here, but you can find the whole thing at the travis log: https://travis-ci.org/theochem/cellcutoff/jobs/300474972. (You can simplify the messages by pasting in gedit and replacing the placeholder_placeholder etc with a dummy.)

Can you take a look at this please? It's beyond my C++ familiarity (and I really should re-familiarize myself, but I don't have time right now =S).

cd /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/build/cellcutoff && /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/x86_64-apple-darwin13.4.0-clang++  -Dcellcutoff_EXPORTS -I/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work  -std=c++11 -Wall -Wconversion -Wextra -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.9 -fPIC   -o CMakeFiles/cellcutoff.dir/decomposition.cpp.o -c /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp

In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:22:
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:61:31: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const int small = 4*(icell[0] < 0) + 2*(icell[1] < 0) + (icell[2] < 0);
                         ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:61:50: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const int small = 4*(icell[0] < 0) + 2*(icell[1] < 0) + (icell[2] < 0);
                                            ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:61:67: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const int small = 4*(icell[0] < 0) + 2*(icell[1] < 0) + (icell[2] < 0);
                                                             ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:62:31: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const size_t x = abs(icell[0]) + (icell[0] >= 0);
                         ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:62:44: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const size_t x = abs(icell[0]) + (icell[0] >= 0);
                                      ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:63:31: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const size_t y = abs(icell[1]) + (icell[1] >= 0);
                         ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:63:44: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const size_t y = abs(icell[1]) + (icell[1] >= 0);
                                      ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:64:31: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const size_t z = abs(icell[2]) + (icell[2] >= 0);
                         ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:64:44: error: type 'const std::array<int, 3>' does not provide a subscript operator
    const size_t z = abs(icell[2]) + (icell[2] >= 0);
                                      ~~~~~^~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:67:71: warning: implicit conversion changes signedness: 'const int' to 'unsigned long' [-Wsign-conversion]
    return (((d0-3)*(d0-2)*(d0-1))/6 + ((d1-2)*(d1-1))/2 + (x-1))*8 + small;
                                                                    ~ ^~~~~
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:121:5: error: implicit instantiation of undefined template 'std::__1::array<int, 3>'
    std::array<int, 3>{icell[0], icell[1], icell[2]},
    ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__tuple:222:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:122:5: error: implicit instantiation of undefined template 'std::__1::array<unsigned long, 2>'
    std::array<size_t, 2>{ibegin, iend});
    ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__tuple:222:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:22:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:27:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/vector:266:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__bit_reference:15:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/algorithm:639:
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/utility:317:9: error: implicit instantiation of undefined template 'std::__1::array<int, 3>'
    _T1 first;
        ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:143:7: note: in instantiation of template class 'std::__1::pair<const std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >' requested here
      _store_in_cell_map(icell_begin, ibegin, ipoint, cell_map);
      ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__tuple:222:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:22:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:27:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/vector:266:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__bit_reference:15:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/algorithm:639:
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/utility:318:9: error: implicit instantiation of undefined template 'std::__1::array<unsigned long, 2>'
    _T2 second;
        ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__tuple:222:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:22:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:27:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/vector:266:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__bit_reference:15:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/algorithm:639:
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/utility:317:9: error: implicit instantiation of undefined template 'std::__1::array<int, 3>'
    _T1 first;
        ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/unordered_map:597:21: note: in instantiation of template class 'std::__1::pair<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >' requested here
    __nc_value_type __nc;
                    ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__hash_table:107:23: note: in instantiation of template class 'std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >' requested here
    __node_value_type __value_;
                      ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__hash_table:1517:69: note: in instantiation of template class 'std::__1::__hash_node<std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, void *>' requested here
        __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__value_));
                                                                    ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__hash_table:1456:5: note: in instantiation of member function 'std::__1::__hash_table<std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, std::__1::__unordered_map_hasher<std::__1::array<int, 3>, std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, cellcutoff::icell_hash, true>, std::__1::__unordered_map_equal<std::__1::array<int, 3>, std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, std::__1::equal_to<std::__1::array<int, 3> >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> > > >::__deallocate_node' requested here
    __deallocate_node(__p1_.first().__next_);
    ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/unordered_map:747:28: note: in instantiation of member function 'std::__1::__hash_table<std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, std::__1::__unordered_map_hasher<std::__1::array<int, 3>, std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, cellcutoff::icell_hash, true>, std::__1::__unordered_map_equal<std::__1::array<int, 3>, std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> >, std::__1::equal_to<std::__1::array<int, 3> >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::array<int, 3>, std::__1::array<unsigned long, 2> > > >::~__hash_table' requested here
class _LIBCPP_TEMPLATE_VIS unordered_map
                           ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__tuple:222:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.cpp:22:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/work/cellcutoff/decomposition.h:27:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/vector:266:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__bit_reference:15:
In file included from /Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/algorithm:639:
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/utility:318:9: error: implicit instantiation of undefined template 'std::__1::array<unsigned long, 2>'
    _T2 second;
        ^
/Users/travis/miniconda/conda-bld/cellcutoff_1510371582680/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/../include/c++/v1/__tuple:222:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^

Builds don't have coverage option

The script in cellcutoff/test/CMakeLists.txt includes a coverage target which calls a script that doesn't exist (tools/coverage_analyze.py). It also introduces a dependency on gcov (I think). I'll remove it for now, but we should come back to it at some point if we want coverage information for the C++ part of the code.

Bug when dealing with nvec < 3

Hi @tovrstra, is this a bug?

cdef np.ndarray[double, ndim=2] vecs = np.zeros((3, 3), float)
memcpy(&vecs[0, 0], self._this.vecs(), sizeof(double)*9);

It always copies nine elements, even if nvec is less than 3. I think this will end up giving garbage data at some point? The constructor allows for vec smaller than (3,3) if you provide one yourself.

check_array_arg('vecs', vecs, (-1, 3))
assert vecs.shape[0] <= 3
nvec = vecs.shape[0]
self._this = new cell.Cell(&vecs[0,0], nvec)

The C++ constructor just copies the data, regardless of what size it is, meaning you can get arrays of less than 9 elements.

std::copy(vecs, vecs + nvec_*3, vecs_);

gitversion.py is messy

It would be cleaner to use gitversion.py only as a script, rather than a python module, which gets executed before cmake or setup.py. The script should just print useful info to stdout, controlled by the command line options:

  1. The bare version number
  2. A Python version.py, also including the git tag from which the version was derived as a comment
  3. A file to be included in CMakeLists.txt, containing a bunch of useful variables with fixed names (GIT_DESCRIBE, GIT_TAG_VERSION, GIT_TAG_SOVERSION, GIT_TAG_VERSION_MAJOR, GIT_TAG_VERSION_MINOR, GIT_TAG_PATCH)

Redirects can be used to get this information into the right file, which keeps gitversion.py simple.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.