Skip to content

Refactor: move "hPsi-call-act" procedure from OperatorPW into basic Operator and redesign act() interface #2911

Description

@maki49

Background

Why move to basic class?

  • for physics: act() is a basic property of an operator to a vector: $\ket{\psi_\text{out}}=\hat{O}\ket{\psi_\text{in}}$
  • for demand:
    • LR-TDDFT Implementation #2460 has 2 different types of operators inheriting basic Operator rather than OperatorPW, whose act() interface will be called in hPsi() in sequence.
    • if a derived class (like OperatorLCAO) doesn't need the hPsi-call-act procedure, just ignore or override it.

Why redesign the interface?

The old act() inteface uses both psi::Psi<std::complex<FPTYPE>, Device> *psi_in and std::complex<FPTYPE>* tmpsi_in (the data pointer of psi_in) as input, which is a kind of redundancy.

What's changed (in #2912)

  • move "hPsi-call-act" procedure from OperatorPW into basic Operator
  • redesign act() interface:
    • hardware-friendly type:
    virtual void act(const int nbands,
          const int nbasis,
          const int npol,
          const FPTYPE* tmpsi_in,
          FPTYPE* tmhpsi,
          const int ngk_ik = 0)const;
    
    • developer-friendly type:
    virtual psi::Psi<FPTYPE> act(const psi::Psi<FPTYPE>& psi_in) const;
    

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions