Skip to content

Commit

Permalink
Merge pull request #32 from xivh/local_corr_test
Browse files Browse the repository at this point in the history
calc_local_correlations function signature
  • Loading branch information
bpuchala authored Dec 10, 2024
2 parents 3e6f6de + 4c529a6 commit e7951ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions python/src/clexulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,10 +1309,10 @@ PYBIND11_MODULE(_clexulator, m) {

m.def(
"calc_local_correlations",
[](clexulator::LocalClexulatorWrapper const &wrapper,
clexulator::ConfigDoFValues const &config_dof_values,
std::shared_ptr<clexulator::SuperNeighborList const> const
[](std::shared_ptr<clexulator::SuperNeighborList const> const
&supercell_neighbor_list,
clexulator::LocalClexulatorWrapper const &wrapper,
clexulator::ConfigDoFValues const &config_dof_values,
Index unitcell_index, Index equivalent_index,
std::optional<std::vector<unsigned int>> indices) {
if (wrapper.local_clexulator->size() == 0) {
Expand Down Expand Up @@ -1340,12 +1340,12 @@ PYBIND11_MODULE(_clexulator, m) {
Parameters
----------
supercell_neighbor_list: SuperNeighborList
The SuperNeighborList for the supercell consistent with `config_dof_values`.
local_clexulator: LocalClexulator
The LocalClexulator used to evaluate local basis functions
config_dof_values: ConfigDoFValues
Configuration degree of freedom (DoF) values input to the basis functions.
supercell_neighbor_list: SuperNeighborList
The SuperNeighborList for the supercell consistent with `config_dof_values`.
unitcell_index: int
Linear unit cell index specifying in which unit cell to evaluate the
local correlations.
Expand Down
20 changes: 10 additions & 10 deletions python/tests/clexulator/test_correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ def test_calc_local_correlations(session_shared_datadir):
# Test calculate all correlations
for equivalent_index in range(local_clexulator.n_equivalents()):
correlations = clex.calc_local_correlations(
local_clexulator,
dof_values,
supercell_neighbor_list,
unitcell_index,
equivalent_index,
local_clexulator=local_clexulator,
config_dof_values=dof_values,
supercell_neighbor_list=supercell_neighbor_list,
unitcell_index=unitcell_index,
equivalent_index=equivalent_index,
)
assert isinstance(correlations, np.ndarray)
assert len(correlations) == 6
# print(unitcell_index, equivalent_index, correlations.tolist())

restricted = clex.calc_local_correlations(
local_clexulator,
dof_values,
supercell_neighbor_list,
unitcell_index,
equivalent_index,
local_clexulator=local_clexulator,
config_dof_values=dof_values,
supercell_neighbor_list=supercell_neighbor_list,
unitcell_index=unitcell_index,
equivalent_index=equivalent_index,
indices=[1, 2],
)
assert isinstance(restricted, np.ndarray)
Expand Down

0 comments on commit e7951ec

Please sign in to comment.