23 : lmax_(0), nchannel_(0), nknot_(0), sknot_(0), total_knots_(0), rmax_(-1), vp_(nullptr)
28 for (
int i = 0; i <
sopp_m_.size(); i++)
38 assert(
vp_ ==
nullptr);
60 for (
int i = 0; i <
sopp_m_.size(); i++)
75 throw std::runtime_error(
"Spin integration uses Simpson's rule. Must have even number of knots in this case");
86 APP_ABORT(
"SOECPComponent::resize_warrays has incorrect number of radial channels\n");
103 APP_ABORT(
"SOECPComponent::sMatrixElements invalid operator dimension\n");
131 APP_ABORT(
"SOECPComponent::lMatrixElements Invalid operator dimension\n");
193 for (
int m1 = -l; m1 <= l; m1++)
196 for (
int m2 = -l; m2 <= l; m2++)
199 for (
int id = 0;
id < 3;
id++)
202 msums += Y * cY * ldots;
205 lsum +=
vrad_[il] * msums;
223 std::pair<ValueVector, ValueVector> spinor_multiplier;
224 auto& up_row = spinor_multiplier.first;
225 auto& dn_row = spinor_multiplier.second;
230 for (
int j = 0; j <
nknot_; j++)
238 for (
int iq = 0; iq <
nknot_; iq++)
245 for (
int m1 = -l; m1 <= l; m1++)
248 for (
int m2 = -l; m2 <= l; m2++)
256 up_row[iq] += fourpi *
vrad_[il] * Y * cY * so_up;
257 dn_row[iq] += fourpi *
vrad_[il] * Y * cY * so_dn;
265 for (
size_t iq = 0; iq <
nknot_; iq++)
269 throw std::runtime_error(
"SOECPComponent::evaluateOneBodyOpMatrixContribution only implemented in complex build");
277 std::vector<RealType>& pairpots,
280 auto& soecp_component_leader = soecp_component_list.
getLeader();
281 if (soecp_component_leader.vp_)
289 vp_list.reserve(soecp_component_list.size());
290 const_vp_list.reserve(soecp_component_list.size());
291 deltaV_list.reserve(soecp_component_list.size());
292 deltaS_list.reserve(soecp_component_list.size());
293 psiratios_list.reserve(soecp_component_list.size());
295 for (
size_t i = 0; i < soecp_component_list.size(); i++)
303 vp_list.push_back(*component.
vp_);
304 const_vp_list.push_back(*component.
vp_);
305 deltaV_list.push_back(component.
deltaV_);
306 deltaS_list.push_back(component.
deltaS_);
307 psiratios_list.push_back(component.
psiratio_);
319 for (
size_t i = 0; i < p_list.size(); i++)
339 for (
size_t i = 0; i < p_list.size(); i++)
359 throw std::runtime_error(
"SOECPComponent::evaluateValueAndDerivatives should not be called in real build\n");
406 for (
int m1 = -l; m1 <= l; m1++)
409 for (
int m2 = -l; m2 <= l; m2++)
412 for (
int id = 0;
id < 3;
id++)
415 msums += Y * cY * ldots;
418 lsum +=
sopp_m_[il]->splint(r) * msums;
421 pairpot +=
wvec_[iq];
424 BLAS::gemv(
'N', num_vars,
total_knots_, 1.0,
dratio_.
data(), num_vars,
wvec_.data(), 1, 1.0, dhpsioverpsi.
data(), 1);
443 for (
int iq = 0; iq <
nknot_; iq++)
445 int offset = is *
nknot_ + iq;
457 for (
int is = 1; is <=
sknot_ - 1; is += 2)
460 addSpatialQuadrature(is, r, dr, snew - sold,
RealType(4. / 3.) * dS);
464 for (
int is = 2; is <=
sknot_ - 2; is += 2)
467 addSpatialQuadrature(is, r, dr, snew - sold,
RealType(2. / 3.) * dS);
471 addSpatialQuadrature(0, r, dr, smin - sold,
RealType(1. / 3.) * dS);
472 addSpatialQuadrature(
sknot_, r, dr, smax - sold,
RealType(1. / 3.) * dS);
void resize(size_type n, Type_t val=Type_t())
Resize the container.
int nchannel_
the number of non-local channels
void evaluateSpinorRatios(const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multiplier, std::vector< ValueType > &ratios) const
Used by SOECPComponent to do faster SOC evaluation.
ValueType calcRatio(ParticleSet &P, int iat, ComputeType ct=ComputeType::ALL)
compute psi(R_new) / psi(R_current) ratio It returns a complex value if the wavefunction is complex...
void pause()
Pause the summary and log streams.
helper functions for EinsplineSetBuilder
ParticleScalar spins
internal spin variables for dynamical spin calculations
QTBase::RealType RealType
RealType evaluateOneExactSpinIntegration(ParticleSet &W, const int iat, const TrialWaveFunction &psi, const int iel, const RealType r, const PosType &dr)
void rotateQuadratureGrid(const TensorType &rmat)
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false)
update the state with the new data
Vector< ValueType > dlogpsi_vp_
aligned_vector< int > angpp_m_
Angular momentum map.
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
void makeMovesWithSpin(const ParticleSet &refp, int jel, const std::vector< PosType > &deltaV, const std::vector< RealType > &deltaS, bool sphere=false, int iat=-1)
move virtual particles to new postions and update distance tables
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
void makeMoves(const ParticleSet &refp, int jel, const std::vector< PosType > &deltaV, bool sphere=false, int iat=-1)
move virtual particles to new postions and update distance tables
std::vector< ValueType > vrad_
void resize_warrays(int n, int m, int s)
QTBase::ComplexType ComplexType
void buildTotalQuadrature(const RealType r, const PosType &dr, const RealType sold)
class SOECPComponent brief Computes the nonlocal spin-orbit interaction .
void resize(size_type n, size_type m)
Resize the container.
void deleteVirtualParticle()
OrbitalSetTraits< ValueType >::ValueVector ValueVector
static ComplexType sMatrixElements(RealType s1, RealType s2, int dim)
OutputManagerClass outputManager(Verbosity::HIGH)
static ComplexType matrixElementDecomposed(int l, int m1, int m2, RealType spin, bool plus=true)
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
void resume()
Resume the summary and log streams.
Specialized paritlce class for atomistic simulations.
std::vector< PosType > deltaV_
size_type size() const
return the current size
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
static ComplexType lmMatrixElements(int l, int m1, int m2, int dim)
RealType calculateProjector(RealType r, const PosType &dr, RealType sold)
std::vector< ValueType > psiratio_
void rejectMove(Index_t iat)
reject a proposed move in regular mode
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle a set of variables that can be modified during optimizations
SpherGridType sgridxyz_m_
void makeMoveWithSpin(Index_t iat, const SingleParticlePos &displ, const Scalar_t &sdispl)
makeMove, but now includes an update to the spin variable
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
RealType evaluateValueAndDerivatives(ParticleSet &P, int iat, TrialWaveFunction &psi, int iel, RealType r, const PosType &dr, const opt_variables_type &optvars, const Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
void initVirtualParticle(const ParticleSet &qp)
void print(std::ostream &os)
const RealType ion_elec_dist
std::vector< RadialPotentialType * > sopp_m_
Non-Local part of the pseudo-potential.
float conj(const float &c)
Workaround to allow conj on scalar to return real instead of complex.
std::vector< ValueType > wvec_
static void mw_makeMovesWithSpin(const RefVectorWithLeader< VirtualParticleSet > &vp_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< const std::vector< PosType >> &deltaV_list, const RefVector< const std::vector< RealType >> &deltaS_list, const RefVector< const NLPPJob< RealType >> &joblist, bool sphere)
std::vector< std::reference_wrapper< T > > RefVector
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
void add(int l, RadialPotentialType *pp)
add a new Spin-Orbit component
Class to represent a many-body trial wave function.
std::vector< RealType > sgridweight_m_
handles acquire/release resource by the consumer (RefVectorWithLeader type).
SpherGridType rrotsgrid_m_
RealType evaluateOne(ParticleSet &W, int iat, TrialWaveFunction &Psi, int iel, RealType r, const PosType &dr)
Evaluate the spin orbit pp contribution to total energy from ion "iat" and electron "iel"...
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
meta data for NLPP calculation of a pair of ion and electron This is not just meta data...
static int kroneckerDelta(int x, int y)
void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratio)
compute both ratios and deriatives of ratio with respect to the optimizables
SOECPComponent * makeClone(const ParticleSet &qp)
std::complex< T > sphericalHarmonic(const int l, const int m, const TinyVector< T, 3 > &r)
wrapper for Ylm, which can take any normal position vector as an argument param[in] l angular momentu...
const PosType ion_elec_displ
void acceptMove(Index_t iat)
accept the move and update the particle attribute by the proposed move in regular mode ...
std::vector< RealType > deltaS_
static void mw_evaluateRatios(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< const VirtualParticleSet > &Vp_list, const RefVector< std::vector< ValueType >> &ratios_list, ComputeType ct=ComputeType::ALL)
batched version of evaluateRatios Note: unlike other mw_ static functions, *this is the batch leader ...
Matrix< ValueType > dratio_
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios, ComputeType ct=ComputeType::ALL)
compulte multiple ratios to handle non-local moves and other virtual moves
std::vector< RealType > spin_quad_weights_
int num_active_vars
number of active variables
static void mw_evaluateOne(const RefVectorWithLeader< SOECPComponent > &soecp_component_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVectorWithLeader< TrialWaveFunction > &psi_list, const RefVector< const NLPPJob< RealType >> &joblist, std::vector< RealType > &pairpots, ResourceCollection &collection)