You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
Verify the issue is not a duplicate.
Describe the bug.
Steps to reproduce.
Expected behavior.
Error message.
Environment details.
Additional context.
Assign a priority level (low, medium, high, urgent).
Assign the issue to a team member.
Label the issue with relevant tags.
Identify possible related issues.
Create a unit test or automated test to reproduce the bug (if applicable).
Fix the bug.
Test the fix.
Update documentation (if necessary).
Close the issue and inform the reporter (if applicable).
The text was updated successfully, but these errors were encountered:
@dyzheng
Actually, I find that the size setting for BaseMatrix corresponding to an AtomPair object is realized in its constructor. And usually the set_size(col_size, row_size) function will be used after construction, which results in such bug.
ErjieWu
changed the title
Irreasonable setting when setting size of BaseMatrix size of AtomPair in HContainer.
Irreasonable results when setting size of BaseMatrix size of AtomPair in HContainer.
Dec 19, 2024
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)
The text was updated successfully, but these errors were encountered: