Error while using CPPPotential

43 views
Skip to first unread message

SANJAY BHANDARKAR

unread,
Jun 1, 2023, 5:55:09 AM6/1/23
to hoomd-users
Dear everone,

I am trying to run an example script which gives me an error. Could someone please let me know how to resolve this?

My Code- 

# The square well potential
r_interaction = 1.1
evaluate_square_well = f'''float rsq = dot(r_ij, r_ij);
                    if (rsq < {r_interaction * r_interaction}f)
                        return param_array[0];
                    else
                        return 0.0f;
            '''
square_well = hoomd.hpmc.pair.user.CPPPotential(r_cut=r_interaction,
                                                code=evaluate_square_well,
                                                param_array=[-1])

# hpmc.Sphere provides the hard sphere part of the potential
mc = hoomd.hpmc.integrate.Sphere()
mc.shape['S'] = dict(diameter=1.0)

The error - 

RuntimeError: Error compiling JIT code:

                        #include <stdio.h>
                        #include "hoomd/HOOMDMath.h"
                        #include "hoomd/VectorMath.h"

                        // param_array (singlet class) or param_array_isotropic
                        // and param_array_constituent (union class) are
                        // allocated by the library
                        float *param_array;
                       

                        using namespace hoomd;

                        extern "C"
                        {
                        float eval(const vec3<float>& r_ij,
                            unsigned int type_i,
                            const quat<float>& q_i,
                            float d_i,
                            float charge_i,
                            unsigned int type_j,
                            const quat<float>& q_j,
                            float d_j,
                            float charge_j)
                            {
                        float rsq = dot(r_ij, r_ij);
                    if (rsq < 1.2100000000000002f)
                        return param_array[0];
                    else
                        return 0.0f;
           
                            }
                        }

In file included from code.cc:3:
/home/anaconda3/lib/python3.10/site-packages/hoomd/include/hoomd/HOOMDMath.h:33:10: fatal error: 'cmath' file not found
#include <cmath>
         ^~~~~~~
Error generating code.
1 error generated.

Joshua Anderson

unread,
Jun 1, 2023, 7:48:59 AM6/1/23
to hoomd...@googlegroups.com
Sanjay,

Please try this with a mambaforge, miniforge, or miniconda install (with conda-forge set as the default channel). The anaconda distribution pins many packages to versions that are not compatible with hoomd.

If you get the same behavior, then please let me know what platform you are running on and provide the output of `conda list`.
------
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/ffd353d9-5a40-4f0f-aaa0-0d387d1cbc68n%40googlegroups.com.

SANJAY BHANDARKAR

unread,
Jun 7, 2023, 4:28:46 AM6/7/23
to hoomd-users
I get the same error even with a miniconda install. I am running on Ubuntu 22.04.2. 
This is the output of conda-list - 

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
binutils_impl_linux-64    2.38                 h2a08ee3_1  
boltons                   23.0.0          py310h06a4308_0  
brotlipy                  0.7.0           py310h7f8727e_1002  
bzip2                     1.0.8                h7b6447c_0  
ca-certificates           2023.5.7             hbcca054_0    conda-forge
certifi                   2023.5.7           pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h5eee18b_3  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
clang                     14.0.6               h06a4308_1  
clang-14                  14.0.6          default_hc6dbbc7_1  
clangxx                   14.0.6          default_hc6dbbc7_1  
conda                     23.5.0          py310hff52083_1    conda-forge
conda-content-trust       0.1.3           py310h06a4308_0  
conda-package-handling    2.0.2           py310h06a4308_0  
conda-package-streaming   0.7.0           py310h06a4308_0  
cryptography              39.0.1          py310h9ce1e76_0  
gcc_impl_linux-64         7.5.0               habd7529_20    conda-forge
gsd                       2.9.0                    pypi_0    pypi
hoomd                     3.11.0          cpu_py310h9445866_0    conda-forge
icu                       58.2              hf484d3e_1000    conda-forge
idna                      3.4             py310h06a4308_0  
jsonpatch                 1.32               pyhd3eb1b0_0  
jsonpointer               2.1                pyhd3eb1b0_0  
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
ld_impl_linux-64          2.38                 h1181459_1  
libblas                   3.9.0           17_linux64_openblas    conda-forge
libcblas                  3.9.0           17_linux64_openblas    conda-forge
libclang-cpp              14.0.6          default_hc6dbbc7_1  
libclang-cpp14            14.0.6          default_hc6dbbc7_1  
libcxx                    14.0.6               h83ecd13_0  
libcxxabi                 14.0.6               h06a4308_0  
libffi                    3.4.2                h6a678d5_6  
libgcc-devel_linux-64     7.5.0               hda03d7c_20    conda-forge
libgcc-ng                 13.1.0               he5830b7_0    conda-forge
libgfortran-ng            13.1.0               h69a702a_0    conda-forge
libgfortran5              13.1.0               h15d22d2_0    conda-forge
libgomp                   13.1.0               he5830b7_0    conda-forge
libhwloc                  2.9.1                hd6dc26d_0    conda-forge
liblapack                 3.9.0           17_linux64_openblas    conda-forge
libllvm14                 14.0.6               hdb19cb5_3  
libopenblas               0.3.23          pthreads_h80387f5_0    conda-forge
libstdcxx-devel_linux-64  13.1.0               he3cc6c4_0    conda-forge
libstdcxx-ng              13.1.0               hfd8a6a1_0    conda-forge
libuuid                   1.41.5               h5eee18b_0  
libxml2                   2.10.3               hcbfbd50_0  
ncurses                   6.4                  h6a678d5_0  
numpy                     1.24.3          py310ha4c1d20_0    conda-forge
openssl                   1.1.1u               hd590300_0    conda-forge
packaging                 23.0            py310h06a4308_0  
pip                       23.0.1          py310h06a4308_0  
pluggy                    1.0.0           py310h06a4308_1  
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.4           py310h5eee18b_0  
pycparser                 2.21               pyhd3eb1b0_0  
pyopenssl                 23.0.0          py310h06a4308_0  
pysocks                   1.7.1           py310h06a4308_0  
python                    3.10.10              h7a1cb2a_2  
python_abi                3.10                    2_cp310    conda-forge
readline                  8.2                  h5eee18b_0  
requests                  2.28.1          py310h06a4308_1  
ruamel.yaml               0.17.21         py310h5eee18b_0  
ruamel.yaml.clib          0.2.6           py310h5eee18b_1  
setuptools                65.6.3          py310h06a4308_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.41.1               h5eee18b_0  
sysroot_linux-64          2.12                he073ed8_15    conda-forge
tbb                       2021.9.0             hf52228f_0    conda-forge
tk                        8.6.12               h1ccaba5_0  
toolz                     0.12.0          py310h06a4308_0  
tqdm                      4.65.0          py310h2f386ee_0  
tzdata                    2023c                h04d1e81_0  
urllib3                   1.26.15         py310h06a4308_0  
wheel                     0.38.4          py310h06a4308_0  
xz                        5.2.10               h5eee18b_1  
zlib                      1.2.13               h5eee18b_0  
zstandard                 0.19.0          py310h5eee18b_0 

Joshua Anderson

unread,
Jun 7, 2023, 7:48:29 AM6/7/23
to hoomd...@googlegroups.com
Sanjay,

Your install includes clang (and many other packages) from the default channel:
clang                     14.0.6               h06a4308_1  

Specifically, the conda-forge clang is patched to search for headers like cmath in the conda-forge provided sysroot package. Read the conda-forge documentation for instructions on how to use miniconda appropriately with conda-forge.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

SANJAY BHANDARKAR

unread,
Jun 7, 2023, 8:18:37 AM6/7/23
to hoomd-users
I tried it with miniforge install.
This is the output od conda list - 
_libgcc_mutex             0.1                 conda_forge    conda-forge                                                                                                                                          
_openmp_mutex             4.5                       2_gnu    conda-forge                                                                                                                                          
binutils_impl_linux-64    2.40                 hf600244_0    conda-forge                                                                                                                                          
boltons                   23.0.0             pyhd8ed1ab_0    conda-forge                                                                                                                                          
brotlipy                  0.7.0           py310h5764c6d_1005    conda-forge                                                                                                                                        
bzip2                     1.0.8                h7f98852_4    conda-forge                                                                                                                                          
ca-certificates           2023.5.7             hbcca054_0    conda-forge                                                                                                                                          
certifi                   2023.5.7           pyhd8ed1ab_0    conda-forge                                                                                                                                          
cffi                      1.15.1          py310h255011f_3    conda-forge                                                                                                                                          
charset-normalizer        3.1.0              pyhd8ed1ab_0    conda-forge                                                                                                                                          
clang                     14.0.6               ha770c72_1    conda-forge                                                                                                                                          
clang-14                  14.0.6          default_h7634d5b_1    conda-forge                                                                                                                                        
clangxx                   14.0.6          default_h1e1816b_1    conda-forge                                                                                                                                        
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge                                                                                                                                          
conda                     23.5.0          py310hff52083_1    conda-forge                                                                                                                                          
conda-package-handling    2.0.2              pyh38be061_0    conda-forge                                                                                                                                          
conda-package-streaming   0.7.0              pyhd8ed1ab_1    conda-forge                                                                                                                                          
cryptography              40.0.1          py310h34c0648_0    conda-forge                                                                                                                                          
gcc_impl_linux-64         12.2.0              hcc96c02_19    conda-forge                                                                                                                                          
gsd                       2.9.0                    pypi_0    pypi                                                                                                                                                  
hoomd                     3.11.0          cpu_py310h9445866_0    conda-forge                                                                                                                                      
icu                       72.1                 hcb278e6_0    conda-forge                                                                                                                                          
idna                      3.4                pyhd8ed1ab_0    conda-forge                                                                                                                                          
jsonpatch                 1.32               pyhd8ed1ab_0    conda-forge                                                                                                                                          
jsonpointer               2.0                        py_0    conda-forge                                                                                                                                          
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge                                                                                                                                          
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge                                                                                                                                          
libblas                   3.9.0           17_linux64_openblas    conda-forge                                                                                                                                      
libcblas                  3.9.0           17_linux64_openblas    conda-forge                                                                                                                                      
libclang-cpp              14.0.6          default_h7634d5b_1    conda-forge
libclang-cpp14            14.0.6          default_h7634d5b_1    conda-forge
libcxx                    14.0.6               hf52228f_0    conda-forge
libcxxabi                 14.0.6               ha770c72_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-devel_linux-64     12.2.0              h3b97bd3_19    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge

libgfortran-ng            13.1.0               h69a702a_0    conda-forge
libgfortran5              13.1.0               h15d22d2_0    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libhwloc                  2.9.1            cpu_h1633a84_5    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
liblapack                 3.9.0           17_linux64_openblas    conda-forge
libllvm14                 14.0.6               hcd5def8_3    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.23          pthreads_h80387f5_0    conda-forge
libsanitizer              12.2.0              h46fd767_19    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libstdcxx-devel_linux-64  13.1.0               he3cc6c4_0    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxml2                   2.11.4               h0d562d8_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
numpy                     1.24.3          py310ha4c1d20_0    conda-forge
openssl                   3.1.1                hd590300_1    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.4           py310h5764c6d_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.1.1             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.10         he550d4f_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
readline                  8.2                  h8228510_1    conda-forge
requests                  2.28.2             pyhd8ed1ab_1    conda-forge
ruamel.yaml               0.17.21         py310h1fa729e_3    conda-forge
ruamel.yaml.clib          0.2.7           py310h1fa729e_1    conda-forge
setuptools                65.6.3             pyhd8ed1ab_0    conda-forge

sysroot_linux-64          2.12                he073ed8_15    conda-forge
tbb                       2021.9.0             hf52228f_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
urllib3                   1.26.15            pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zstandard                 0.19.0          py310hdeb6495_1    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge

Reply all
Reply to author
Forward
0 new messages