From 7be84e1a34019b1eb09374a4295dcacf24002e0b Mon Sep 17 00:00:00 2001 From: Josh Buckner Date: Wed, 27 Nov 2019 14:36:19 -0500 Subject: [PATCH] fix broken gamus install --- CMakeLists.txt | 17 ++ configure | 2 + doc/gamus.info | 15 +- install.com | 6 +- source/gamus/gamus.F90 | 4 +- test/c44test/domdec_minimize.inp | 295 +++++++++++++++++++++++++++++++ tool/cmake/prefx_keywords.cmake | 4 + 7 files changed, 334 insertions(+), 9 deletions(-) create mode 100644 test/c44test/domdec_minimize.inp diff --git a/CMakeLists.txt b/CMakeLists.txt index e45009b40..99643d98b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ option(quantum "QUANTUM support" ON) # default OFF features which users must specifically request option(abpo "ABPO support; requires MPI and activates ENSEMBLE") option(domdec_gpu "DOMDEC GPU support") +option(gamus "GAMUS support") option(ensemble "support for ENSEMBLE replicas; requires MPI") option(in_place_install "install binaries and libraries in the source root directory") option(lite "compile with minimal features") @@ -784,6 +785,22 @@ endif() set_property(TARGET charmm PROPERTY LINKER_LANGUAGE Fortran) +if(gamus) + if(lite) + message(FATAL_ERROR + "The lite build is incompatible with GAMUS.") + endif() + + find_package(LAPACK) + + if(NOT LAPACK_FOUND) + message(FATAL_ERROR + "LAPACK support was not found and is required for GAMUS.") + endif() + + target_link_libraries(charmm ${LAPACK_LINKER_FLAGS} ${LAPACK_LIBRARIES}) +endif(gamus) + if(CMAKE_GENERATOR MATCHES Ninja) list(APPEND LOWER_OPT_FILES source/dynamc/dynamc.F90 diff --git a/configure b/configure index e91dc4a9e..f3d95ad34 100755 --- a/configure +++ b/configure @@ -33,6 +33,8 @@ show_help() { echo " link only static libs for a portable executable" echo "-u, --domdec_gpu" echo " include support for DOMDEC_GPU" + echo "--with-gamus" + echo " include support for GAMUS" echo "--repdstr" echo " include support for REPDSTR" echo "-s, --sccdftb" diff --git a/doc/gamus.info b/doc/gamus.info index 14b5ca6c9..14f46aa86 100644 --- a/doc/gamus.info +++ b/doc/gamus.info @@ -253,14 +253,19 @@ File: GAMUS, Node: Installation, Up: Top, Previous: Caveats, Next: Examples GAMUS requires an implementation of LAPACK in order to perform linear algebra as part of the E-M and MARE algorithms. -To compile CHARMM with GAMUS included add the keyword GAMUS to the install.com -command line, for example: +To compile CHARMM with GAMUS included add the option '--with-gamus' +to the configure command line, for example: -./install.com gnu large gfortran x86_64 gamus +./configure --with-gamus Since the name and path of the LAPACK library can vary from one system to -another, the installer will prompt for the necessary link options. -These options will be added to the link command line. +another, cmake will attempt to find a suitable LAPACK installation +and linker options. These options will be added to the link command line. +If the options are not determined correctly, one may set the cmake variables +LAPACK_LINKER_FLAGS and LAPACK_LIBRARIES to the required linker flags (excluding -l and -L) and to the libraries (using full path name) to link against to use LAPACK respectively. The cmake variables may be set using the '-D' option +to the configure command. If all else fails, one may set +the environment variable LDFLAGS before running the configure command +with the correct options, such as -L and -l options.  File: GAMUS, Node: Examples, Up: Top, Previous: Installation, Next: Top diff --git a/install.com b/install.com index d4917ec6b..870a59eb6 100755 --- a/install.com +++ b/install.com @@ -1385,8 +1385,10 @@ flag: echo -n ">> " set lapackopts = "$<" #echo $lapackopts - awk -v lapackopts="$lapackopts" '/QLIB =/ { print "QLIB = "lapackopts; next} /./ {print $0}' \ - $chmbuild/Makefile_$chmhost > $chmbuild/Makefile_$$ + #awk -v lapackopts="$lapackopts" '/QLIB =/ { print "QLIB = "lapackopts; next} /./ {print $0}' \ + # $chmbuild/Makefile_$chmhost > $chmbuild/Makefile_$$ + cat $chmbuild/Makefile_$chmhost | \ + sed -e "s@QLIB =@QLIB = $lapackopts@" > $chmbuild/Makefile_$$ /bin/mv $chmbuild/Makefile_$$ $chmbuild/Makefile_$chmhost awk '/gamint/ { print "\t$(LIB)/gamus.a \\" } \ /./ {print $0}' \ diff --git a/source/gamus/gamus.F90 b/source/gamus/gamus.F90 index 030e44841..745bdf35d 100644 --- a/source/gamus/gamus.F90 +++ b/source/gamus/gamus.F90 @@ -604,7 +604,7 @@ contains use chm_kinds use memory use stream - use param_store, only: set_params + use param_store, only: set_param implicit none integer :: ngauss @@ -612,7 +612,7 @@ contains if (allocated(params%weight)) call dealloc_gmm_parameter(params) mgamus=ngauss - call set_params("NGAUSS",ngauss) + call set_param("NGAUSS",ngauss) call alloc_gmm_parameter(ngauss,idgamus,params) end subroutine gamusrealloc diff --git a/test/c44test/domdec_minimize.inp b/test/c44test/domdec_minimize.inp new file mode 100644 index 000000000..92d05a133 --- /dev/null +++ b/test/c44test/domdec_minimize.inp @@ -0,0 +1,295 @@ +* This test case tests domdec minimization options +* + +if ?domdec .ne. 1 then + echo "Test NOT performed. DOMDEC must be compiled" + stop +endif + +stream datadir.def + +set tol = 0.02 +set tolr = 0.006 +set nsteps 2500 +system "rm diffs.txt" +bomlev -2 +read rtf card name @0/top_all36_prot.rtf +read param card name @0/par_all36_prot.prm +bomlev 0 +read sequ ala 1 + +generate ala first ace last ct3 setup + +ic param +ic seed 1 cay 1 cy 1 n +ic build + +coor orie + +set returnpoint = r1 +set lambda = 0.5 +set temp = 298 +goto msld +label r1 + +coor copy compare + +scalar x store 1 +scalar y store 2 +scalar z store 3 + +set L 100 +Crystal define cubic @L @L @L 90 90 90 +open unit 1 read form name @0/cubic.xtl +crystal read card unit 1 +close unit 1 +image byseg xcen 0.0 ycen 0.0 zcen 0.0 select all end + +energy fswitch vswitch + +scalar x recall 1 +scalar y recall 2 +scalar z recall 3 + +mini sd nstep @nsteps +set sener = ?ener +set sbond = ?bond +set sangl = ?angl +set surey = ?urey +set sdihe = ?dihe +set simpr = ?impr +set svdw = ?vdw +set selec = ?elec + +scalar x store 4 +scalar y store 5 +scalar z store 6 + +scalar x recall 1 +scalar y recall 2 +scalar z recall 3 + +mini abnr nstep @nsteps +set aener = ?ener +set abond = ?bond +set aangl = ?angl +set aurey = ?urey +set adihe = ?dihe +set aimpr = ?impr +set avdw = ?vdw +set aelec = ?elec + +scalar x store 7 +scalar y store 8 +scalar z store 9 + +set statusall = pass +set m = 1 +label domini + + if @m eq 1 set mini = sd + if @m eq 2 set mini = abnr + set d = 1 + label dodomdec + set status = pass + if @d eq 1 set domdec = + if @d eq 2 set domdec = gpu on + if @d eq 3 set domdec = gpu only + + scalar x recall 1 + scalar y recall 2 + scalar z recall 3 + + energy domdec @{domdec} + + mini @{mini} nstep @nsteps + + energy domdec @{domdec} + + if @m eq 1 then + calc dsener = abs ( @sener - ?ener ) + calc dsbond = abs ( @sbond - ?bond ) + calc dsangl = abs ( @sangl - ?angl ) + calc dsurey = abs ( @surey - ?urey ) + calc dsdihe = abs ( @sdihe - ?dihe ) + calc dsimpr = abs ( @simpr - ?impr ) + calc dsvdw = abs ( @svdw - ?vdw ) + calc dselec = abs ( @selec - ?elec ) + if @{dsener} gt @tol then + echo FAIL: ener @{mini} @{domdec} @sener ?ener + set status = fail + else + echo PASS: ener @{mini} @{domdec} @sener ?ener + endif + if @{dsbond} gt @tol then + echo FAIL: bond @{mini} @{domdec} @sbond ?bond + set status = fail + else + echo PASS: bond @{mini} @{domdec} @sbond ?bond + endif + if @{dsangl} gt @tol then + echo FAIL: angl @{mini} @{domdec} @sangl ?angl + set status = fail + else + echo PASS: angl @{mini} @{domdec} @sangl ?angl + endif + if @{dsurey} gt @tol then + echo FAIL: urey @{mini} @{domdec} @surey ?urey + set status = fail + else + echo PASS: urey @{mini} @{domdec} @surey ?urey + endif + if @{dsdihe} gt @tol then + echo FAIL: dihe @{mini} @{domdec} @sdihe ?dihe + set status = fail + else + echo PASS: dihe @{mini} @{domdec} @sdihe ?dihe + endif + if @{dsimpr} gt @tol then + echo FAIL: impr @{mini} @{domdec} @simpr ?impr + set status = fail + else + echo PASS: impr @{mini} @{domdec} @simpr ?impr + endif + if @{dsvdw} gt @tol then + echo FAIL: vdw @{mini} @{domdec} @svdw ?vdw + set status = fail + else + echo PASS: vdw @{mini} @{domdec} @svdw ?vdw + endif + if @{dselec} gt @tol then + echo FAIL: elec @{mini} @{domdec} @selec ?elec + set status = fail + else + echo PASS: elec @{mini} @{domdec} @selec ?elec + endif + scalar xcomp recall 4 + scalar ycomp recall 5 + scalar zcomp recall 6 + coor rms + if ?rms .gt. @tolr then + echo FAIL: rms @{mini} @{domdec} ?rms + set status = fail + else + echo PASS: rms @{mini} @{domdec} ?rms + endif + + else + + calc daener = abs ( @aener - ?ener ) + calc dabond = abs ( @abond - ?bond ) + calc daangl = abs ( @aangl - ?angl ) + calc daurey = abs ( @aurey - ?urey ) + calc dadihe = abs ( @adihe - ?dihe ) + calc daimpr = abs ( @aimpr - ?impr ) + calc davdw = abs ( @avdw - ?vdw ) + calc daelec = abs ( @aelec - ?elec ) + if @{daener} gt @tol then + echo FAIL: ener @{mini} @{domdec} @aener ?ener + set status = fail + else + echo PASS: ener @{mini} @{domdec} @aener ?ener + endif + if @{dabond} gt @tol then + echo FAIL: bond @{mini} @{domdec} @abond ?bond + set status = fail + else + echo PASS: bond @{mini} @{domdec} @abond ?bond + endif + if @{daangl} gt @tol then + echo FAIL: angl @{mini} @{domdec} @aangl ?angl + set status = fail + else + echo PASS: angl @{mini} @{domdec} @aangl ?angl + endif + if @{daurey} gt @tol then + echo FAIL: urey @{mini} @{domdec} @aurey ?urey + set status = fail + else + echo PASS: urey @{mini} @{domdec} @aurey ?urey + endif + if @{dadihe} gt @tol then + echo FAIL: dihe @{mini} @{domdec} @adihe ?dihe + set status = fail + else + echo PASS: dihe @{mini} @{domdec} @adihe ?dihe + endif + if @{daimpr} gt @tol then + echo FAIL: impr @{mini} @{domdec} @aimpr ?impr + set status = fail + else + echo PASS: impr @{mini} @{domdec} @aimpr ?impr + endif + if @{davdw} gt @tol then + echo FAIL: vdw @{mini} @{domdec} @avdw ?vdw + set status = fail + else + echo PASS: vdw @{mini} @{domdec} @avdw ?vdw + endif + if @{daelec} gt @tol then + echo FAIL: elec @{mini} @{domdec} @aelec ?elec + set status = fail + else + echo PASS: elec @{mini} @{domdec} @aelec ?elec + endif + scalar xcomp recall 7 + scalar ycomp recall 8 + scalar zcomp recall 9 + coor rms + if ?rms .gt. @tolr then + echo FAIL: rms @{mini} @{domdec} ?rms + set status = fail + else + echo PASS: rms @{mini} @{domdec} ?rms + endif + endif + + echo Status of @{mini} @{domdec} is @status + if @status eq fail set statusall = fail + incr d by 1 + if @d le 3 goto dodomdec + incr m by 1 +if @m le 2 goto domini + +echo Status of all @statusall +stop + +label msld + + replica a nrep 1 select ( type cb .or. type hb* ) show end + + print coor + + define side select type cb .or. type hb* show end + define g1 select side .and. segid ala show end + define g2 select side .and. segid a1 show end + + set lambda2 = @lambda + calc lambda1 = 1 - @lambda + + + BLOCK 3 + Call 2 sele g1 show end + Call 3 sele g2 show end + + qldm theta + lang temp @temp + + ldin 1 1.0 0.0 5.0 0.0 5.0 + ldin 2 @lambda1 0.0 5.0 0.00 5.0 + ldin 3 @lambda2 0.0 5.0 0.00 5.0 + + nora ! no random forces + excl 2 3 + rmla bond thet impr dihe + + msld 0 1 1 ffix + msma + + ldbi 0 ! no biasing potentials + + soft on + pmel on + end + +goto @returnpoint diff --git a/tool/cmake/prefx_keywords.cmake b/tool/cmake/prefx_keywords.cmake index 38ba841f0..27adada33 100644 --- a/tool/cmake/prefx_keywords.cmake +++ b/tool/cmake/prefx_keywords.cmake @@ -161,6 +161,10 @@ if(tsri) RGYCONS) endif(tsri) +if(gamus) + list(APPEND keywords GAMUS) +endif() + if(pipf) list(APPEND keywords PIPF) endif(pipf) -- 2.24.0