Template Function deepmd::hpp::validate_charge_spin

Template Function deepmd::hpp::validate_charge_spin#

Function Documentation#

template<typename FPTYPE>
inline const FPTYPE *deepmd::hpp::validate_charge_spin(const std::vector<FPTYPE> &charge_spin, const int dchgspin, const unsigned int nframes)#

Validate a runtime charge_spin vector and return a raw pointer to it (or nullptr when empty, which falls back to the model’s default_chg_spin).

Parameters:
  • charge_spin[in] The per-frame charge/spin values.

  • dchgspin[in] The model’s charge/spin dimension (0 if unsupported).

  • nframes[in] The number of frames.

Returns:

charge_spin.data() if non-empty and valid, otherwise nullptr.