From 163f50a913f3af981ef33207785222333daed086 Mon Sep 17 00:00:00 2001 From: Cher-Tian Ser <45384530+chertianser@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:12:24 -0500 Subject: [PATCH 1/3] Reinitialize env%calc between timestep iterations (#453) --- src/algos/setuptest.f90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/algos/setuptest.f90 b/src/algos/setuptest.f90 index c118957d..720d73c6 100644 --- a/src/algos/setuptest.f90 +++ b/src/algos/setuptest.f90 @@ -60,6 +60,7 @@ subroutine trialMD_calculator(env) type(timer) :: profiler type(calcdata) :: tmpcalc + type(calcdata) :: calcstart real(wp) :: energy real(wp),allocatable :: grd(:,:) integer :: T,Tn @@ -104,6 +105,7 @@ subroutine trialMD_calculator(env) MTD%mtdtype = cv_rmsd MTD%cvdump_fs = 550.0_wp call MDSTART%add(MTD) + calcstart = env%calc !> Save clean state before loop pr = .false. !> supress stdout printout of MD @@ -121,6 +123,8 @@ subroutine trialMD_calculator(env) !>--- Restore initial starting geometry mol = molstart +!>--- Restore clean calculation state + env%calc = calcstart !>--- Modify MD output trajectory MD = MDSTART MD%tstep = tstep From 6257b08ae2bcf693ff4470185893ec787887d7cf Mon Sep 17 00:00:00 2001 From: Philipp Pracht <42216327+pprcht@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:56:24 +0100 Subject: [PATCH 2/3] 3.0.2 maintenance (#456) A small refactor of the GitHub workflows plus: - adding alias for `--cinp`: `-C`/`-c` - position independent input file readout from cli - Update of the `tblite` submodule to its version 0.5.0 - activation of pre-optimization when selecting search runtypes via toml - `-grad`/`-nograd` flags for `--sp` runtype. --- .github/workflows/build-CI.yml | 216 +++++++++++++++++++ .github/workflows/build-upload.yml | 262 +++++++++++++++++++++++ .github/workflows/build.yml | 321 ----------------------------- README.md | 2 +- src/classes.f90 | 1 + src/confparse.f90 | 27 ++- src/legacy_wrappers.f90 | 16 +- src/parsing/parse_inputfile.F90 | 61 +++++- src/parsing/parse_maindata.f90 | 8 +- src/strucreader.f90 | 29 +-- subprojects/tblite | 2 +- 11 files changed, 584 insertions(+), 361 deletions(-) create mode 100644 .github/workflows/build-CI.yml create mode 100644 .github/workflows/build-upload.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-CI.yml b/.github/workflows/build-CI.yml new file mode 100644 index 00000000..b40f62b0 --- /dev/null +++ b/.github/workflows/build-CI.yml @@ -0,0 +1,216 @@ +name: CI + +on: + push: + pull_request: + +env: + BUILD_DIR: _build + PIP_PACKAGES: >- + meson!=1.8.0 + cmake + ninja + PIP_EXTRAS: >- + pkgconfig + numpy + ase + matplotlib + LINUX_INTEL_COMPONENTS: >- + intel-oneapi-compiler-fortran-2023.1.0 + intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 + intel-oneapi-mkl-2023.1.0 + intel-oneapi-mkl-devel-2023.1.0 + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + build-type: [debug] + toolchain: + - { compiler: gcc, version: '11', build: cmake } + - { compiler: gcc, version: '12', build: cmake } + - { compiler: gcc, version: '14', build: cmake } + - { compiler: intel, version: '2023.1.0', build: cmake } + + include: + # ---- Linux GCC CMake debugoptimized build ------------------------ + - { os: ubuntu-latest, build-type: debugoptimized, + toolchain: { compiler: gcc, version: '14', build: cmake } } + + # ---- Linux static builds ----------------------------------------- + - { os: ubuntu-latest, build-type: static, + toolchain: { compiler: gcc, version: '12', build: cmake } } + - { os: ubuntu-latest, build-type: static, + toolchain: { compiler: intel, version: '2023.1.0', build: meson } } + + # ---- macOS GCC CMake debug builds -------------------------------- + - { os: macos-latest, build-type: debug, + toolchain: { compiler: gcc, version: '12', build: cmake } } + - { os: macos-latest, build-type: debug, + toolchain: { compiler: gcc, version: '14', build: cmake } } + + defaults: + run: + shell: bash + + steps: + # ---------------------------------------------------------------------- + # Setup + # ---------------------------------------------------------------------- + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + # ---------------------------------------------------------------------- + # Compiler setup (GCC via setup-fortran, Intel via oneAPI on Linux) + # ---------------------------------------------------------------------- + + - name: Install GCC using setup-fortran + if: ${{ contains(matrix.toolchain.compiler, 'gcc') }} + uses: fortran-lang/setup-fortran@v1 + with: + compiler: ${{ matrix.toolchain.compiler }} # "gcc" + version: ${{ matrix.toolchain.version }} # e.g. "12" + + - name: Install libopenblas (Linux GNU builds only) + if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'gcc') }} + run: | + sudo apt-get update + sudo apt-get install -y libopenblas-dev + + - name: Install OpenBLAS (macOS) + if: ${{ contains(matrix.os, 'macos') }} + run: | + brew update + brew install openblas + echo "PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig:/opt/homebrew/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV + echo "LDFLAGS=-L/usr/local/opt/openblas/lib -L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV + echo "CPPFLAGS=-I/usr/local/opt/openblas/include -I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV + + - name: Prepare for Intel cache restore + if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'intel') }} + run: | + sudo mkdir -p /opt/intel + sudo chown "$USER" /opt/intel + + - name: Cache Intel oneAPI install + if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'intel') }} + id: cache-install + uses: actions/cache@v4 + with: + path: /opt/intel/oneapi + key: install-${{ matrix.toolchain.compiler }}-${{ matrix.toolchain.version }}-${{ matrix.os }} + + - name: Install Intel oneAPI (compiler + MKL) + if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }} + run: | + KEY=GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + wget https://apt.repos.intel.com/intel-gpg-keys/$KEY + sudo apt-key add $KEY + rm $KEY + + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install -y $PKG + env: + PKG: ${{ env.LINUX_INTEL_COMPONENTS }} + + - name: Setup Intel oneAPI environment + if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'intel') }} + run: | + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + + - name: Set compiler environment variables + run: | + if [ "${{ matrix.toolchain.compiler }}" = "gcc" ]; then + echo "FC=gfortran" >> $GITHUB_ENV + echo "CC=gcc" >> $GITHUB_ENV + elif [ "${{ matrix.toolchain.compiler }}" = "intel" ]; then + # adjust to ifx/ifort if we want to change it in the future + echo "FC=ifort" >> $GITHUB_ENV + echo "CC=icx" >> $GITHUB_ENV + fi + echo "COMPILER_VERSION=${{ matrix.toolchain.version }}" >> $GITHUB_ENV + + # ---------------------------------------------------------------------- + # Dependencies & submodules + # ---------------------------------------------------------------------- + + - name: Git submodules checkout + run: git submodule update --init + + - name: Install build and test dependencies + run: | + pip3 install ${{ env.PIP_PACKAGES }} ${{ env.PIP_EXTRAS }} + + # ---------------------------------------------------------------------- + # Configure + # ---------------------------------------------------------------------- + + - name: Configure build (Meson) + if: ${{ matrix.toolchain.build == 'meson' }} + run: > + meson setup ${{ env.BUILD_DIR }} + --buildtype=debugoptimized + --prefix=$PWD/_dist + --libdir=lib + --warnlevel=0 + + - name: Configure build (CMake, debug) + if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'debug' }} + run: > + cmake -B${{ env.BUILD_DIR }} + -GNinja + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_INSTALL_PREFIX=$PWD/_dist + -DCMAKE_INSTALL_LIBDIR=lib + + - name: Configure build (CMake, debugoptimized) + if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'debugoptimized' }} + run: > + cmake -B${{ env.BUILD_DIR }} + -GNinja + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_INSTALL_PREFIX=$PWD/_dist + -DCMAKE_INSTALL_LIBDIR=lib + + - name: Configure build (CMake, static) + if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'static' }} + run: > + cmake -B${{ env.BUILD_DIR }} + -GNinja + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_INSTALL_PREFIX=$PWD/_dist + -DCMAKE_INSTALL_LIBDIR=lib + -DWITH_TESTS=OFF + -DSTATICBUILD=ON + + # ---------------------------------------------------------------------- + # Build / test / install + # ---------------------------------------------------------------------- + + - name: Build project + run: ninja -C ${{ env.BUILD_DIR }} + + - name: Run unit tests (ctest) + if: ${{ matrix.toolchain.build == 'cmake' && contains(matrix.toolchain.compiler, 'gcc') }} + run: | + ctest --output-on-failure --parallel 2 -R '^crest/' + working-directory: ${{ env.BUILD_DIR }} + env: + OMP_NUM_THREADS: 1,2,1 + + - name: Install project + run: | + ninja -C ${{ env.BUILD_DIR }} install + echo "CREST_PREFIX=$PWD/_dist" >> $GITHUB_ENV + diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml new file mode 100644 index 00000000..b7b7813a --- /dev/null +++ b/.github/workflows/build-upload.yml @@ -0,0 +1,262 @@ +name: Continuous release (static Linux) + +on: + push: + branches: + - main # ONLY upload on main branch + +env: + BUILD_DIR: _build + PIP_PACKAGES: >- + meson!=1.8.0 + cmake + ninja + PIP_EXTRAS: >- + pkgconfig + numpy + ase + matplotlib + LINUX_INTEL_COMPONENTS: >- + intel-oneapi-compiler-fortran-2023.1.0 + intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 + intel-oneapi-mkl-2023.1.0 + intel-oneapi-mkl-devel-2023.1.0 + +jobs: + build-static: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + build-type: [static] + toolchain: + # GNU static CMake build + - { compiler: gcc, version: '12', build: cmake } + # Intel static Meson build + - { compiler: intel, version: '2023.1.0', build: meson } + + defaults: + run: + shell: bash + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + # --- Compiler setup ---------------------------------------------------- + + - name: Install GCC (Linux) using setup-fortran + if: ${{ contains(matrix.toolchain.compiler, 'gcc') }} + uses: fortran-lang/setup-fortran@v1 + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + + - name: Install libopenblas (Linux GNU builds only) + if: ${{ contains(matrix.toolchain.compiler, 'gcc') }} + run: | + sudo apt-get update + sudo apt-get install -y libopenblas-dev + + - name: Prepare for Intel cache restore + if: ${{ contains(matrix.toolchain.compiler, 'intel') }} + run: | + sudo mkdir -p /opt/intel + sudo chown "$USER" /opt/intel + + - name: Cache Intel oneAPI install + if: ${{ contains(matrix.toolchain.compiler, 'intel') }} + id: cache-install + uses: actions/cache@v4 + with: + path: /opt/intel/oneapi + key: install-${{ matrix.toolchain.compiler }}-${{ matrix.toolchain.version }}-${{ matrix.os }} + + - name: Install Intel oneAPI (compiler + MKL) + if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }} + run: | + KEY=GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + wget https://apt.repos.intel.com/intel-gpg-keys/$KEY + sudo apt-key add $KEY + rm $KEY + + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install -y $PKG + env: + PKG: ${{ env.LINUX_INTEL_COMPONENTS }} + + - name: Setup Intel oneAPI environment + if: ${{ contains(matrix.toolchain.compiler, 'intel') }} + run: | + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + + - name: Set compiler environment variables + run: | + if [ "${{ matrix.toolchain.compiler }}" = "gcc" ]; then + echo "FC=gfortran" >> $GITHUB_ENV + echo "CC=gcc" >> $GITHUB_ENV + elif [ "${{ matrix.toolchain.compiler }}" = "intel" ]; then + echo "FC=ifort" >> $GITHUB_ENV + echo "CC=icx" >> $GITHUB_ENV + fi + echo "COMPILER_VERSION=${{ matrix.toolchain.version }}" >> $GITHUB_ENV + + # --- Dependencies & submodules --------------------------------------- + + - name: Git submodules checkout + run: git submodule update --init + + - name: Install build dependencies + run: | + pip3 install ${{ env.PIP_PACKAGES }} ${{ env.PIP_EXTRAS }} + + # --- Configure -------------------------------------------------------- + + - name: Configure build (Meson, static-ish) + if: ${{ matrix.toolchain.build == 'meson' }} + run: > + meson setup ${{ env.BUILD_DIR }} + --buildtype=debugoptimized + --prefix=$PWD/_dist + --libdir=lib + --warnlevel=0 + + - name: Configure build (CMake, static) + if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'static' }} + run: > + cmake -B${{ env.BUILD_DIR }} + -GNinja + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_INSTALL_PREFIX=$PWD/_dist + -DCMAKE_INSTALL_LIBDIR=lib + -DWITH_TESTS=OFF + -DSTATICBUILD=ON + + # --- Build / (optional) test / install -------------------------------- + + - name: Build project + run: ninja -C ${{ env.BUILD_DIR }} + + # (You can add tests here if you want for the release builds) + + - name: Install project + run: | + ninja -C ${{ env.BUILD_DIR }} install + echo "CREST_PREFIX=$PWD/_dist" >> $GITHUB_ENV + + - name: Create package + run: | + mkdir crest + cp COPYING crest/LICENSE + cp COPYING.LESSER crest/LICENSE.LESSER + cp _dist/bin/crest crest/ + OUTPUT="crest-${{ matrix.toolchain.compiler }}-${{ matrix.toolchain.version }}-${{ matrix.os }}.tar" + tar cvf "$OUTPUT" crest + xz -T0 "$OUTPUT" + echo "CREST_OUTPUT=${OUTPUT}.xz" >> $GITHUB_ENV + + - name: Upload package + uses: actions/upload-artifact@v4 + with: + name: ${{ env.CREST_OUTPUT }} + path: ${{ env.CREST_OUTPUT }} + + continuous-delivery: + if: github.event_name == 'push' + runs-on: ubuntu-latest + needs: + - build-static + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_TAG: latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install github-release + run: | + go install github.com/github-release/github-release@latest + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + + - name: Set GitHub user/repo + run: | + echo "GITHUB_USER=$( echo ${{ github.repository }} | cut -d/ -f1 )" >> $GITHUB_ENV + echo "GITHUB_REPO=$( echo ${{ github.repository }} | cut -d/ -f2 )" >> $GITHUB_ENV + + - name: Move/Create continuous tag + run: | + git tag --force ${{ env.RELEASE_TAG }} ${{ github.sha }} + git push --tags --force + + - name: Get Time + run: echo "TIME=$(date -u '+%Y/%m/%d, %H:%M')" >> $GITHUB_ENV + + - name: Check continuous release status + run: | + if ! github-release info -t ${{ env.RELEASE_TAG }} > /dev/null 2>&1; then + echo "RELEASE_COMMAND=release" >> $GITHUB_ENV + else + echo "RELEASE_COMMAND=edit" >> $GITHUB_ENV + fi + + - name: Setup continuous release + run: > + github-release ${{ env.RELEASE_COMMAND }} + --tag ${{ env.RELEASE_TAG }} + --name "Continuous release version" + --description "$DESCRIPTION" + --pre-release + env: + DESCRIPTION: | + Created on ${{ env.TIME }} UTC by @${{ github.actor }} with commit ${{ github.sha }}. + This is an automated distribution of the latest CREST version. + This version is only minimally tested and may be unstable or even crash. + Use with caution! + https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Create SHA256 checksums + run: | + cd artifacts + for f in crest-*.tar.xz; do + sha256sum "$f" > "$f.sha256.txt" + done + + - name: Upload CREST tarballs to release + run: | + cd artifacts + for f in crest-*.tar.xz; do + github-release upload \ + --tag ${{ env.RELEASE_TAG }} \ + --replace \ + --name "$f" \ + --file "$f" + done + + - name: Upload SHA256 checksums to release + run: | + cd artifacts + for f in crest-*.tar.xz.sha256.txt; do + github-release upload \ + --tag ${{ env.RELEASE_TAG }} \ + --replace \ + --name "$f" \ + --file "$f" + done + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index a59c5dd1..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,321 +0,0 @@ -name: CI - -on: [push, pull_request] - -env: - BUILD_DIR: _build - PIP_PACKAGES: >- - meson!=1.8.0 - cmake - ninja - PIP_EXTRAS: >- - pkgconfig - numpy - ase - matplotlib - LINUX_INTEL_COMPONENTS: >- - intel-oneapi-compiler-fortran-2023.1.0 - intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 - intel-oneapi-mkl-2023.1.0 - intel-oneapi-mkl-devel-2023.1.0 - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - build: [cmake] - build-type: [debug] - compiler: [gnu] - version: [11,12,14] - - include: - - os: ubuntu-latest - build: cmake - build-type: debug - compiler: intel - version: 2023.1.0 - - - os: macos-latest - build: cmake - build-type: debug - compiler: gnu - version: 12 - - - os: ubuntu-latest - build: cmake - build-type: debugoptimized - compiler: gnu - version: 14 - - - os: ubuntu-latest - build: cmake - build-type: static - compiler: gnu - version: 12 - - - os: ubuntu-latest - build: meson - build-type: static - compiler: intel - version: 2023.1.0 - - defaults: - run: - shell: ${{ matrix.shell || 'bash' }} - - env: - FC: ${{ matrix.compiler == 'intel' && 'ifort' || 'gfortran' }} - CC: ${{ matrix.compiler == 'intel' && 'icx' || 'gcc' }} - GCC_V: ${{ matrix.version }} - PYTHON_V: 3.9 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_V }} - - - name: Link pre-installed GCC and FC (macOS) - if: ${{ contains(matrix.os, 'macos') && matrix.compiler == 'gnu' }} - run: | - brew install openblas - gfortran_path=$( which gfortran-${{ env.GCC_V }} ) - gcc_path=$( which gcc-${{ env.GCC_V }} ) - gplusplus_path=$( which g++-${{ env.GCC_V }} ) - export FC=$gfortran_path - export CC=$gcc_path - export CXX=$gplusplus_path - ln -s $gfortran_path /usr/local/bin/gfortran - ln -s $gcc_path /usr/local/bin/gcc - ln -s $gplusplus_path /usr/local/bin/g++ - echo "PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV - echo "LDFLAGS=-L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV - echo "CPPFLAGS=-I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV - - - name: Install GCC (Linux) - if: ${{ contains(matrix.os, 'ubuntu') && matrix.compiler == 'gnu' }} - run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -y gcc-${{ env.GCC_V}} gfortran-${{ env.GCC_V }} - sudo update-alternatives \ - --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \ - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }} - - - name: Install libopenblas (Linux GNU build only) - if: ${{ matrix.compiler == 'gnu' && contains(matrix.os, 'ubuntu') }} - run: sudo apt-get update && sudo apt-get install -y libopenblas-dev - - - name: Prepare for cache restore - if: ${{ matrix.compiler == 'intel' }} - run: | - sudo mkdir -p /opt/intel - sudo chown $USER /opt/intel - - - name: Cache Intel install - if: ${{ matrix.compiler == 'intel' }} - id: cache-install - uses: actions/cache@v4 - with: - path: /opt/intel/oneapi - key: install-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }} - - - name: Install Intel (Linux) - if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }} - run: | - wget https://apt.repos.intel.com/intel-gpg-keys/${{ env.KEY }} - sudo apt-key add ${{ env.KEY }} - rm ${{ env.KEY }} - echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - sudo apt-get update - sudo apt-get install ${{ env.PKG }} - env: - KEY: GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - PKG: ${{ env.LINUX_INTEL_COMPONENTS }} - - - name: Setup Intel oneAPI environment - if: ${{ matrix.compiler == 'intel' }} - run: | - source /opt/intel/oneapi/setvars.sh - printenv >> $GITHUB_ENV - - - name: Git Sumbodules checkout - run: | - git submodule update --init - - - name: Install build and test dependencies - if: ${{ ! contains(matrix.os, 'windows') }} - run: pip3 install ${{ env.PIP_PACKAGES }} ${{ env.PIP_EXTRAS }} - - - name: Configure build (meson) - if: ${{ matrix.build == 'meson' }} - run: >- - meson setup ${{ env.BUILD_DIR }} - --buildtype=debugoptimized - --prefix=$PWD/_dist - --libdir=lib - --warnlevel=0 - - - name: Configure build (CMake, debug) - if: ${{ matrix.build == 'cmake' && matrix.build-type == 'debug' }} - run: >- - cmake -B${{ env.BUILD_DIR }} - -GNinja - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_INSTALL_PREFIX=$PWD/_dist - -DCMAKE_INSTALL_LIBDIR=lib - - - name: Configure build (CMake, static) - if: ${{ matrix.build == 'cmake' && matrix.build-type == 'debugoptimized' }} - run: >- - cmake -B${{ env.BUILD_DIR }} - -GNinja - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DCMAKE_INSTALL_PREFIX=$PWD/_dist - -DCMAKE_INSTALL_LIBDIR=lib - - - name: Configure build (CMake, static) - if: ${{ matrix.build == 'cmake' && matrix.build-type == 'static' }} - run: >- - cmake -B${{ env.BUILD_DIR }} - -GNinja - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DCMAKE_INSTALL_PREFIX=$PWD/_dist - -DCMAKE_INSTALL_LIBDIR=lib - -DWITH_TESTS=OFF - -DSTATICBUILD=ON - - - name: Build project - run: ninja -C ${{ env.BUILD_DIR }} - - - name: Run unit tests (ctest) - if: ${{ matrix.build == 'cmake' && matrix.compiler == 'gnu' }} - run: | - ctest --output-on-failure --parallel 2 -R '^crest/' - working-directory: ${{ env.BUILD_DIR }} - env: - OMP_NUM_THREADS: 1,2,1 - - - name: Install project - run: | - ninja -C ${{ env.BUILD_DIR }} install - echo "CREST_PREFIX=$PWD/_dist" >> $GITHUB_ENV - - - name: Create package - if: ${{ matrix.build-type == 'static' }} - run: | - mkdir crest - cp COPYING crest/LICENSE - cp COPYING.LESSER crest/LICENSE.LESSER - cp _dist/bin/crest crest/ - tar cvf ${{ env.OUTPUT }} crest - xz -T0 ${{ env.OUTPUT }} - echo "CREST_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV - env: - OUTPUT: crest-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}.tar - - - name: Upload package - if: ${{ matrix.build-type == 'static' }} - uses: actions/upload-artifact@v4 - with: - name: ${{ env.CREST_OUTPUT }} - path: ${{ env.CREST_OUTPUT }} - - - continuous-delivery: - if: github.event_name == 'push' - runs-on: ubuntu-latest - needs: - - build - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG: latest - - steps: - - uses: actions/checkout@v4 - - - name: Install github-release - run: | - go install github.com/github-release/github-release@latest - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - - name: Set environment variables - run: | - echo "GITHUB_USER=$( echo ${{ github.repository }} | cut -d/ -f1 )" >> $GITHUB_ENV - echo "GITHUB_REPO=$( echo ${{ github.repository }} | cut -d/ -f2 )" >> $GITHUB_ENV - - - name: Move/Create continuous tag - run: | - git tag --force ${{ env.RELEASE_TAG }} ${{ github.sha }} - git push --tags --force - - - name: Get Time - run: echo "TIME=$(date -u '+%Y/%m/%d, %H:%M')" >> $GITHUB_ENV - - - name: Check continuous release status - run: | - if ! github-release info -t ${{ env.RELEASE_TAG }} > /dev/null 2>&1; then - echo "RELEASE_COMMAND=release" >> $GITHUB_ENV - else - echo "RELEASE_COMMAND=edit" >> $GITHUB_ENV - fi - - - name: Setup continuous release - run: >- - github-release ${{ env.RELEASE_COMMAND }} - --tag ${{ env.RELEASE_TAG }} - --name "Continuous release version" - --description "$DESCRIPTION" - --pre-release - env: - DESCRIPTION: | - Created on ${{ env.TIME }} UTC by @${{ github.actor }} with commit ${{ github.sha }}. - This is an automated distribution of the latest CREST version. - This version is only minimally tested and may be unstable or even crash. - Use with caution! - https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - path: ${{ github.workspace }} # This will download all files - - - name: Create SHA256 checksums - run: | - for dir in crest-*.tar.xz; do - if [ -d "$dir" ]; then - sha256sum "$dir/$dir" > "$dir.sha256.txt" - fi - done - - - name: Upload CREST tarballs to release - run: | - for dir in crest-*.tar.xz; do - if [ -d "$dir" ]; then - github-release upload \ - --tag ${{ env.RELEASE_TAG }} \ - --replace \ - --name "${dir}" \ - --file "$dir/$dir" - fi - done - - - name: Upload SHA256 checksums to release - run: | - for file in crest-*.tar.xz.sha256.txt; do - github-release upload \ - --tag ${{ env.RELEASE_TAG }} \ - --replace \ - --name "$file" \ - --file "$file" - done - - diff --git a/README.md b/README.md index 83ef71d8..86b2065c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Conda Version](https://img.shields.io/conda/vn/conda-forge/crest?color=khaki)](https://anaconda.org/conda-forge/crest) [![DOI](https://img.shields.io/badge/DOI-10.1039%2Fc9cp06869d%20-blue)](http://dx.doi.org/10.1039/c9cp06869d) [![DOI](https://img.shields.io/badge/DOI-10.1063%2F5.0197592-blue)](https://doi.org/10.1063/5.0197592) -![CI workflow](https://github.com/crest-lab/crest/actions/workflows/build.yml/badge.svg) +[![CI workflow](https://github.com/crest-lab/crest/actions/workflows/build-CI.yml/badge.svg)](https://github.com/crest-lab/crest/actions/workflows/build-CI.yml) [![License: LGPL v3](https://img.shields.io/badge/license-LGPL_v3-coral.svg)](https://www.gnu.org/licenses/lgpl-3.0) [![Documentation](https://img.shields.io/badge/documentation-crest--lab.github.io%2Fcrest--docs%2F-gold)](https://crest-lab.github.io/crest-docs/) diff --git a/src/classes.f90 b/src/classes.f90 index 53050cb2..f24dbd9d 100644 --- a/src/classes.f90 +++ b/src/classes.f90 @@ -553,6 +553,7 @@ module crest_data logical :: fullcre = .false. !> calculate exact rotamer degeneracies logical :: gbsa !> use gbsa logical :: gcmultiopt !> 2 level optimization for GC in V2 + logical :: gradsp = .true. !> turn on/off gradient calculation in singlepoint logical :: heavyrmsd = .false. !> use only heavy atoms for RMSD in CREGEN? logical :: inplaceMode = .true. !> in-place mode: optimization dirs are created "on-the-fly" logical :: iterativeV2 !> iterative version of V2 (= V3) diff --git a/src/confparse.f90 b/src/confparse.f90 index f06d639d..203eec7e 100644 --- a/src/confparse.f90 +++ b/src/confparse.f90 @@ -330,18 +330,12 @@ subroutine parseflags(env,arg,nra) env%properties2 = p_none !> backup for env%properties env%iterativeV2 = .true. !> iterative crest V2 version env%preopt = .true. -!>--- check for input file - do i = 1,nra - argument = trim(arg(i)) - if (argument == '--input'.or.argument == '-i') then - call parseinputfile(env,trim(arg(i+1))) - exit - end if - if (i == 1.and.index(argument,'.toml') .ne. 0) then - call parseinputfile(env,trim(arg(1))) - exit - end if - end do +!>--- check for (TOML) input file + call find_input_file(arg,nra,idum) + if(idum.ne.0)then + call parseinputfile(env,trim(arg(idum))) + endif + !>--- first arg loop do i = 1,nra argument = trim(arg(i)) @@ -1261,6 +1255,11 @@ subroutine parseflags(env,arg,nra) close (ich) write (*,'(2x,a,1x,a)') trim(arg(i)),trim(arg(i+1)) + case ('-grad') + env%gradsp = .true. + case ('-nograd') + env%gradsp = .false. + case ('-len','-mdlen','-mdtime') !> set md length in ps atmp = arg(i+1) call to_lower(atmp) @@ -1362,11 +1361,11 @@ subroutine parseflags(env,arg,nra) env%cts%cbonds_md = .true. env%cts%cbonds_global = .false. end if - case ('-cfile','-cinp') !> specify the constrain file + case ('-cfile','-cinp','-C','-c') !> specify the constrain file ctmp = trim(arg(i+1)) if (ctmp(1:1) .ne. '-') then env%constraints = trim(ctmp) - write (*,'(2x,a,1x,a)') '--cinp :',trim(ctmp) + write (*,'(2x,a,1x,a)') argument//' :',trim(ctmp) end if case ('-fc','-forceconstant') ctmp = trim(arg(i+1)) diff --git a/src/legacy_wrappers.f90 b/src/legacy_wrappers.f90 index e32cd2cd..cad970f3 100644 --- a/src/legacy_wrappers.f90 +++ b/src/legacy_wrappers.f90 @@ -52,11 +52,17 @@ subroutine env2calc(env,calc,molin) cal%rdwbo = .false. cal%rddip = .false. !> except for SP runtype (from command line!) - if (env%crestver == crest_sp.and. & - & cal%id .ne. jobtype%turbomole) then - cal%rdwbo = .true. - cal%rddip = .true. - cal%rdqat = .true. + if (env%crestver == crest_sp) then + cal%rdgrad = env%gradsp + if (cal%id .ne. jobtype%turbomole) then + cal%rdwbo = .true. + cal%rddip = .true. + cal%rdqat = .true. + else + if (.not.env%gradsp) then + cal%other = '' + end if + end if end if !> implicit solvation diff --git a/src/parsing/parse_inputfile.F90 b/src/parsing/parse_inputfile.F90 index 4497c873..7f7bb201 100644 --- a/src/parsing/parse_inputfile.F90 +++ b/src/parsing/parse_inputfile.F90 @@ -27,9 +27,13 @@ module parse_inputfile public :: parse_test public :: parse_input + public :: find_input_file external creststop + integer,parameter :: nf = 2 + character(len=*),parameter :: ftypes(nf) = [& + & '.toml','.TOML'] !========================================================================================! !========================================================================================! contains !> MODULE PROCEDURES START HERE @@ -76,7 +80,7 @@ subroutine parse_input(fname,dict) case default write (stdout,'(a,a)') 'Unknown file format of input file ',trim(fname) call creststop(status_input) - case ('.toml') + case ('.toml','.TOML') #ifdef WITH_TOMLF !>--- parse .toml file via the toml-f library (the DEFAULT setting) call parse_tomlf(fname,dict) @@ -88,5 +92,60 @@ subroutine parse_input(fname,dict) end subroutine parse_input +!========================================================================================! + + subroutine find_input_file(args,nra,pos) + !******************************************* + !* A routine to look up an input file from + !* the list of command line arguments + !******************************************* + implicit none + integer,intent(in) :: nra + character(len=*) :: args(nra) + integer,intent(out) :: pos + + character(len=:),allocatable :: argument + logical,allocatable :: isinputfile(:) + logical,allocatable :: inputprio(:) + integer :: i,j,k,l + logical :: ex + + pos = 0 + allocate (isinputfile(nra),source=.false.) + allocate (inputprio(nra),source=.false.) + + do i = 1,nra + argument = args(i) + inquire (file=argument,exist=ex) + if (ex) then + do j = 1,nf + if (index(argument,ftypes(j)) .ne. 0) then + isinputfile(i) = .true. + if (i > 1) then + if (args(i-1) == '--input'.or.args(i-1) == '-i') then + inputprio(i) = .true. + end if + end if + end if + end do + end if + end do + + !> if there are multiple inputs given, we select the last one, + !> except if it was provided with --input/-i + !> (same logic applies for multiple --input/-i) + if (any(inputprio(:))) then + do i = 1,nra + if (inputprio(i)) pos = i + end do + elseif (any(isinputfile(:))) then + do i = 1,nra + if (isinputfile(i)) pos = i + end do + else + pos = 0 + end if + + end subroutine find_input_file !========================================================================================! end module parse_inputfile diff --git a/src/parsing/parse_maindata.f90 b/src/parsing/parse_maindata.f90 index 33fa9734..a192a973 100644 --- a/src/parsing/parse_maindata.f90 +++ b/src/parsing/parse_maindata.f90 @@ -168,7 +168,7 @@ subroutine parse_main_c(env,key,val,rd) env%preopt = .false. env%crestver = crest_scanning case ('search_1') - env%preopt = .false. + env%preopt = .true. env%crestver = crest_s1 env%runver = crest_s1 case ('mecp','mecp_search') @@ -176,7 +176,7 @@ subroutine parse_main_c(env,key,val,rd) env%crestver = crest_mecp env%runver = crest_mecp case ('imtd-gc') - env%preopt = .false. + env%preopt = .true. env%crestver = crest_imtd env%runver = 1 case ('nci-mtd','nci') @@ -203,7 +203,7 @@ subroutine parse_main_c(env,key,val,rd) env%crestver = crest_numhessian env%runver = crest_numhessian case ('rigidconf') - env%preopt = .false. + env%preopt = .true. env%crestver = crest_rigcon env%runver = crest_rigcon @@ -228,7 +228,7 @@ subroutine parse_main_c(env,key,val,rd) case ('ensemble_input','ensemble','input_ensemble') env%ensemblename = val env%inputcoords = val - case ('input','structure') + case ('input','structure','coord','coords') env%inputcoords = val call mol%open(val) call env%ref%load(mol) diff --git a/src/strucreader.f90 b/src/strucreader.f90 index 24c7e583..01acc3b8 100644 --- a/src/strucreader.f90 +++ b/src/strucreader.f90 @@ -1506,10 +1506,10 @@ subroutine coord_get_z(self,z) end subroutine coord_get_z !==================================================================! - - subroutine coord_cn_to_bond(self,cn,bond,cn_type,cn_thr) - implicit none - class(coord) :: self + + subroutine coord_cn_to_bond(self,cn,bond,cn_type,cn_thr) + implicit none + class(coord) :: self real(wp),intent(out),allocatable :: cn(:) real(wp),intent(out),allocatable,optional :: bond(:,:) real(wp),intent(in),optional :: cn_thr @@ -1519,8 +1519,7 @@ subroutine coord_cn_to_bond(self,cn,bond,cn_type,cn_thr) allocate (cn(self%nat),source=0.0_wp) call calculate_CN(self%nat,self%at,self%xyz,cn, & & cntype=cn_type,cnthr=cn_thr,bond=bond) - end subroutine coord_cn_to_bond - + end subroutine coord_cn_to_bond !=========================================================================================! !=========================================================================================! @@ -1935,12 +1934,14 @@ subroutine writecoord(self,fname) implicit none class(coord) :: self character(len=*),intent(in) :: fname + character(len=80) :: comment if (.not.allocated(self%xyz)) then write (*,*) 'Cannot write ',trim(fname),'. not allocated' end if if (index(fname,'.xyz') .ne. 0) then + write (comment,'(a,G0.12)') ' energy= ',self%energy self%xyz = self%xyz*bohr !to Angström - call wrxyz(fname,self%nat,self%at,self%xyz) + call wrxyz(fname,self%nat,self%at,self%xyz,comment) self%xyz = self%xyz/bohr !back else call wrc0(fname,self%nat,self%at,self%xyz) @@ -2230,14 +2231,14 @@ function grepenergy(line) integer :: i,io,k atmp = trim(line) energy = 0.0_wp - if(index(atmp,'energy=').ne.0)then - k=index(atmp,'energy=') - atmp=atmp(k+7:) + if (index(atmp,'energy=') .ne. 0) then + k = index(atmp,'energy=') + atmp = atmp(k+7:) read (atmp,*,iostat=io) energy - if(io.ne.0) energy=0.0_wp - else if(index(atmp,'energy:').ne.0)then - k=index(atmp,'energy:') - atmp=atmp(k+7:) + if (io .ne. 0) energy = 0.0_wp + else if (index(atmp,'energy:') .ne. 0) then + k = index(atmp,'energy:') + atmp = atmp(k+7:) read (atmp,*,iostat=io) energy if (io .ne. 0) energy = 0.0_wp else diff --git a/subprojects/tblite b/subprojects/tblite index 660d1678..6f6cd7d2 160000 --- a/subprojects/tblite +++ b/subprojects/tblite @@ -1 +1 @@ -Subproject commit 660d1678d6f36999d7ffda6e710d5ff00ff2f8ff +Subproject commit 6f6cd7d20d97b22ef00d420904343c7bb8e2afdf From 3f19b05268d15ea20b6bdcd9c78c2a5b03429337 Mon Sep 17 00:00:00 2001 From: Philipp Pracht Date: Mon, 24 Nov 2025 16:11:34 +0100 Subject: [PATCH 3/3] Correct branch name on GH workflow --- .github/workflows/build-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-upload.yml b/.github/workflows/build-upload.yml index b7b7813a..efba42c2 100644 --- a/.github/workflows/build-upload.yml +++ b/.github/workflows/build-upload.yml @@ -3,7 +3,7 @@ name: Continuous release (static Linux) on: push: branches: - - main # ONLY upload on main branch + - master # ONLY upload on master branch env: BUILD_DIR: _build