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

100 Commits

Author SHA1 Message Date
Olivier Parcollet
41caa7ab91 Fix #139
- Python legacy code :
- Put back for both refreq and imfreq gf
g += matrix
g += complex
g + matrix
g + complex
and same with - operator.

- same impl. for both.
- with python wrapping
2014-10-22 21:19:05 +02:00
Olivier Parcollet
ed6379ce63 [clang tool] add parameter class treatment and h5 generator
wrapper generator: add treatment of parameter class

- methods taking a parameter class are called by **kw
- the dict is passed to the C++
- the converters for the parameters are generated.
2014-10-18 21:20:41 +02:00
Olivier Parcollet
0a1285405c [gfs] Lattice fourier, multivar G, curry, tail
- Add Fourier for lattice.
  - Add regular_bz_mesh, cyclic_lattice, and their FFT.

- rm freq_infty.
- The gf can now be evaluated on a tail_view, which result in composing the tail.
- Fix the following issue :
  g(om_) << g(om_ +1)
  will recompose the tail correctly.
- TODO : TEST THIS NEW FEATURE IN DETAIL.

- Work on singularity for G(x, omega)

 - Separate the factory for singularity from the data factory in gf.
 - overload assign_from_functoin (renamed).
 - Fix singularity_t and co in the gf (const issue).

- Clean tail, add tail_const_view
 - add m_tail for x -> tail on any mesh
 - test curry + fourier works on k
2014-10-18 21:20:35 +02:00
Priyanka Seth
70d4aba545 Determining delta from gf (currently only BlockGf and GfImFreq) 2014-10-17 15:55:03 +02:00
Priyanka Seth
ec32223ea7 Clean up _gf_common.py -- removed duplicated python functions 2014-10-17 10:21:32 +02:00
Hartmut Hafermann
e93adc0b84 [gfs] add << operator for gfs
kept <<= for backward compatibility
TODO: clean doc and examples, possibly add deprecation warning
2014-10-13 17:42:11 +02:00
Michel Ferrero
173a97d07c Fix for issue #134
There was a bug in the transpose of the indices. Added a test.
2014-10-09 12:46:07 +02:00
Priyanka Seth
9be131e8e1 Allow indices in gf_struct/operator names to be strings. 2014-10-07 13:53:18 +02:00
Michel Ferrero
3b59d26a67 Two fixes in tight binding part 2014-10-06 23:18:10 +02:00
Priyanka Seth
71fa498833 API change for tail fitters
python fit_tail, replace_by_tail ==> fit_tail_depr, replace_by_tail_depr
c++ set_tail_from_fit ==> fit_tail
2014-10-01 10:52:32 +02:00
Priyanka Seth
11f17631b5 Added predefined hamiltonians to operators 2014-09-27 01:16:28 +02:00
Michel Ferrero
d73c1cf00c Fix and wrap set_tail_from_fit
The c++ version of the tail fit is wrapped to python. I also changed
slightly the code so that when replace_by_fit is true the data is
changed all the way to the end of the Matsubara axis not only on the
interval where the fit was done.
2014-09-26 12:35:59 +02:00
Olivier Parcollet
7cf7d09c77 Fix #112 and put back g +=/-= matrix for imfreq
- The issue comes from the fact that the default generated
  += and co by the Python API is the one for immutable types, like int.
- Indeed, in python, for an int :
  x=1
  id(x)
  140266967205832
  x+=1
  id(x)
  140266967205808
- For a mutable type, like a gf, it is necessary to
  add explicitly the xxx_inplace_add functions.
- Added :
   - the generation of the inplace_xxx functions
   - a method in class_ in the wrapper generator that
     deduce all += operator from the + operators.
   - this assumes that the +=, ... are defined in C++.
   - The generation of such operators are optional, with option
     with_inplace_operators in the arithmetic flag.
- Also, added the overload g += M and g -= M for
  g : GfImfreq, M a complex matrix.
  Mainly for legacy Python codes.
2014-09-06 19:07:34 +02:00
Olivier Parcollet
be1b9b6f19 python wrapper. No new function if no constructor
- When a type has no python constructor (E.g. parameters)
  do not define the xxx_new function.
- Leads to a better error message when trying to construct
  such an object in python.
- TODO : check there is no issue with serialization ?
2014-07-27 16:27:16 +02:00
Olivier Parcollet
522477eb2d desc generator : minor cleaning
- while porting apps. examples to 1.2
- add build_ipytriqs, etc...
- various details...
2014-07-27 15:38:22 +02:00
Olivier Parcollet
06dbfb71bf correct previous commit after linux test 2014-07-26 18:46:57 +02:00
Olivier Parcollet
6fb71f50c9 desc wrapper generator: small improve, clean
- detect the use module.
- clean the code specific to wrapper generation from clang_parser.
- add support for default arguments for int, double, char.
- TODO : add more complex default arguments
2014-07-26 18:37:20 +02:00
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