sharc-md / sharc

The SHARC molecular dynamics (MD) program suite is an ab initio MD software package developed to study the excited-state dynamics of molecules.
https://www.sharc-md.org
GNU General Public License v3.0
59 stars 31 forks source link

Problem in installation #41

Closed Kalpa08 closed 1 year ago

Kalpa08 commented 1 year ago

Dear Developers! I was trying to install sharc-md with pysharc in centos 7. While compiling the following error I hav encountered. Can you please tell me how to overcome this problem? First I have modified the Makefile in source as follows:

=======================================

true, false # also implies NETCDF

USE_PYSHARC := true

intel, gnu

USE_COMPILER := intel

mkl,gnu

USE_LIBS := mkl

needed for PYSHARC

ANACONDA := /opt/SOFTWARES/anaconda/3.9

=======================================

then I ran make install in pysharc and the following output came on the screen:

(base) [root@compute pysharc]# make install cd netcdf; make lib make[1]: Entering directory /opt/SOFTWARES/sharc/sharc-master/pysharc/netcdf' ar -cvq ../lib/libsharcnc.so nc_basic.o nc_sharc.o a - nc_basic.o a - nc_sharc.o make[1]: Leaving directory/opt/SOFTWARES/sharc/sharc-master/pysharc/netcdf' cd ../source; make libsharc make[1]: Entering directory /opt/SOFTWARES/sharc/sharc-master/source' Updating "build_info.inc" ifort -D__PYSHARC__ -O3 -fPIC -g -c definitions.F90 definitions.F90(54): warning #6379: The structure contains one or more misaligned fields. [AUX_TRAJECTORY_TYPE] type aux_trajectory_type -----^ definitions.F90(92): warning #6379: The structure contains one or more misaligned fields. [TRAJECTORY_TYPE] type trajectory_type -----^ definitions.F90(207): warning #6379: The structure contains one or more misaligned fields. [CTRL_TYPE] type ctrl_type -----^ ifort -O3 -fPIC -g -c matrix.f90 ifort -O3 -fPIC -g -c string.f90 ifort -O3 -fPIC -g -c input_list.f90 ifort -O3 -fPIC -g -c misc.f90 ifort -O3 -fPIC -g -c output.f90 ifort -O3 -fPIC -g -c decoherence_afssh.f90 ifort -O3 -fPIC -g -c restart.f90 ifort -O3 -fPIC -g -c qm_out.f90 ifort -O3 -fPIC -g -c nuclear.f90 ifort -O3 -fPIC -g -c electronic.f90 ifort -O3 -fPIC -g -c qm.f90 ifort -O3 -fPIC -g -c electronic_laser.f90 ifort -D__PYSHARC__ -O3 -fPIC -g -c input.F90 ifort -O3 -fPIC -g -c definitions_NetCDF.f90 ifort -D__PYSHARC__ -O3 -fPIC -g -c interface.F90 ifort -shared definitions.o matrix.o string.o input_list.o misc.o output.o restart.o qm_out.o nuclear.o electronic.o qm.o electronic_laser.o input.o decoherence_afssh.o interface.o -o ../pysharc/lib/libsharc.so -L/opt/compilers/intel/mkl/2023.0.0/lib/intel64 -lmkl_rt -lpthread -lm -lgfortran -L/opt/SOFTWARES/anaconda/3.9/lib make[1]: Leaving directory/opt/SOFTWARES/sharc/sharc-master/source' python sharc_setup build_ext --build-lib . running build_ext cp lib/.so ../lib cp bin/.py ../bin

Then I ran make install in source, and I found the following error which I am not able to solve. (base) [root@compute source]# make install Updating "build_info.inc" ifort -O3 -fPIC -g -c output.f90 ifort -DPYSHARC -O3 -fPIC -g -c input.F90 ifort -DPYSHARC -O3 -fPIC -g -c interface.F90 ifort -DPYSHARC -O3 -fPIC -g -c main.F90 ifort definitions.o matrix.o string.o input_list.o misc.o output.o restart.o qm_out.o nuclear.o electronic.o qm.o electronic_laser.o input.o decoherence_afssh.o interface.o main.o -o sharc2.x -L/opt/compilers/intel/mkl/2023.0.0/lib/intel64 -lmkl_rt -lpthread -lm -lgfortran -L/opt/SOFTWARES/anaconda/3.9/lib interface.o: In function write_data_netcdf_': /opt/SOFTWARES/sharc/sharc-master/source/interface.F90:1033: undefined reference towrite_sharc_ncoutputdatistep' interface.o: In function close_files_': /opt/SOFTWARES/sharc/sharc-master/source/interface.F90:1067: undefined reference toclosencfile' make: *** [sharc] Error 1

Can you please let me know, is there any mistake I am making?

markusoppel commented 1 year ago

Hi,

your link command generating the sharc executable (the last ifort command causing the error message) is missing the link flags for the netcdf (and hdf5) libraries. These flags should get set up automatically through setting USE_PYSHARC := true in the Makefile. Please check these lines. The actual link flags are set starting with line 57 in the Makefile. Maybe you can try to add these flags manually to the link command.

Cheers, Markus

Kalpa08 commented 1 year ago

Thank you for your response! In the Makefile, after 57 th line, the following are there

# ifeq ($(USE_PYSHARC),true) FPREPROCESSOR := -DPYSHARC NETCDF_LIB = -L$(ANACONDA)/lib \

NETCDF_LIB = -L/usr/lib64 \

       -lhdf5 \
       -lhdf5_hl \
       -lnetcdf \
       -lmfhdf \
       -ldf \
       -ljpeg \
       -L../pysharc/lib \
       -lsharcnc

else

Kalpa08 commented 1 year ago

That time I missed to give the following step: conda create -n pysharc_3.0 -c conda-forge python=3.9 numpy scipy h5py six matplotlib python-dateutil pyyaml pyparsing kiwisolver cycler netcdf4 hdf5 h5utils gfortran_linux-64

After this I did: run make install in pysharc/, then run make install in source/. I found the following problem: (pysharc_3.0) [root@compute source]# make Updating "build_info.inc" /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -DPYSHARC -O3 -fPIC -g -c definitions.F90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c matrix.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c string.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c input_list.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c misc.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c output.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c decoherence_afssh.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c restart.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c qm_out.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c nuclear.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c electronic.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c qm.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c electronic_laser.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -DPYSHARC -O3 -fPIC -g -c input.F90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -O3 -fPIC -g -c definitions_NetCDF.f90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -DPYSHARC -O3 -fPIC -g -c interface.F90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran -DPYSHARC -O3 -fPIC -g -c main.F90 /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/x86_64-conda-linux-gnu-gfortran definitions.o matrix.o string.o input_list.o misc.o output.o restart.o qm_out.o nuclear.o electronic.o qm.o electronic_laser.o input.o decoherence_afssh.o interface.o main.o -o sharc2.x -L/opt/compilers/intel/mkl/2023.0.0/lib/intel64 -lmkl_rt -lpthread -lm -lgfortran -L/opt/SOFTWARES/anaconda/3.9/lib/lib /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/../lib/gcc/x86_64-conda-linux-gnu/12.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: interface.o: in function write_data_netcdf_': /opt/SOFTWARES/sharc/sharc-master/source/interface.F90:1051: undefined reference towrite_sharc_ncoutputdatistep' /opt/SOFTWARES/anaconda/3.9/envs/pysharc_3.0/bin/../lib/gcc/x86_64-conda-linux-gnu/12.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: interface.o: in function close_files_': /opt/SOFTWARES/sharc/sharc-master/source/interface.F90:1067: undefined reference toclosencfile' collect2: error: ld returned 1 exit status make: *** [sharc] Error 1

markusoppel commented 1 year ago

It looks like your usage of the Makefile is still not correct. Have you set up the enviroment variable $ANACONDA correctly?