Skip to content

Commit 030ac36

Browse files
committed
Fix pyabacus conflict caused by using same name for member variable and member function.
1 parent 20871ce commit 030ac36

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

python/pyabacus/src/ModuleNAO/py_m_nao.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ void bind_m_nao(py::module& m)
8282
.def("symbol", &RadialCollection::symbol, "itype"_a)
8383
.def_property_readonly("ntype", &RadialCollection::ntype)
8484
.def("lmax", overload_cast_<const int>()(&RadialCollection::lmax, py::const_), "itype"_a)
85-
.def_property_readonly("lmax", overload_cast_<>()(&RadialCollection::lmax, py::const_))
85+
.def("lmax", overload_cast_<>()(&RadialCollection::lmax, py::const_))
8686
.def("rcut_max", overload_cast_<const int>()(&RadialCollection::rcut_max, py::const_), "itype"_a)
87-
.def_property_readonly("rcut_max", overload_cast_<>()(&RadialCollection::rcut_max, py::const_))
87+
.def("rcut_max", overload_cast_<>()(&RadialCollection::rcut_max, py::const_))
8888
.def("nzeta", &RadialCollection::nzeta, "itype"_a, "l"_a)
8989
.def("nzeta_max", overload_cast_<const int>()(&RadialCollection::nzeta_max, py::const_), "itype"_a)
9090
.def("nzeta_max", overload_cast_<>()(&RadialCollection::nzeta_max, py::const_))

python/pyabacus/src/pyabacus/ModuleNAO/_module_nao.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,21 @@ def symbol(self, itype: int) -> str:
8383
def ntype(self) -> int:
8484
return super().ntype
8585

86-
def lmax(self, itype: int) -> int:
87-
return super().lmax(itype)
88-
89-
@property
90-
def lmax(self) -> int:
91-
return super().lmax
92-
93-
def rcut_max(self, itype: int) -> float:
94-
return super().rcut_max(itype)
86+
@overload
87+
def lmax(self) -> int: ...
88+
@overload
89+
def lmax(self, itype: int) -> int: ...
9590

96-
@property
97-
def rcut_max(self) -> float:
98-
return super().rcut_max
91+
def lmax(self, *args, **kwargs):
92+
return super().lmax(*args, **kwargs)
93+
94+
@overload
95+
def rcut_max(self) -> float: ...
96+
@overload
97+
def rcut_max(self, itype: int) -> float: ...
98+
99+
def rcut_max(self, *args, **kwargs):
100+
return super().rcut_max(*args, **kwargs)
99101

100102
def nzeta(self, itype: int, l: int) -> int:
101103
return super().nzeta(itype, l)

0 commit comments

Comments
 (0)