Error compile generating code

14 views
Skip to first unread message

Spencer Xu

unread,
Oct 27, 2023, 4:22:29 AM10/27/23
to hoomd-users
Dear everone,

I am trying to run a script which gives me an error. Could someone please let me know how to resolve this?
I was using cpppotential (hoomd blue cpu v.3.2.0) while these turned out:

code.cc:53:33: error: invalid operands to binary expression ('const vec3<float>' and 'double')
    vec3<float> r_hat_ij = r_ij / sqrt(dot(r_ij, r_ij));
                           ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/HOOMDMath.h:715:34: note: candidate function not viable: no known conversion from 'const vec3<float>' to 'const hoomd::Scalar3' (aka 'const double3') for 1st argument
HOSTDEVICE inline hoomd::Scalar3 operator/(const hoomd::Scalar3& a, const hoomd::Scalar& b)
                                 ^
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/HOOMDMath.h:692:34: note: candidate function not viable: no known conversion from 'const vec3<float>' to 'const hoomd::Scalar3' (aka 'const double3') for 1st argument
HOSTDEVICE inline hoomd::Scalar3 operator/(const hoomd::Scalar3& a, const hoomd::Scalar3& b)
                                 ^
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/HOOMDMath.h:728:34: note: candidate function not viable: no known conversion from 'const vec3<float>' to 'const hoomd::Scalar' (aka 'const double') for 1st argument
HOSTDEVICE inline hoomd::Scalar3 operator/(const hoomd::Scalar& a, const hoomd::Scalar3& b)
                                 ^
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/VectorMath.h:294:47: note: candidate template ignored: deduced conflicting types for parameter 'Real' ('float' vs. 'double')
template<class Real> DEVICE inline vec3<Real> operator/(const vec3<Real>& a, const Real& b)
                                              ^
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/VectorMath.h:187:47: note: candidate template ignored: could not match 'vec3<Real>' against 'double'
template<class Real> DEVICE inline vec3<Real> operator/(const vec3<Real>& a, const vec3<Real>& b)
                                              ^
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/VectorMath.h:483:47: note: candidate template ignored: could not match 'vec2' against 'vec3'
template<class Real> DEVICE inline vec2<Real> operator/(const vec2<Real>& a, const vec2<Real>& b)
                                              ^
/public3/home/scg6342/.conda/envs/sac/lib/python3.7/site-packages/hoomd/include/hoomd/VectorMath.h:586:47: note: candidate template ignored: could not match 'vec2' against 'vec3'
template<class Real> DEVICE inline vec2<Real> operator/(const vec2<Real>& a, const Real& b)
                                              ^
Error generating code.
1 error generated.

Joshua Anderson

unread,
Oct 31, 2023, 11:41:08 AM10/31/23
to hoomd...@googlegroups.com
Spencer,

Use sqrtf.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/4c7677ae-b3d6-42db-b412-b9746522f684n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages