2014-05-21 16:35:33 +02:00
|
|
|
from wrap_generator import *
|
|
|
|
|
2014-07-03 19:22:19 +02:00
|
|
|
# The many_body_operators module
|
|
|
|
module = module_(full_name = "pytriqs.operators.operators2", doc = "Doc to be written")
|
|
|
|
module.add_include("<triqs/operators/many_body_operator.hpp>")
|
|
|
|
module.add_include("<triqs/arrays.hpp>")
|
|
|
|
module.add_using("namespace triqs::utility")
|
|
|
|
|
|
|
|
|
2014-05-21 16:35:33 +02:00
|
|
|
# The operator class
|
|
|
|
op = class_(
|
|
|
|
py_type = "Operator",
|
|
|
|
c_type = "many_body_operator<double>",
|
2014-06-03 15:09:07 +02:00
|
|
|
c_type_absolute = "triqs::utility::many_body_operator<double>",
|
2014-05-21 16:35:33 +02:00
|
|
|
is_printable= True,
|
2014-05-31 11:38:40 +02:00
|
|
|
arithmetic = ("algebra","with_unit","with_unary_minus","double")
|
2014-05-21 16:35:33 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
op.add_constructor(signature="()", doc="create zero operator")
|
2014-07-03 19:22:19 +02:00
|
|
|
op.add_method("bool is_zero()", doc = "Boolean : is the operator null ?")
|
2014-05-21 16:35:33 +02:00
|
|
|
|
|
|
|
module.add_class(op)
|
|
|
|
|
2014-05-31 11:38:40 +02:00
|
|
|
# Add various overload of c, c_dag to the module Annihilation & Creation operators
|
2014-06-05 14:07:15 +02:00
|
|
|
for name, doc in [("c","annihilation operator"), ("c_dag","creation operator"), ("n","number operator")] :
|
2014-05-31 11:38:40 +02:00
|
|
|
for sign in [
|
|
|
|
"",
|
|
|
|
"std::string ind1",
|
|
|
|
"std::string ind1, std::string ind2",
|
|
|
|
"int i, std::string ind1",
|
2014-06-05 14:07:15 +02:00
|
|
|
"std::string ind1, int i",
|
2014-05-31 11:38:40 +02:00
|
|
|
"int i, int j"
|
|
|
|
]:
|
|
|
|
module.add_function(name = name, signature="many_body_operator<double>(%s)"%sign, doc=doc)
|
2014-05-21 16:35:33 +02:00
|
|
|
|
2014-05-31 18:51:50 +02:00
|
|
|
module.generate_code()
|
2014-05-21 16:35:33 +02:00
|
|
|
|