crest-lab / crest

CREST - A program for the automated exploration of low-energy molecular chemical space.
https://crest-lab.github.io/crest-docs/
GNU Lesser General Public License v3.0
183 stars 42 forks source link

Symbol conflicts when compiling `3.0dev` #185

Closed jevandezande closed 1 year ago

jevandezande commented 1 year ago

When attempting to compile the 3.0dev branch, I receive an error about symbol conflicts (compilation of master succeeds).

Compilation details: cmake FC=gfortran CC=gcc

[ 35%] Building Fortran object CMakeFiles/crest-exe.dir/src/dynamics/metadynamics_module.f90.o
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:36:28:

   25 |   use crest_parameters
      |      2
......
   36 |   real(wp),parameter :: bohr = 0.52917726_wp
      |                            1
Error: Symbol ‘bohr’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:37:32:

   25 |   use crest_parameters
      |      2
......
   37 |   real(wp),parameter :: autokcal = 627.509541_wp
      |                                1
Error: Symbol ‘autokcal’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:38:30:

   25 |   use crest_parameters
      |      2
......
   38 |   real(wp),parameter :: autoaa = 0.52917726_wp
      |                              1
Error: Symbol ‘autoaa’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:39:30:

   25 |   use crest_parameters
      |      2
......
   39 |   real(wp),parameter :: aatoau = 1.0_wp / autoaa
      |                              1
Error: Symbol ‘aatoau’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:40:31:

   25 |   use crest_parameters
      |      2
......
   40 |   real(wp),parameter :: amutokg = 1.660539040e-27_wp
      |                               1
Error: Symbol ‘amutokg’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:41:30:

   25 |   use crest_parameters
      |      2
......
   41 |   real(wp),parameter :: metokg = 9.10938356e-31_wp
      |                              1
Error: Symbol ‘metokg’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:42:30:

   25 |   use crest_parameters
      |      2
......
   42 |   real(wp),parameter :: kgtome = 1.0_wp / metokg
      |                              1
Error: Symbol ‘kgtome’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
/home/vandezan/progs/crest/src/dynamics/metadynamics_module.f90:45:26:

   25 |   use crest_parameters
      |      2
......
   45 |   real(wp),parameter :: kB = 3.166808578545117e-06_wp !in Eh/K
      |                          1
Error: Symbol ‘kb’ at (1) conflicts with symbol from module ‘crest_parameters’, use-associated at (2)
pprcht commented 1 year ago

Thanks for letting me know, I will fix it

jevandezande commented 1 year ago

1

I deleted the offending lines in src/dynamics/dynamics_module.f90 and src/dynamics/metadynamics_module.f90. My knowledge of Fortran is minimal, but I presume that the compiler wasn't happy with redefining variables.

2

Compilation then continued until I got the following error:

/home/vandezan/progs/crest/src/algos/crossing.f90:122:53:

  122 |   call crossing(nat,nall,at,xyz,eread,ewin,rthr,cthr,maxgen)
      |                                                     1
Error: Dummy argument ‘maxgen’ with INTENT(IN) in variable definition context (actual argument to INTENT = OUT/INOUT) at (1)

I presume this has to due with mutability of the argument. I switched the calling function to intent(inout) (line 36).

3

Compilation then continued until I got the following error:

/home/vandezan/progs/crest/src/legacy_wrappers.f90:106:34:

  106 |       call crest_xtbsp(env,-1,mol)
      |                                  1
Error: More actual than formal arguments in procedure call at (1)

Seeing that calls elsewhere (and what I presume to be the definition) have a variable number of arguments, the problem is unclear to me, but I tried just deleting the last argument (consistent with line 91).

4

Compilation then continued until I got the following error:

/home/vandezan/progs/crest/src/ztopology.f90:971:20:

  971 |             if (all(ringtracker(:,k) .eq. tmpmem(:))) then
      |                    1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.

Which was an easy enough fix, and compilation finally succeeded.

5

I then attempted running crest on benzene, and received the following error:

Fortran runtime error: EXECUTE_COMMAND_LINE: Invalid command line

Error termination. Backtrace:
#0  0x7effe6d8ead0 in ???
#1  0x7effe6d8f649 in ???
#2  0x7effe6d8faf9 in ???
#3  0x7effe7000cdc in ???
#4  0x7effe7000f69 in ???
#5  0x7effe700102f in ???
#6  0x55dbfdd954a6 in xtbopt_
        at /home/vandezan/progs/crest/src/legacy_algos/confscript2_misc.f90:191
#7  0x55dbfded7ddc in crest
        at /home/vandezan/progs/crest/src/crest_main.f90:241
#8  0x55dbfdba7f8e in main
        at /home/vandezan/progs/crest/src/crest_main.f90:26

Presumably one of my edits is incorrect, but I'm unsure of which one.

pprcht commented 1 year ago

Just removing lines is typically a bad idea...

I updated the 3.0dev branch and the default builds should now work.

However, there are a couple of things to consider. This is a challenging build as it tries to integrate new external libraries such as https://github.com/tblite/tblite, which at the moment can cause some issues. For now I've turned off this part by default, but it shouldn't affect much of the implementations. Also, by default I'm building the binary with a meson/ifort build, which will produce a statically linked executable. You will usually be on the safer side if you use the same, however, there are some issues with the newer ifort versions I haven't come to fixing yet. ifort2021 or ifort2022 should work fine, you can basically follow the commands in .github/workflows/build.yml. The CMake/gfortran build you are attempting is not well tested, but I'm able to build it and run the program. This build produces a dynamically linked binary. Overall there is quite a bit of development going on, so new issues are sure to arise. Feel free to write if further help is required. I'll also gladly share the compiled binary, should the build get stuck.

jevandezande commented 1 year ago

Well if I delete enough lines of code, it will eventually compile...I just might not have anything left.

Compiling the updated version with gcc/gfortran was successful, but still led to Invalid command line errors. I'm currently obtaining the Intel compilers, but the problems mentioned above have been solved. Thanks.