Describe the bug
When I use HContainer to save data, following the step below to allocate:
- Create HContainer;
- Find all atom pairs and repeat:
- Use AtomPair to represent them;
- Insert AtomPair to HContainer;
- Allocate using member function of HContainer.
Normally, it will create several BaseMatrix objects for each atom pair (i, j, R), with size nw1*nw2 (number of orbitals for each atom).
However, when I want to save some other matrices instead of Hamiltonian and the size if different, I should set size before allocating, the step will change into:
- Create HContainer;
- Find all atom pairs and repeat:
- Use AtomPair to represent them;
- Use set_size member function of Atompair to set the matrix size;
- Insert AtomPair to HContainer;
- Allocate using member function of HContainer.
It will create several BaseMatrix objects for each atom pair (i, j, R) with size I set.
The allocation will run correctly, but when I use H.get_atom_pair(i, j).get_HR_values(Rx, Ry, Rz) to get the BaseMatrix and print the size by using get_row_size() and get_col_size(), it will return the BaseMatrix with the size nw1*nw2 (number of orbitals for each atom).
That is to say, if we use pointer to get/set the value, everything will goes correctly (since the memory is allocated correctly). But when we use BaseMatrix, it will be wrong!
Expected behavior
When we set size of matrix by hand, BaseMatrix should be refreshed automatically. It should be safe to use BaseMatrix to access the data.
To Reproduce
No response
Environment
No response
Additional Context
No response
Task list for Issue attackers (only for developers)
Describe the bug
When I use HContainer to save data, following the step below to allocate:
Normally, it will create several BaseMatrix objects for each atom pair (i, j, R), with size nw1*nw2 (number of orbitals for each atom).
However, when I want to save some other matrices instead of Hamiltonian and the size if different, I should set size before allocating, the step will change into:
It will create several BaseMatrix objects for each atom pair (i, j, R) with size I set.
The allocation will run correctly, but when I use
H.get_atom_pair(i, j).get_HR_values(Rx, Ry, Rz)to get the BaseMatrix and print the size by usingget_row_size()andget_col_size(), it will return the BaseMatrix with the size nw1*nw2 (number of orbitals for each atom).That is to say, if we use pointer to get/set the value, everything will goes correctly (since the memory is allocated correctly). But when we use BaseMatrix, it will be wrong!
Expected behavior
When we set size of matrix by hand, BaseMatrix should be refreshed automatically. It should be safe to use BaseMatrix to access the data.
To Reproduce
No response
Environment
No response
Additional Context
No response
Task list for Issue attackers (only for developers)