Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.8%) to scientific vocabulary
Repository
Reflection tools based on clang
Basic Info
- Host: GitHub
- Owner: TRIQS
- License: apache-2.0
- Language: Python
- Default Branch: 3.3.x
- Size: 554 KB
Statistics
- Stars: 25
- Watchers: 12
- Forks: 14
- Open Issues: 23
- Releases: 3
Metadata Files
README.md
Cpp2Py is the Python-C++ interfacing tool of the TRIQS project, provided here as a standalone project.
Installation
To install Cpp2Py, follow the installation steps:
bash
git clone https://github.com/TRIQS/cpp2py.git cpp2py
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=INSTALL_DIR ../cpp2py
make && make install
This installs the library in INSTALL_DIR.
In order to make Cpp2Py available in your current environment you should run
bash
source INSTALL_DIR/share/cpp2pyvars.sh
Example
Make sure that you have loaded Cpp2Py into your environment as instructed above.
Created a C++ source file mymodule.hpp in a folder SRC:
```c++ ///A wonderful little class class myclass{ int a, b;
public: myclass(int a, int b) : a(a), b(b) {}
///getter for member a
int get_a() const { return a;}
}; ```
In the same folder, create a file CMakeLists.txt:
```cmake cmakeminimumrequired(VERSION 3.0.2) find_package(Cpp2Py REQUIRED)
addcpp2pymodule(mymodule) targetcompileoptions(mymodule PRIVATE -std=c++17) targetincludedirectories(mymodule PRIVATE ${CMAKECURRENTSOURCE_DIR}) ```
Then, in the SRC folder, issue the command
c++2py mymodule.hpp
This creates a file mymodule_desc.py.
Exit the SRC folder and create a BUILD folder. Then, issue the following commands:
bash
cd BUILD
cmake ../SRC
make
In the BUILD dir, you should see a mymodule.so file. You can now use your c++ class in Python:
python
import mymodule
A = mymodule.Myclass(4,5)
print(A.get_a())
By convention, c++ classes of the type my_little_class are converted in python classes of the type MyLittleClass.
License
Before you proceed, make sure you have read the LICENSE.txt file.
Enjoy!
The TRIQS team
Owner
- Name: TRIQS
- Login: TRIQS
- Kind: organization
- Website: https://triqs.github.io
- Repositories: 31
- Profile: https://github.com/TRIQS
Software Platform for Research on Interacting Quantum Systems
Citation (CITATIONS.bib)
TRIQS/Cpp2Py is a part of our scientific work and we would appreciate if projects
using it will include a citation to the TRIQS paper, where the tool was first introduced.
In order to help you, we provide theBibTeX reference.
@article{triqs,
title = "TRIQS: A toolbox for research on interacting quantum systems",
journal = "Computer Physics Communications",
volume = "196",
number = "",
pages = "398 - 415",
year = "2015",
note = "",
issn = "0010-4655",
doi = "http://dx.doi.org/10.1016/j.cpc.2015.04.023",
url = "http://www.sciencedirect.com/science/article/pii/S0010465515001666",
author = "Olivier Parcollet and Michel Ferrero and Thomas Ayral and Hartmut Hafermann and Igor Krivenko and Laura Messio and Priyanka Seth",
keywords = "Many-body physics",
keywords = "Strongly-correlated systems",
keywords = "DMFT",
keywords = "Monte Carlo",
keywords = "ab initio calculations",
keywords = "C++",
keywords = "Python"
}
GitHub Events
Total
- Issues event: 1
- Watch event: 3
- Issue comment event: 1
- Push event: 2
Last Year
- Issues event: 1
- Watch event: 3
- Issue comment event: 1
- Push event: 2