From 47963d8246243e0c568980ccaf6c3109cae2665a Mon Sep 17 00:00:00 2001 From: Markus Eisenbach Date: Thu, 2 Nov 2023 11:21:06 -0400 Subject: [PATCH] Cleaned up compilation warnings and linking issues on macos wit Xcode 15 --- src/Core/radialSolver.cpp | 1 + src/Kubo/CurrentMatrix.hpp | 4 ++-- src/Main/initializeAtom.cpp | 2 +- src/Main/wl_lsms.cpp | 2 +- src/Mixer/Mixer.hpp | 2 ++ src/Potential/XCBase.hpp | 2 ++ src/Potential/newPotential.hpp | 1 + toolchain/macos-gfortran.cmake | 10 +++++++--- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Core/radialSolver.cpp b/src/Core/radialSolver.cpp index 8693a7fa7..9b9e42efd 100644 --- a/src/Core/radialSolver.cpp +++ b/src/Core/radialSolver.cpp @@ -5,6 +5,7 @@ #include #include #include +#include void lsms::nrel_in(double energy, int l_qn, double *p_array, double *q_array, const double *__restrict__ r_mesh, diff --git a/src/Kubo/CurrentMatrix.hpp b/src/Kubo/CurrentMatrix.hpp index 3f0ae98ad..6cd940f06 100644 --- a/src/Kubo/CurrentMatrix.hpp +++ b/src/Kubo/CurrentMatrix.hpp @@ -12,14 +12,14 @@ #include "MultipleScattering/linearSolvers.hpp" #include "MultipleScattering/MultipleScattering.hpp" #include "MultipleScattering/buildKKRMatrix.hpp" -#include "Accelerator/DeviceStorage.hpp" #if defined(ACCELERATOR_LIBSCI) || defined(ACCELERATOR_CUDA_C) || defined(ACCELERATOR_HIP) +#include "Accelerator/DeviceStorage.hpp" extern DeviceStorage *deviceStorage; #endif class CurrentMatrix { public: - Complex sqrtm1 = (0.0,1.0); + const Complex sqrtm1 = Complex(0.0,1.0); Complex energy,prel,pnrel; int local_index, is,lmax_cg,kkrsz,nrmat; AtomData *atom; diff --git a/src/Main/initializeAtom.cpp b/src/Main/initializeAtom.cpp index 6a4776496..5b29d288f 100644 --- a/src/Main/initializeAtom.cpp +++ b/src/Main/initializeAtom.cpp @@ -406,7 +406,7 @@ int calculateAtomLevels(AtomData &a, std::vector &atomLevels, FILE *orbitalFile; if (writeOrbitals) { for (int nl = 0; nl < atomLevels.size(); nl++) { - sprintf(fname, "orbital_density_n%d_l%d", atomLevels[nl].n, + snprintf(fname, 250, "orbital_density_n%d_l%d", atomLevels[nl].n, atomLevels[nl].l); orbitalFile = fopen(fname, "w"); diff --git a/src/Main/wl_lsms.cpp b/src/Main/wl_lsms.cpp index 7826287f6..11c921a4d 100644 --- a/src/Main/wl_lsms.cpp +++ b/src/Main/wl_lsms.cpp @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) { num_steps = 1; initial_steps = 0; - sprintf(i_lsms_name, "i_lsms"); + snprintf(i_lsms_name, 60, "i_lsms"); gWL_in_name[0] = gWL_out_name[0] = 0; mode_name[0] = 0; energy_calculation_name[0] = 0; diff --git a/src/Mixer/Mixer.hpp b/src/Mixer/Mixer.hpp index 0402b4a70..7cd69496c 100644 --- a/src/Mixer/Mixer.hpp +++ b/src/Mixer/Mixer.hpp @@ -26,6 +26,8 @@ class AbstractMixer { unsigned int mixerType, const RealMixingVector &mixVector, const MixingParameter ¶ms); + virtual ~AbstractMixer() = default; + }; /** diff --git a/src/Potential/XCBase.hpp b/src/Potential/XCBase.hpp index dd8e21ace..a3f828632 100644 --- a/src/Potential/XCBase.hpp +++ b/src/Potential/XCBase.hpp @@ -30,6 +30,8 @@ class XCBase { Real xc_pot_out[2]) = 0; virtual std::string get_name() = 0; + + virtual ~XCBase() = default; }; } // namespace lsms diff --git a/src/Potential/newPotential.hpp b/src/Potential/newPotential.hpp index 96903d43c..a5180a057 100644 --- a/src/Potential/newPotential.hpp +++ b/src/Potential/newPotential.hpp @@ -30,6 +30,7 @@ class Potential { LocalTypeInfo &local, CrystalParameters &crystal, std::vector &qsub) = 0; + virtual ~Potential() = default; }; class ASAPotential : public Potential { diff --git a/toolchain/macos-gfortran.cmake b/toolchain/macos-gfortran.cmake index a82076f41..fd6b3231e 100644 --- a/toolchain/macos-gfortran.cmake +++ b/toolchain/macos-gfortran.cmake @@ -7,9 +7,13 @@ set(MST_BUILD_KKR_MATRIX_DEFAULT 0x1000) set(BLA_VENDOR Apple) set(CMAKE_CXX_COMPILER "mpic++") -set(CMAKE_C_COMPILER "gcc-11") +set(CMAKE_C_COMPILER "gcc-13") + +set(BUILD_WITH_OPENMP OFF) set(CMAKE_BUILD_TYPE Release) set(CMAKE_CXX_FLAGS "-O3 -mtune=native") -set(libxc_LIBRARIES "/Users/vie/Documents/MuST/external/libxc/LibXC/lib/libxc.a") -set(libxc_INCLUDE_DIR "/Users/vie/Documents/MuST/external/libxc/LibXC/include") +set(LINK_FLAGS "-Wl,-ld_classic") +# set(LINK_FLAGS "-ld64") +# set(libxc_LIBRARIES "/Users/vie/Documents/MuST/external/libxc/LibXC/lib/libxc.a") +# set(libxc_INCLUDE_DIR "/Users/vie/Documents/MuST/external/libxc/LibXC/include")