3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 19:53:45 +01:00
Commit Graph

83 Commits

Author SHA1 Message Date
Priyanka Seth
c61b8941ee More prettification: can not --> cannot 2014-07-16 23:30:05 +02:00
Michel Ferrero
f6da304234 Add indicesR/L to gf_desc 2014-07-10 11:56:05 +02:00
Olivier Parcollet
a6e1528730 hdfarchive + gf : two corrections
- hdfarchive : transform the key to string with str
  because they can be unicode and C wrapper does not convert python unicode strings.
- gf : Correct the scheme for BlockGf : not very clean, to be improved ?
2014-07-08 23:38:00 +02:00
Olivier Parcollet
ab3b9b3d4d Draft libclang based python wrapper desc generator
- Given a C++ file, e.g. a class,
  it calls libclang to parse the C++, and retrieve from
  its AST the necessary info to write a xxx_desc.py file.

- THIS IS WORK IN PROGRESS. There are several corner cases for which we
  may want (or not) the script to do better.
- It is not designed to be used automatically, but to to 90 % of the
  boring typesetting work...
- The preamble still needs manual choices

- The properties, methods, functions are automatically declared in
  the _desc file, in the simplest possible way.
- An option --properties, -p : to transform some simple methods or
  get_x, set_x into python properties, not methods.
  Cf doc.

- requires clang (tested on 3.4).
- the script is configured by cmake and installed in
  INSTALLATION_DIRECTORY/bin, with some other files.
  It can only be used for applications, after the lib has been installed.
  It is cmake configured, to include automatically the various include
  paths configure in the triqs installation, including the triqs install dir
  in order to simplify invocation.

- TODO : improve, and test more in real cases.
2014-07-08 23:37:59 +02:00
Olivier Parcollet
eeba763171 Fix #101 operator: add python wrapper for is_zero
- added is_zero in python
- reorder a bit (module defined first), but that is cosmetics
2014-07-03 19:23:32 +02:00
Olivier Parcollet
fcfcce8d61 Cmake. Fix #97 and #89
- C++14 mode not automatic. Was based on compiler version,
  but the version of the C++ lib also matters....
  Now, there is an explicit USE_CPP14 option [default =OFF]
  to set to compile in c++1y mode.
  Solve also #89, i.e. the flags is now in TRIQS_CXX_DEFINITIONS and
  therefore pass to applications (including ipython magic).

- Python_use_mpi4py is now ON by default.
  Rational : it has been used for a while by e.g. Thomas,
  and it is necessary on OS X (boost.mpi.python raises a lot of issues).
  Hence we put it as default.

- Rename the option Build_Triqs_General_Tools_Test to a simpler
  Build_Tests
2014-07-02 21:44:51 +02:00
Olivier Parcollet
3b2372c437 python wrapper. Pre/postcall can now be inlined
- Add the possibility to give a function "on the fly"
  for the precall and postcall of a python wrapped functoin.
- No change for previous code, it is a simple new feature.
- changed test accordingly. See my_module_desc.py for an example.
2014-07-02 16:48:15 +02:00
Olivier Parcollet
76798cf6a2 wrap generator : minor correction
- setter was not working in general.
  name variable error.
2014-06-23 17:08:13 +02:00
Olivier Parcollet
4af1afbdaf hdf5 : clean up
- For users : only change is :
   H5::H5File in apps. to be replaced by triqs::h5::file, same API.

- using only the C API because :
   - it is cleaner, better documented, more examples.
   - it is the native hdf5 interface.
   - simplify the installation e.g. on mac. Indeed, hdf5 is
     usually installed without C++ interface, which is optional.
     E.g. EPD et al., brew by default.
     Also the infamous mpi+ hdf5_cpp bug, for which we have no clean solution.

- clean the notion of parent of a group. Not needed, better iterate function in C LT API.
- modified doc : no need for C++ bindings any more.
- modified cmake to avoid requiring CPP bindings.
2014-06-22 13:57:47 +02:00
Olivier Parcollet
842274003f Fix import array in extensions.
- import arrays in extensions (mako file).
- put import_arrays in converter,
  along the lines of our own objects (numpy and triqs uses
  the same capsule technique, i.e. the standard technique from python
  doc.)
2014-06-12 17:27:48 +02:00
Olivier Parcollet
f1c32012a6 magic : redirect std::cout to python sys.out.write
- for all functions, except when GIL option (not implemented) is here
  we use a triqs::py_stream, which redirect the stream
  to python sys.write
- so that a simple C++ code with a std::cout
  print its output in the notebook...
- NB : it only works for the code within the cell.
  If it calls another function on the lib which uses cout,
  print is not redirected.
  Designed for simple tests....
- cerr not (yet) redirected. (useful ?).
2014-06-11 16:25:47 +02:00
Michel Ferrero
31d8120b64 Add missing file in installation of gf 2014-06-05 14:07:44 +02:00
Michel Ferrero
3eb9b16a57 Add number operator in operator class 2014-06-05 14:07:15 +02:00
Michel Ferrero
6295d563ae Add absolute c_type in many_body_operator desc 2014-06-03 15:09:07 +02:00
Michel Ferrero
8c75aa6373 Small fix in wrap_generator 2014-06-03 15:08:24 +02:00
Olivier Parcollet
d29be978e9 magic : correct for linux
- compiler path, etc...
2014-06-02 11:04:17 +02:00
Olivier Parcollet
28a12c7b2f ipython triqs magic v1
- first version of triqs magic for the notebook
- add add_preamble to the wrap_generator.
2014-06-01 21:00:07 +02:00
Olivier Parcollet
3fe400d34c doc : split c++ code from rst
- examples split from the rst file using a python script (split_code).
- Final result for the doc is unchanged.
- examples are compiled and tested with the other tests.
- examples' code have been clang-formatted, with triqs style.
- doc compiles much faster, and with the same options as the rest of the
  test.
- examples are added as tests, so they are run by make test, as simple C
  tests.
- done for the tutorials and the reference.
- autocompile removed (changed into triqs_example directive).
- add triqs_example :
   - make a literal include of the source code.
   - runs the compiled example
   - add, as before, the result to the source code in the doc.
- added the script split_code, used to make the changes automatically,
  maybe for later reuse. (in _tools)
2014-05-31 23:00:16 +02:00
Olivier Parcollet
4f51c1e043 Correction.
- forgot the doc file.
- minor correction for wrapping application
2014-05-31 18:51:50 +02:00
Olivier Parcollet
4e9460bc1c Wrapper : clean and document.
- clean the c_name.
- add more refined signature (with c_name optionally in it).
- add some autodoc.
- clean code : move class in nested, remove useless dict call, etc...
- operator2 : move unary - and unit in algebra in general wrapper.
- various name change to make private function start with _, for
  autodoc.
2014-05-31 16:10:07 +02:00
Olivier Parcollet
2abf36a2ff move wrap_test to test/pytriqs 2014-05-30 23:08:32 +02:00
Olivier Parcollet
446f817111 wrapper: add release_GIL_and_enable_signal option.
- Add to the wrapper generator (add_method) the release_GIL_and_enable_signal option which :

   - release the GIL
   - save the python signal handler
   - enable the C++ triqs signal handler instead.
   - undo all of this after the code runs, or in a case of exception.
   - used python include, ceval.h, line 72 comments and below.

- reworked the triqs::signal_handler.
  simple C like function, no object (no need).
  start, stop, received, cf header file.

- clean the call_back.cpp : only place using the signal directly
  (qmc uses the callback).
  in particular, remove the old BOOST CHRONO, since
  the std::chrono works fine on platforms we use now.
2014-05-30 21:09:18 +02:00
Olivier Parcollet
243d4a798b wrapper: add use_module
- a module can use the converters used by another
  with the use_module('A') command.
  In which case :
    - the generate converter header for A will be included.
    - the header, at the top, now contains a simple list of all
      wrapped types, which is then included in the wrapped_types
      of the module for proper code generation.
- simplify the code generation : just generate_code.
- all arguments are analyzed from sys.argv at the import of the
  wrap_generator module. In any case, the xx_desc.py will be called from the corresponding
  cmake command, hence with the right arguments.
- Added a dependencies in my_module_B of wrap_test to show how to make
  the dependencies in the cmake file, if needed.
2014-05-30 19:34:13 +02:00
Olivier Parcollet
31927c9132 wrapper : remove the need of default constructor
- change the constructor wrapper.
- in the new method, leave the pointer _c to NULL.
- in the init, allocate it.
- It seems ok to leave the object in this non initialized state,
  but that is not so clear from the doc.
  Added check for this pointer == NULL in converters.
2014-05-30 19:34:13 +02:00
Olivier Parcollet
2d071bb74b Remove Cython & prepare wrapper for applis.
- removed cython : macro, detection, pxd, etc...
- adapt wrapper tools for external applis.
- cleaned doc for cython
2014-05-30 19:34:13 +02:00
Olivier Parcollet
a920697e78 fixes in wrap_generator, parameters, h5 for strings
- string size in h5. Add +1 (or empty string is wrong).
- parameters : modified flags from python
- minor corrections in wrapper
2014-05-30 14:16:15 +02:00
Olivier Parcollet
3036fe6529 wrapper : correct namespace in enum in converters
- the absolute path was missing for the value of the enum.
2014-05-30 14:16:15 +02:00
Olivier Parcollet
ad45adbadd wrapper: add static methods
- is_static= True to wrap a static method.
2014-05-30 13:03:51 +02:00
Olivier Parcollet
e6529b608e Change implementation of random_generator & python wrapper.
- Use a new buffered_function to replace the complicated generator code from ALPS.
- Clean the implementation of the random_generator
- update the documentation
- update to the new python wrapper (could not be done with the previous
  version, because of lack of move constructor).
2014-05-29 22:25:22 +02:00
Olivier Parcollet
2b5dd322ce lattice : python wrapper 2014-05-29 22:25:22 +02:00
Olivier Parcollet
22f9576834 Finish gf wrapping
- clean old.
- clean gf_desc.py
2014-05-29 21:39:36 +02:00
Michel Ferrero
3be8e65ae7 Fix operator generator to have converter header 2014-05-24 01:00:16 +02:00
Michel Ferrero
76aa6120e9 Add new python operators
For now they are called operators2.
2014-05-22 23:58:07 +02:00
Michel Ferrero
df09891219 Add unary operators in python wrapper
This is useful to add unary operators to the number_protocol.
2014-05-22 23:58:07 +02:00
Olivier Parcollet
6934692327 add converter for scalar_valued gf
- converted as 1x1 matrix view.
- add a small test
2014-05-22 23:42:51 +02:00
Olivier Parcollet
16057c7a4e forgot one file 2014-05-22 21:08:08 +02:00
Olivier Parcollet
f2136f7b80 gf. wrap legendre. 2014-05-22 17:56:42 +02:00
Olivier Parcollet
cfe3532c94 array & gf transpose
- implement transposed_view for arrays.
- .transpose method for gf
- wrapped to python
- add call op. for GfImTime, using C++
- Added ChangeLog
- rm matrix_stack
- start cleaning old code
2014-05-22 16:08:23 +02:00
Olivier Parcollet
5c8270c437 gf_block converter 2014-05-21 23:01:52 +02:00
Olivier Parcollet
27af80c04e Serialization boost/h5 and clean parameters
- parameters : clean, add back serialization. Clean whitespace

- serialization : depending on the version of the hdf5 lib,
  uses h5 or boost.

- TODO : test it on a machine with new hdf5.
2014-05-21 14:35:26 +02:00
Olivier Parcollet
8c0bf592d0 Fix compilation of py_converter.
- py_converters in hpp files
- add guard to prevent inclusion in the wrapper (to avoid 2
  specialisation of the same py_converter).
2014-05-20 22:24:30 +02:00
Olivier Parcollet
dd91c51647 wrapper.
Correction converter specialization
(avoid redeclaration).
2014-05-19 22:18:17 +02:00
Olivier Parcollet
914901864a wrapper. Correction
- clean the call to py_converter.
- add a & in the generic function py2c (to be specialized later).
2014-05-19 21:58:33 +02:00
Olivier Parcollet
af084f5d59 parameters & wrapper
- new parameter class :
  parameters are viewed as form, built in C++, and filled in C++/python.
  Each field of the form as a precise C++ type (erased using standard techniques).
  First tests ok, to be reread/checked.

  TODO : serialization is commented. Lead to long compilation time & large code
  due to boost::serialization. Use h5 when possible.

- wrapper :
  - separated the converters of the wrapped type in the TRIQS library
  - necessary for parameters (it used outside an .so) and potentially
    other codes, outside an .so module
2014-05-19 15:19:18 +02:00
Olivier Parcollet
a9bcc33c7e minor correction for linux
- vector on C++14 has explicit default (until C++14 apparently)
  it is a small difference between libc++ and gnu libstdC++
2014-05-11 21:57:18 +02:00
Olivier Parcollet
3a31077d51 gf : new wrapper 2014-05-11 21:47:52 +02:00
Olivier Parcollet
5105e04ac7 Add new wrapper generator
- with pytriqs.wrap_test as an example.
2014-05-11 21:47:46 +02:00
tayral
3aa380ba9d Fixed abs bug in bravais_lattice + added method
When constructing the last unit vector in 2D, the sanity check was wrong because of usage of abs instead of std::abs.

Added method energy_on_bz_path_2 that returns the energy *matrix* at each k point on a given path instead of the eigenvalues of this matrix. The name of the function should be changed (to energy_matrix_on_bz_path?)

Renaming energies_on_bz_path_2 to energy_matrix_on_bz_path
2014-05-08 12:09:58 +01:00
tayral
91dc34a869 Added accessor positive only to MeshImFreq 2014-05-08 12:04:54 +01:00
Olivier Parcollet
22ef7ac015 gf. add __call__(double) to gf_imtime, wrapped from C++ evaluator 2014-04-02 11:15:24 +02:00