Skip to content

Commit

Permalink
[enhancement] more printout (#1035)
Browse files Browse the repository at this point in the history
* print GPU UUID for AMD GPUs with the same format as rocm-smi
* print atom label and spin channel information with the occupation matrices
* calculate and print the eigenvalues of the occupation matrix
  • Loading branch information
gsavva authored Dec 17, 2024
1 parent 8c245b4 commit 9fe5844
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/core/acc/acc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ get_uuid(int device_id__)
}
s << std::hex << std::setw(2) << std::setfill('0') << (int)devprop.uuid.bytes[i];
}
#elif defined(SIRIUS_ROCM)
for (int i = 0; i < 16; ++i) {
s << std::hex << devprop.uuid.bytes[i];
}
#endif
return s.str();
}
Expand Down
25 changes: 23 additions & 2 deletions src/hubbard/hubbard_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,35 @@ Hubbard_matrix::print_local(int at_lvl__, std::ostream& out__) const

auto print_number = [&](double x) { out__ << std::setw(width) << std::setprecision(prec) << std::fixed << x; };
auto const& atom = ctx_.unit_cell().atom(atomic_orbitals_[at_lvl__].first);
auto solver = la::Eigensolver_factory("lapack");

out__ << "level : " << atom.type().lo_descriptor_hub(atomic_orbitals_[at_lvl__].second).n();
out__ << "atom : " << atom.type().label();
out__ << " level : " << atom.type().lo_descriptor_hub(atomic_orbitals_[at_lvl__].second).n();
out__ << " l: " << atom.type().lo_descriptor_hub(atomic_orbitals_[at_lvl__].second).l() << std::endl;
const int l = atom.type().lo_descriptor_hub(atomic_orbitals_[at_lvl__].second).l();
if (ctx_.num_mag_dims() != 3) {
int mmax = 2 * l + 1;
std::vector<double> eigenvals(mmax);
la::dmatrix<double> eigenvecs(mmax, mmax);
la::dmatrix<double> A(mmax, mmax);
for (int is = 0; is < ctx_.num_spins(); is++) {
out__ << hbar(width * mmax, '-') << std::endl;
for (int m = 0; m < mmax; m++) {
for (int mp = 0; mp < mmax; mp++) {
A(m, mp) = std::real(this->local(at_lvl__)(m, mp, is));
}
}
solver->solve(mmax, A, &eigenvals[0], eigenvecs);
// don't print "SPIN: 1" for non-magnetic case
if (ctx_.num_spins() == 1) {
out__ << hbar(width * mmax, '-') << std::endl;
} else {
out__ << hbar(width * mmax, '-') << " SPIN: " << is + 1 << std::endl;
}
// print eigenvalues
for (const auto& val : eigenvals) {
print_number(val);
}
out__ << std::endl << hbar(width * mmax, '-') << std::endl;
bool has_imag{false};
for (int m = 0; m < mmax; m++) {
for (int mp = 0; mp < mmax; mp++) {
Expand Down

0 comments on commit 9fe5844

Please sign in to comment.