Skip to content

Bug: It seems that the electric field force in RT-TDDFT is not applied at all, and the wrong function was called as well #5894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AsTonyshment opened this issue Feb 11, 2025 · 0 comments · Fixed by #5918
Assignees
Labels
Bugs Bugs that only solvable with sufficient knowledge of DFT MD & LAM MD and Larege Atomic Models

Comments

@AsTonyshment
Copy link
Collaborator

AsTonyshment commented Feb 11, 2025

Describe the bug

When I was debugging issue #5333, I found this in module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp:

//! atomic forces from E-field of rt-TDDFT
ModuleBase::matrix fefield_tddft;
if (PARAM.inp.esolver_type == "TDDFT" && isforce)
{
fefield_tddft.create(nat, 3);
elecstate::Efield::compute_force(ucell, fefield_tddft);
}

This piece of code has three issues:

  • String case mismatch: The string for PARAM.inp.esolver_type should be "tddft" in lowercase, not "TDDFT" in uppercase. Due to this, this branch is skipped, which means the electric field force in RT-TDDFT is not applied at all.
  • Incorrect function call: Why is compute_force from the elecstate::Efield class being called here? It’s unrelated to the RT-TDDFT algorithm. Instead, we should be calling H_TDDFT_pw::compute_force:
    void H_TDDFT_pw ::compute_force(const UnitCell& cell, ModuleBase::matrix& fe)
    {
    int iat = 0;
    for (int it = 0; it < cell.ntype; ++it)
    {
    for (int ia = 0; ia < cell.atoms[it].na; ++ia)
    {
    for (int jj = 0; jj < 3; ++jj)
    {
    fe(iat, jj) = ModuleBase::e2 * amp * cell.atoms[it].ncpp.zv * bvec[jj] / bmod;
    }
    ++iat;
    }
    }
    }
  • Formula issue: Even in the function H_TDDFT_pw::compute_force, the force formula seems incorrect. The amp variable is just a constant amplitude that doesn’t change with time. This should likely be replaced with vext_time or something else. It is worth noting that the H_TDDFT_pw::compute_force function is never called anywhere in the entire program.
@AsTonyshment AsTonyshment added Bugs Bugs that only solvable with sufficient knowledge of DFT MD & LAM MD and Larege Atomic Models labels Feb 11, 2025
@AsTonyshment AsTonyshment self-assigned this Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugs Bugs that only solvable with sufficient knowledge of DFT MD & LAM MD and Larege Atomic Models
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant