include:
- - local: '/admin/ci-templates/.include-template.yml'
+ - local: '/admin/ci-templates/.include-template.yml'
.configure-extends-template:
- extends:
- - .configure-build-template
- - .no-cache-template
- - .variables-template
- - .tags-template
+ extends:
+ - .configure-build-template
+ - .no-cache-template
+ - .variables-template
+ - .tags-template
.configure-release-extends-template:
- extends:
- - .configure-build-release-template
- - .no-cache-template
- - .variables-template
- - .tags-template
+ extends:
+ - .configure-build-release-template
+ - .no-cache-template
+ - .variables-template
+ - .tags-template
.build-extends-template:
- extends:
- - .binary-build-template
- - .build-cache-template
- - .variables-template
- - .tags-template
+ extends:
+ - .binary-build-template
+ - .build-cache-template
+ - .variables-template
+ - .tags-template
.test-extends-template:
- extends:
- - .test-base-template
- - .pull-cache-template
- - .test-script-template
- - .variables-template
- - .tags-template
+ extends:
+ - .test-base-template
+ - .pull-cache-template
+ - .test-script-template
+ - .variables-template
+ - .tags-template
.regressiontests-extends-template:
- extends:
- - .no-cache-template
- - .variables-template
- - .tags-template
+ extends:
+ - .no-cache-template
+ - .variables-template
+ - .tags-template
# CI is organized into stages so that if early stages fail
# the later ones are not run.
# Templates for configuration stage
.configure-gcc:
- extends:
- - .configure-extends-template
- - .gcc-before-script-template
- - .build-gcc-template
+ extends:
+ - .configure-extends-template
+ - .gcc-before-script-template
+ - .build-gcc-template
.configure-gcc-release:
- extends:
- - .configure-release-extends-template
- - .gcc-before-script-template
- - .build-gcc-template
+ extends:
+ - .configure-release-extends-template
+ - .gcc-before-script-template
+ - .build-gcc-template
.configure-gcc-cuda:
extends:
- .cuda-template
.configure-clang:
- extends:
- - .configure-extends-template
- - .clang-before-script-template
- - .build-clang-template
+ extends:
+ - .configure-extends-template
+ - .clang-before-script-template
+ - .build-clang-template
.configure-clang-release:
- extends:
- - .configure-release-extends-template
- - .clang-before-script-template
- - .build-clang-template
+ extends:
+ - .configure-release-extends-template
+ - .clang-before-script-template
+ - .build-clang-template
.configure-docs:
- extends:
- - .configure-extends-template
- - .configure-docs-template
- - .documentation-before-script-template
+ extends:
+ - .configure-extends-template
+ - .configure-docs-template
+ - .documentation-before-script-template
.configure-docs-release:
- extends:
- - .configure-extends-template
- - .configure-docs-release-template
- - .documentation-before-script-template
+ extends:
+ - .configure-extends-template
+ - .configure-docs-release-template
+ - .documentation-before-script-template
# Templates for build stage
.build-archive:
- extends:
- - .build-extends-template
- - .documentation-before-script-template
- - .build-docs-binary-template
- - .archive-build-template
+ extends:
+ - .build-extends-template
+ - .documentation-before-script-template
+ - .build-docs-binary-template
+ - .archive-build-template
.build-gcc:
- extends:
- - .build-extends-template
- - .gcc-before-script-template
- - .build-gcc-template
+ extends:
+ - .build-extends-template
+ - .gcc-before-script-template
+ - .build-gcc-template
.build-clang:
- extends:
- - .build-extends-template
- - .clang-before-script-template
- - .build-clang-template
+ extends:
+ - .build-extends-template
+ - .clang-before-script-template
+ - .build-clang-template
.build-docs-binary:
- extends:
- - .build-extends-template
- - .build-cache-template
- - .build-docs-binary-template
- - .documentation-before-script-template
+ extends:
+ - .build-extends-template
+ - .build-cache-template
+ - .build-docs-binary-template
+ - .documentation-before-script-template
.build-docs-webpage:
- extends:
- - .binary-build-template
- - .variables-template
- - .tags-template
- - .no-cache-template
- - .build-docs-webpage-template
- - .documentation-before-script-template
+ extends:
+ - .binary-build-template
+ - .variables-template
+ - .tags-template
+ - .no-cache-template
+ - .build-docs-webpage-template
+ - .documentation-before-script-template
.build-gcc-cuda:
extends:
# Templates for test stage
.test-gcc:
- extends:
- - .test-extends-template
- - .gcc-before-script-template
- - .test-gcc-template
+ extends:
+ - .test-extends-template
+ - .gcc-before-script-template
+ - .test-gcc-template
.test-gcc-cuda:
extends:
- .cuda-template
.test-clang:
- extends:
- - .test-extends-template
- - .clang-before-script-template
- - .test-clang-template
+ extends:
+ - .test-extends-template
+ - .clang-before-script-template
+ - .test-clang-template
# Special job to package regressiontest files and have them available for testing
# Runs during pre-build
prepare-regressiontests:
- extends:
- - .regressiontests-extends-template
- - .regressiontests-template
+ extends:
+ - .regressiontests-extends-template
+ - .regressiontests-template
prepare-release-version:
- extends:
- - .regressiontests-extends-template
- - .release-version-template
+ extends:
+ - .regressiontests-extends-template
+ - .release-version-template
# Initial build that always needs to pass before follow-up stages run
simple-build:
- extends:
- - .simple-build-template
- - .build-cache-template
- - .variables-template
- - .tags-template
- - .gcc-before-script-template
- - .build-gcc-template
- - .gcc7-template
+ extends:
+ - .simple-build-template
+ - .build-cache-template
+ - .variables-template
+ - .tags-template
+ - .gcc-before-script-template
+ - .build-gcc-template
+ - .gcc7-template
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ BUILD_DIR: simple-build
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- BUILD_DIR: simple-build
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
# Jobs running in first pre-build stage
configure-gcc-7:
- extends:
- - .configure-gcc
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-gcc-7-gmxapi:
- extends:
- - .configure-gcc
- - .configure-gmxapi-template
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-gcc
+ - .configure-gmxapi-template
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-gcc-7-double:
- extends:
- - .configure-gcc
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ CMAKE_PRECISION_OPTIONS: -DGMX_DOUBLE=ON
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- CMAKE_PRECISION_OPTIONS: -DGMX_DOUBLE=ON
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-gcc-8:
- extends:
- - .configure-gcc
- - .gcc8-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-gcc
+ - .gcc8-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 8
+ except:
variables:
- COMPILER_MAJOR_VERSION: 8
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-gcc-8-cuda-10.2:
extends:
- $GROMACS_RELEASE
configure-gcc-7-simd-sse41:
- extends:
- - .configure-gcc
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=SSE4.1"
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=SSE4.1"
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-clang-7:
- extends:
- - .configure-clang
- - .clang7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-clang
+ - .clang7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-clang-7-gmxapi:
- extends:
- - .configure-clang
- - .configure-gmxapi-template
- - .clang7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-clang
+ - .configure-gmxapi-template
+ - .clang7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ except:
variables:
- COMPILER_MAJOR_VERSION: 7
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-clang-8:
- extends:
- - .configure-clang
- - .clang8-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-clang
+ - .clang8-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: 8
+ except:
variables:
- COMPILER_MAJOR_VERSION: 8
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
# For version of clang before 7, we need to always provide the full version
# Use something like this instead in the download script:
# APT_COMPILER_VERSION=$(($COMPILER_MAJOR_VERSION < 7 ? "${COMPILER_MAJOR_VERSION}.0" : $COMPILER_MAJOR_VERSION))
configure-clang-6:
- extends:
- - .configure-clang
- - .clang6-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-clang
+ - .clang6-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ COMPILER_MAJOR_VERSION: "6.0"
+ CMAKE_MPI_OPTIONS: -DGMX_OPENMP=OFF
+ except:
variables:
- COMPILER_MAJOR_VERSION: "6.0"
- CMAKE_MPI_OPTIONS: -DGMX_OPENMP=OFF
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-clang-tidy:
- extends:
- - .configure-clang
- - .clang7-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-clang
+ - .clang7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ BUILD_DIR: build-clang-tidy
+ COMPILER_MAJOR_VERSION: 7
+ CMAKE_EXTRA_OPTIONS: -DCLANG_TIDY=clang-tidy-$COMPILER_MAJOR_VERSION -DGMX_CLANG_TIDY=ON -DGMX_COMPILER_WARNINGS=ON
+ EXTRA_INSTALLS: clang-tidy-$COMPILER_MAJOR_VERSION
+ except:
variables:
- BUILD_DIR: build-clang-tidy
- COMPILER_MAJOR_VERSION: 7
- CMAKE_EXTRA_OPTIONS: -DCLANG_TIDY=clang-tidy-$COMPILER_MAJOR_VERSION -DGMX_CLANG_TIDY=ON -DGMX_COMPILER_WARNINGS=ON
- EXTRA_INSTALLS: clang-tidy-$COMPILER_MAJOR_VERSION
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
configure-docs:
- extends:
- - .configure-docs
- needs:
- - job: simple-build
- artifacts: false
- variables:
- BUILD_DIR: build-docs
- CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
- except:
- variables:
- - $GROMACS_RELEASE
+ extends:
+ - .configure-docs
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ BUILD_DIR: build-docs
+ CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
+ except:
+ variables:
+ - $GROMACS_RELEASE
configure-docs-gmxapi:
- extends:
- - .configure-docs
- - .configure-gmxapi-template
- needs:
- - job: simple-build
- artifacts: false
+ extends:
+ - .configure-docs
+ - .configure-gmxapi-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ BUILD_DIR: build-docs-gmxapi
+ CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
+ except:
variables:
- BUILD_DIR: build-docs-gmxapi
- CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
- except:
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
# Only running in scheduled pipelines that are not release builds
configure-archive-nightly:
- stage: nightly-configure
- only:
- - triggers
- - schedules
- needs:
- - job: simple-build
- artifacts: false
- except:
- variables:
- - $GROMACS_RELEASE
- extends:
- - .configure-docs
+ stage: nightly-configure
+ only:
+ - triggers
+ - schedules
+ needs:
+ - job: simple-build
+ artifacts: false
+ except:
variables:
- BUILD_DIR: build-package
- CMAKE_SIMD_OPTIONS: -DGMX_SIMD=None
- CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_USE_RDTSCP=OFF
- CMAKE_MPI_OPTIONS: -DGMX_THREAD_MPI=OFF -DGMX_OPENMP=OFF
+ - $GROMACS_RELEASE
+ extends:
+ - .configure-docs
+ variables:
+ BUILD_DIR: build-package
+ CMAKE_SIMD_OPTIONS: -DGMX_SIMD=None
+ CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_USE_RDTSCP=OFF
+ CMAKE_MPI_OPTIONS: -DGMX_THREAD_MPI=OFF -DGMX_OPENMP=OFF
configure-archive-release:
- only:
- refs:
- - web
- - triggers
- - schedules
- variables:
- - $GROMACS_RELEASE
-
- extends:
- - .configure-docs
+ only:
+ refs:
+ - web
+ - triggers
+ - schedules
variables:
- BUILD_DIR: build-package
- CMAKE_SIMD_OPTIONS: -DGMX_SIMD=None
- CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_USE_RDTSCP=OFF
- CMAKE_MPI_OPTIONS: -DGMX_THREAD_MPI=OFF -DGMX_OPENMP=OFF
+ - $GROMACS_RELEASE
+
+ extends:
+ - .configure-docs
+ variables:
+ BUILD_DIR: build-package
+ CMAKE_SIMD_OPTIONS: -DGMX_SIMD=None
+ CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_USE_RDTSCP=OFF
+ CMAKE_MPI_OPTIONS: -DGMX_THREAD_MPI=OFF -DGMX_OPENMP=OFF
# Jobs running during build stage
build-gcc-7:
- extends:
- - .build-gcc
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
- - job: configure-gcc-7
- artifacts: true
- except:
- variables:
- - $GROMACS_RELEASE
+ extends:
+ - .build-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-gcc-7
+ artifacts: true
+ except:
+ variables:
+ - $GROMACS_RELEASE
build-gcc-7-gmxapi:
- extends:
- - .build-gcc
- - .gmxapi-extra-installs
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
- - job: configure-gcc-7-gmxapi
- artifacts: true
- except:
- variables:
- - $GROMACS_RELEASE
+ extends:
+ - .build-gcc
+ - .gmxapi-extra-installs
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-gcc-7-gmxapi
+ artifacts: true
+ except:
+ variables:
+ - $GROMACS_RELEASE
build-gcc-7-double:
- extends:
- - .build-gcc
- - .gcc7-template
- needs:
- - job: simple-build
- artifacts: false
- - job: configure-gcc-7-double
- artifacts: true
- except:
- variables:
- - $GROMACS_RELEASE
+ extends:
+ - .build-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-gcc-7-double
+ artifacts: true
+ except:
+ variables:
+ - $GROMACS_RELEASE
build-gcc-8:
extends:
# Jobs running in source checking stage
build-clang-tidy:
extends:
- - .build-clang
- - .clang7-template
- stage: source-check
+ - .build-gcc
+ - .gcc8-template
needs:
- job: simple-build
- artifacts: false
- - job: configure-clang-tidy
+ artifacts: false
+ - job: configure-gcc-8
artifacts: true
- variables:
- BUILD_DIR: build-clang-tidy
- COMPILER_MAJOR_VERSION: 7
- EXTRA_INSTALLS: clang-tidy-$COMPILER_MAJOR_VERSION
except:
variables:
- $GROMACS_RELEASE
-run-clang-format:
+build-gcc-7-simd-sse41:
extends:
- - .binary-build-template
- - .no-cache-template
- - .variables-template
- - .tags-template
- - .clang-before-script-template
- - .build-clang-template
- - .clang7-template
- stage: source-check
- when: always
+ - .build-gcc
+ - .gcc7-template
needs:
- job: simple-build
- artifacts: false
- variables:
- KUBERNETES_CPU_LIMIT: 1
- KUBERNETES_CPU_REQUEST: 1
- KUBERNETES_MEMORY_LIMIT: 2Gi
- COMPILER_MAJOR_VERSION: 7
- EXTRA_INSTALLS: clang-format-$COMPILER_MAJOR_VERSION
+ artifacts: false
+ - job: configure-gcc-7-simd-sse41
+ artifacts: true
except:
variables:
- $GROMACS_RELEASE
- script:
- - export CLANG_FORMAT=clang-format-$COMPILER_MAJOR_VERSION
- - admin/clang-format.sh check --rev=HEAD^ --warnings=clang-format.log
- - grep -iq "needs formatting" clang-format.log | tee formatting.txt || true
- - if [ -s formatting.txt ] ; then echo "clang-format.sh found issues"; exit 1; fi
- artifacts:
- when: on_failure
- paths:
- - clang-format.log
- - formatting.txt
-run-copyright-check:
+build-clang-7:
extends:
- - .binary-build-template
- - .no-cache-template
- - .variables-template
- - .tags-template
- - .clang-before-script-template
- - .build-clang-template
+ - .build-clang
- .clang7-template
-
- stage: source-check
- when: always
needs:
- job: simple-build
- artifacts: false
- variables:
- KUBERNETES_CPU_LIMIT: 1
- KUBERNETES_CPU_REQUEST: 1
- KUBERNETES_MEMORY_LIMIT: 2Gi
+ artifacts: false
+ - job: configure-clang-7
+ artifacts: true
except:
variables:
- $GROMACS_RELEASE
- script:
- - admin/copyright.sh check --rev=HEAD^ --warnings=copyright.log
- - grep -iq "copyright year" copyright.log | tee years.log || true
- - grep -iq "copyright header" copyright.log | tee headers.log || true
- - if [[ -s years.log || -s headers.log ]] ; then
- echo "Copyright information needs updating" ;
- exit 1 ;
- fi
- artifacts:
- when: on_failure
- paths:
- - copyright.log
- - years.log
- - headers.log
-run-check-source:
+build-clang-7-gmxapi:
extends:
- - .no-cache-template
- - .variables-template
- - .tags-template
- - .build-docs-binary-template
- - .documentation-before-script-template
- stage: source-check
+ - .build-clang
+ - .gmxapi-extra-installs
+ - .clang7-template
needs:
- job: simple-build
- artifacts: false
- - job: build-docs
+ artifacts: false
+ - job: configure-clang-7-gmxapi
artifacts: true
- variables:
- KUBERNETES_CPU_LIMIT: 1
- KUBERNETES_CPU_REQUEST: 1
- KUBERNETES_MEMORY_LIMIT: 2Gi
- BUILD_DIR: build-docs
- COMPILER_MAJOR_VERSION: 7
except:
variables:
- $GROMACS_RELEASE
- script:
- - cd $BUILD_DIR
- - cmake --build . --target check-source
- - grep -qi "error" docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee doxygenError.txt || true
- - grep -qi "warning" docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee -a doxygenError.txt || true
- - if [ -s doxygenError.txt ] ; then echo "Found errors while running doxygen"; exit 1; fi
- artifacts:
- name: docs-artifacts-$CI_COMMIT_REF_SLUG
- when: always
- expire_in: 1 week
- paths:
- - $BUILD_DIR/docs/doxygen/doxygen-xml.log
- - $BUILD_DIR/docs/doxygen/check-source.log
-
-# Jobs running during documentation build stage
-build-docs:
+build-clang-8:
extends:
- - .build-docs-binary
- stage: documentation
+ - .build-clang
+ - .clang8-template
needs:
- job: simple-build
- artifacts: false
- - job: configure-docs
+ artifacts: false
+ - job: configure-clang-8
artifacts: true
- variables:
- BUILD_DIR: build-docs
except:
variables:
- $GROMACS_RELEASE
-build-docs-gmxapi:
- extends:
- - .build-docs-binary
- - .gmxapi-extra-installs
- stage: documentation
- needs:
- - job: simple-build
- artifacts: false
- - job: configure-docs-gmxapi
- artifacts: true
- variables:
- BUILD_DIR: build-docs-gmxapi
- except:
- variables:
- - $GROMACS_RELEASE
-
-# Jobs running in post-test stage
-
-# The manual build is built separately so that errors in converting
-# Sphinx to LaTeX and compiling can always be found in the
-# all-output.txt file, while avoiding many thousands of lines of spam
-# from pdflatex for normal builds. This does reduce the available
-# parallel utilization, and so increases the build time.
-#
-# TODO why are the doxygen and sphinx log files disappearing
-# TODO use a feature from gitlab runner instead of using pipefail to get timings for the job
-webpage:
+build-clang-6:
extends:
- - .build-docs-webpage
- stage: post-test
+ - .build-clang
+ - .clang6-template
needs:
- - job: build-docs
- artifacts: true
- - job: run-check-source
+ - job: simple-build
artifacts: false
- variables:
- BUILD_DIR: build-docs
+ - job: configure-clang-6
+ artifacts: true
except:
variables:
- $GROMACS_RELEASE
-webpage-gmxapi:
+# Jobs running during test stage
+test-gcc-7:
extends:
- - .build-docs-webpage
- - .gmxapi-extra-installs
+ - .test-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-gcc-7
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-gcc-7-gmxapi:
+ extends:
+ - .test-gcc
+ - .gmxapi-extra-installs
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-gcc-7-gmxapi
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-gcc-7-double:
+ extends:
+ - .test-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-gcc-7-double
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-gcc-8:
+ extends:
+ - .test-gcc
+ - .gcc8-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-gcc-8
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-gcc-7-simd-sse41:
+ extends:
+ - .test-gcc
+ - .gcc7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-gcc-7-simd-sse41
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-clang-7:
+ extends:
+ - .test-clang
+ - .clang7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-clang-7
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-clang-7-gmxapi:
+ extends:
+ - .test-clang
+ - .gmxapi-extra-installs
+ - .clang7-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-clang-7-gmxapi
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-clang-8:
+ extends:
+ - .test-clang
+ - .clang8-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-clang-8
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+test-clang-6:
+ extends:
+ - .test-clang
+ - .clang6-template
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-clang-6
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+# Jobs running in source checking stage
+build-clang-tidy:
+ extends:
+ - .build-clang
+ - .clang7-template
+ stage: source-check
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-clang-tidy
+ artifacts: true
+ variables:
+ BUILD_DIR: build-clang-tidy
+ COMPILER_MAJOR_VERSION: 7
+ EXTRA_INSTALLS: clang-tidy-$COMPILER_MAJOR_VERSION
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+run-clang-format:
+ extends:
+ - .binary-build-template
+ - .no-cache-template
+ - .variables-template
+ - .tags-template
+ - .clang-before-script-template
+ - .build-clang-template
+ - .clang7-template
+ stage: source-check
+ when: always
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ KUBERNETES_CPU_LIMIT: 1
+ KUBERNETES_CPU_REQUEST: 1
+ KUBERNETES_MEMORY_LIMIT: 2Gi
+ COMPILER_MAJOR_VERSION: 7
+ EXTRA_INSTALLS: clang-format-$COMPILER_MAJOR_VERSION
+ except:
+ variables:
+ - $GROMACS_RELEASE
+ script:
+ - export CLANG_FORMAT=clang-format-$COMPILER_MAJOR_VERSION
+ - admin/clang-format.sh check --rev=HEAD^ --warnings=clang-format.log
+ - grep -iq "needs formatting" clang-format.log | tee formatting.txt || true
+ - if [ -s formatting.txt ] ; then echo "clang-format.sh found issues"; exit 1; fi
+ artifacts:
+ when: on_failure
+ paths:
+ - clang-format.log
+ - formatting.txt
+
+run-copyright-check:
+ extends:
+ - .binary-build-template
+ - .no-cache-template
+ - .variables-template
+ - .tags-template
+ - .clang-before-script-template
+ - .build-clang-template
+ - .clang7-template
+ stage: source-check
+ when: always
+ needs:
+ - job: simple-build
+ artifacts: false
+ variables:
+ KUBERNETES_CPU_LIMIT: 1
+ KUBERNETES_CPU_REQUEST: 1
+ KUBERNETES_MEMORY_LIMIT: 2Gi
+ except:
+ variables:
+ - $GROMACS_RELEASE
+ script:
+ - admin/copyright.sh check --rev=HEAD^ --warnings=copyright.log
+ - grep -iq "copyright year" copyright.log | tee years.log || true
+ - grep -iq "copyright header" copyright.log | tee headers.log || true
+ - if [[ -s years.log || -s headers.log ]] ; then
+ echo "Copyright information needs updating" ;
+ exit 1 ;
+ fi
+ artifacts:
+ when: on_failure
+ paths:
+ - copyright.log
+ - years.log
+ - headers.log
+
+run-check-source:
+ extends:
+ - .no-cache-template
+ - .variables-template
+ - .tags-template
+ - .build-docs-binary-template
+ - .documentation-before-script-template
+ stage: source-check
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: build-docs
+ artifacts: true
+ variables:
+ KUBERNETES_CPU_LIMIT: 1
+ KUBERNETES_CPU_REQUEST: 1
+ KUBERNETES_MEMORY_LIMIT: 2Gi
+ BUILD_DIR: build-docs
+ COMPILER_MAJOR_VERSION: 7
+ except:
+ variables:
+ - $GROMACS_RELEASE
+ script:
+ - cd $BUILD_DIR
+ - cmake --build . --target check-source
+ - grep -qi "error" docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee doxygenError.txt || true
+ - grep -qi "warning" docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee -a doxygenError.txt || true
+ - if [ -s doxygenError.txt ] ; then echo "Found errors while running doxygen"; exit 1; fi
+ artifacts:
+ name: docs-artifacts-$CI_COMMIT_REF_SLUG
+ when: always
+ expire_in: 1 week
+ paths:
+ - $BUILD_DIR/docs/doxygen/doxygen-xml.log
+ - $BUILD_DIR/docs/doxygen/check-source.log
+
+# Jobs running during documentation build stage
+build-docs:
+ extends:
+ - .build-docs-binary
+ stage: documentation
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-docs
+ artifacts: true
+ variables:
+ BUILD_DIR: build-docs
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+build-docs-gmxapi:
+ extends:
+ - .build-docs-binary
+ - .gmxapi-extra-installs
+ stage: documentation
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-docs-gmxapi
+ artifacts: true
+ variables:
+ BUILD_DIR: build-docs-gmxapi
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+# Jobs running in post-test stage
+
+# The manual build is built separately so that errors in converting
+# Sphinx to LaTeX and compiling can always be found in the
+# all-output.txt file, while avoiding many thousands of lines of spam
+# from pdflatex for normal builds. This does reduce the available
+# parallel utilization, and so increases the build time.
+#
+# TODO why are the doxygen and sphinx log files disappearing
+# TODO use a feature from gitlab runner instead of using pipefail to get timings for the job
+webpage:
+ extends:
+ - .build-docs-webpage
+ stage: post-test
+ needs:
+ - job: build-docs
+ artifacts: true
+ - job: run-check-source
+ artifacts: false
+ variables:
+ BUILD_DIR: build-docs
+ except:
+ variables:
+ - $GROMACS_RELEASE
+
+webpage-gmxapi:
+ extends:
+ - .build-docs-webpage
+ - .gmxapi-extra-installs
stage: post-test
needs:
- job: build-docs-gmxapi
dependencies:
- webpage-gmxapi
only:
- - schedules
+ - schedules
+ - triggers
+ - merge_requests
+ - external_pull_requests
+ except:
+ variables:
+ - $GROMACS_RELEASE
+ variables:
+ KUBERNETES_CPU_LIMIT: 1
+ KUBERNETES_CPU_REQUEST: 1
+ KUBERNETES_MEMORY_LIMIT: 2Gi
+ BUILD_DIR: build-docs-gmxapi
+ script:
+ - cd $BUILD_DIR
+ - linkchecker docs/html/index.html -f ../docs/linkcheckerrc -Fxml --ignore-url html-full
+ --ignore-url html-user --ignore-url html-lib --ignore-url .tar.gz --ignore-url _sources
+ -o xml
+ artifacts:
+ reports:
+ junit: $BUILD_DIR/linkchecker-out.xml
+
+build-archive-nightly:
+ extends:
+ - .build-archive
+ stage: nightly-build
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: configure-archive-nightly
+ artifacts: true
+ only:
+ - triggers
+ - schedules
+ except:
+ variables:
+ - $GROMACS_RELEASE
+ variables:
+ BUILD_DIR: build-package
+
+webpage-nightly:
+ extends:
+ - .build-docs-webpage
+ - .configure-gmxapi-template
+ stage: nightly-deploy
+ only:
- triggers
- - merge_requests
- - external_pull_requests
+ - schedules
except:
variables:
- $GROMACS_RELEASE
+ needs:
+ - job: simple-build
+ artifacts: false
+ - job: linkchecker
+ artifacts: false
+ - job: webpage-gmxapi
+ artifacts: true
variables:
- KUBERNETES_CPU_LIMIT: 1
- KUBERNETES_CPU_REQUEST: 1
- KUBERNETES_MEMORY_LIMIT: 2Gi
- BUILD_DIR: build-docs-gmxapi
+ BUILD_DIR: build-docs-gmxapi
script:
- - cd $BUILD_DIR
- - linkchecker docs/html/index.html -f ../docs/linkcheckerrc -Fxml --ignore-url html-full
- --ignore-url html-user --ignore-url html-lib --ignore-url .tar.gz --ignore-url _sources
- -o xml
+ - tar czf webpage.tar.gz $BUILD_DIR/docs/html/
artifacts:
- reports:
- junit: $BUILD_DIR/linkchecker-out.xml
-
-build-archive-nightly:
- extends:
- - .build-archive
- stage: nightly-build
- needs:
- - job: simple-build
- artifacts: false
- - job: configure-archive-nightly
- artifacts: true
- only:
- - triggers
- - schedules
- except:
- variables:
- - $GROMACS_RELEASE
- variables:
- BUILD_DIR: build-package
+ when: always
+ paths:
+ - webpage.tar.gz
-webpage-nightly:
- extends:
- - .build-docs-webpage
- - .configure-gmxapi-template
- stage: nightly-deploy
- only:
+package-regressiontests-release:
+ extends:
+ - .regressiontests-extends-template
+ - .regressiontests-release-template
+ needs:
+ - job: prepare-release-version
+ artifacts: true
+ only:
+ refs:
- triggers
+ - web
- schedules
- except:
- variables:
- - $GROMACS_RELEASE
- needs:
- - job: simple-build
- artifacts: false
- - job: linkchecker
- artifacts: false
- - job: webpage-gmxapi
- artifacts: true
variables:
- BUILD_DIR: build-docs-gmxapi
- script:
- - tar czf webpage.tar.gz $BUILD_DIR/docs/html/
- artifacts:
- when: always
- paths:
- - webpage.tar.gz
-
-package-regressiontests-release:
- extends:
- - .regressiontests-extends-template
- - .regressiontests-release-template
- needs:
- - job: prepare-release-version
- artifacts: true
-
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
package-archive-release:
- extends:
- - .build-archive
- stage: release-package
- needs:
- - job: configure-archive-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ extends:
+ - .build-archive
+ stage: release-package
+ needs:
+ - job: configure-archive-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: build-package
+ - $GROMACS_RELEASE
+ variables:
+ BUILD_DIR: build-package
release-verify:
- extends:
- - .regressiontests-extends-template
- - .release-verify-template
-
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ extends:
+ - .regressiontests-extends-template
+ - .release-verify-template
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
+ variables:
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
webpage-configure-release:
- extends:
- - .configure-docs-release
- - .configure-gmxapi-template
- - .no-cache-template
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ extends:
+ - .configure-docs-release
+ - .configure-gmxapi-template
+ - .no-cache-template
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
+ variables:
+ CMAKE_EXTRA_OPTIONS: -DGMX_BUILD_HELP=on -DGMX_BUILD_MANUAL=on
configure-gcc-7-release:
- extends:
- - .configure-gcc-release
- - .no-cache-template
- - .gcc7-template
+ extends:
+ - .configure-gcc-release
+ - .no-cache-template
+ - .gcc7-template
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ RELEASE_BUILD_DIR: release-builds-gcc
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 7
- RELEASE_BUILD_DIR: release-builds-gcc
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
configure-gcc-7-gmxapi-release:
- extends:
- - .configure-gcc-release
- - .configure-gmxapi-template
- - .no-cache-template
- - .gcc7-template
+ extends:
+ - .configure-gcc-release
+ - .configure-gmxapi-template
+ - .no-cache-template
+ - .gcc7-template
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ RELEASE_BUILD_DIR: release-builds-gcc
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 7
- RELEASE_BUILD_DIR: release-builds-gcc
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
configure-gcc-7-double-release:
- extends:
- - .configure-gcc-release
- - .no-cache-template
- - .gcc7-template
+ extends:
+ - .configure-gcc-release
+ - .no-cache-template
+ - .gcc7-template
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ CMAKE_PRECISION_OPTIONS: -DGMX_DOUBLE=ON
+ RELEASE_BUILD_DIR: release-builds-gcc
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 7
- CMAKE_PRECISION_OPTIONS: -DGMX_DOUBLE=ON
- RELEASE_BUILD_DIR: release-builds-gcc
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
configure-gcc-8-release:
- extends:
- - .configure-gcc-release
- - .no-cache-template
- - .gcc8-template
+ extends:
+ - .configure-gcc-release
+ - .no-cache-template
+ - .gcc8-template
+ variables:
+ COMPILER_MAJOR_VERSION: 8
+ RELEASE_BUILD_DIR: release-builds-gcc
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 8
- RELEASE_BUILD_DIR: release-builds-gcc
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
configure-clang-7-release:
- extends:
- - .configure-clang-release
- - .no-cache-template
- - .clang7-template
+ extends:
+ - .configure-clang-release
+ - .no-cache-template
+ - .clang7-template
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ RELEASE_BUILD_DIR: release-builds-clang
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 7
- RELEASE_BUILD_DIR: release-builds-clang
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
configure-clang-7-gmxapi-release:
- extends:
- - .configure-clang-release
- - .configure-gmxapi-template
- - .no-cache-template
- - .clang7-template
+ extends:
+ - .configure-clang-release
+ - .configure-gmxapi-template
+ - .no-cache-template
+ - .clang7-template
+ variables:
+ COMPILER_MAJOR_VERSION: 7
+ RELEASE_BUILD_DIR: release-builds-clang
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 7
- RELEASE_BUILD_DIR: release-builds-clang
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
configure-clang-8-release:
- extends:
- - .configure-clang-release
- - .no-cache-template
- - .clang8-template
+ extends:
+ - .configure-clang-release
+ - .no-cache-template
+ - .clang8-template
+ variables:
+ COMPILER_MAJOR_VERSION: 8
+ RELEASE_BUILD_DIR: release-builds-clang
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- COMPILER_MAJOR_VERSION: 8
- RELEASE_BUILD_DIR: release-builds-clang
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - package-archive-release
- - package-regressiontests-release
- - prepare-release-version
+ - $GROMACS_RELEASE
+ dependencies:
+ - package-archive-release
+ - package-regressiontests-release
+ - prepare-release-version
build-gcc-7-release:
- extends:
- - .build-gcc
- - .gcc7-template
- stage: release-build
+ extends:
+ - .build-gcc
+ - .gcc7-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-7-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-7-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
build-gcc-7-gmxapi-release:
- extends:
- - .build-gcc
- - .gmxapi-extra-installs
- - .gcc7-template
- stage: release-build
+ extends:
+ - .build-gcc
+ - .gmxapi-extra-installs
+ - .gcc7-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-7-gmxapi-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-7-gmxapi-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
build-gcc-7-double-release:
- extends:
- - .build-gcc
- - .gcc7-template
- stage: release-build
- variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-7-double-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ extends:
+ - .build-gcc
+ - .gcc7-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-7-double-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
+ variables:
+ - $GROMACS_RELEASE
build-gcc-8-release:
- extends:
- - .build-gcc
- - .gcc8-template
- stage: release-build
+ extends:
+ - .build-gcc
+ - .gcc8-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-8-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-8-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
build-clang-7-release:
- extends:
- - .build-clang
- - .clang7-template
- stage: release-build
+ extends:
+ - .build-clang
+ - .clang7-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-clang
+ needs:
+ - job: configure-clang-7-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- BUILD_DIR: release-builds-clang
- needs:
- - job: configure-clang-7-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
build-clang-7-gmxapi-release:
- extends:
- - .build-clang
- - .gmxapi-extra-installs
- - .clang7-template
- stage: release-build
+ extends:
+ - .build-clang
+ - .gmxapi-extra-installs
+ - .clang7-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-clang
+ needs:
+ - job: configure-clang-7-gmxapi-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- BUILD_DIR: release-builds-clang
- needs:
- - job: configure-clang-7-gmxapi-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
build-clang-8-release:
- extends:
- - .build-clang
- - .clang8-template
- stage: release-build
+ extends:
+ - .build-clang
+ - .clang8-template
+ stage: release-build
+ variables:
+ BUILD_DIR: release-builds-clang
+ needs:
+ - job: configure-clang-8-release
+ artifacts: true
+ only:
+ refs:
+ - web
+ - schedules
+ - triggers
variables:
- BUILD_DIR: release-builds-clang
- needs:
- - job: configure-clang-8-release
- artifacts: true
- only:
- refs:
- - web
- - schedules
- - triggers
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
webpage-binary-release:
- extends:
- - .build-docs-binary
- - .gmxapi-extra-installs
- stage: release-build
- needs:
- - job: webpage-configure-release
- artifacts: true
+ extends:
+ - .build-docs-binary
+ - .gmxapi-extra-installs
+ stage: release-build
+ needs:
+ - job: webpage-configure-release
+ artifacts: true
+ variables:
+ BUILD_DIR: release-doc-builds
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-doc-builds
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-gcc-7-release:
- extends:
- - .test-gcc
- - .gcc7-template
- stage: release-tests
+ extends:
+ - .test-gcc
+ - .gcc7-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-7-release
+ artifacts: true
+ - job: build-gcc-7-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-7-release
- artifacts: true
- - job: build-gcc-7-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-gcc-7-gmxapi-release:
- extends:
- - .test-gcc
- - .gmxapi-extra-installs
- - .gcc7-template
- stage: release-tests
+ extends:
+ - .test-gcc
+ - .gmxapi-extra-installs
+ - .gcc7-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-7-gmxapi-release
+ artifacts: true
+ - job: build-gcc-7-gmxapi-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-7-gmxapi-release
- artifacts: true
- - job: build-gcc-7-gmxapi-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-gcc-7-double-release:
- extends:
- - .test-gcc
- - .gcc7-template
- stage: release-tests
+ extends:
+ - .test-gcc
+ - .gcc7-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-7-double-release
+ artifacts: true
+ - job: build-gcc-7-double-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-7-double-release
- artifacts: true
- - job: build-gcc-7-double-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-gcc-8-release:
- extends:
- - .test-gcc
- - .gcc8-template
- stage: release-tests
+ extends:
+ - .test-gcc
+ - .gcc8-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-gcc
+ needs:
+ - job: configure-gcc-8-release
+ artifacts: true
+ - job: build-gcc-8-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-gcc
- needs:
- - job: configure-gcc-8-release
- artifacts: true
- - job: build-gcc-8-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-clang-7-release:
- extends:
- - .test-clang
- - .clang7-template
- stage: release-tests
+ extends:
+ - .test-clang
+ - .clang7-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-clang
+ needs:
+ - job: configure-clang-7-release
+ artifacts: true
+ - job: build-clang-7-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-clang
- needs:
- - job: configure-clang-7-release
- artifacts: true
- - job: build-clang-7-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-clang-7-gmxapi-release:
- extends:
- - .test-clang
- - .gmxapi-extra-installs
- - .clang7-template
- stage: release-tests
+ extends:
+ - .test-clang
+ - .gmxapi-extra-installs
+ - .clang7-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-clang
+ needs:
+ - job: configure-clang-7-gmxapi-release
+ artifacts: true
+ - job: build-clang-7-gmxapi-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-clang
- needs:
- - job: configure-clang-7-gmxapi-release
- artifacts: true
- - job: build-clang-7-gmxapi-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
test-clang-8-release:
- extends:
- - .test-clang
- - .clang8-template
- stage: release-tests
+ extends:
+ - .test-clang
+ - .clang8-template
+ stage: release-tests
+ variables:
+ BUILD_DIR: release-builds-clang
+ needs:
+ - job: configure-clang-8-release
+ artifacts: true
+ - job: build-clang-8-release
+ artifacts: true
+ only:
+ refs:
+ - triggers
+ - web
+ - schedules
variables:
- BUILD_DIR: release-builds-clang
- needs:
- - job: configure-clang-8-release
- artifacts: true
- - job: build-clang-8-release
- artifacts: true
- only:
- refs:
- - triggers
- - web
- - schedules
- variables:
- - $GROMACS_RELEASE
+ - $GROMACS_RELEASE
webpage-build-release:
extends:
- .build-docs-webpage
- .configure-gmxapi-template
-
dependencies:
- webpage-binary-release
- webpage-configure-release
-
stage: release-prepare-deploy
only:
refs:
variables:
- $GROMACS_RELEASE
variables:
- BUILD_DIR: release-doc-builds
+ BUILD_DIR: release-doc-builds
webpage-archive-release:
- extends:
- - .build-docs-webpage
- - .configure-gmxapi-template
- stage: release-deploy
- only:
- refs:
- - web
- - triggers
- - schedules
- variables:
- - $GROMACS_RELEASE
- dependencies:
- - webpage-build-release
- - package-archive-release
- - package-regressiontests-release
- variables:
- BUILD_DIR: release-doc-builds
- script:
- - tar czf webpage.tar.gz $BUILD_DIR/docs/html/
- artifacts:
- when: always
- paths:
- - webpage.tar.gz
- - gromacs-*tar.gz
- - regressiontests-*tar.gz
+ extends:
+ - .build-docs-webpage
+ - .configure-gmxapi-template
+ stage: release-deploy
+ only:
+ refs:
+ - web
+ - triggers
+ - schedules
+ variables:
+ - $GROMACS_RELEASE
+ dependencies:
+ - webpage-build-release
+ - package-archive-release
+ - package-regressiontests-release
+ variables:
+ BUILD_DIR: release-doc-builds
+ script:
+ - tar czf webpage.tar.gz $BUILD_DIR/docs/html/
+ artifacts:
+ when: always
+ paths:
+ - webpage.tar.gz
+ - gromacs-*tar.gz
+ - regressiontests-*tar.gz
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
include(gmxManageSimd)
gmx_manage_simd()
-include(gmxManageCycleCounters)
-gmx_manage_cycle_counters()
-
# Process QM/MM Settings
if(${GMX_QMMM_PROGRAM} STREQUAL "GAUSSIAN")
set(GMX_QMMM_GAUSSIAN 1)
20. Reference implementation of std::optional
=============================================
-Used with minor modifications from commit a08fda6c674ae4c9f of
+Used with minor modifications from commit 096ce6d7e45ef184d of
https://github.com/martinmoene/optional-lite.git, which is licensed as below.
Boost Software License - Version 1.0 - August 17th, 2003
--- /dev/null
+# This matrix is intended to permit Jenkins on-demand testing
+# of code hidden behind the GMX_USE_BUFFER_OPS feature flag
+# during development. When the feature flag is removed, the
+# normal test matrices will be adapted to cover this code path.
+#
+# Comment line(s) preceding each configuration document the main
+# intent behind that configuration, so that we can correctly judge
+# whether to preserve that during maintenance decisions.
+#
+# Both configurations currently target bs_nix1204, for better load
+# balance with pre-submit matrix, which makes heavier use of
+# bs_nix1310 agent.
+
+# Test an older version of CUDA
+# Test MPI with CUDA
+# Test MPMD PME with library MPI
+# Test gpubufferops features in the above combination
+gcc-5 gpuhw=nvidia cuda-9.0 mpi npme=1 nranks=2 openmp gpubufferops
+
+# Test newest gcc supported by newest CUDA at time of release
+# Test thread-MPI with CUDA
+# Test gpubufferops features in the above combination
+gcc-8 gpuhw=nvidia nranks=1 gpu_id=1 cuda-10.1 thread-mpi openmp cmake-3.10.0 release-with-assert simd=avx2_256 hwloc libhwloc-2.0.4 gpubufferops
+
+# Test non-default use of mdrun -gpu_id
+# Test GPU-sharing among 4 PP ranks
+# Test no hwloc build, tests internal CPU topology detection (mainly for x86)
+# Test gpubufferops in the above combination
+gcc-7 gpuhw=nvidia nranks=4 gpu_id=1 cuda-10.0 no-hwloc release-with-assert gpubufferops
+
+# Test CUDA build on a agent with no CUDA devices
+# Test without TNG support
+# Test gpubufferops in the above combination
+gcc-7 gpuhw=none cuda-10.0 openmp no-tng release-with-assert gpubufferops
+
+# Test OpenCL build with gpudev features
+# Test gpubufferops on the OpenCL path where it is unsupported
+clang-8 openmp gpuhw=amd opencl-1.2 clFFT-2.14 simd=None gpubufferops
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2017,2018,2019,2020, The GROMACS development team.
+# Copyright (c) 2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# TODO: Generalize the machinery here such that it can easily be used
# also for non-release builds.
else:
+ # run OpenCL offline compile tests on clang tidy builds
+ if (context.opts.tidy and context.opts.opencl):
+ context.build_target(target='ocl_nbnxm_kernels')
+ context.build_target(target='ocl_pme_kernels')
+
context.build_target(target='tests', keep_going=True)
context.run_ctest(args=['--output-on-failure', '--label-exclude', 'SlowTest'], memcheck=context.opts.asan)
context.build_target(target='install')
# TODO: Consider what could be tested about the installed binaries.
- # run OpenCL offline compile tests on clang tidy builds
- if (context.opts.tidy and context.opts.opencl):
- context.build_target(target='ocl_nbnxm_kernels')
-
if not context.opts.mdrun_only:
context.env.prepend_path_env(os.path.join(context.workspace.build_dir, 'bin'))
context.chdir(regressiontests_path)
# configuration syntax, so that the configurations are stable even
# if the defaults change in future.
-# Test on ARM v7
-# Test ARM_NEON SIMD
-gcc-5 simd=ARM_NEON no-hwloc release-with-assert
-
# Test on ARM v8
# Test ARM_NEON_ASIMD SIMD
gcc-5 simd=ARM_NEON_ASIMD release-with-assert
.configure-build-template:
- # Dockerfiles are from dockerhub, user eriklindahl
- # image in admin/dockerimages/ci-docs-py27
+ # Docker image uploaded to dockerhub by user eriklindahl
+ # TODO: Get DockerFile for admin/dockerfiles
stage: configure-build
image: biophysics/gcc-gromacs
variables:
except:
variables:
- $GROMACS_RELEASE
-# Always clone the default version for this branch, release-2020 in this case
+# Always clone the default version for this branch, master in this case
script:
- - export REGTESTBRANCH=release-2020
+ - export REGTESTBRANCH=master
- if [ ! -z $CI_MERGE_REQUEST_TARGET_BRANCH_NAME ] ; then
if [[ ! -d regressiontests ]] ; then
mkdir regressiontests ;
- gmx-regressiontests.tar.gz
.regressiontests-release-template:
+ # Docker image uploaded to dockerhub by user eriklindahl
+ # TODO: Get DockerFile for admin/dockerfiles
image: biophysics/gcc-gromacs
stage: release-package
- if [[ $GROMACS_RELEASE != "true" ]] ; then
REGTESTNAME=$REGTESTNAME-dev ;
fi
- - export REGTESTBRANCH=release-2020
+ - export REGTESTBRANCH=master
- if [[ $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME == "release-20"[1-2][0-9] ]] ; then
export REGTESTBRANCH=$CI_COMMIT_REF_NAME ;
fi
.release-version-template:
+ # Docker image uploaded to dockerhub by user eriklindahl
+ # TODO: Get DockerFile for admin/dockerfiles
image: biophysics/gcc-gromacs
stage: configure-build
.test-base-template:
variables:
BUILD_DIR: build
+ # Docker image uploaded to dockerhub by user eriklindahl
+ # TODO: Get DockerFile for admin/dockerfiles
image: biophysics/gcc-gromacs
stage: test
retry:
if [ -z "$CLANG_FORMAT" ]
then
echo "Please set the path to clang-format using the git hook"
- echo "git config hooks.clang_formatpath /path/to/clang-format"
+ echo "git config hooks.clangformatpath /path/to/clang-format"
echo "or by setting an environment variable, e.g."
echo "CLANG_FORMAT=/path/to/clang-format"
echo "See docs/dev-manual/code-formatting.rst for how to get clang-format."
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2016,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
--- /dev/null
+#!/bin/bash
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2020, by the GROMACS development team, led by
+# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+# and including many others, as listed in the AUTHORS file in the
+# top-level source directory and at http://www.gromacs.org.
+#
+# GROMACS is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1
+# of the License, or (at your option) any later version.
+#
+# GROMACS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with GROMACS; if not, see
+# http://www.gnu.org/licenses, or write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# If you want to redistribute modifications to GROMACS, please
+# consider that scientific software is very special. Version
+# control is crucial - bugs must be traceable. We will be happy to
+# consider code for inclusion in the official distribution, but
+# derived work must not be called official GROMACS. Details are found
+# in the README & COPYING files - if they are missing, get the
+# official version at http://www.gromacs.org.
+#
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org.
+
+# Finds copyright statements that have more than five years, such as
+#
+# ... Copyright (c) 2012,2013,2016,2017,2018,2019, by the GROMACS ...
+#
+# and splits them into multiple lines, like
+#
+# ... Copyright (c) 2012,2013,2016,2017,2018, by the GROMACS development team.
+# ... Copyright (c) 2019, by the GROMACS development team, led by
+#
+# so that the copyright checker recognizes the second line as one that can be extended.
+# This will need to be re-rerun every few years as the length of the last line grows.
+
+sed -i 's/\( \?.\) Copyright (c) \([0-9][0-9][0-9][0-9],[0-9][0-9][0-9][0-9],[0-9][0-9][0-9][0-9],[0-9][0-9][0-9][0-9],[0-9][0-9][0-9][0-9]\),\([0-9][0-9][0-9][0-9],.*,\) by the GROMACS/\1 Copyright (c) \2 by the GROMACS development team.\n\1 Copyright (c) \3 by the GROMACS/g' $(git grep -l "by the GROMACS")
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
+++ /dev/null
-int main()
-{
-#ifdef __ARM_ARCH_7A__
- return 0;
-#else
-#error This compiler is not targetting 32-bit ARMv7
-#endif
-}
+++ /dev/null
-int main()
-{
-#if defined(__ARM_ARCH_7A__) && defined(__GNUC__)
- unsigned int cycles_lo, cycles_hi;
- asm volatile("mrrc p15, 1, %0, %1, c14" : "=r" (cycles_lo), "=r" (cycles_hi));
-
- // Return 0 (success) if low or high 32 bits contained anything non-trivial
- return !(cycles_lo > 0 || cycles_hi > 0);
-#else
-#error This architecture/compiler does not support ARMv7 32-bit cycle counters
-#endif
-}
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
try_compile(GMX_TARGET_MIC ${CMAKE_BINARY_DIR}
"${CMAKE_SOURCE_DIR}/cmake/TestMIC.cpp")
endif()
- if (NOT DEFINED GMX_TARGET_ARMV7)
- try_compile(GMX_TARGET_ARMV7 ${CMAKE_BINARY_DIR}
- "${CMAKE_SOURCE_DIR}/cmake/TestARMv7.cpp")
- endif()
if (NOT DEFINED GMX_TARGET_FUJITSU_SPARC64)
try_compile(GMX_TARGET_FUJITSU_SPARC64 ${CMAKE_BINARY_DIR}
"${CMAKE_SOURCE_DIR}/cmake/TestFujitsuSparc64.cpp")
+++ /dev/null
-#
-# This file is part of the GROMACS molecular simulation package.
-#
-# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
-# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
-# and including many others, as listed in the AUTHORS file in the
-# top-level source directory and at http://www.gromacs.org.
-#
-# GROMACS is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation; either version 2.1
-# of the License, or (at your option) any later version.
-#
-# GROMACS is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with GROMACS; if not, see
-# http://www.gnu.org/licenses, or write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# If you want to redistribute modifications to GROMACS, please
-# consider that scientific software is very special. Version
-# control is crucial - bugs must be traceable. We will be happy to
-# consider code for inclusion in the official distribution, but
-# derived work must not be called official GROMACS. Details are found
-# in the README & COPYING files - if they are missing, get the
-# official version at http://www.gromacs.org.
-#
-# To help us fund GROMACS development, we humbly ask that you cite
-# the research papers on the package. Check out http://www.gromacs.org.
-
-# - Decide whether to use CPU cycle counters
-#
-# gmx_manage_cycle_counters()
-#
-# By default, we enable GMX_CYCLECOUNTERS for all architectures except ARMv7.
-# On ARMv7, we enable it if we are not cross-compiling and can run a small
-# test to confirm that the support is present in the kernel, otherwise we
-# disable it.
-#
-macro(gmx_manage_cycle_counters)
-
- if(NOT DEFINED GMX_CYCLECOUNTERS)
-
- if(GMX_TARGET_ARMV7)
-
- if(NOT CMAKE_CROSSCOMPILING)
-
- try_run(ARMV7_COUNTER_RUN_VAR ARMV7_COUNTER_COMPILE_VAR
- ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/cmake/TestARMv7CycleCounters.cpp")
-
- # Enable cycle counter usage if the test ran fine and exited with 0 return code
- if(${ARMV7_COUNTER_COMPILE_VAR} AND ("${ARMV7_COUNTER_RUN_VAR}" EQUAL "0"))
- set(GMX_CYCLECOUNTERS ON CACHE BOOL "Use CPU cycle counters timing")
- else()
- set(GMX_CYCLECOUNTERS OFF CACHE BOOL "Use CPU cycle counters for timing")
- endif()
-
- else()
-
- # Disable cycle counters when cross-compiling for ARMv7
- set(GMX_CYCLECOUNTERS OFF CACHE BOOL "Use CPU cycle counters for timing")
-
- endif()
-
- else()
-
- # For now we (try to) enable cycle counters on all other platforms
- set(GMX_CYCLECOUNTERS ON CACHE BOOL "Use CPU cycle counters timing")
-
- endif()
-
- mark_as_advanced(GMX_CYCLECOUNTERS)
-
- endif()
-
-endmacro()
-
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# Source files generated by NVCC can include gmxmpi.h, and so
# need access to thread-MPI.
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+ # Source files can also contain topology related files and need access to
+ # the remaining external headers
+ include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/src/external)
# Now add all the compilation options
gmx_cuda_target_compile_options(CUDA_${TARGET}_CXXFLAGS)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2012,2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2012,2013,2014 by the GROMACS development team.
+# Copyright (c) 2015,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2012,2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2012,2013,2014 by the GROMACS development team.
+# Copyright (c) 2015,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-#
# GMX_TEST_MM_MALLOC(VARIABLE)
#
# VARIABLE will be set to true if we find _mm_malloc() and _mm_free().
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2011,2012,2014,2015,2016,2020, by the GROMACS development team, led by
+# Copyright (c) 2009,2011,2012,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# GROMACS 2018 3
# GROMACS 2019 4
# GROMACS 2020 5
+# GROMACS 2021 6
# LIBRARY_SOVERSION_MINOR so minor version for the built libraries.
# Should be increased for each release that changes only the implementation.
# In GROMACS, the typical policy is to increase it for each patch version
# The GROMACS convention is that these are the version number of the next
# release that is going to be made from this branch.
-set(GMX_VERSION_MAJOR 2020)
-set(GMX_VERSION_PATCH 2)
+set(GMX_VERSION_MAJOR 2021)
+set(GMX_VERSION_PATCH 0)
# The suffix, on the other hand, is used mainly for betas and release
# candidates, where it signifies the most recent such release from
# this branch; it will be empty before the first such release, as well
# here. The important thing is to minimize the chance of third-party
# code being able to dynamically link with a version of libgromacs
# that might not work.
-set(LIBRARY_SOVERSION_MAJOR 5)
+set(LIBRARY_SOVERSION_MAJOR 6)
set(LIBRARY_SOVERSION_MINOR 0)
set(LIBRARY_VERSION ${LIBRARY_SOVERSION_MAJOR}.${LIBRARY_SOVERSION_MINOR}.0)
endif()
set(REGRESSIONTEST_VERSION "${GMX_VERSION_STRING}")
-set(REGRESSIONTEST_BRANCH "refs/heads/release-2020")
+set(REGRESSIONTEST_BRANCH "refs/heads/master")
# Run the regressiontests packaging job with the correct pakage
# version string, and the release box checked, in order to have it
# build the regressiontests tarball with all the right naming. The
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
dev-manual/doxygen.rst
dev-manual/error-handling.rst
dev-manual/formatting.rst
+ dev-manual/gitlab.rst
dev-manual/gmxtree.rst
dev-manual/includestyle.rst
dev-manual/index.rst
+ dev-manual/infrastructure.rst
dev-manual/jenkins.rst
dev-manual/known-issues.rst
dev-manual/language-features.rst
how-to/visualize.rst
install-guide/index.rst
release-notes/index.rst
+ release-notes/2021/major/highlights.rst
+ release-notes/2021/major/features.rst
+ release-notes/2021/major/performance.rst
+ release-notes/2021/major/tools.rst
+ release-notes/2021/major/bugs-fixed.rst
+ release-notes/2021/major/removed-functionality.rst
+ release-notes/2021/major/deprecated-functionality.rst
+ release-notes/2021/major/portability.rst
+ release-notes/2021/major/miscellaneous.rst
release-notes/2020/2020.1.rst
release-notes/2020/2020.2.rst
release-notes/2020/major/highlights.rst
# Sphinx cache with pickled ReST documents
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
+ set(SPHINX_CONFIG_OVERRIDES "")
+ if (GMX_DEVELOPER_BUILD)
+ set(SPHINX_CONFIG_OVERRIDES "-Dtodo_include_todos=1")
+ endif()
add_custom_target(webpage-sphinx
DEPENDS sphinx-programs
DEPENDS sphinx-input
-q -b html
-w sphinx-html.log
-d "${SPHINX_CACHE_DIR}"
+ ${SPHINX_CONFIG_OVERRIDES}
"${SPHINX_INPUT_DIR}"
"${HTML_OUTPUT_DIR}"
WORKING_DIRECTORY
- Quite a few error conditions are unhandled, noted with TODOs in several files
-- gmx_device_info_t needs struct field documentation
-
3. ENHANCEMENTS
============
- Implement OpenCL kernels for Intel GPUs
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2017,2018,2019 by the GROMACS development team.
+# Copyright (c) 2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
developers or advanced users can set to affect what CMake generates and/or what
will get built.
-.. TODO: Figure out where to document basic variables intended for user
+.. todo::
+
+ Figure out where to document basic variables intended for user
consumption, and how does it relate to documentation here.
-.. TODO: Document the remaining variables below, and identify any variables
+.. todo::
+
+ Document the remaining variables below, and identify any variables
missing from the list.
Compiler flags
Defaults to ``OFF``, and there should not be any need to change this in a
manual build.
- .. TODO: This could likely be replaced by a (yet another) build type.
+ .. todo:: This could likely be replaced by a (yet another) build type.
.. cmake:: GMX_BUILD_MDRUN_ONLY
version 8.0.* with libstdc++<7 or libc++ is supported. Others might miss tests or give false positives.
It is run automatically on Jenkins for each commit. Many checks have fixes which can automatically be
applied. To run it, the build has to be configured with
- ``cmake -DGMX_CLANG_TIDY=ON -DGMX_OPENMP=no -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=on``.
+ ``cmake -DGMX_CLANG_TIDY=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=on``.
Any ``CMAKE_BUILD_TYPE`` which enables asserts (e.g. ASAN) works. Such a configured build will
run both the compiler as well as clang-tidy when building. The name of the clang-tidy executable is set with
``-DCLANG_TIDY=...``, and the full path to it can be set with ``-DCLANG_TIDY_EXE=...``.
If ``OFF`` (the default), all detection is skipped and the manual cannot be
built.
- .. TODO: Consider if this is really necessary, or if we could just use
+ .. todo:: Consider if this is really necessary, or if we could just use
GMX_DEVELOPER_BUILD.
.. cmake:: GMX_BUILD_TARBALL
External libraries
------------------
-.. TODO: List external libraries used (either from src/external/, or from the
+.. todo::
+
+ List external libraries used (either from src/external/, or from the
system), whether they are required or optional, what functionality they
provide for Gromacs, and how to control their use.
--- /dev/null
+GitLab
+======
+
+|Gromacs| is transitioning to GitLab for source code management, issue tracking,
+and integrated automation for testing and documentation.
+
+The repository contains DockerFiles and GitLab Runner configuration
+files to support automated testing and documentation builds.
+General information on configuring GitLab CI pipelines can be found
+in the official `Gitlab documentation <https://docs.gitlab.com/ee/ci/yaml/>`_.
+
+The GitLab CI configuration entry point is the :file:`.gitlab-ci.yml` file
+at the root of the source tree.
+Configuration templates are found in the files in the
+:file:`admin/ci-templates/` directory.
+
+Docker images used by GitLab Runner are available on `Docker Hub <https://hub.docker.com/u/gromacs>`__.
+Images are (re)built manually from DockerFiles in :file:`admin/dockerfiles`.
+
+This documentation is incomplete, pending resolution of :issue:`3275`.
+
+.. todo:: Expand this documentation to resolve :issue:`3275`
--- /dev/null
+=============================
+Automation and Infrastructure
+=============================
+
+Through the 2020 release, automated testing and documentation builds are
+performed by a Jenkins installation. With the resolution of :issue:`3272`,
+|Gromacs| is transitioning to GitLab and GitLab Runner.
+
+.. toctree::
+ :maxdepth: 2
+
+ jenkins
+ gitlab
Understanding Jenkins builds
============================
-This page documents what different Jenkins builds actually run from the
-|Gromacs| source tree. The purpose is two-fold:
+This page documents what different Jenkins builds actually run at
+http://jenkins.gromacs.org/ from the |Gromacs| source tree.
+The purpose is two-fold:
* Provide information on how to interpret Jenkins failures and how to run the
same tasks locally to diagnose issues (in most cases, referring to the
See :doc:`doxygen` for details of how the Doxygen documentation is built and
organized.
-.. TODO: Create a separate page (at the front of the developer guide, and/or at
+.. todo:: Create a separate page (at the front of the developer guide, and/or at
the main index.rst) that describes the documentation from readers'
perspective, and move relevant content there. This should contain just an
overview of how the documentation is organized in the source tree.
:hidden:
We are currently switching our build and testing system to use Gitlab
-and the integrated CI system, with information for the general system found
-in the official `Gitlab documentation <https://docs.gitlab.com/ee/ci/yaml/>`_.
-The new configuration for the builds and tests can be found in the file
-``.gitlab-ci.yml``, with the templates for configuring is found in the files in the
-``admin/ci-templates/`` directory. This section is going to be extended
+CI pipelines run on GitLab Runner. This section is going to be extended
with individual build information as it comes available. For now we are
using a combination of building with the previous system on Jenkins
and post-submit verification on Gitlab.
+.. seealso:: :doc:`../infrastructure`
+
.. _releng-triggering-builds:
Triggering builds on Gitlab
:doc:`commitstyle`
Guidelines for formatting git commits when sending in proposed fixes for code review.
-.. TODO: Add more guidelines
+.. todo:: Add more guidelines
doxygen
change-management
- jenkins
+ infrastructure
releng/index
gmxtree
code-formatting
testutils
physical_validation
-.. TODO: Consider what is the most reasonable structure; currently, this list
+.. todo:: :issue:`3032`
+
+ Consider what is the most reasonable structure; currently, this list
here does not make much sense in the overall organization and creates a
confusing TOC for the developer guide.
-.. TODO: Add details for most of the tools, either in the form of links to wiki,
+.. todo:: :issue:`3267`
+
+ Add details for most of the tools, either in the form of links to wiki,
or to a separate page that explains more details.
Change management
All code changes go through a code review system at
http://gerrit.gromacs.org.
-Jenkins
+Build testing
All changes pushed to Gerrit are automatically compiled and otherwise
- checked on various platforms using a continuous integration system at
- http://jenkins.gromacs.org.
- :doc:`jenkins` documents how Jenkins interacts with the build system,
- providing information on how to replicate the builds Jenkins does (e.g., to
+ checked on various platforms.
+ :doc:`infrastructure` documents how builds are automated,
+ providing information on how to replicate the builds (e.g., to
diagnose issues).
:doc:`releng/index` provides more information on the technical implementation
of the builds.
Build system
------------
-.. TODO: details, ASAN, others?
+.. todo:: details, ASAN, others?
CMake
Main tool used in the build system.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
src/gromacs/nbnxm/kernels_simd_2xmm/kernel_common.h: warning: should include "nbnxm_simd.h"
src/gromacs/nbnxm/kernels_simd_4xm/kernel_common.h: warning: should include "nbnxm_simd.h"
+# This seems to be a false positive
+src/gromacs/nbnxm/cuda/nbnxm_cuda_types.h: error: NbnxmGpu: is in internal file(s), but appears in public documentation
+
# Temporary while we change the SIMD implementation
src/gromacs/simd/impl_sparc64_hpc_ace/impl_sparc64_hpc_ace_common.h: warning: should include "simd.h"
Welcome to the |Gromacs| documentation!
=======================================
-.. TODO : consolidate at least some of the material in the
+.. todo::
+
+ Consolidate at least some of the material in the
Documentation links below into the new user guide, along with all
of http://www.gromacs.org/Documentation/Cut-off_schemes,
http://www.gromacs.org/Documentation/Acceleration_and_parallelization
|Gromacs| can be compiled for many operating systems and
architectures. These include any distribution of Linux, Mac OS X or
Windows, and architectures including x86, AMD64/x86-64, several
-PowerPC including POWER8, ARM v7, ARM v8, and SPARC VIII.
+PowerPC including POWER8, ARM v8, and SPARC VIII.
Compiler
^^^^^^^^
512-wide AVX, including KNL, add ``--enable-avx512`` also.
FFTW will create a fat library with codelets for all different instruction sets,
and pick the fastest supported one at runtime.
-On ARM architectures with NEON SIMD support and IBM Power8 and later, you
+On ARM architectures with SIMD support and IBM Power8 and later, you
definitely want version 3.3.5 or later,
and to compile it with ``--enable-neon`` and ``--enable-vsx``, respectively, for
SIMD support. If you are using a Cray, there is a special modified
The GPU acceleration has been tested on AMD64/x86-64 platforms with
Linux, Mac OS X and Windows operating systems, but Linux is the
-best-tested and supported of these. Linux running on POWER 8, ARM v7 and v8
+best-tested and supported of these. Linux running on POWER 8 and ARM v8
CPUs also works well.
Experimental support is available for compiling CUDA code, both for host and
have a look at the `continuous integration server used by GROMACS`_,
which runs Jenkins_.
-We test irregularly on ARM v7, ARM v8, Cray, Fujitsu
-PRIMEHPC, Power8, Power9,
+We test irregularly on ARM v8, Cray, Power8, Power9,
Google Native Client and other environments, and
with other compilers and compiler versions, too.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
File formats
============
-.. TODO in future patch: update for accuracy, organize better, improve formatting
+.. todo:: in future patch: update for accuracy, organize better, improve formatting
Summary of file formats
^^^^^^^^^^^^^^^^^^^^^^^
.. highlight:: bash
-.. TODO this needs to be carefully checked that I didn't mess anything up too bad
+.. todo:: this needs to be carefully checked that I didn't mess anything up too bad
.. ifconfig:: gmx_image_convert == 'possible'
Citation information
--------------------
-.. TODO needs link to ref list
+.. todo:: needs link to ref list
|GMX_MANUAL_DOI_STRING|
--- /dev/null
+Bugs fixed
+^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
--- /dev/null
+.. _anticipated-changes:
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
+Changes anticipated to |Gromacs| 2021 functionality
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Functionality deprecated in |Gromacs| 2021
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
--- /dev/null
+New and improved features
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
--- /dev/null
+Highlights
+^^^^^^^^^^
+
+|Gromacs| 2021 was released on INSERT DATE HERE. Patch releases may
+have been made since then, please use the updated versions! Here are
+some highlights of what you can expect, along with more detail in the
+links below!
+
+As always, we've got several useful performance improvements, with or
+without GPUs, all enabled and automated by default. In addition,
+several new features are available for running simulations. We are extremely
+interested in your feedback on how well the new release works on your
+simulations and hardware. The new features are:
+
+* Cool quote autogenerator
+
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
--- /dev/null
+Miscellaneous
+^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
--- /dev/null
+Performance improvements
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
+Extend supported use-cases for GPU version of update and constraints
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+GPU version of update and constraints can now be used for FEP, except mass and constraints
+free-energy perturbation.
--- /dev/null
+Portability
+^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
--- /dev/null
+Removed functionality
+^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
--- /dev/null
+Improvements to |Gromacs| tools
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on redmine, without the
+ a space between the colon and number!
+
functionality supported, whereas patch releases contain only fixes for
issues identified in the corresponding major releases.
-Two versions of |Gromacs| are under active maintenance, the 2020
-series and the 2019 series. In the latter, only highly conservative
+Two versions of |Gromacs| are under active maintenance, the 2021
+series and the 2020 series. In the latter, only highly conservative
fixes will be made, and only to address issues that affect scientific
correctness. Naturally, some of those releases will be made after the
-year 2019 ends, but we keep 2019 in the name so users understand how
+year 2020 ends, but we keep 2019 in the name so users understand how
up to date their version is. Such fixes will also be incorporated into
-the 2020 release series, as appropriate. Around the time the 2021
-release is made, the 2019 series will no longer be maintained.
+the 2021 release series, as appropriate. Around the time the 2022
+release is made, the 2020 series will no longer be maintained.
Where issue numbers are reported in these release notes, more details
can be found at https://redmine.gromacs.org at that issue number.
+|Gromacs| 2021 series
+---------------------
+
+.. todolist::
+
+Major release
+^^^^^^^^^^^^^
+
+.. toctree::
+ :maxdepth: 1
+
+ 2021/major/highlights
+ 2021/major/features
+ 2021/major/performance
+ 2021/major/tools
+ 2021/major/bugs-fixed
+ 2021/major/deprecated-functionality
+ 2021/major/removed-functionality
+ 2021/major/portability
+ 2021/major/miscellaneous
+
+
|Gromacs| 2020 series
---------------------
.. Another useful one-liner to find undocumentedvariables:
.. ( export INPUT_FILE=docs/user-guide/environment-variables.rst; GIT_PAGER="cat "; for ss in `for s in $(git grep getenv | sed 's/.*getenv("\(.*\)".*/\1/' | sort -u | grep '^[A-Z]'); do [ $(grep $s $INPUT_FILE -c) -eq 0 ] && echo $s; done `; do git grep $ss ; done )
-.. TODO: still undocumented GMX_QM_GAUSSIAN_NCPUS
+.. todo:: still undocumented GMX_QM_GAUSSIAN_NCPUS
Environment Variables
=====================
You can choose different values for :mdp:`tinit` and :mdp:`init-step`.
- .. TODO make links work :ref:`Continuing simulations <gmx-cont-simulation>`.
+ .. todo:: Add "Continuing simulations" content (label: gmx-cont-simulation) and link.
+
+ e.g. ``:ref:`Continuing simulations <gmx-cont-simulation>`.``
#. Why can't I do conjugate gradient minimization with constraints?
You can either prepare a new :ref:`mdp` file, or extend the simulation time
in the original :ref:`tpr` file using :ref:`convert-tpr <gmx convert-tpr>`.
- .. TODO #. How do I complete a crashed simulation?
+ .. todo:: #. How do I complete a crashed simulation?
+
+ Need gmx-cont-crash doc target.
+
+ .. code-block:: none
+
+ This can be easily achieved using the checkpoint reading
+ :ref:`available <gmx-cont-crash>` in |Gromacs| versions newer than 4.
- .. This can be easily achieved using the checkpoint reading
- :ref:`available <gmx-cont-crash>` in |Gromacs| versions newer than 4.
+ .. todo:: #. How can I do a simulation at constant pH?
- .. TODO #. How can I do a simulation at constant pH?
+ Need gmx-howto-cph doc target.
- .. This is a rather large topic, and you should at least read the short
- :ref:`Constant pH How-To <gmx-howto-cph>` and all of the literature
- included there to get an overview over the topic.
+ .. code-block:: none
+
+ This is a rather large topic, and you should at least read the short
+ :ref:`Constant pH How-To <gmx-howto-cph>` and all of the literature
+ included there to get an overview over the topic.
#. How should I compute a single-point energy?
Analysis and Visualization
--------------------------
- .. TODO #. How do I visualize a trajectory?
+.. todo:: #. How do I visualize a trajectory?
+
+ gmx-howto-visualize doc target:
+
+ .. code-block:: none
- .. Use one of the number of different programs that can visualize
+ Use one of the number of different programs that can visualize
coordinate :ref:`files and trajectories <gmx-howto-visualize>`.
#. Why am I seeing bonds being created when I watch the trajectory?
* GROMOS 43a1p - 43a1 modified to contain SEP (phosphoserine), TPO (phosphothreonine),
and PTR (phosphotyrosine) (all PO42- forms), and SEPH, TPOH, PTRH (PO4H- forms).
-.. TODO Add new force fields to the list
+.. todo:: Add new force fields to the list
.. _GROMOS: http://www.igc.ethz.ch/gromos/
.. _reference manual: gmx-manual-parent-dir_
|GMX_SOURCE_DOI_STRING|
-.. TODO This is going to require more organization now that
+.. todo::
+
+ This is going to require more organization now that
we are getting more content available.
.. toctree::
See the "run control" section for a working example of the
syntax to use when making .mdp entries, with and without detailed
documentation for values those entries might take. Everything can
- be cross-referenced, see the examples there. TODO Make more
- cross-references.
+ be cross-referenced, see the examples there.
+
+.. todo:: Make more cross-references.
Molecular dynamics parameters (.mdp options)
============================================
The file name can be changed with the ``-awh`` option.
The first :mdp:`awh1-ndim` columns of
each input file should contain the coordinate values, such that each row defines a point in
- coordinate space. Column :mdp:`awh1-ndim` + 1 should contain the PMF value for each point.
+ coordinate space. Column :mdp:`awh1-ndim` + 1 should contain the PMF value (in kT) for each point.
The target distribution column can either follow the PMF (column :mdp:`awh1-ndim` + 2) or
be in the same column as written by :ref:`gmx awh`.
(6)
power 6 for the radial term in the soft-core equation.
- (48)
- (deprecated) power 48 for the radial term in the soft-core equation.
- Note that sc-alpha should generally be much lower (between 0.001 and 0.003).
-
.. mdp:: sc-coul
(no)
Setting "gpu" requires that a compatible CUDA GPU is available,
the simulation uses a single rank.
Update and constraints on a GPU is currently not supported
- with domain decomposition, free-energy, virtual sites,
- Ewald surface correction, replica exchange, constraint pulling,
- orientation restraints and computational electrophysiology.
+ with mass and constraints free-energy perturbation, domain
+ decomposition, virtual sites, Ewald surface correction,
+ replica exchange, constraint pulling, orientation restraints
+ and computational electrophysiology.
``-gpu_id``
A string that specifies the ID numbers of the GPUs that
Subcounters are geared toward developers and have to be enabled during compilation. See
:doc:`/dev-manual/build-system` for more information.
-.. TODO In future patch:
- - red flags in log files, how to interpret wallcycle output
- - hints to devs how to extend wallcycles
+.. todo::
+
+ In future patch:
+ - red flags in log files, how to interpret wallcycle output
+ - hints to devs how to extend wallcycles
.. _gmx-mdrun-on-gpu:
GPU computation of short range nonbonded interactions
.....................................................
-.. TODO make this more elaborate and include figures
+.. todo:: make this more elaborate and include figures
Using the GPU for the short-ranged nonbonded interactions provides
the majority of the available speed-up compared to run using only the CPU.
GPU accelerated calculation of PME
..................................
-.. TODO again, extend this and add some actual useful information concerning performance etc...
+.. todo:: again, extend this and add some actual useful information concerning performance etc...
|Gromacs| now allows the offloading of the PME calculation
to the GPU, to further reduce the load on the CPU and improve usage overlap between
GPU accelerated calculation of bonded interactions (CUDA only)
..............................................................
-.. TODO again, extend this and add some actual useful information concerning performance etc...
+.. todo:: again, extend this and add some actual useful information concerning performance etc...
|Gromacs| now allows the offloading of the bonded part of the PP
workload to a CUDA-compatible GPU. This is treated as part of the PP
#) The only way to know for sure what alternative is best for
your machine is to test and check performance.
-.. TODO: we need to be more concrete here, i.e. what machine/software aspects to take into consideration, when will default run mode be using PME-GPU and when will it not, when/how should the user reason about testing different settings than the default.
+.. todo:: we need to be more concrete here, i.e. what machine/software aspects to take into consideration, when will default run mode be using PME-GPU and when will it not, when/how should the user reason about testing different settings than the default.
-.. TODO someone who knows about the mixed mode should comment further.
+.. todo:: someone who knows about the mixed mode should comment further.
Reducing overheads in GPU accelerated runs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
involves a tradeoff which may outweigh the benefits of reduced GPU driver overhead,
in particular without HyperThreading and with few CPU cores.
-.. TODO In future patch: any tips not covered above
+.. todo:: In future patch: any tips not covered above
Running the OpenCL version of mdrun
-----------------------------------
provide the OpenCL support.
For Intel integrated GPUs, the `Neo driver <https://github.com/intel/compute-runtime/releases>`_ is
recommended.
-TODO: add more Intel driver recommendations
+.. seealso:: :issue:`3268` add more Intel driver recommendations
+
The minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|. See
also the :ref:`known limitations <opencl-known-limitations>`.
* search the primary literature for publications for parameters for the
residue that are consistent with the force field that is being used.
-.. TODO Once you have determined the parameters and topology for your residue, see
- :ref:`adding a residue to a force field <gmx-add-new-residue>` for instructions on how to proceed.
+.. todo:: gmx-add-new-residue doc target
+
+ Need gmx-add-new-residue doc target.
+
+ .. code-block:: none
+
+ Once you have determined the parameters and topology for your residue, see
+ :ref:`adding a residue to a force field <gmx-add-new-residue>` for instructions on how to proceed.
Long bonds and/or missing atoms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2017,2018,2019 by the GROMACS development team.
+# Copyright (c) 2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# Python package requirements for complete build, installation, and testing of
# gmxapi functionality.
cmake>=3.9.6
+flake8>=3.7.7
networkx>=2.0
pip>=10.1
setuptools>=28.0.0
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
import json
import logging
import os
-import shutil
-import tempfile
-import warnings
-from contextlib import contextmanager
import pytest
-
-def pytest_addoption(parser):
- """Add a command-line user option for the pytest invocation."""
- parser.addoption(
- '--rm',
- action='store',
- default='always',
- choices=['always', 'never', 'success'],
- help='Remove temporary directories "always", "never", or on "success".'
- )
-
-
-@pytest.fixture(scope='session')
-def remove_tempdir(request):
- """pytest fixture to get access to the --rm CLI option."""
- return request.config.getoption('--rm')
-
-
-@contextmanager
-def scoped_chdir(dir):
- oldpath = os.getcwd()
- os.chdir(dir)
- try:
- yield dir
- # If the `with` block using scoped_chdir produces an exception, it will
- # be raised at this point in this function. We want the exception to
- # propagate out of the `with` block, but first we want to restore the
- # original working directory, so we skip `except` but provide a `finally`.
- finally:
- os.chdir(oldpath)
-
-
-@contextmanager
-def _cleandir(remove_tempdir):
- """Context manager for a clean temporary working directory.
-
- Arguments:
- remove_tempdir (str): whether to remove temporary directory "always",
- "never", or on "success"
-
- The context manager will issue a warning for each temporary directory that
- is not removed.
- """
-
- newpath = tempfile.mkdtemp()
-
- def remove():
- shutil.rmtree(newpath)
-
- def warn():
- warnings.warn('Temporary directory not removed: {}'.format(newpath))
-
- if remove_tempdir == 'always':
- callback = remove
- else:
- callback = warn
- try:
- with scoped_chdir(newpath):
- yield newpath
- # If we get to this line, the `with` block using _cleandir did not throw.
- # Clean up the temporary directory unless the user specified `--rm never`.
- # I.e. If the user specified `--rm success`, then we need to toggle from `warn` to `remove`.
- if remove_tempdir != 'never':
- callback = remove
- finally:
- callback()
-
-
-@pytest.fixture
-def cleandir(remove_tempdir):
- """Provide a clean temporary working directory for a test.
-
- Example usage:
-
- import os
- import pytest
-
- @pytest.mark.usefixtures("cleandir")
- def test_cwd_starts_empty():
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- def test_cwd_also_starts_empty(cleandir):
- assert os.listdir(os.getcwd()) == []
- assert os.path.abspath(os.getcwd()) == os.path.abspath(cleandir)
- with open("myfile", "w") as f:
- f.write("hello")
-
- @pytest.mark.usefixtures("cleandir")
- class TestDirectoryInit(object):
- def test_cwd_starts_empty(self):
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- def test_cwd_also_starts_empty(self):
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- Ref: https://docs.pytest.org/en/latest/fixture.html#using-fixtures-from-classes-modules-or-projects
- """
- with _cleandir(remove_tempdir) as newdir:
- yield newdir
-
-
-@pytest.fixture(scope='session')
-def gmxcli():
- # TODO: (#2896) Find a more canonical way to identify the GROMACS commandline wrapper binary.
- # We should be able to get the GMXRC contents and related hints from a gmxapi
- # package resource or from module attributes of a ``gromacs`` stub package.
- allowed_command_names = ['gmx', 'gmx_mpi']
- command = None
- for command_name in allowed_command_names:
- if command is not None:
- break
- command = shutil.which(command_name)
- if command is None:
- gmxbindir = os.getenv('GMXBIN')
- if gmxbindir is None:
- gromacsdir = os.getenv('GROMACS_DIR')
- if gromacsdir is not None and gromacsdir != '':
- gmxbindir = os.path.join(gromacsdir, 'bin')
- if gmxbindir is None:
- gmxapidir = os.getenv('gmxapi_DIR')
- if gmxapidir is not None and gmxapidir != '':
- gmxbindir = os.path.join(gmxapidir, 'bin')
- if gmxbindir is not None:
- gmxbindir = os.path.abspath(gmxbindir)
- command = shutil.which(command_name, path=gmxbindir)
- if command is None:
- message = "Tests need 'gmx' command line tool, but could not find it on the path."
- raise RuntimeError(message)
- try:
- assert os.access(command, os.X_OK)
- except Exception as E:
- raise RuntimeError('"{}" is not an executable gmx wrapper program'.format(command)) from E
- yield command
+pytest_plugins = ('gmxapi.testsupport',)
@pytest.fixture(scope='class')
Prepare the MD input in a freshly created working directory.
"""
import gmxapi as gmx
+ # TODO: Remove this import when the the spc_water_box fixture is migrated to gmxapi.testsupport
+ from gmxapi.testsupport import _cleandir
# TODO: (#2896) Fetch MD input from package / library data.
# Example:
from gmxapi.simulation.workflow import WorkElement, from_tpr
from gmxapi import version as gmx_version
import pytest
-from gmxapi.testsupport import withmpi_only
logging.getLogger().setLevel(logging.DEBUG)
# create console handler
session.run()
-@withmpi_only
+@pytest.mark.withmpi_only
@pytest.mark.usefixtures("cleandir")
def test_ensemble_potential_withmpi(spc_water_box):
tpr_filename = spc_water_box
--- /dev/null
+#!/bin/bash -x
+
+# Note: E501 specifies a line length limit of 80 characters, but GROMACS allows more.
+# Ref: http://manual.gromacs.org/current/dev-manual/formatting.html
+# Note: --max-complexity can be used to check McCabe complexity. Compliance
+# could be a future goal, but is not yet a GROMACS priority.
+# W503 is ignored in observation of current PEP-8 conventions, but must be
+# explicitly disabled in at least some versions.
+# http://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
+# https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator
+
+# Check gmxapi package sources.
+python -m flake8 --ignore W503 --max-line-length 119 ${HOME}/gmxapi/src/gmxapi
+
+# Check gmxapi unit tests.
+python -m flake8 --ignore W503 --max-line-length 119 ${HOME}/gmxapi/src/test
+
+# Check gmxapi acceptance tests.
+python -m flake8 --ignore W503 --max-line-length 119 ${HOME}/gmxapi/test
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+
"""
Provide command line operation.
"""
__all__ = ['commandline_operation']
+import os
import shutil
import subprocess
# TODO: Operation returns the output object when called with the shorter signature.
#
@gmx.function_wrapper(output={'erroroutput': str, 'returncode': int})
-def cli(command: NDArray, shell: bool, output: OutputCollectionDescription):
+def cli(command: NDArray, shell: bool, output: OutputCollectionDescription, stdin: str = ''):
"""Execute a command line program in a subprocess.
Configure an executable in a subprocess. Executes when run in an execution
command: a tuple (or list) to be the subprocess arguments, including `executable`
output: mapping of command line flags to output filename arguments
shell: unused (provides forward-compatibility)
+ stdin (str): String input to send to STDIN (terminal input) of the executable.
+
+ Multi-line text sent to *stdin* should be joined into a single string
+ (e.g. ``'\n'.join(list_of_strings) + '\n'``).
+ If multiple strings are provided to *stdin*, gmxapi will assume an ensemble,
+ and will run one operation for each provided string.
+
+ Only string input (:py:func:str) to *stdin* is currently supported.
+ If you have a use case that requires streaming input or binary input,
+ please open an issue or contact the author(s).
Arguments are iteratively added to the command line with standard Python
iteration, so you should use a tuple or list even if you have only one parameter.
# * STDOUT is available if a consuming operation is bound to `output.stdout`.
# * STDERR is available if a consuming operation is bound to `output.stderr`.
# * Otherwise, STDOUT and/or STDERR is(are) closed when command is called.
- #
- # Warning:
- # Commands relying on STDIN cannot be used and is closed when command is called.
# In the operation implementation, we expect the `shell` parameter to be intercepted by the
# wrapper and set to False.
if shell:
raise exceptions.UsageError("Operation does not support shell processing.")
+ if stdin == '':
+ stdin = None
+
if isinstance(command, (str, bytes)):
command = [command]
command = list([arg for arg in command])
- try:
- command[0] = shutil.which(command[0])
- except Exception:
- raise exceptions.ValueError('command argument could not be resolved to an executable file path.')
+
+ executable = shutil.which(command[0])
+ if executable is None:
+ raise exceptions.ValueError('"{}" is not found or not executable.'.format(command[0]))
+ command[0] = executable
# TODO: (FR9) Can OS input/output filehandles be a responsibility of
# the code providing 'resources'?
erroroutput = ''
logger.debug('executing subprocess')
try:
- # TODO: If Python >=3.5 is required, switch to subprocess.run()
- command_output = subprocess.check_output(command,
- shell=shell,
- stdin=subprocess.DEVNULL,
- stderr=subprocess.STDOUT,
- )
- returncode = 0
+ completed_process = subprocess.run(command,
+ shell=shell,
+ input=stdin,
+ check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ universal_newlines=True
+ )
+ returncode = completed_process.returncode
# TODO: Resource management code should manage a safe data object for `output`.
- # WARNING: We have no reason to assume the output is utf-8 encoded text!!!
- for line in command_output.decode('utf-8').split('\n'):
+ for line in completed_process.stdout.split('\n'):
logger.debug(line)
except subprocess.CalledProcessError as e:
logger.info("commandline operation had non-zero return status when calling {}".format(e.cmd))
- erroroutput = e.output.decode('utf-8')
+ erroroutput = e.output
returncode = e.returncode
- # resources.output.erroroutput.publish(erroroutput)
- # resources.output.returncode.publish(returncode)
- # `publish` is descriptive, but redundant. Access to the output data handler is
- # assumed to coincide with publishing, and we assume data is published when the
- # handler is released. A class with a single `publish` method is overly complex
- # since we can just use the assignment operator.
+ # Publish outputs.
output.erroroutput = erroroutput
output.returncode = returncode
- # TODO: Handle the file output at the higher level wrapper.
- # output.file = None
# TODO: (FR4) Make this a formal operation to properly handle gmxapi data dependencies.
arguments=(),
input_files: dict = None,
output_files: dict = None,
+ stdin: str = None,
**kwargs):
"""Helper function to define a new operation that executes a subprocess in gmxapi data flow.
arguments: list of positional arguments to insert at ``argv[1]``
input_files: mapping of command-line flags to input file names
output_files: mapping of command-line flags to output file names
+ stdin (str): String input to send to STDIN (terminal input) of the executable (optional).
+
+ Multi-line text sent to *stdin* should be joined into a single string.
+ E.g.::
+
+ commandline_operation(..., stdin='\\n'.join(list_of_strings) + '\\n')
+
+ If multiple strings are provided to *stdin*, gmxapi will assume an ensemble,
+ and will run one operation for each provided string.
+
+ Only string input (:py:func:`str`) to *stdin* is currently supported.
+ If you have a use case that requires streaming input or binary input,
+ please open an issue or contact the author(s).
Output:
The output node of the resulting operation handle contains
+
* ``file``: the mapping of CLI flags to filename strings resulting from the ``output_files`` kwarg
* ``erroroutput``: A string of error output (if any) if the process failed.
* ``returncode``: return code of the subprocess.
cli_args = {'command': command,
'shell': shell}
cli_args.update(**kwargs)
+ if stdin is not None:
+ cli_args['stdin'] = str(stdin)
##
# 3. Merge operations
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# gets used correctly.
# ref: https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager
+ if self._done[ensemble_member]:
+ raise exceptions.ProtocolError('Attempting to publish {}[{}] more than once.'.format(self.operation_id, ensemble_member))
+
try:
- if not self._done[ensemble_member]:
- resource = self.__publishing_data_proxy(instance=weakref.proxy(self),
- client_id=ensemble_member)
- yield resource
+ resource = self.__publishing_data_proxy(instance=weakref.proxy(self),
+ client_id=ensemble_member)
except Exception as e:
- message = 'Uncaught {} while providing output-publishing resources for {}.'
- message.format(repr(e), self.operation_id)
- raise exceptions.ApiError(message) from e
- finally:
- logger.debug('Published output for {} member {}'.format(self.operation_id, ensemble_member))
- self._done[ensemble_member] = True
+ logger.debug('Publishing context could not be created due to {}'.format(e))
+ raise e
+
+ yield resource
+ # Note: The remaining lines are skipped if an exception occurs in the `with` block
+ # for the contextmanager suite, which effectively raises at the line after 'yield'.
+ logger.debug('Published output for {} member {}'.format(self.operation_id, ensemble_member))
+ self._done[ensemble_member] = True
def __init__(self, *,
source: DataEdge,
Used internally to implement Futures for the local operation
associated with this resource manager.
+ Raises:
+ exceptions.ApiError if operation runner fails to publish output.
+
+ TODO: More comprehensive error handling for operations that fail to execute.
+
TODO: We need a different implementation for an operation whose output
is served by multiple resource managers. E.g. an operation whose output
is available across the ensemble, but which should only be executed on
# option 1: Make the input and output resources with separate factories and add_resource on
# the runner builder.
# option 2: Pass resource_builder to input_director and then output_director.
- resources = self._resource_factory(input=input, output=output)
+ error_message = 'Got {} while executing {} for operation {}.'
+ try:
+ resources = self._resource_factory(input=input, output=output)
+ except exceptions.TypeError as e:
+ message = error_message.format(e, self._resource_factory, self.operation_id)
+ raise exceptions.ApiError(message) from e
+
runner = self._runner_director(resources)
- runner()
+ try:
+ runner()
+ except Exception as e:
+ message = error_message.format(e, runner, self.operation_id)
+ raise exceptions.ApiError(message) from e
if not self.done():
- raise exceptions.ApiError('update_output implementation failed to update all outputs.')
+ message = 'update_output implementation failed to update all outputs for {}.'
+ message = message.format(self.operation_id)
+ raise exceptions.ApiError(message)
def future(self, name: str, description: ResultDescription):
"""Retrieve a Future for a named output.
For the Python Context, the protocol is for the Context to call the
resource_director instance method, passing input and output containers.
+
+ Raises:
+ exceptions.TypeError if provided resource type does not match input signature.
"""
resources = PyFunctionRunnerResources()
resources.update(input.kwargs)
expected = cls.signature()[name]
got = type(value)
if got != expected:
- raise exceptions.TypeError('Expected {} but got {}.'.format(expected, got))
+ raise exceptions.TypeError(
+ 'Expected {} but got {} for {} resource {}.'.format(expected,
+ got,
+ cls.__basename,
+ name))
return resources
# TODO: (FR4) Update annotations with gmxapi data types. E.g. return -> Future.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
"""Reusable definitions for test modules.
-Define the ``withmpi_only`` test decorator.
+Provides utilities and pytest fixtures for gmxapi and GROMACS tests.
+
+To load these facilities in a pytest environment, set a `pytest_plugins`
+variable in a conftest.py
+(Reference https://docs.pytest.org/en/latest/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file)
+
+ pytest_plugins = "gmxapi.testsupport"
+
+.. seealso:: https://docs.pytest.org/en/latest/plugins.html#findpluginname
.. todo:: Consider moving this to a separate optional package.
"""
+import json
+import logging
+import os
+import shutil
+import tempfile
+import warnings
+from contextlib import contextmanager
+from enum import Enum
+from typing import Union
+
import pytest
-mpi_requirement = 'Test requires mpi4py managing 2 MPI ranks.'
+mpi_status = 'Test requires mpi4py managing 2 MPI ranks.'
+skip_mpi = False
try:
from mpi4py import MPI
if not MPI.Is_initialized():
skip_mpi = True
- reason = mpi_requirement + ' MPI is not initialized'
+ mpi_status += ' MPI is not initialized'
elif MPI.COMM_WORLD.Get_size() < 2:
skip_mpi = True
- reason = mpi_requirement + ' MPI context is too small.'
- else:
- skip_mpi = False
- reason = ''
- withmpi_only = pytest.mark.skipif(skip_mpi, reason=reason)
+ mpi_status += ' MPI context is too small.'
except ImportError:
- withmpi_only = pytest.mark.skip(
- reason=mpi_requirement + ' mpi4py is not available.')
+ skip_mpi = True
+ mpi_status += ' mpi4py is not available.'
+
+
+def pytest_configure(config):
+ config.addinivalue_line("markers", "withmpi_only: test requires mpi4py managing 2 MPI ranks.")
+
+
+def pytest_runtest_setup(item):
+ # Handle the withmpi_only marker.
+ for _ in item.iter_markers(name='withmpi_only'):
+ if skip_mpi:
+ pytest.skip(mpi_status)
+ # The API uses iteration because markers may be duplicated, but we only
+ # care about whether 'withmpi_only' occurs at all.
+ break
+
+
+def pytest_addoption(parser):
+ """Add a command-line user option for the pytest invocation."""
+ parser.addoption(
+ '--rm',
+ action='store',
+ default='always',
+ choices=['always', 'never', 'success'],
+ help='Remove temporary directories "always", "never", or on "success".'
+ )
+
+
+class RmOption(Enum):
+ """Enumerate allowable values of the --rm option."""
+ always = 'always'
+ never = 'never'
+ success = 'success'
+
+
+@pytest.fixture(scope='session')
+def remove_tempdir(request) -> RmOption:
+ """pytest fixture to get access to the --rm CLI option."""
+ arg = request.config.getoption('--rm')
+ return RmOption(arg)
+
+
+@contextmanager
+def scoped_chdir(dir):
+ oldpath = os.getcwd()
+ os.chdir(dir)
+ try:
+ yield dir
+ # If the `with` block using scoped_chdir produces an exception, it will
+ # be raised at this point in this function. We want the exception to
+ # propagate out of the `with` block, but first we want to restore the
+ # original working directory, so we skip `except` but provide a `finally`.
+ finally:
+ os.chdir(oldpath)
+
+
+@contextmanager
+def _cleandir(remove_tempdir: Union[str, RmOption]):
+ """Context manager for a clean temporary working directory.
+
+ Arguments:
+ remove_tempdir (RmOption): whether to remove temporary directory "always",
+ "never", or on "success"
+
+ Raises:
+ ValueError: if remove_tempdir value is not valid.
+
+ The context manager will issue a warning for each temporary directory that
+ is not removed.
+ """
+ if not isinstance(remove_tempdir, RmOption):
+ remove_tempdir = RmOption(remove_tempdir)
+
+ newpath = tempfile.mkdtemp()
+
+ def remove():
+ shutil.rmtree(newpath)
+
+ def warn():
+ warnings.warn('Temporary directory not removed: {}'.format(newpath))
+
+ # Initialize callback function reference
+ if remove_tempdir == RmOption.always:
+ callback = remove
+ else:
+ callback = warn
+
+ try:
+ with scoped_chdir(newpath):
+ yield newpath
+ # If we get to this line, the `with` block using _cleandir did not throw.
+ # Clean up the temporary directory unless the user specified `--rm never`.
+ # I.e. If the user specified `--rm success`, then we need to toggle from `warn` to `remove`.
+ if remove_tempdir != RmOption.never:
+ callback = remove
+ finally:
+ callback()
+
+
+@pytest.fixture
+def cleandir(remove_tempdir: RmOption):
+ """Provide a clean temporary working directory for a test.
+
+ Example usage:
+
+ import os
+ import pytest
+
+ @pytest.mark.usefixtures("cleandir")
+ def test_cwd_starts_empty():
+ assert os.listdir(os.getcwd()) == []
+ with open("myfile", "w") as f:
+ f.write("hello")
+
+ def test_cwd_also_starts_empty(cleandir):
+ assert os.listdir(os.getcwd()) == []
+ assert os.path.abspath(os.getcwd()) == os.path.abspath(cleandir)
+ with open("myfile", "w") as f:
+ f.write("hello")
+
+ @pytest.mark.usefixtures("cleandir")
+ class TestDirectoryInit(object):
+ def test_cwd_starts_empty(self):
+ assert os.listdir(os.getcwd()) == []
+ with open("myfile", "w") as f:
+ f.write("hello")
+
+ def test_cwd_also_starts_empty(self):
+ assert os.listdir(os.getcwd()) == []
+ with open("myfile", "w") as f:
+ f.write("hello")
+
+ Ref: https://docs.pytest.org/en/latest/fixture.html#using-fixtures-from-classes-modules-or-projects
+ """
+ with _cleandir(remove_tempdir) as newdir:
+ yield newdir
+
+
+@pytest.fixture(scope='session')
+def gmxcli():
+ # TODO: (#2896) Find a more canonical way to identify the GROMACS commandline wrapper binary.
+ # We should be able to get the GMXRC contents and related hints from a gmxapi
+ # package resource or from module attributes of a ``gromacs`` stub package.
+ allowed_command_names = ['gmx', 'gmx_mpi']
+ command = None
+ for command_name in allowed_command_names:
+ if command is not None:
+ break
+ command = shutil.which(command_name)
+ if command is None:
+ gmxbindir = os.getenv('GMXBIN')
+ if gmxbindir is None:
+ gromacsdir = os.getenv('GROMACS_DIR')
+ if gromacsdir is not None and gromacsdir != '':
+ gmxbindir = os.path.join(gromacsdir, 'bin')
+ if gmxbindir is None:
+ gmxapidir = os.getenv('gmxapi_DIR')
+ if gmxapidir is not None and gmxapidir != '':
+ gmxbindir = os.path.join(gmxapidir, 'bin')
+ if gmxbindir is not None:
+ gmxbindir = os.path.abspath(gmxbindir)
+ command = shutil.which(command_name, path=gmxbindir)
+ if command is None:
+ message = "Tests need 'gmx' command line tool, but could not find it on the path."
+ raise RuntimeError(message)
+ try:
+ assert os.access(command, os.X_OK)
+ except Exception as E:
+ raise RuntimeError('"{}" is not an executable gmx wrapper program'.format(command)) from E
+ yield command
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
"""
-Provide version and release information.
+gmxapi version and release information.
-Attributes:
- major (int): gmxapi major version number.
- minor (int): gmxapi minor version number.
- patch (int): gmxapi patch level number.
- release (bool): True if imported gmx module is an officially tagged release, else False.
+The ``gmxapi.__version__`` attribute contains a :pep:`version string <440>`.
+The more general way to access the package version is with the
+:py:mod:`pkg_resources <https://setuptools.readthedocs.io/en/latest/pkg_resources.html>` module::
-"""
-import warnings
+ pkg_resources.get_distribution('gmxapi').version
+
+`gmxapi.version` module functions `api_is_at_least()` and `has_feature()`
+support additional convenience and introspection.
+
+.. versionchanged:: 0.2
+
+ This module no longer provides public data attributes.
+ Instead, use the module functions or
+ :py:mod:`packaging.version <https://packaging.pypa.io/en/latest/version/>`.
-__version__ = "0.1.0"
+.. seealso::
-# TODO: (pending infrastructure and further discussion) Configure with CMake.
-# __version__ = "@PROJECT_VERSION@"
-# major = @PROJECT_VERSION_MAJOR@
-# minor = @PROJECT_VERSION_MINOR@
-# patch = @PROJECT_VERSION_PATCH@
+ Consider https://packaging.pypa.io/en/latest/version/ for programmatic
+ handling of the version string. For example::
+
+ from packaging.version import parse
+ gmxapi_version = pkg_resources.get_distribution('gmxapi').version
+ if parse(gmxapi_version).is_prerelease:
+ print('The early bird gets the worm.')
+
+.. todo:: Use pkg_resources.get_distribution('gmxapi').version and
+ "development installations" instead of relying on or publicizing
+ a __version__ attribute.
+"""
+import warnings
-from gmxapi.exceptions import FeatureNotAvailableError
+from .exceptions import FeatureNotAvailableError
-major = 0
-minor = 1
-patch = 0
+# TODO: Version management policy and procedures.
+_major = 0
+_minor = 2
+_micro = 0
+_suffix = 'b1'
-# Note: this is not automatically updated. See RELEASE.txt and https://github.com/kassonlab/gmxapi/issues/152
-release = True
+# Reference https://www.python.org/dev/peps/pep-0440/
+# and https://packaging.pypa.io/en/latest/version/
+__version__ = '{major}.{minor}.{micro}{suffix}'.format(major=_major,
+ minor=_minor,
+ micro=_micro,
+ suffix=_suffix)
# Features added since the initial gmxapi prototype, targeted for version 0.1.
_named_features_0_0 = ['fr1', 'fr3', 'fr7', 'fr15']
"""
if not isinstance(major_version, int) or not isinstance(minor_version, int) or not isinstance(patch_version, int):
raise TypeError('Version levels must be provided as integers.')
- if major > major_version:
+ if _major > major_version:
return True
- elif major == major_version and minor >= minor_version:
+ elif _major == major_version and _minor >= minor_version:
return True
- elif major == major_version and minor == minor_version and patch >= patch_version:
+ elif _major == major_version and _minor == minor_version and _micro >= patch_version:
return True
else:
return False
if name in _named_features_0_0:
warnings.warn(
'Old feature name. Use `api_is_at_least(0, 1)` instead of `has_feature({})`.'.format(name),
- category=DeprecationWarning
+ category=DeprecationWarning,
+ stacklevel=2
)
# Check whether the feature is listed in the API specification amendments.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
setup(
name='gmxapi',
- # TODO: (pending infrastructure and further discussion) Replace with CMake variables from GMXAPI version.
- version='0.1.0.1',
+ # TODO: single-source version information (currently repeated in gmxapi/version.py)
+ version='0.2.0b1',
python_requires='>=3.5, <3.9',
setup_requires=['cmake>=3.12',
'setuptools>=28',
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
import json
import logging
import os
-import shutil
-import tempfile
-import warnings
-from contextlib import contextmanager
-
import pytest
-
-def pytest_addoption(parser):
- """Add a command-line user option for the pytest invocation."""
- parser.addoption(
- '--rm',
- action='store',
- default='always',
- choices=['always', 'never', 'success'],
- help='Remove temporary directories "always", "never", or on "success".'
- )
-
-
-@pytest.fixture(scope='session')
-def remove_tempdir(request):
- """pytest fixture to get access to the --rm CLI option."""
- return request.config.getoption('--rm')
-
-
-@contextmanager
-def scoped_chdir(dir):
- oldpath = os.getcwd()
- os.chdir(dir)
- try:
- yield dir
- # If the `with` block using scoped_chdir produces an exception, it will
- # be raised at this point in this function. We want the exception to
- # propagate out of the `with` block, but first we want to restore the
- # original working directory, so we skip `except` but provide a `finally`.
- finally:
- os.chdir(oldpath)
-
-
-@contextmanager
-def _cleandir(remove_tempdir):
- """Context manager for a clean temporary working directory.
-
- Arguments:
- remove_tempdir (str): whether to remove temporary directory "always",
- "never", or on "success"
-
- The context manager will issue a warning for each temporary directory that
- is not removed.
- """
-
- newpath = tempfile.mkdtemp()
-
- def remove():
- shutil.rmtree(newpath)
-
- def warn():
- warnings.warn('Temporary directory not removed: {}'.format(newpath))
-
- if remove_tempdir == 'always':
- callback = remove
- else:
- callback = warn
- try:
- with scoped_chdir(newpath):
- yield newpath
- # If we get to this line, the `with` block using _cleandir did not throw.
- # Clean up the temporary directory unless the user specified `--rm never`.
- # I.e. If the user specified `--rm success`, then we need to toggle from `warn` to `remove`.
- if remove_tempdir != 'never':
- callback = remove
- finally:
- callback()
-
-
-@pytest.fixture
-def cleandir(remove_tempdir):
- """Provide a clean temporary working directory for a test.
-
- Example usage:
-
- import os
- import pytest
-
- @pytest.mark.usefixtures("cleandir")
- def test_cwd_starts_empty():
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- def test_cwd_also_starts_empty(cleandir):
- assert os.listdir(os.getcwd()) == []
- assert os.path.abspath(os.getcwd()) == os.path.abspath(cleandir)
- with open("myfile", "w") as f:
- f.write("hello")
-
- @pytest.mark.usefixtures("cleandir")
- class TestDirectoryInit(object):
- def test_cwd_starts_empty(self):
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- def test_cwd_also_starts_empty(self):
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- Ref: https://docs.pytest.org/en/latest/fixture.html#using-fixtures-from-classes-modules-or-projects
- """
- with _cleandir(remove_tempdir) as newdir:
- yield newdir
-
-
-@pytest.fixture(scope='session')
-def gmxcli():
- # TODO: (#2896) Find a more canonical way to identify the GROMACS commandline wrapper binary.
- # We should be able to get the GMXRC contents and related hints from a gmxapi
- # package resource or from module attributes of a ``gromacs`` stub package.
- allowed_command_names = ['gmx', 'gmx_mpi']
- command = None
- for command_name in allowed_command_names:
- if command is not None:
- break
- command = shutil.which(command_name)
- if command is None:
- gmxbindir = os.getenv('GMXBIN')
- if gmxbindir is None:
- gromacsdir = os.getenv('GROMACS_DIR')
- if gromacsdir is not None and gromacsdir != '':
- gmxbindir = os.path.join(gromacsdir, 'bin')
- if gmxbindir is None:
- gmxapidir = os.getenv('gmxapi_DIR')
- if gmxapidir is not None and gmxapidir != '':
- gmxbindir = os.path.join(gmxapidir, 'bin')
- if gmxbindir is not None:
- gmxbindir = os.path.abspath(gmxbindir)
- command = shutil.which(command_name, path=gmxbindir)
- if command is None:
- message = "Tests need 'gmx' command line tool, but could not find it on the path."
- raise RuntimeError(message)
- try:
- assert os.access(command, os.X_OK)
- except Exception as E:
- raise RuntimeError('"{}" is not an executable gmx wrapper program'.format(command)) from E
- yield command
-
+pytest_plugins = ('gmxapi.testsupport',)
@pytest.fixture(scope='class')
def spc_water_box(gmxcli, remove_tempdir):
Prepare the MD input in a freshly created working directory.
"""
import gmxapi as gmx
+ # TODO: Remove this import when the the spc_water_box fixture is migrated to gmxapi.testsupport
+ from gmxapi.testsupport import _cleandir
# TODO: (#2896) Fetch MD input from package / library data.
# Example:
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
operation = commandline.cli(command=[shutil.which('echo'), 'hi', 'there'], shell=False)
assert operation.output.returncode.result() == 0
+ def test_command_with_stdin(self):
+ """Test that cli() can handle string input."""
+ stdin = 'hi\nthere\n'
+ subcommand = '{wc} -l | {grep} -q 2'.format(wc=shutil.which('wc'), grep=shutil.which('grep'))
+
+ operation = commandline.cli(command=['/bin/sh', '-c', subcommand], shell=False, stdin=stdin)
+ assert operation.output.returncode.result() == 0
+ operation = commandline.commandline_operation('/bin/sh', ['-c', subcommand], stdin=stdin)
+ assert operation.output.returncode.result() == 0
+
+ subcommand = '{wc} -l | {grep} -q 1'.format(wc=shutil.which('wc'), grep=shutil.which('grep'))
+
+ operation = commandline.cli(command=['/bin/sh', '-c', subcommand], shell=False, stdin=stdin)
+ assert operation.output.returncode.result() != 0
+ operation = commandline.commandline_operation('/bin/sh', ['-c', subcommand], stdin=stdin)
+ assert operation.output.returncode.result() != 0
+
class CommandLineOperationSimpleTestCase(unittest.TestCase):
"""Test the command line wrapper operation factory."""
import pytest
import gmxapi as gmx
-from gmxapi.testsupport import withmpi_only
# Configure the `logging` module before proceeding any further.
gmx.logger.setLevel(logging.WARNING)
# TODO: better handling of output on unused MPI ranks.
-@withmpi_only
+@pytest.mark.withmpi_only
@pytest.mark.usefixtures('cleandir')
def test_run_trivial_ensemble(spc_water_box, caplog):
from mpi4py import MPI
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
import json
import logging
import os
-import shutil
-import tempfile
-import warnings
-from contextlib import contextmanager
import pytest
-
-def pytest_addoption(parser):
- """Add a command-line user option for the pytest invocation."""
- parser.addoption(
- '--rm',
- action='store',
- default='always',
- choices=['always', 'never', 'success'],
- help='Remove temporary directories "always", "never", or on "success".'
- )
-
-
-@pytest.fixture(scope='session')
-def remove_tempdir(request):
- """pytest fixture to get access to the --rm CLI option."""
- return request.config.getoption('--rm')
-
-
-@contextmanager
-def scoped_chdir(dir):
- oldpath = os.getcwd()
- os.chdir(dir)
- try:
- yield dir
- # If the `with` block using scoped_chdir produces an exception, it will
- # be raised at this point in this function. We want the exception to
- # propagate out of the `with` block, but first we want to restore the
- # original working directory, so we skip `except` but provide a `finally`.
- finally:
- os.chdir(oldpath)
-
-
-@contextmanager
-def _cleandir(remove_tempdir):
- """Context manager for a clean temporary working directory.
-
- Arguments:
- remove_tempdir (str): whether to remove temporary directory "always",
- "never", or on "success"
-
- The context manager will issue a warning for each temporary directory that
- is not removed.
- """
-
- newpath = tempfile.mkdtemp()
-
- def remove():
- shutil.rmtree(newpath)
-
- def warn():
- warnings.warn('Temporary directory not removed: {}'.format(newpath))
-
- if remove_tempdir == 'always':
- callback = remove
- else:
- callback = warn
- try:
- with scoped_chdir(newpath):
- yield newpath
- # If we get to this line, the `with` block using _cleandir did not throw.
- # Clean up the temporary directory unless the user specified `--rm never`.
- # I.e. If the user specified `--rm success`, then we need to toggle from `warn` to `remove`.
- if remove_tempdir != 'never':
- callback = remove
- finally:
- callback()
-
-
-@pytest.fixture
-def cleandir(remove_tempdir):
- """Provide a clean temporary working directory for a test.
-
- Example usage:
-
- import os
- import pytest
-
- @pytest.mark.usefixtures("cleandir")
- def test_cwd_starts_empty():
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- def test_cwd_also_starts_empty(cleandir):
- assert os.listdir(os.getcwd()) == []
- assert os.path.abspath(os.getcwd()) == os.path.abspath(cleandir)
- with open("myfile", "w") as f:
- f.write("hello")
-
- @pytest.mark.usefixtures("cleandir")
- class TestDirectoryInit(object):
- def test_cwd_starts_empty(self):
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- def test_cwd_also_starts_empty(self):
- assert os.listdir(os.getcwd()) == []
- with open("myfile", "w") as f:
- f.write("hello")
-
- Ref: https://docs.pytest.org/en/latest/fixture.html#using-fixtures-from-classes-modules-or-projects
- """
- with _cleandir(remove_tempdir) as newdir:
- yield newdir
-
-
-@pytest.fixture(scope='session')
-def gmxcli():
- # TODO: (#2896) Find a more canonical way to identify the GROMACS commandline wrapper binary.
- # We should be able to get the GMXRC contents and related hints from a gmxapi
- # package resource or from module attributes of a ``gromacs`` stub package.
- allowed_command_names = ['gmx', 'gmx_mpi']
- command = None
- for command_name in allowed_command_names:
- if command is not None:
- break
- command = shutil.which(command_name)
- if command is None:
- gmxbindir = os.getenv('GMXBIN')
- if gmxbindir is None:
- gromacsdir = os.getenv('GROMACS_DIR')
- if gromacsdir is not None and gromacsdir != '':
- gmxbindir = os.path.join(gromacsdir, 'bin')
- if gmxbindir is None:
- gmxapidir = os.getenv('gmxapi_DIR')
- if gmxapidir is not None and gmxapidir != '':
- gmxbindir = os.path.join(gmxapidir, 'bin')
- if gmxbindir is not None:
- gmxbindir = os.path.abspath(gmxbindir)
- command = shutil.which(command_name, path=gmxbindir)
- if command is None:
- message = "Tests need 'gmx' command line tool, but could not find it on the path."
- raise RuntimeError(message)
- try:
- assert os.access(command, os.X_OK)
- except Exception as E:
- raise RuntimeError('"{}" is not an executable gmx wrapper program'.format(command)) from E
- yield command
+pytest_plugins = ('gmxapi.testsupport',)
@pytest.fixture(scope='class')
Prepare the MD input in a freshly created working directory.
"""
import gmxapi as gmx
+ # TODO: Remove this import when the the spc_water_box fixture is migrated to gmxapi.testsupport
+ from gmxapi.testsupport import _cleandir
# TODO: (#2896) Fetch MD input from package / library data.
# Example:
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
"""Test gmxapi functionality described in roadmap.rst."""
import gmxapi as gmx
-import pytest
-from gmxapi.version import has_feature
-@pytest.mark.skipif(not has_feature('fr1'),
- reason="Feature level not met.")
def test_fr1():
"""FR1: Wrap importable Python code.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
import tempfile
import gmxapi as gmx
-import pytest
-from gmxapi.version import has_feature
-@pytest.mark.skipif(not has_feature('fr3'),
- reason="Feature level not met.")
def test_fr3():
"""FR3: Output proxy can be used as input."""
with tempfile.TemporaryDirectory() as directory:
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
import pytest
import gmxapi as gmx
-from gmxapi.version import has_feature
-@pytest.mark.skipif(not has_feature('fr7'),
- reason="Feature level not met.")
+
@pytest.mark.usefixtures('cleandir')
def test_fr7(spc_water_box):
"""FR7: Python bindings for launching simulations.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
import pytest
import gmxapi as gmx
-from gmxapi.version import has_feature
# Configure the `logging` module before proceeding any further.
gmx.logger.setLevel(logging.WARNING)
formatter = logging.Formatter(rank_tag + '%(name)s:%(levelname)s: %(message)s')
@pytest.mark.usefixtures('cleandir')
-@pytest.mark.skipif(not has_feature('fr15'),
- reason="Feature level not met.")
def test_fr15(spc_water_box, caplog):
"""FR15: Simulation input modification.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2018, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+# Copyright (c) 2014,2018,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2014,2016,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2014,2016,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
gmx_target_warning_suppression(template /wd4244 HAS_NO_MSVC_LOSSY_CONVERSION_DOUBLE_TO_REAL)
gmx_target_warning_suppression(template /wd4267 HAS_NO_MSVC_LOSSY_CONVERSION_SIZE_T_TO_INT)
endif()
+# This should be removable once object libraries can directly use target_link_libraries
+# with CMake 3.12, #3290
+target_include_directories(template SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
target_link_libraries(template libgromacs ${GMX_EXE_LINKER_FLAGS})
set(DOCUMENTATION_HTTP_URL_BASE
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
"-Wno-double-promotion")
string(REPLACE " " ";" IGNORED_CLANG_ALL_WARNINGS "${IGNORED_CLANG_ALL_WARNINGS}")
+option(GMX_CLANG_TIDY "Use clang-tidy" OFF)
if (GMX_CLANG_TIDY)
+ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithAssert")
+ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
+ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "ASAN")
+ else()
+ message(FATAL_ERROR "Can only use clang-tidy with build type containing asserts: Debug, RelWithAssert, RelWithDebInfo, ASAN.")
+ endif()
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+ mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CLANG_TIDY "clang-tidy" CACHE STRING "Name of clang-tidy executable")
find_program(CLANG_TIDY_EXE NAMES "${CLANG_TIDY}"
DOC "Path to clang-tidy executable")
if(NOT CLANG_TIDY_EXE)
message(FATAL_ERROR "clang-tidy not found.")
endif()
+ mark_as_advanced(CLANG_TIDY)
+ mark_as_advanced(CLANG_TIDY_EXE)
endif()
-#####
add_subdirectory(external)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
gmx_target_compile_options(gmxapi)
target_compile_definitions(gmxapi PRIVATE HAVE_CONFIG_H)
target_include_directories(gmxapi SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+# Should be possible to change this when resolving #3290
+target_include_directories(gmxapi SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
# Define public interface. Make sure targets linking against `gmxapi` in the build
# system don't accidentally have the implementation headers (this directory))
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Use ORCA for QM-MM calculations */
#cmakedefine01 GMX_QMMM_ORCA
-/* Use cycle counters */
-#cmakedefine01 GMX_CYCLECOUNTERS
-
/* Use sub-counters */
#cmakedefine01 GMX_CYCLE_SUBCOUNTERS
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2019, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#define NONSTD_OPTIONAL_LITE_HPP
#define optional_lite_MAJOR 3
-#define optional_lite_MINOR 1
-#define optional_lite_PATCH 1
+#define optional_lite_MINOR 2
+#define optional_lite_PATCH 0
#define optional_lite_VERSION optional_STRINGIFY(optional_lite_MAJOR) "." optional_STRINGIFY(optional_lite_MINOR) "." optional_STRINGIFY(optional_lite_PATCH)
#define optional_HAVE_NOEXCEPT optional_CPP11_140
#define optional_HAVE_NULLPTR optional_CPP11_100
#define optional_HAVE_REF_QUALIFIER optional_CPP11_140
+#define optional_HAVE_INITIALIZER_LIST optional_CPP11_140
// Presence of C++14 language features:
using optional_lite::optional;
using optional_lite::nullopt_t;
using optional_lite::nullopt;
+
+#if ! optional_CONFIG_NO_EXCEPTIONS
using optional_lite::bad_optional_access;
+#endif
using optional_lite::make_optional;
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+# Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2011,2012,2013,2014,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* allow the MdModuleNotifier to statically distinguish the callback
* function type from other 'int' function callbacks.
*
- * \param[in] pbc MdModuleNotification class that contains a variable
- * that enumerates the periodic boundary condition.
+ * \param[in] pbcType enumerates the periodic boundary condition.
*/
- void setPeriodicBoundaryConditionType(PeriodicBoundaryConditionType pbc)
+ void setPeriodicBoundaryConditionType(const PbcType& pbcType)
{
- pbcType_ = std::make_unique<int>(pbc.pbcType);
+ pbcType_ = std::make_unique<PbcType>(pbcType);
}
//! Get the periodic boundary conditions
- int periodicBoundaryConditionType()
+ PbcType periodicBoundaryConditionType()
{
if (pbcType_ == nullptr)
{
//! The local atom set to act on
std::unique_ptr<LocalAtomSet> localAtomSet_;
//! The type of periodic boundary conditions in the simulation
- std::unique_ptr<int> pbcType_;
+ std::unique_ptr<PbcType> pbcType_;
//! The simulation time step
double simulationTimeStep_ = 1;
* \param[in] notifier allows the module to subscribe to notifications from MdModules.
*
* The density fitting code subscribes to these notifications:
- * - setting atom group indices in the densityFittingOptions_ by
- * taking a parmeter const IndexGroupsAndNames &
+ * - setting atom group indices in the densityFittingOptions_ from an
+ * index group string by taking a parmeter const IndexGroupsAndNames &
* - storing its internal parameters in a tpr file by writing to a
* key-value-tree during pre-processing by a function taking a
* KeyValueTreeObjectBuilder as parameter
// and subscribed, and will be dispatched correctly at run time
// based on the type of the parameter required by the lambda.
- // Setting atom group indices
+ // Setting the atom group indices from index group string
const auto setFitGroupIndicesFunction = [this](const IndexGroupsAndNames& indexGroupsAndNames) {
densityFittingOptions_.setFitGroupIndices(indexGroupsAndNames);
};
- notifier->notifier_.subscribe(setFitGroupIndicesFunction);
+ notifier->preProcessingNotifications_.subscribe(setFitGroupIndicesFunction);
// Writing internal parameters during pre-processing
const auto writeInternalParametersFunction = [this](KeyValueTreeObjectBuilder treeBuilder) {
densityFittingOptions_.writeInternalParametersToKvt(treeBuilder);
};
- notifier->notifier_.subscribe(writeInternalParametersFunction);
+ notifier->preProcessingNotifications_.subscribe(writeInternalParametersFunction);
// Reading internal parameters during simulation setup
const auto readInternalParametersFunction = [this](const KeyValueTreeObject& tree) {
densityFittingOptions_.readInternalParametersFromKvt(tree);
};
- notifier->notifier_.subscribe(readInternalParametersFunction);
+ notifier->simulationSetupNotifications_.subscribe(readInternalParametersFunction);
// Checking for consistency with all .mdp options
const auto checkEnergyCaluclationFrequencyFunction =
[this](EnergyCalculationFrequencyErrors* energyCalculationFrequencyErrors) {
densityFittingOptions_.checkEnergyCaluclationFrequency(energyCalculationFrequencyErrors);
};
- notifier->notifier_.subscribe(checkEnergyCaluclationFrequencyFunction);
+ notifier->preProcessingNotifications_.subscribe(checkEnergyCaluclationFrequencyFunction);
// constructing local atom sets during simulation setup
const auto setLocalAtomSetFunction = [this](LocalAtomSetManager* localAtomSetManager) {
this->constructLocalAtomSet(localAtomSetManager);
};
- notifier->notifier_.subscribe(setLocalAtomSetFunction);
+ notifier->simulationSetupNotifications_.subscribe(setLocalAtomSetFunction);
// constructing local atom sets during simulation setup
- const auto setPeriodicBoundaryContionsFunction = [this](PeriodicBoundaryConditionType pbc) {
+ const auto setPeriodicBoundaryContionsFunction = [this](const PbcType& pbc) {
this->densityFittingSimulationParameters_.setPeriodicBoundaryConditionType(pbc);
};
- notifier->notifier_.subscribe(setPeriodicBoundaryContionsFunction);
+ notifier->simulationSetupNotifications_.subscribe(setPeriodicBoundaryContionsFunction);
// setting the simulation time step
const auto setSimulationTimeStepFunction = [this](const SimulationTimeStep& simulationTimeStep) {
this->densityFittingSimulationParameters_.setSimulationTimeStep(simulationTimeStep.delta_t);
};
- notifier->notifier_.subscribe(setSimulationTimeStepFunction);
+ notifier->simulationSetupNotifications_.subscribe(setSimulationTimeStepFunction);
// adding output to energy file
const auto requestEnergyOutput =
[this](MdModulesEnergyOutputToDensityFittingRequestChecker* energyOutputRequest) {
this->setEnergyOutputRequest(energyOutputRequest);
};
- notifier->notifier_.subscribe(requestEnergyOutput);
+ notifier->simulationSetupNotifications_.subscribe(requestEnergyOutput);
// writing checkpoint data
const auto checkpointDataWriting = [this](MdModulesWriteCheckpointData checkpointData) {
this->writeCheckpointData(checkpointData);
};
- notifier->notifier_.subscribe(checkpointDataWriting);
+ notifier->checkpointingNotifications_.subscribe(checkpointDataWriting);
// reading checkpoint data
const auto checkpointDataReading = [this](MdModulesCheckpointReadingDataOnMaster checkpointData) {
this->readCheckpointDataOnMaster(checkpointData);
};
- notifier->notifier_.subscribe(checkpointDataReading);
+ notifier->checkpointingNotifications_.subscribe(checkpointDataReading);
// broadcasting checkpoint data
const auto checkpointDataBroadcast = [this](MdModulesCheckpointReadingBroadcast checkpointData) {
this->broadcastCheckpointData(checkpointData);
};
- notifier->notifier_.subscribe(checkpointDataBroadcast);
+ notifier->checkpointingNotifications_.subscribe(checkpointDataBroadcast);
}
//! From IMDModule
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
#include <string>
+enum class PbcType : int;
+
namespace gmx
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
basic_mdspan<const float, dynamicExtents3D> referenceDensity,
const TranslateAndScale& transformationToDensityLattice,
const LocalAtomSet& localAtomSet,
- int pbcType,
+ PbcType pbcType,
double simulationTimeStep,
const DensityFittingForceProviderState& state);
~Impl();
DensityFittingAmplitudeLookup amplitudeLookup_;
TranslateAndScale transformationToDensityLattice_;
RVec referenceDensityCenter_;
- int pbcType_;
+ PbcType pbcType_;
//! Optionally scale the force according to a moving average of the similarity
compat::optional<ExponentialMovingAverage> expAverageSimilarity_;
basic_mdspan<const float, dynamicExtents3D> referenceDensity,
const TranslateAndScale& transformationToDensityLattice,
const LocalAtomSet& localAtomSet,
- int pbcType,
+ PbcType pbcType,
double simulationTimeStep,
const DensityFittingForceProviderState& state) :
parameters_(parameters),
basic_mdspan<const float, dynamicExtents3D> referenceDensity,
const TranslateAndScale& transformationToDensityLattice,
const LocalAtomSet& localAtomSet,
- int pbcType,
+ PbcType pbcType,
double simulationTimeStep,
const DensityFittingForceProviderState& state) :
impl_(new Impl(parameters, referenceDensity, transformationToDensityLattice, localAtomSet, pbcType, simulationTimeStep, state))
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/iforceprovider.h"
#include "gromacs/utility/classhelpers.h"
+enum class PbcType : int;
+
namespace gmx
{
basic_mdspan<const float, dynamicExtents3D> referenceDensity,
const TranslateAndScale& transformationToDensityLattice,
const LocalAtomSet& localAtomSet,
- int pbcType,
+ PbcType pbcType,
double simulationTimeStep,
const DensityFittingForceProviderState& state);
~DensityFittingForceProvider();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return (nstout_ > 0 && step % nstout_ == 0);
}
-real Awh::applyBiasForcesAndUpdateBias(int ePBC,
+real Awh::applyBiasForcesAndUpdateBias(PbcType pbcType,
const t_mdatoms& mdatoms,
const matrix box,
gmx::ForceWithVirial* forceWithVirial,
wallcycle_start(wallcycle, ewcAWH);
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
/* During the AWH update the potential can instantaneously jump due to either
an bias update or moving the umbrella. The jumps are kept track of and
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_enxframe;
struct t_inputrec;
struct t_mdatoms;
+enum class PbcType : int;
namespace gmx
{
* for this).
*
* \param[in] mdatoms Atom properties.
- * \param[in] ePBC Type of periodic boundary conditions.
+ * \param[in] pbcType Type of periodic boundary conditions.
* \param[in] box Box vectors.
* \param[in,out] forceWithVirial Force and virial buffers, should cover at least the local atoms.
* \param[in] t Time.
* \param[in,out] fplog General output file, normally md.log, can be nullptr.
* \returns the potential energy for the bias.
*/
- real applyBiasForcesAndUpdateBias(int ePBC,
+ real applyBiasForcesAndUpdateBias(PbcType pbcType,
const t_mdatoms& mdatoms,
const matrix box,
gmx::ForceWithVirial* forceWithVirial,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const pull_params_t* pull_params,
pull_t* pull_work,
const matrix box,
- int ePBC,
+ PbcType pbcType,
const tensor& compressibility,
const t_grpopts* inputrecGroupOptions,
warninp_t wi)
}
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (int k = 0; k < awhParams->numBias; k++)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_inputrec;
struct pull_params_t;
struct pull_t;
+enum class PbcType : int;
namespace gmx
{
* \param[in] pull_params Pull parameters.
* \param[in,out] pull_work Pull working struct to register AWH bias in.
* \param[in] box Box vectors.
- * \param[in] ePBC Periodic boundary conditions enum.
+ * \param[in] pbcType Periodic boundary conditions enum.
* \param[in] compressibility Compressibility matrix for pressure coupling, pass all 0 without pressure coupling
* \param[in] inputrecGroupOptions Parameters for atom groups.
* \param[in,out] wi Struct for bookeeping warnings.
const pull_params_t* pull_params,
pull_t* pull_work,
const matrix box,
- int ePBC,
+ PbcType pbcType,
const tensor& compressibility,
const t_grpopts* inputrecGroupOptions,
warninp_t wi);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \ingroup module_coordinateio
*/
-
#include "gmxpre.h"
#include "coordinatefile.h"
#include <algorithm>
+#include "gromacs/options.h"
#include "gromacs/coordinateio/outputadapters.h"
#include "gromacs/coordinateio/requirements.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/math/vec.h"
+#include "gromacs/topology/mtop_util.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/utility/exceptions.h"
}
}
copy_mat(input.box, copy->box);
- copy->bPBC = input.bPBC;
- copy->ePBC = input.ePBC;
+ copy->bPBC = input.bPBC;
+ copy->pbcType = input.pbcType;
}
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_COORDINATEIO_COORDINATEFILE_H
#define GMX_COORDINATEIO_COORDINATEFILE_H
-#include <algorithm>
+#include <string>
#include <utility>
#include "gromacs/coordinateio/ioutputadapter.h"
#include "gromacs/coordinateio/outputadaptercontainer.h"
-#include "gromacs/fileio/filetypes.h"
-#include "gromacs/fileio/trxio.h"
-#include "gromacs/selection/selection.h"
-#include "gromacs/topology/mtop_util.h"
-#include "gromacs/topology/topology.h"
+#include "gromacs/math/vectypes.h"
+#include "gromacs/topology/atoms.h"
+
+struct gmx_mtop_t;
+struct t_trxstatus;
namespace gmx
{
+class Selection;
class TrajectoryFrameWriter;
struct OutputRequirements;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <utility>
#include "gromacs/coordinateio/outputadapters/setatoms.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/trajectoryanalysis/topologyinformation.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/coordinateio/outputadapters/setstarttime.h"
#include "gromacs/coordinateio/outputadapters/settimestep.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/coordinateio/tests/coordinate_test.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
#include "gromacs/coordinateio/outputadapters/setstarttime.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/coordinateio/tests/coordinate_test.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
#include "gromacs/coordinateio/outputadapters/settimestep.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/coordinateio/tests/coordinate_test.h"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx::ArrayRef<const gmx::RVec> xRef = constArrayRefFromArray(
x.data(), masterRankHasTheSystemState ? x.size() : dd.comm->atomRanges.numHomeAtoms());
- low_set_ddbox(dd.unitCellInfo.npbcdim, dd.unitCellInfo.numBoundedDimensions, &dd.nc, box,
- calculateUnboundedSize, xRef,
+ low_set_ddbox(dd.unitCellInfo.npbcdim, dd.unitCellInfo.numBoundedDimensions, &dd.numCells,
+ box, calculateUnboundedSize, xRef,
needToReduceCoordinateData ? &dd.mpi_comm_all : nullptr, ddbox);
}
{
if (MASTER(&cr))
{
- low_set_ddbox(ePBC2npbcdim(ir.ePBC), inputrec2nboundeddim(&ir), dd_nc, box, true, x, nullptr, ddbox);
+ low_set_ddbox(numPbcDimensions(ir.pbcType), inputrec2nboundeddim(&ir), dd_nc, box, true, x,
+ nullptr, ddbox);
}
gmx_bcast(sizeof(gmx_ddbox_t), ddbox, &cr);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_commrec* cr,
const DomdecOptions& options,
const MdrunOptions& mdrunOptions,
- bool prefer1DAnd1Pulse,
+ bool prefer1D,
const gmx_mtop_t& mtop,
const t_inputrec& ir,
const matrix box,
int sh;
comm = dd->comm;
- nc = dd->nc[ddpme->dim];
+ nc = dd->numCells[ddpme->dim];
ns = ddpme->nslab;
if (!ddpme->dim_match)
dim = dd->dim[d];
if (dim < ddbox->nboundeddim
&& ddbox->box_size[dim] * ddbox->skew_fac[dim]
- < dd->nc[dim] * dd->comm->cellsize_limit * DD_CELL_MARGIN)
+ < dd->numCells[dim] * dd->comm->cellsize_limit * DD_CELL_MARGIN)
{
gmx_fatal(
FARGS,
"The %c-size of the box (%f) times the triclinic skew factor (%f) is smaller "
"than the number of DD cells (%d) times the smallest allowed cell size (%f)\n",
- dim2char(dim), ddbox->box_size[dim], ddbox->skew_fac[dim], dd->nc[dim],
+ dim2char(dim), ddbox->box_size[dim], ddbox->skew_fac[dim], dd->numCells[dim],
dd->comm->cellsize_limit);
}
}
{
cellsize_min[d] = ddbox->box_size[d] * ddbox->skew_fac[d];
npulse[d] = 1;
- if (dd->nc[d] == 1 || comm->slb_frac[d] == nullptr)
+ if (dd->numCells[d] == 1 || comm->slb_frac[d] == nullptr)
{
/* Uniform grid */
- real cell_dx = ddbox->box_size[d] / dd->nc[d];
+ real cell_dx = ddbox->box_size[d] / dd->numCells[d];
switch (setmode)
{
case setcellsizeslbMASTER:
- for (int j = 0; j < dd->nc[d] + 1; j++)
+ for (int j = 0; j < dd->numCells[d] + 1; j++)
{
cell_x_master[d][j] = ddbox->box0[d] + j * cell_dx;
}
}
else
{
- cell_x_buffer.resize(dd->nc[d] + 1);
+ cell_x_buffer.resize(dd->numCells[d] + 1);
cell_x = cell_x_buffer;
}
cell_x[0] = ddbox->box0[d];
- for (int j = 0; j < dd->nc[d]; j++)
+ for (int j = 0; j < dd->numCells[d]; j++)
{
real cell_dx = ddbox->box_size[d] * comm->slb_frac[d][j];
cell_x[j + 1] = cell_x[j] + cell_dx;
real cellsize = cell_dx * ddbox->skew_fac[d];
- while (cellsize * npulse[d] < comm->systemInfo.cutoff && npulse[d] < dd->nc[d] - 1)
+ while (cellsize * npulse[d] < comm->systemInfo.cutoff && npulse[d] < dd->numCells[d] - 1)
{
npulse[d]++;
}
* some of its own home charge groups back over the periodic boundary.
* Double charge groups cause trouble with the global indices.
*/
- if (d < ddbox->npbcdim && dd->nc[d] > 1 && npulse[d] >= dd->nc[d])
+ if (d < ddbox->npbcdim && dd->numCells[d] > 1 && npulse[d] >= dd->numCells[d])
{
char error_string[STRLEN];
"small for a cut-off of %f with %d domain decomposition cells, use 1 or more "
"than %d %s or increase the box size in this direction",
dim2char(d), ddbox->box_size[d], ddbox->skew_fac[d], comm->systemInfo.cutoff,
- dd->nc[d], dd->nc[d], dd->nnodes > dd->nc[d] ? "cells" : "ranks");
+ dd->numCells[d], dd->numCells[d], dd->nnodes > dd->numCells[d] ? "cells" : "ranks");
if (setmode == setcellsizeslbLOCAL)
{
comm = dd->comm;
- const int ncd = dd->nc[dim];
+ const int ncd = dd->numCells[dim];
const bool dimHasPbc = (dim < ddbox->npbcdim);
if (!rowMaster->isCellMin[i])
{
cell_size[i] *= fac;
- if (!dimHasPbc && (i == 0 || i == dd->nc[dim] - 1))
+ if (!dimHasPbc && (i == 0 || i == dd->numCells[dim] - 1))
{
cellsize_limit_f_i = 0;
}
/* Convert the maximum change from the input percentage to a fraction */
const real change_limit = comm->ddSettings.dlb_scale_lim * 0.01;
- const int ncd = dd->nc[dim];
+ const int ncd = dd->numCells[dim];
const bool bPBC = (dim < ddbox->npbcdim);
rowMaster->cellFrac[i], rowMaster->cellFrac[i + 1]);
}
- if ((bPBC || (i != 0 && i != dd->nc[dim] - 1))
+ if ((bPBC || (i != 0 && i != dd->numCells[dim] - 1))
&& rowMaster->cellFrac[i + 1] - rowMaster->cellFrac[i] < cellsize_limit_f / DD_CELL_MARGIN)
{
char buf[22];
comm.cellsizesWithDlb[d].fracLower = cellFracRow[dd->ci[dim]];
comm.cellsizesWithDlb[d].fracUpper = cellFracRow[dd->ci[dim] + 1];
/* The whole array was communicated, so set the buffer position */
- int pos = dd->nc[dim] + 1;
+ int pos = dd->numCells[dim] + 1;
for (int d1 = 0; d1 <= d; d1++)
{
if (d1 < d)
/* Set the dimensions for which no DD is used */
for (dim = 0; dim < DIM; dim++)
{
- if (dd->nc[dim] == 1)
+ if (dd->numCells[dim] == 1)
{
comm->cell_x0[dim] = 0;
comm->cell_x1[dim] = ddbox->box_size[dim];
if (d < dd.unitCellInfo.npbcdim)
{
bool bScrew = (dd.unitCellInfo.haveScrewPBC && d == XX);
- if (ddbox.tric_dir[d] && dd.nc[d] > 1)
+ if (ddbox.tric_dir[d] && dd.numCells[d] > 1)
{
/* Use triclinic coordinates for this dimension */
for (int j = d + 1; j < DIM; j++)
}
/* This could be done more efficiently */
ind[d] = 0;
- while (ind[d] + 1 < dd.nc[d] && pos_d >= cellBoundaries[d][ind[d] + 1])
+ while (ind[d] + 1 < dd.numCells[d] && pos_d >= cellBoundaries[d][ind[d] + 1])
{
ind[d]++;
}
}
- return dd_index(dd.nc, ind);
+ return dd_index(dd.numCells, ind);
}
{ 2, 5, 6 },
{ 3, 5, 7 } };
-
-/*
- #define dd_index(n,i) ((((i)[ZZ]*(n)[YY] + (i)[YY])*(n)[XX]) + (i)[XX])
-
- static void index2xyz(ivec nc,int ind,ivec xyz)
- {
- xyz[XX] = ind % nc[XX];
- xyz[YY] = (ind / nc[XX]) % nc[YY];
- xyz[ZZ] = ind / (nc[YY]*nc[XX]);
- }
- */
-
static void ddindex2xyz(const ivec nc, int ind, ivec xyz)
{
xyz[XX] = ind / (nc[YY] * nc[ZZ]);
int ddnodeid = -1;
const CartesianRankSetup& cartSetup = dd->comm->cartesianRankSetup;
- const int ddindex = dd_index(dd->nc, c);
+ const int ddindex = dd_index(dd->numCells, c);
if (cartSetup.bCartesianPP_PME)
{
ddnodeid = cartSetup.ddindex2ddnodeid[ddindex];
ivec coords;
int slab;
- dd = cr->dd;
- /*
- if (dd->comm->bCartesian) {
- gmx_ddindex2xyz(dd->nc,ddindex,coords);
- dd_coords2pmecoords(dd,coords,coords_pme);
- copy_ivec(dd->ntot,nc);
- nc[dd->cartpmedim] -= dd->nc[dd->cartpmedim];
- coords_pme[dd->cartpmedim] -= dd->nc[dd->cartpmedim];
-
- slab = (coords_pme[XX]*nc[YY] + coords_pme[YY])*nc[ZZ] + coords_pme[ZZ];
- } else {
- slab = (ddindex*cr->npmenodes + cr->npmenodes/2)/dd->nnodes;
- }
- */
+ dd = cr->dd;
coords[XX] = x;
coords[YY] = y;
coords[ZZ] = z;
- slab = ddindex2pmeindex(dd->comm->ddRankSetup, dd_index(dd->nc, coords));
+ slab = ddindex2pmeindex(dd->comm->ddRankSetup, dd_index(dd->numCells, coords));
return slab;
}
}
else
{
- int ddindex = dd_index(cr->dd->nc, coords);
+ int ddindex = dd_index(cr->dd->numCells, coords);
if (cartSetup.bCartesianPP)
{
nodeid = cartSetup.ddindex2simnodeid[ddindex];
ivec coords;
MPI_Cart_coords(cr->mpi_comm_mysim, cr->sim_nodeid, DIM, coords);
coords[cartSetup.cartpmedim]++;
- if (coords[cartSetup.cartpmedim] < dd->nc[cartSetup.cartpmedim])
+ if (coords[cartSetup.cartpmedim] < dd->numCells[cartSetup.cartpmedim])
{
int rank;
MPI_Cart_rank(cr->mpi_comm_mysim, coords, &rank);
comm = dd->comm;
- snew(*dim_f, dd->nc[dim] + 1);
+ snew(*dim_f, dd->numCells[dim] + 1);
(*dim_f)[0] = 0;
- for (i = 1; i < dd->nc[dim]; i++)
+ for (i = 1; i < dd->numCells[dim]; i++)
{
if (comm->slb_frac[dim])
{
}
else
{
- (*dim_f)[i] = static_cast<real>(i) / static_cast<real>(dd->nc[dim]);
+ (*dim_f)[i] = static_cast<real>(i) / static_cast<real>(dd->numCells[dim]);
}
}
- (*dim_f)[dd->nc[dim]] = 1;
+ (*dim_f)[dd->numCells[dim]] = 1;
}
static void init_ddpme(gmx_domdec_t* dd, gmx_ddpme_t* ddpme, int dimind)
snew(ddpme->pp_max, ddpme->nslab);
for (int slab = 0; slab < ddpme->nslab; slab++)
{
- ddpme->pp_min[slab] = dd->nc[dd->dim[dimind]] - 1;
+ ddpme->pp_min[slab] = dd->numCells[dd->dim[dimind]] - 1;
ddpme->pp_max[slab] = 0;
}
for (int i = 0; i < dd->nnodes; i++)
{
ivec xyz;
- ddindex2xyz(dd->nc, i, xyz);
+ ddindex2xyz(dd->numCells, i, xyz);
/* For y only use our y/z slab.
* This assumes that the PME x grid size matches the DD grid size.
*/
dim = dd->dim[dim_ind];
copy_ivec(loc, loc_c);
- for (i = 0; i < dd->nc[dim]; i++)
+ for (i = 0; i < dd->numCells[dim]; i++)
{
loc_c[dim] = i;
- rank = dd_index(dd->nc, loc_c);
+ rank = dd_index(dd->numCells, loc_c);
if (rank == dd->rank)
{
/* This process is part of the group */
RowMaster& rowMaster = *cellsizes.rowMaster;
rowMaster.cellFrac.resize(ddCellFractionBufferSize(dd, dim_ind));
- rowMaster.oldCellFrac.resize(dd->nc[dim] + 1);
- rowMaster.isCellMin.resize(dd->nc[dim]);
+ rowMaster.oldCellFrac.resize(dd->numCells[dim] + 1);
+ rowMaster.isCellMin.resize(dd->numCells[dim]);
if (dim_ind > 0)
{
- rowMaster.bounds.resize(dd->nc[dim]);
+ rowMaster.bounds.resize(dd->numCells[dim]);
}
- rowMaster.buf_ncd.resize(dd->nc[dim]);
+ rowMaster.buf_ncd.resize(dd->numCells[dim]);
}
else
{
}
if (dd->ci[dim] == dd->master_ci[dim])
{
- snew(dd->comm->load[dim_ind].load, dd->nc[dim] * DD_NLOAD_MAX);
+ snew(dd->comm->load[dim_ind].load, dd->numCells[dim] * DD_NLOAD_MAX);
}
}
}
if (dd->ndim > 1)
{
dim0 = dd->dim[0];
- for (i = 0; i < dd->nc[dim0]; i++)
+ for (i = 0; i < dd->numCells[dim0]; i++)
{
loc[dim0] = i;
make_load_communicator(dd, 1, loc);
if (dd->ndim > 2)
{
dim0 = dd->dim[0];
- for (i = 0; i < dd->nc[dim0]; i++)
+ for (i = 0; i < dd->numCells[dim0]; i++)
{
loc[dim0] = i;
dim1 = dd->dim[1];
- for (j = 0; j < dd->nc[dim1]; j++)
+ for (j = 0; j < dd->numCells[dim1]; j++)
{
loc[dim1] = j;
make_load_communicator(dd, 2, loc);
{
dim = dd->dim[d];
copy_ivec(dd->ci, tmp);
- tmp[dim] = (tmp[dim] + 1) % dd->nc[dim];
+ tmp[dim] = (tmp[dim] + 1) % dd->numCells[dim];
dd->neighbor[d][0] = ddcoord2ddnodeid(dd, tmp);
copy_ivec(dd->ci, tmp);
- tmp[dim] = (tmp[dim] - 1 + dd->nc[dim]) % dd->nc[dim];
+ tmp[dim] = (tmp[dim] - 1 + dd->numCells[dim]) % dd->numCells[dim];
dd->neighbor[d][1] = ddcoord2ddnodeid(dd, tmp);
if (debug)
{
s[d] = dd->ci[d] - zones->shift[i][d];
if (s[d] < 0)
{
- s[d] += dd->nc[d];
+ s[d] += dd->numCells[d];
}
- else if (s[d] >= dd->nc[d])
+ else if (s[d] >= dd->numCells[d])
{
- s[d] -= dd->nc[d];
+ s[d] -= dd->numCells[d];
}
}
}
std::min(ddNonbondedZonePairRanges[iZoneIndex][2], nzone));
for (dim = 0; dim < DIM; dim++)
{
- if (dd->nc[dim] == 1)
+ if (dd->numCells[dim] == 1)
{
/* All shifts should be allowed */
iZone.shift0[dim] = -1;
{
/* Set up cartesian communication for the particle-particle part */
GMX_LOG(mdlog.info)
- .appendTextFormatted("Will use a Cartesian communicator: %d x %d x %d", dd->nc[XX],
- dd->nc[YY], dd->nc[ZZ]);
+ .appendTextFormatted("Will use a Cartesian communicator: %d x %d x %d",
+ dd->numCells[XX], dd->numCells[YY], dd->numCells[ZZ]);
ivec periods;
for (int i = 0; i < DIM; i++)
periods[i] = TRUE;
}
MPI_Comm comm_cart;
- MPI_Cart_create(cr->mpi_comm_mygroup, DIM, dd->nc, periods, static_cast<int>(reorder), &comm_cart);
+ MPI_Cart_create(cr->mpi_comm_mygroup, DIM, dd->numCells, periods, static_cast<int>(reorder),
+ &comm_cart);
/* We overwrite the old communicator with the new cartesian one */
cr->mpi_comm_mygroup = comm_cart;
}
* and not the one after split, we need to make an index.
*/
cartSetup.ddindex2ddnodeid.resize(dd->nnodes);
- cartSetup.ddindex2ddnodeid[dd_index(dd->nc, dd->ci)] = dd->rank;
+ cartSetup.ddindex2ddnodeid[dd_index(dd->numCells, dd->ci)] = dd->rank;
gmx_sumi(dd->nnodes, cartSetup.ddindex2ddnodeid.data(), cr);
/* Get the rank of the DD master,
* above we made sure that the master node is a PP node.
std::vector<int> buf(dd->nnodes);
if (thisRankHasDuty(cr, DUTY_PP))
{
- buf[dd_index(dd->nc, dd->ci)] = cr->sim_nodeid;
+ buf[dd_index(dd->numCells, dd->ci)] = cr->sim_nodeid;
}
/* Communicate the ddindex to simulation nodeid index */
MPI_Allreduce(buf.data(), cartSetup.ddindex2simnodeid.data(), dd->nnodes, MPI_INT, MPI_SUM,
{
if (cartSetup.ddindex2simnodeid[i] == 0)
{
- ddindex2xyz(dd->nc, i, dd->master_ci);
+ ddindex2xyz(dd->numCells, i, dd->master_ci);
MPI_Cart_rank(dd->mpi_comm_all, dd->master_ci, &dd->masterrank);
}
}
{
/* No Cartesian communicators */
/* We use the rank in dd->comm->all as DD index */
- ddindex2xyz(dd->nc, dd->rank, dd->ci);
+ ddindex2xyz(dd->numCells, dd->rank, dd->ci);
/* The simulation master nodeid is 0, so the DD master rank is also 0 */
dd->masterrank = 0;
clear_ivec(dd->master_ci);
std::vector<int> buf(dd->nnodes);
if (thisRankHasDuty(cr, DUTY_PP))
{
- buf[dd_index(dd->nc, dd->ci)] = cr->sim_nodeid;
+ buf[dd_index(dd->numCells, dd->ci)] = cr->sim_nodeid;
}
/* Communicate the ddindex to simulation nodeid index */
MPI_Allreduce(buf.data(), cartSetup.ddindex2simnodeid.data(), dd->nnodes, MPI_INT, MPI_SUM,
/* We can not use DDMASTER(dd), because dd->masterrank is set later */
if (MASTER(cr))
{
- dd->ma = std::make_unique<AtomDistribution>(dd->nc, numAtomsInSystem, numAtomsInSystem);
+ dd->ma = std::make_unique<AtomDistribution>(dd->numCells, numAtomsInSystem, numAtomsInSystem);
}
}
static void check_dd_restrictions(const gmx_domdec_t* dd, const t_inputrec* ir, const gmx::MDLogger& mdlog)
{
- if (ir->ePBC == epbcSCREW && (dd->nc[XX] == 1 || dd->nc[YY] > 1 || dd->nc[ZZ] > 1))
+ if (ir->pbcType == PbcType::Screw
+ && (dd->numCells[XX] == 1 || dd->numCells[YY] > 1 || dd->numCells[ZZ] > 1))
{
gmx_fatal(FARGS, "With pbc=%s can only do domain decomposition in the x-direction",
- epbc_names[ir->ePBC]);
+ c_pbcTypeNames[ir->pbcType].c_str());
}
if (ir->nstlist == 0)
gmx_fatal(FARGS, "Domain decomposition does not work with nstlist=0");
}
- if (ir->comm_mode == ecmANGULAR && ir->ePBC != epbcNONE)
+ if (ir->comm_mode == ecmANGULAR && ir->pbcType != PbcType::No)
{
GMX_LOG(mdlog.warning)
.appendText(
}
UnitCellInfo::UnitCellInfo(const t_inputrec& ir) :
- npbcdim(ePBC2npbcdim(ir.ePBC)),
+ npbcdim(numPbcDimensions(ir.pbcType)),
numBoundedDimensions(inputrec2nboundeddim(&ir)),
ddBoxIsDynamic(numBoundedDimensions < DIM || inputrecDynamicBox(&ir)),
- haveScrewPBC(ir.ePBC == epbcSCREW)
+ haveScrewPBC(ir.pbcType == PbcType::Screw)
{
}
systemInfo.useUpdateGroups = false;
if (ir.cutoff_scheme == ecutsVERLET)
{
- real cutoffMargin = std::sqrt(max_cutoff2(ir.ePBC, box)) - ir.rlist;
+ real cutoffMargin = std::sqrt(max_cutoff2(ir.pbcType, box)) - ir.rlist;
setupUpdateGroups(mdlog, mtop, ir, cutoffMargin, &systemInfo);
}
}
/* Set the DD setup given by ddGridSetup */
- copy_ivec(ddGridSetup.numDomains, dd->nc);
+ copy_ivec(ddGridSetup.numDomains, dd->numCells);
dd->ndim = ddGridSetup.numDDDimensions;
copy_ivec(ddGridSetup.ddDimensions, dd->dim);
- dd->nnodes = dd->nc[XX] * dd->nc[YY] * dd->nc[ZZ];
+ dd->nnodes = dd->numCells[XX] * dd->numCells[YY] * dd->numCells[ZZ];
snew(comm->slb_frac, DIM);
if (isDlbDisabled(comm))
{
- comm->slb_frac[XX] = get_slb_frac(mdlog, "x", dd->nc[XX], options.cellSizeX);
- comm->slb_frac[YY] = get_slb_frac(mdlog, "y", dd->nc[YY], options.cellSizeY);
- comm->slb_frac[ZZ] = get_slb_frac(mdlog, "z", dd->nc[ZZ], options.cellSizeZ);
+ comm->slb_frac[XX] = get_slb_frac(mdlog, "x", dd->numCells[XX], options.cellSizeX);
+ comm->slb_frac[YY] = get_slb_frac(mdlog, "y", dd->numCells[YY], options.cellSizeY);
+ comm->slb_frac[ZZ] = get_slb_frac(mdlog, "z", dd->numCells[ZZ], options.cellSizeZ);
}
/* Set the multi-body cut-off and cellsize limit for DLB */
* the minimum and the maximum,
* since the extra communication cost is nearly zero.
*/
- real acs = average_cellsize_min(ddbox, dd->nc);
+ real acs = average_cellsize_min(ddbox, dd->numCells);
comm->cutoff_mbody = 0.5 * (systemInfo.minCutoffForMultiBody + acs);
if (!isDlbDisabled(comm))
{
}
}
-void dd_init_bondeds(FILE* fplog,
- gmx_domdec_t* dd,
- const gmx_mtop_t* mtop,
- const gmx_vsite_t* vsite,
- const t_inputrec* ir,
- gmx_bool bBCheck,
- cginfo_mb_t* cginfo_mb)
+void dd_init_bondeds(FILE* fplog,
+ gmx_domdec_t* dd,
+ const gmx_mtop_t& mtop,
+ const gmx_vsite_t* vsite,
+ const t_inputrec* ir,
+ gmx_bool bBCheck,
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb)
{
gmx_domdec_comm_t* comm;
- dd_make_reverse_top(fplog, dd, mtop, vsite, ir, bBCheck);
+ dd_make_reverse_top(fplog, dd, &mtop, vsite, ir, bBCheck);
comm = dd->comm;
log->writeString("The allowed shrink of domain decomposition cells is:");
for (d = 0; d < DIM; d++)
{
- if (dd->nc[d] > 1)
+ if (dd->numCells[d] > 1)
{
- if (d >= ddbox->npbcdim && dd->nc[d] == 2)
+ if (d >= ddbox->npbcdim && dd->numCells[d] == 2)
{
shrink = 0;
}
else
{
shrink = comm->cellsize_min_dlb[d]
- / (ddbox->box_size[d] * ddbox->skew_fac[d] / dd->nc[d]);
+ / (ddbox->box_size[d] * ddbox->skew_fac[d] / dd->numCells[d]);
}
log->writeStringFormatted(" %c %.2f", dim2char(d), shrink);
}
log->writeString("The initial domain decomposition cell size is:");
for (d = 0; d < DIM; d++)
{
- if (dd->nc[d] > 1)
+ if (dd->numCells[d] > 1)
{
log->writeStringFormatted(" %c %.2f nm", dim2char(d), dd->comm->cellsize_min[d]);
}
else
{
/* There is no cell size limit */
- npulse = std::max(dd->nc[XX] - 1, std::max(dd->nc[YY] - 1, dd->nc[ZZ] - 1));
+ npulse = std::max(dd->numCells[XX] - 1, std::max(dd->numCells[YY] - 1, dd->numCells[ZZ] - 1));
}
if (!bNoCutOff && npulse > 1)
dim = dd->dim[d];
npulse_d = static_cast<int>(
1
- + dd->nc[dim] * comm->systemInfo.cutoff
+ + dd->numCells[dim] * comm->systemInfo.cutoff
/ (ddbox->box_size[dim] * ddbox->skew_fac[dim] * dlb_scale));
npulse_d_max = std::max(npulse_d_max, npulse_d);
}
}
comm->maxpulse = 1;
- comm->bVacDLBNoLimit = (ir->ePBC == epbcNONE);
+ comm->bVacDLBNoLimit = (ir->pbcType == PbcType::No);
for (d = 0; d < dd->ndim; d++)
{
- if (comm->ddSettings.request1DAnd1Pulse)
- {
- comm->cd[d].np_dlb = 1;
- }
- else
- {
- comm->cd[d].np_dlb = std::min(npulse, dd->nc[dd->dim[d]] - 1);
- comm->maxpulse = std::max(comm->maxpulse, comm->cd[d].np_dlb);
- }
- if (comm->cd[d].np_dlb < dd->nc[dd->dim[d]] - 1)
+ comm->cd[d].np_dlb = std::min(npulse, dd->numCells[dd->dim[d]] - 1);
+ comm->maxpulse = std::max(comm->maxpulse, comm->cd[d].np_dlb);
+ if (comm->cd[d].np_dlb < dd->numCells[dd->dim[d]] - 1)
{
comm->bVacDLBNoLimit = FALSE;
}
return dd.comm->systemInfo.moleculesAreAlwaysWhole;
}
-gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, int ePBC)
+gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, PbcType pbcType)
{
/* If each molecule is a single charge group
* or we use domain decomposition for each periodic dimension,
* we do not need to take pbc into account for the bonded interactions.
*/
- return (ePBC != epbcNONE && dd->comm->systemInfo.haveInterDomainBondeds
- && !(dd->nc[XX] > 1 && dd->nc[YY] > 1 && (dd->nc[ZZ] > 1 || ePBC == epbcXY)));
+ return (pbcType != PbcType::No && dd->comm->systemInfo.haveInterDomainBondeds
+ && !(dd->numCells[XX] > 1 && dd->numCells[YY] > 1
+ && (dd->numCells[ZZ] > 1 || pbcType == PbcType::XY)));
}
/*! \brief Sets grid size limits and PP-PME setup, prints settings to log */
logSettings(mdlog, dd, mtop, ir, dlb_scale, ddbox);
real vol_frac;
- if (ir->ePBC == epbcNONE)
+ if (ir->pbcType == PbcType::No)
{
vol_frac = 1 - 1 / static_cast<double>(dd->nnodes);
}
else
{
- vol_frac = (1 + comm_box_frac(dd->nc, comm->systemInfo.cutoff, *ddbox))
+ vol_frac = (1 + comm_box_frac(dd->numCells, comm->systemInfo.cutoff, *ddbox))
/ static_cast<double>(dd->nnodes);
}
if (debug)
ddSettings.useSendRecv2 = (dd_getenv(mdlog, "GMX_DD_USE_SENDRECV2", 0) != 0);
ddSettings.dlb_scale_lim = dd_getenv(mdlog, "GMX_DLB_MAX_BOX_SCALING", 10);
- ddSettings.request1DAnd1Pulse = bool(dd_getenv(mdlog, "GMX_DD_1D_1PULSE", 0));
+ ddSettings.request1D = bool(dd_getenv(mdlog, "GMX_DD_1D", 0));
ddSettings.useDDOrderZYX = bool(dd_getenv(mdlog, "GMX_DD_ORDER_ZYX", 0));
ddSettings.useCartesianReorder = bool(dd_getenv(mdlog, "GMX_NO_CART_REORDER", 1));
ddSettings.eFlop = dd_getenv(mdlog, "GMX_DLB_BASED_ON_FLOPS", 0);
gmx_domdec_t::gmx_domdec_t(const t_inputrec& ir) : unitCellInfo(ir) {}
-/*! \brief Return whether the simulation described can run a 1D single-pulse DD.
+/*! \brief Return whether the simulation described can run a 1D DD.
*
- * The GPU halo exchange code requires a 1D single-pulse DD. Such a DD
+ * The GPU halo exchange code requires 1D DD. Such a DD
* generally requires a larger box than other possible decompositions
* with the same rank count, so the calling code might need to decide
* what is the most appropriate way to run the simulation based on
* exchange code path. The number of PME ranks, if any, should be set
* in \c options.numPmeRanks.
*/
-static bool canMake1DAnd1PulseDomainDecomposition(const DDSettings& ddSettingsOriginal,
- const t_commrec* cr,
- const int numRanksRequested,
- const DomdecOptions& options,
- const gmx_mtop_t& mtop,
- const t_inputrec& ir,
- const matrix box,
- gmx::ArrayRef<const gmx::RVec> xGlobal)
+static bool canMake1DDomainDecomposition(const DDSettings& ddSettingsOriginal,
+ const t_commrec* cr,
+ const int numRanksRequested,
+ const DomdecOptions& options,
+ const gmx_mtop_t& mtop,
+ const t_inputrec& ir,
+ const matrix box,
+ gmx::ArrayRef<const gmx::RVec> xGlobal)
{
// Ensure we don't write any output from this checking routine
gmx::MDLogger dummyLogger;
DDSystemInfo systemInfo = getSystemInfo(dummyLogger, cr, options, mtop, ir, box, xGlobal);
- DDSettings ddSettings = ddSettingsOriginal;
- ddSettings.request1DAnd1Pulse = true;
- const real gridSetupCellsizeLimit = getDDGridSetupCellSizeLimit(
- dummyLogger, ddSettings.request1DAnd1Pulse, !isDlbDisabled(ddSettings.initialDlbState),
- options.dlbScaling, ir, systemInfo.cellsizeLimit);
+ DDSettings ddSettings = ddSettingsOriginal;
+ ddSettings.request1D = true;
+ const real gridSetupCellsizeLimit =
+ getDDGridSetupCellSizeLimit(dummyLogger, !isDlbDisabled(ddSettings.initialDlbState),
+ options.dlbScaling, ir, systemInfo.cellsizeLimit);
gmx_ddbox_t ddbox = { 0 };
DDGridSetup ddGridSetup =
getDDGridSetup(dummyLogger, cr, numRanksRequested, options, ddSettings, systemInfo,
gridSetupCellsizeLimit, mtop, ir, box, xGlobal, &ddbox);
- const bool canMakeDDWith1DAnd1Pulse = (ddGridSetup.numDomains[XX] != 0);
+ const bool canMake1DDD = (ddGridSetup.numDomains[XX] != 0);
- return canMakeDDWith1DAnd1Pulse;
+ return canMake1DDD;
}
-bool is1DAnd1PulseDD(const gmx_domdec_t& dd)
+bool is1D(const gmx_domdec_t& dd)
{
- const int maxDimensionSize = std::max(dd.nc[XX], std::max(dd.nc[YY], dd.nc[ZZ]));
- const int productOfDimensionSizes = dd.nc[XX] * dd.nc[YY] * dd.nc[ZZ];
+ const int maxDimensionSize = std::max(dd.numCells[XX], std::max(dd.numCells[YY], dd.numCells[ZZ]));
+ const int productOfDimensionSizes = dd.numCells[XX] * dd.numCells[YY] * dd.numCells[ZZ];
const bool decompositionHasOneDimension = (maxDimensionSize == productOfDimensionSizes);
- const bool hasMax1Pulse =
- ((isDlbDisabled(dd.comm) && dd.comm->cellsize_limit >= dd.comm->systemInfo.cutoff)
- || (!isDlbDisabled(dd.comm) && dd.comm->maxpulse == 1));
-
- return decompositionHasOneDimension && hasMax1Pulse;
+ return decompositionHasOneDimension;
}
namespace gmx
t_commrec* cr,
const DomdecOptions& options,
const MdrunOptions& mdrunOptions,
- bool prefer1DAnd1Pulse,
+ bool prefer1D,
const gmx_mtop_t& mtop,
const t_inputrec& ir,
const matrix box,
t_commrec* cr,
const DomdecOptions& options,
const MdrunOptions& mdrunOptions,
- const bool prefer1DAnd1Pulse,
+ const bool prefer1D,
const gmx_mtop_t& mtop,
const t_inputrec& ir,
const matrix box,
ddSettings_ = getDDSettings(mdlog_, options_, mdrunOptions, ir_);
- if (prefer1DAnd1Pulse
- && canMake1DAnd1PulseDomainDecomposition(ddSettings_, cr_, cr_->nnodes, options_, mtop_,
- ir_, box, xGlobal))
+ if (prefer1D
+ && canMake1DDomainDecomposition(ddSettings_, cr_, cr_->nnodes, options_, mtop_, ir_, box, xGlobal))
{
- ddSettings_.request1DAnd1Pulse = true;
+ ddSettings_.request1D = true;
}
if (ddSettings_.eFlop > 1)
// DD grid setup uses a more different cell size limit for
// automated setup than the one in systemInfo_. The latter is used
// in set_dd_limits() to configure DLB, for example.
- const real gridSetupCellsizeLimit = getDDGridSetupCellSizeLimit(
- mdlog_, ddSettings_.request1DAnd1Pulse, !isDlbDisabled(ddSettings_.initialDlbState),
- options_.dlbScaling, ir_, systemInfo_.cellsizeLimit);
+ const real gridSetupCellsizeLimit =
+ getDDGridSetupCellSizeLimit(mdlog_, !isDlbDisabled(ddSettings_.initialDlbState),
+ options_.dlbScaling, ir_, systemInfo_.cellsizeLimit);
ddGridSetup_ = getDDGridSetup(mdlog_, cr_, numRanksRequested, options_, ddSettings_, systemInfo_,
gridSetupCellsizeLimit, mtop_, ir_, box, xGlobal, &ddbox_);
checkDDGridSetup(ddGridSetup_, cr_, options_, ddSettings_, systemInfo_, gridSetupCellsizeLimit, ddbox_);
t_commrec* cr,
const DomdecOptions& options,
const MdrunOptions& mdrunOptions,
- const bool prefer1DAnd1Pulse,
+ const bool prefer1D,
const gmx_mtop_t& mtop,
const t_inputrec& ir,
const matrix box,
ArrayRef<const RVec> xGlobal) :
- impl_(new Impl(mdlog, cr, options, mdrunOptions, prefer1DAnd1Pulse, mtop, ir, box, xGlobal))
+ impl_(new Impl(mdlog, cr, options, mdrunOptions, prefer1D, mtop, ir, box, xGlobal))
{
}
{
dim = dd->dim[d];
- inv_cell_size = DD_CELL_MARGIN * dd->nc[dim] / ddbox.box_size[dim];
+ inv_cell_size = DD_CELL_MARGIN * dd->numCells[dim] / ddbox.box_size[dim];
if (dd->unitCellInfo.ddBoxIsDynamic)
{
inv_cell_size *= DD_PRES_SCALE_MARGIN;
np = 1 + static_cast<int>(cutoffRequested * inv_cell_size * ddbox.skew_fac[dim]);
- if (dd->comm->ddSettings.request1DAnd1Pulse && np > 1)
- {
- return FALSE;
- }
-
if (!isDlbDisabled(dd->comm) && (dim < ddbox.npbcdim) && (dd->comm->cd[d].np_dlb > 0))
{
if (np > dd->comm->cd[d].np_dlb)
return bCutoffAllowed;
}
+
+void constructGpuHaloExchange(const gmx::MDLogger& mdlog, const t_commrec& cr, void* streamLocal, void* streamNonLocal)
+{
+
+ int gpuHaloExchangeSize = 0;
+ int pulseStart = 0;
+ if (cr.dd->gpuHaloExchange.empty())
+ {
+ GMX_LOG(mdlog.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "NOTE: Activating the 'GPU halo exchange' feature, enabled "
+ "by the "
+ "GMX_GPU_DD_COMMS environment variable.");
+ }
+ else
+ {
+ gpuHaloExchangeSize = static_cast<int>(cr.dd->gpuHaloExchange.size());
+ pulseStart = gpuHaloExchangeSize - 1;
+ }
+ if (cr.dd->comm->cd[0].numPulses() > gpuHaloExchangeSize)
+ {
+ for (int pulse = pulseStart; pulse < cr.dd->comm->cd[0].numPulses(); pulse++)
+ {
+ cr.dd->gpuHaloExchange.push_back(std::make_unique<gmx::GpuHaloExchange>(
+ cr.dd, cr.mpi_comm_mysim, streamLocal, streamNonLocal, pulse));
+ }
+ }
+}
+
+void reinitGpuHaloExchange(const t_commrec& cr,
+ const DeviceBuffer<gmx::RVec> d_coordinatesBuffer,
+ const DeviceBuffer<gmx::RVec> d_forcesBuffer)
+{
+ for (int pulse = 0; pulse < cr.dd->comm->cd[0].numPulses(); pulse++)
+ {
+ cr.dd->gpuHaloExchange[pulse]->reinitHalo(d_coordinatesBuffer, d_forcesBuffer);
+ }
+}
+
+void communicateGpuHaloCoordinates(const t_commrec& cr,
+ const matrix box,
+ GpuEventSynchronizer* coordinatesReadyOnDeviceEvent)
+{
+ for (int pulse = 0; pulse < cr.dd->comm->cd[0].numPulses(); pulse++)
+ {
+ cr.dd->gpuHaloExchange[pulse]->communicateHaloCoordinates(box, coordinatesReadyOnDeviceEvent);
+ }
+}
+
+void communicateGpuHaloForces(const t_commrec& cr, bool accumulateForces)
+{
+ for (int pulse = cr.dd->comm->cd[0].numPulses() - 1; pulse >= 0; pulse--)
+ {
+ cr.dd->gpuHaloExchange[pulse]->communicateHaloForces(accumulateForces);
+ }
+}
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2005 - 2014, The GROMACS development team.
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019 by the GROMACS development team.
+ * Copyright (c) 2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
+#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
struct t_mdatoms;
struct t_nrnb;
struct gmx_wallcycle;
+enum class PbcType : int;
class t_state;
+class GpuEventSynchronizer;
namespace gmx
{
/*! \brief Return whether update groups are used */
bool ddUsesUpdateGroups(const gmx_domdec_t& dd);
-/*! \brief Return whether the DD has a single dimension with a single pulse
+/*! \brief Return whether the DD has a single dimension
*
- * The GPU halo exchange code requires a 1D single-pulse DD, and its
- * setup code can use the returned value to understand what it should
- * do. */
-bool is1DAnd1PulseDD(const gmx_domdec_t& dd);
+ * The GPU halo exchange code requires a 1D DD, and its setup code can
+ * use the returned value to understand what it should do.
+ */
+bool is1D(const gmx_domdec_t& dd);
/*! \brief Initialize data structures for bonded interactions */
-void dd_init_bondeds(FILE* fplog,
- gmx_domdec_t* dd,
- const gmx_mtop_t* mtop,
- const gmx_vsite_t* vsite,
- const t_inputrec* ir,
- gmx_bool bBCheck,
- cginfo_mb_t* cginfo_mb);
+void dd_init_bondeds(FILE* fplog,
+ gmx_domdec_t* dd,
+ const gmx_mtop_t& mtop,
+ const gmx_vsite_t* vsite,
+ const t_inputrec* ir,
+ gmx_bool bBCheck,
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb);
/*! \brief Returns whether molecules are always whole, i.e. not broken by PBC */
bool dd_moleculesAreAlwaysWhole(const gmx_domdec_t& dd);
/*! \brief Returns if we need to do pbc for calculating bonded interactions */
-gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, int ePBC);
+gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, PbcType pbcType);
/*! \brief Change the DD non-bonded communication cut-off.
*
void dd_clear_f_vsites(struct gmx_domdec_t* dd, rvec* f);
/*! \brief Move x0 and also x1 if x1!=NULL. bX1IsCoord tells if to do PBC on x1 */
-void dd_move_x_constraints(struct gmx_domdec_t* dd, const matrix box, rvec* x0, rvec* x1, gmx_bool bX1IsCoord);
+void dd_move_x_constraints(struct gmx_domdec_t* dd,
+ const matrix box,
+ gmx::ArrayRef<gmx::RVec> x0,
+ gmx::ArrayRef<gmx::RVec> x1,
+ gmx_bool bX1IsCoord);
/*! \brief Communicates the coordinates involved in virtual sites */
void dd_move_x_vsites(struct gmx_domdec_t* dd, const matrix box, rvec* x);
/* In domdec_top.c */
/*! \brief Print error output when interactions are missing */
-[[noreturn]] void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int local_count,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box);
+[[noreturn]] void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int local_count,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box);
/*! \brief Generate and store the reverse topology */
void dd_make_reverse_top(FILE* fplog,
*
* Also stores whether atoms are linked in \p cginfo_mb.
*/
-t_blocka* makeBondedLinks(const gmx_mtop_t* mtop, cginfo_mb_t* cginfo_mb);
+t_blocka* makeBondedLinks(const gmx_mtop_t& mtop, gmx::ArrayRef<cginfo_mb_t> cginfo_mb);
/*! \brief Calculate the maximum distance involved in 2-body and multi-body bonded interactions */
void dd_bonded_cg_distance(const gmx::MDLogger& mdlog,
real* r_2b,
real* r_mb);
+/*! \brief Construct the GPU halo exchange object(s)
+ * \param[in] mdlog The logger object
+ * \param[in] cr The commrec object
+ * \param[in] streamLocal The local GPU stream
+ * \param[in] streamNonLocal The non-local GPU stream
+ */
+void constructGpuHaloExchange(const gmx::MDLogger& mdlog, const t_commrec& cr, void* streamLocal, void* streamNonLocal);
+
+/*! \brief
+ * (Re-) Initialization for GPU halo exchange
+ * \param [in] cr The commrec object
+ * \param [in] d_coordinatesBuffer pointer to coordinates buffer in GPU memory
+ * \param [in] d_forcesBuffer pointer to forces buffer in GPU memory
+ */
+void reinitGpuHaloExchange(const t_commrec& cr,
+ DeviceBuffer<gmx::RVec> d_coordinatesBuffer,
+ DeviceBuffer<gmx::RVec> d_forcesBuffer);
+
+
+/*! \brief GPU halo exchange of coordinates buffer.
+ * \param [in] cr The commrec object
+ * \param [in] box Coordinate box (from which shifts will be constructed)
+ * \param [in] coordinatesReadyOnDeviceEvent event recorded when coordinates have been copied to device
+ */
+void communicateGpuHaloCoordinates(const t_commrec& cr,
+ const matrix box,
+ GpuEventSynchronizer* coordinatesReadyOnDeviceEvent);
+
+
+/*! \brief GPU halo exchange of force buffer.
+ * \param [in] cr The commrec object
+ * \param [in] accumulateForces True if forces should accumulate, otherwise they are set
+ */
+void communicateGpuHaloForces(const t_commrec& cr, bool accumulateForces);
+
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,2010 by the GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
-#include "gromacs/utility/smalloc.h"
+#include "gromacs/utility/listoflists.h"
#include "domdec_internal.h"
#include "domdec_specatomcomm.h"
+using gmx::ListOfLists;
+
/*! \brief Struct used during constraint setup with domain decomposition */
struct gmx_domdec_constraints_t
{
//! @endcond
};
-void dd_move_x_constraints(gmx_domdec_t* dd, const matrix box, rvec* x0, rvec* x1, gmx_bool bX1IsCoord)
+void dd_move_x_constraints(gmx_domdec_t* dd,
+ const matrix box,
+ gmx::ArrayRef<gmx::RVec> x0,
+ gmx::ArrayRef<gmx::RVec> x1,
+ gmx_bool bX1IsCoord)
{
if (dd->constraint_comm)
{
- dd_move_x_specat(dd, dd->constraint_comm, box, x0, x1, bX1IsCoord);
+ dd_move_x_specat(dd, dd->constraint_comm, box, as_rvec_array(x0.data()),
+ as_rvec_array(x1.data()), bX1IsCoord);
ddReopenBalanceRegionCpu(dd);
}
int nrec,
gmx::ArrayRef<const int> ia1,
gmx::ArrayRef<const int> ia2,
- const t_blocka* at2con,
+ const ListOfLists<int>& at2con,
const gmx_ga2la_t& ga2la,
gmx_bool bHomeConnect,
gmx_domdec_constraints_t* dc,
t_ilist* il_local,
std::vector<int>* ireq)
{
- int a1_gl, a2_gl, i, coni, b;
- const t_iatom* iap;
-
if (!dc->gc_req[con_offset + con])
{
/* Add this non-home constraint to the list */
il_local->nalloc = over_alloc_dd(il_local->nr + 3);
srenew(il_local->iatoms, il_local->nalloc);
}
- iap = constr_iatomptr(ia1, ia2, con);
+ const int* iap = constr_iatomptr(ia1, ia2, con);
il_local->iatoms[il_local->nr++] = iap[0];
- a1_gl = offset + iap[1];
- a2_gl = offset + iap[2];
+ const int a1_gl = offset + iap[1];
+ const int a2_gl = offset + iap[2];
/* The following indexing code can probably be optizimed */
if (const int* a_loc = ga2la.findHome(a1_gl))
{
if (nrec > 0)
{
- for (i = at2con->index[a]; i < at2con->index[a + 1]; i++)
+ /* Loop over the constraint connected to atom a */
+ for (const int coni : at2con[a])
{
- coni = at2con->a[i];
if (coni != con)
{
/* Walk further */
- iap = constr_iatomptr(ia1, ia2, coni);
+ const int* iap = constr_iatomptr(ia1, ia2, coni);
+ int b;
if (a == iap[1])
{
b = iap[2];
}
/*! \brief Looks up constraint for the local atoms */
-static void atoms_to_constraints(gmx_domdec_t* dd,
- const gmx_mtop_t* mtop,
- const int* cginfo,
- gmx::ArrayRef<const t_blocka> at2con_mt,
- int nrec,
- t_ilist* ilc_local,
- std::vector<int>* ireq)
+static void atoms_to_constraints(gmx_domdec_t* dd,
+ const gmx_mtop_t* mtop,
+ const int* cginfo,
+ gmx::ArrayRef<const ListOfLists<int>> at2con_mt,
+ int nrec,
+ t_ilist* ilc_local,
+ std::vector<int>* ireq)
{
- const t_blocka* at2con;
- int b_lo, offset, b_mol, i, con, con_offset;
-
gmx_domdec_constraints_t* dc = dd->constraints;
gmx_domdec_specat_comm_t* dcc = dd->constraint_comm;
* This is only required for the global index to make sure
* that we use each constraint only once.
*/
- con_offset = dc->molb_con_offset[mb] + molnr * dc->molb_ncon_mol[mb];
+ const int con_offset = dc->molb_con_offset[mb] + molnr * dc->molb_ncon_mol[mb];
/* The global atom number offset for this molecule */
- offset = a_gl - a_mol;
- at2con = &at2con_mt[molb.type];
- for (i = at2con->index[a_mol]; i < at2con->index[a_mol + 1]; i++)
+ const int offset = a_gl - a_mol;
+ /* Loop over the constraints connected to atom a_mol in the molecule */
+ const auto& at2con = at2con_mt[molb.type];
+ for (const int con : at2con[a_mol])
{
- con = at2con->a[i];
const int* iap = constr_iatomptr(ia1, ia2, con);
+ int b_mol;
if (a_mol == iap[1])
{
b_mol = iap[2];
ilc_local->nalloc = over_alloc_dd(ilc_local->nr + 3);
srenew(ilc_local->iatoms, ilc_local->nalloc);
}
- b_lo = *a_loc;
+ const int b_lo = *a_loc;
ilc_local->iatoms[ilc_local->nr++] = iap[0];
ilc_local->iatoms[ilc_local->nr++] = (a_gl == iap[1] ? a : b_lo);
ilc_local->iatoms[ilc_local->nr++] = (a_gl == iap[1] ? b_lo : a);
int nrec,
t_ilist* il_local)
{
- gmx_domdec_constraints_t* dc;
- t_ilist * ilc_local, *ils_local;
- std::vector<int>* ireq;
- gmx::ArrayRef<const t_blocka> at2con_mt;
- gmx::HashedMap<int>* ga2la_specat;
- int at_end, i, j;
- t_iatom* iap;
+ gmx_domdec_constraints_t* dc;
+ t_ilist * ilc_local, *ils_local;
+ gmx::HashedMap<int>* ga2la_specat;
+ int at_end, i, j;
+ t_iatom* iap;
// This code should not be called unless this condition is true,
// because that's the only time init_domdec_constraints is
dc->ncon = 0;
ilc_local->nr = 0;
+ gmx::ArrayRef<const ListOfLists<int>> at2con_mt;
+ std::vector<int>* ireq = nullptr;
if (dd->constraint_comm)
{
// TODO Perhaps gmx_domdec_constraints_t should keep a valid constr?
ireq = &dc->requestedGlobalAtomIndices[0];
ireq->clear();
}
- else
- {
- // Currently unreachable
- at2con_mt = {};
- ireq = nullptr;
- }
gmx::ArrayRef<const std::vector<int>> at2settle_mt;
/* When settle works inside charge groups, we assigned them already */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2005,2006,2007,2008,2009 by the GROMACS development team.
+ * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Flop counter (0=no,1=yes,2=with (eFlop-1)*5% noise
int eFlop = 0;
- //! Request 1D domain decomposition with maximum one communication pulse
- bool request1DAnd1Pulse;
+ //! Request 1D domain decomposition
+ bool request1D;
//! Whether to order the DD dimensions from z to x
bool useDDOrderZYX = false;
/*! Returns the size of the buffer to hold fractional cell boundaries for DD dimension index dimIndex */
static inline int ddCellFractionBufferSize(const gmx_domdec_t* dd, int dimIndex)
{
- return dd->nc[dd->dim[dimIndex]] + 1 + dimIndex * 2 + 1 + dimIndex;
+ return dd->numCells[dd->dim[dimIndex]] + 1 + dimIndex * 2 + 1 + dimIndex;
}
/*! \brief Maximum number of ranks for using send/recv for state scattering and gathering
/*! \brief Return whether the DD inhomogeneous in the z direction */
static gmx_bool inhomogeneous_z(const t_inputrec& ir)
{
- return ((EEL_PME(ir.coulombtype) || ir.coulombtype == eelEWALD) && ir.ePBC == epbcXYZ
+ return ((EEL_PME(ir.coulombtype) || ir.coulombtype == eelEWALD) && ir.pbcType == PbcType::Xyz
&& ir.ewald_geometry == eewg3DC);
}
float temp;
/* Check the DD algorithm restrictions */
- if ((ir.ePBC == epbcXY && ir.nwall < 2 && nc[ZZ] > 1)
- || (ir.ePBC == epbcSCREW && (nc[XX] == 1 || nc[YY] > 1 || nc[ZZ] > 1)))
+ if ((ir.pbcType == PbcType::XY && ir.nwall < 2 && nc[ZZ] > 1)
+ || (ir.pbcType == PbcType::Screw && (nc[XX] == 1 || nc[YY] > 1 || nc[ZZ] > 1)))
{
return -1;
}
/* Add cost of pbc_dx for bondeds */
cost_pbcdx = 0;
- if ((nc[XX] == 1 || nc[YY] == 1) || (nc[ZZ] == 1 && ir.ePBC != epbcXY))
+ if ((nc[XX] == 1 || nc[YY] == 1) || (nc[ZZ] == 1 && ir.pbcType != PbcType::XY))
{
if ((ddbox.tric_dir[XX] && nc[XX] == 1) || (ddbox.tric_dir[YY] && nc[YY] == 1))
{
const int numRanksRequested,
const int numPmeOnlyRanks,
const real cellSizeLimit,
- const bool request1DAnd1Pulse,
+ const bool request1D,
const gmx_mtop_t& mtop,
const matrix box,
const gmx_ddbox_t& ddbox,
gmx::IVec itry = { 1, 1, 1 };
gmx::IVec numDomains = { 0, 0, 0 };
- assign_factors(cellSizeLimit, request1DAnd1Pulse, systemInfo.cutoff, box, ddbox, mtop.natoms, ir,
- pbcdxr, numRanksDoingPmeWork, div.size(), div.data(), mdiv.data(), &itry, &numDomains);
+ assign_factors(cellSizeLimit, request1D, systemInfo.cutoff, box, ddbox, mtop.natoms, ir, pbcdxr,
+ numRanksDoingPmeWork, div.size(), div.data(), mdiv.data(), &itry, &numDomains);
return numDomains;
}
real getDDGridSetupCellSizeLimit(const gmx::MDLogger& mdlog,
- const bool request1DAnd1Pulse,
const bool bDynLoadBal,
const real dlb_scale,
const t_inputrec& ir,
- const real systemInfoCellSizeLimit)
+ real systemInfoCellSizeLimit)
{
real cellSizeLimit = systemInfoCellSizeLimit;
- if (request1DAnd1Pulse)
- {
- cellSizeLimit = std::max(cellSizeLimit, ir.rlist);
- }
/* Add a margin for DLB and/or pressure scaling */
if (bDynLoadBal)
{
int numPmeOnlyRanks = getNumPmeOnlyRanksToUse(mdlog, options, mtop, ir, box, numRanksRequested);
- if (ddSettings.request1DAnd1Pulse && (numRanksRequested - numPmeOnlyRanks == 1))
+ if (ddSettings.request1D && (numRanksRequested - numPmeOnlyRanks == 1))
{
// With only one PP rank, there will not be a need for
// GPU-based halo exchange that wants to request that any DD
- // has only 1 dimension and 1 pulse.
+ // has only 1 dimension.
return DDGridSetup{};
}
if (MASTER(cr))
{
numDomains = optimizeDDCells(mdlog, numRanksRequested, numPmeOnlyRanks, cellSizeLimit,
- ddSettings.request1DAnd1Pulse, mtop, box, *ddbox, ir, systemInfo);
+ ddSettings.request1D, mtop, box, *ddbox, ir, systemInfo);
}
}
/*! \brief Return the minimum cell size (in nm) required for DD */
real getDDGridSetupCellSizeLimit(const gmx::MDLogger& mdlog,
- bool request1DAnd1Pulse,
bool bDynLoadBal,
real dlb_scale,
const t_inputrec& ir,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,2010 by the GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
for (int d = dd->ndim - 1; d >= 0; d--)
{
dim = dd->dim[d];
- if (dd->nc[dim] > 2)
+ if (dd->numCells[dim] > 2)
{
/* Pulse the grid forward and backward */
spas = spac->spas[d];
vbuf + spas[0].a.size(), spas[1].a.size());
for (dir = 0; dir < 2; dir++)
{
- bPBC = ((dir == 0 && dd->ci[dim] == 0) || (dir == 1 && dd->ci[dim] == dd->nc[dim] - 1));
+ bPBC = ((dir == 0 && dd->ci[dim] == 0)
+ || (dir == 1 && dd->ci[dim] == dd->numCells[dim] - 1));
bScrew = (bPBC && dd->unitCellInfo.haveScrewPBC && dim == XX);
spas = &spac->spas[d][dir];
spas->a.size());
/* Sum the buffer into the required forces */
if (dd->unitCellInfo.haveScrewPBC && dim == XX
- && (dd->ci[dim] == 0 || dd->ci[dim] == dd->nc[dim] - 1))
+ && (dd->ci[dim] == 0 || dd->ci[dim] == dd->numCells[dim] - 1))
{
int i = 0;
for (int a : spas->a)
for (d = 0; d < dd->ndim; d++)
{
dim = dd->dim[d];
- if (dd->nc[dim] > 2)
+ if (dd->numCells[dim] > 2)
{
/* Pulse the grid forward and backward */
rvec* vbuf = as_rvec_array(spac->vbuf.data());
bScrew = (dd->unitCellInfo.haveScrewPBC && dim == XX);
copy_rvec(box[dim], shift);
}
- else if (dir == 1 && dd->ci[dim] == dd->nc[dim] - 1)
+ else if (dir == 1 && dd->ci[dim] == dd->numCells[dim] - 1)
{
bPBC = TRUE;
bScrew = (dd->unitCellInfo.haveScrewPBC && dim == XX);
{
rvec* x = (v == 0 ? x0 : x1);
if (dd->unitCellInfo.haveScrewPBC && dim == XX
- && (dd->ci[XX] == 0 || dd->ci[XX] == dd->nc[XX] - 1))
+ && (dd->ci[XX] == 0 || dd->ci[XX] == dd->numCells[XX] - 1))
{
/* Here we only perform the rotation, the rest of the pbc
* is handled in the constraint or viste routines.
/* Pulse the grid forward and backward */
dim = dd->dim[d];
bPBC = (dim < dd->unitCellInfo.npbcdim);
- if (dd->nc[dim] == 2)
+ if (dd->numCells[dim] == 2)
{
/* Only 2 cells, so we only need to communicate once */
ndir = 1;
}
for (int dir = 0; dir < ndir; dir++)
{
- if (!bPBC && dd->nc[dim] > 2
- && ((dir == 0 && dd->ci[dim] == dd->nc[dim] - 1) || (dir == 1 && dd->ci[dim] == 0)))
+ if (!bPBC && dd->numCells[dim] > 2
+ && ((dir == 0 && dd->ci[dim] == dd->numCells[dim] - 1) || (dir == 1 && dd->ci[dim] == 0)))
{
/* No pbc: the fist/last cell should not request atoms */
nsend_ptr = nsend_zero;
for (int d = 0; d < dd->ndim; d++)
{
/* Pulse the grid forward and backward */
- if (dd->dim[d] >= dd->unitCellInfo.npbcdim || dd->nc[dd->dim[d]] > 2)
+ if (dd->dim[d] >= dd->unitCellInfo.npbcdim || dd->numCells[dd->dim[d]] > 2)
{
ndir = 2;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2005,2006,2007,2008,2009 by the GROMACS development team.
+ * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! The j-atom range
gmx::Range<int> jAtomRange;
//! Minimum shifts to consider
- ivec shift0 = {};
+ gmx::IVec shift0 = { 0, 0, 0 };
//! Maximum shifts to consider
- ivec shift1 = {};
+ gmx::IVec shift1 = { 0, 0, 0 };
};
typedef struct
{
/* Zone lower corner in triclinic coordinates */
- rvec x0 = {};
+ gmx::RVec x0 = { 0, 0, 0 };
/* Zone upper corner in triclinic coordinates */
- rvec x1 = {};
+ gmx::RVec x1 = { 0, 0, 0 };
/* Zone bounding box lower corner in Cartesian coords */
- rvec bb_x0 = {};
+ gmx::RVec bb_x0 = { 0, 0, 0 };
/* Zone bounding box upper corner in Cartesian coords */
- rvec bb_x1 = {};
+ gmx::RVec bb_x1 = { 0, 0, 0 };
} gmx_domdec_zone_size_t;
struct gmx_domdec_zones_t
struct gmx_ddbox_t
{
- int npbcdim;
- int nboundeddim;
- rvec box0;
- rvec box_size;
+ int npbcdim;
+ int nboundeddim;
+ gmx::RVec box0 = { 0, 0, 0 };
+ gmx::RVec box_size = { 0, 0, 0 };
/* Tells if the box is skewed for each of the three cartesian directions */
- ivec tric_dir;
- rvec skew_fac;
+ gmx::IVec tric_dir = { 0, 0, 0 };
+ gmx::RVec skew_fac = { 0, 0, 0 };
/* Orthogonal vectors for triclinic cells, Cartesian index */
rvec v[DIM][DIM];
/* Normal vectors for the cells walls */
int nnodes = 0;
MPI_Comm mpi_comm_all = MPI_COMM_NULL;
/* The local DD cell index and rank */
- ivec ci = { 0, 0, 0 };
- int rank = 0;
- ivec master_ci = { 0, 0, 0 };
- int masterrank = 0;
+ gmx::IVec ci = { 0, 0, 0 };
+ int rank = 0;
+ gmx::IVec master_ci = { 0, 0, 0 };
+ int masterrank = 0;
/* Communication with the PME only nodes */
int pme_nodeid = 0;
gmx_bool pme_receive_vir_ener = false;
UnitCellInfo unitCellInfo;
/* The communication setup, identical for each cell, cartesian index */
- ivec nc = { 0, 0, 0 };
- int ndim = 0;
- ivec dim = { 0, 0, 0 }; /* indexed by 0 to ndim */
+ //! Todo: refactor nbnxm to not rely on this sometimes being a nullptr so this can be IVec
+ ivec numCells = { 0, 0, 0 };
+ int ndim = 0;
+ gmx::IVec dim = { 0, 0, 0 }; /* indexed by 0 to ndim */
/* Forward and backward neighboring cells, indexed by 0 to ndim */
int neighbor[DIM][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
std::vector<gmx::RVec> pmeForceReceiveBuffer;
/* GPU halo exchange object */
- std::unique_ptr<gmx::GpuHaloExchange> gpuHaloExchange;
+ std::vector<std::unique_ptr<gmx::GpuHaloExchange>> gpuHaloExchange;
};
//! Are we the master node for domain decomposition
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
+#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdtypes/commrec.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/strconvert.h"
#include "domdec_vsite.h"
#include "dump.h"
+using gmx::ListOfLists;
+
/*! \brief The number of integer item in the local state, used for broadcasting of the state */
#define NITEM_DD_INIT_LOCAL_STATE 5
t_idef idef; /**< Partial local topology */
std::unique_ptr<VsitePbc> vsitePbc; /**< vsite PBC structure */
int nbonded; /**< The number of bondeds in this struct */
- t_blocka excl; /**< List of exclusions */
+ ListOfLists<int> excl; /**< List of exclusions */
int excl_count; /**< The total exclusion count for \p excl */
};
struct gmx_reverse_top_t
{
//! @cond Doxygen_Suppress
- //! \brief The maximum number of exclusions one atom can have
- int n_excl_at_max = 0;
//! \brief Are there constraints in this revserse top?
bool bConstr = false;
//! \brief Are there settles in this revserse top?
}
}
-void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int local_count,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box)
+void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int local_count,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box)
{
int ndiff_tot, cl[F_NRE], n, ndiff, rest_global, rest_local;
int ftype, nral;
}
print_missing_interactions_atoms(mdlog, cr, top_global, &top_local->idef);
- write_dd_pdb("dd_dump_err", 0, "dump", top_global, cr, -1, x, box);
+ write_dd_pdb("dd_dump_err", 0, "dump", top_global, cr, -1, as_rvec_array(x.data()), box);
std::string errorMessage;
}
/*! \brief Returns the maximum number of exclusions per atom */
-static int getMaxNumExclusionsPerAtom(const t_blocka& excls)
+static int getMaxNumExclusionsPerAtom(const ListOfLists<int>& excls)
{
int maxNumExcls = 0;
- for (int at = 0; at < excls.nr; at++)
+ for (gmx::index at = 0; at < excls.ssize(); at++)
{
- const int numExcls = excls.index[at + 1] - excls.index[at];
+ const auto list = excls[at];
+ const int numExcls = list.ssize();
- GMX_RELEASE_ASSERT(numExcls != 1 || excls.a[excls.index[at]] == at,
+ GMX_RELEASE_ASSERT(numExcls != 1 || list[0] == at,
"With 1 exclusion we expect a self-exclusion");
maxNumExcls = std::max(maxNumExcls, numExcls);
make_reverse_top(mtop, ir->efep != efepNO, !dd->comm->systemInfo.haveSplitConstraints,
!dd->comm->systemInfo.haveSplitSettles, bBCheck, &dd->nbonded_global);
- gmx_reverse_top_t* rt = dd->reverse_top;
-
dd->haveExclusions = false;
- rt->n_excl_at_max = 0;
for (const gmx_molblock_t& molb : mtop->molblock)
{
const int maxNumExclusionsPerAtom = getMaxNumExclusionsPerAtom(mtop->moltype[molb.type].excls);
{
dd->haveExclusions = true;
}
- rt->n_excl_at_max = std::max(rt->n_excl_at_max, maxNumExclusionsPerAtom);
}
if (vsite && vsite->numInterUpdategroupVsites > 0)
return norm2(dx);
}
-/*! \brief Append t_blocka block structures 1 to nsrc in src to *dest */
-static void combine_blocka(t_blocka* dest, gmx::ArrayRef<const thread_work_t> src)
-{
- int ni = src.back().excl.nr;
- int na = 0;
- for (const thread_work_t& th_work : src)
- {
- na += th_work.excl.nra;
- }
- if (ni + 1 > dest->nalloc_index)
- {
- dest->nalloc_index = over_alloc_large(ni + 1);
- srenew(dest->index, dest->nalloc_index);
- }
- if (dest->nra + na > dest->nalloc_a)
- {
- dest->nalloc_a = over_alloc_large(dest->nra + na);
- srenew(dest->a, dest->nalloc_a);
- }
- for (gmx::index s = 1; s < src.ssize(); s++)
- {
- for (int i = dest->nr + 1; i < src[s].excl.nr + 1; i++)
- {
- dest->index[i] = dest->nra + src[s].excl.index[i];
- }
- for (int i = 0; i < src[s].excl.nra; i++)
- {
- dest->a[dest->nra + i] = src[s].excl.a[i];
- }
- dest->nr = src[s].excl.nr;
- dest->nra += src[s].excl.nra;
- }
-}
-
/*! \brief Append t_idef structures 1 to nsrc in src to *dest */
static void combine_idef(t_idef* dest, gmx::ArrayRef<const thread_work_t> src)
{
return nbonded_local;
}
-/*! \brief Set the exclusion data for i-zone \p iz for the case of no exclusions */
-static void set_no_exclusions_zone(const gmx_domdec_zones_t* zones, int iz, t_blocka* lexcls)
-{
- for (int a = zones->cg_range[iz]; a < zones->cg_range[iz + 1]; a++)
- {
- lexcls->index[a + 1] = lexcls->nra;
- }
-}
-
/*! \brief Set the exclusion data for i-zone \p iz */
static void make_exclusions_zone(gmx_domdec_t* dd,
gmx_domdec_zones_t* zones,
const std::vector<gmx_moltype_t>& moltype,
const int* cginfo,
- t_blocka* lexcls,
+ ListOfLists<int>* lexcls,
int iz,
int at_start,
int at_end,
const gmx::ArrayRef<const int> intermolecularExclusionGroup)
{
- int n_excl_at_max, n, at;
-
const gmx_ga2la_t& ga2la = *dd->ga2la;
const auto& jAtomRange = zones->iZones[iz].jAtomRange;
- n_excl_at_max = dd->reverse_top->n_excl_at_max;
-
- /* We set the end index, but note that we might not start at zero here */
- lexcls->nr = at_end;
+ const gmx::index oldNumLists = lexcls->ssize();
- n = lexcls->nra;
- for (at = at_start; at < at_end; at++)
+ std::vector<int> exclusionsForAtom;
+ for (int at = at_start; at < at_end; at++)
{
- if (n + 1000 > lexcls->nalloc_a)
- {
- lexcls->nalloc_a = over_alloc_large(n + 1000);
- srenew(lexcls->a, lexcls->nalloc_a);
- }
+ exclusionsForAtom.clear();
if (GET_CGINFO_EXCL_INTER(cginfo[at]))
{
- int a_gl, mb, mt, mol, a_mol, j;
- const t_blocka* excls;
-
- if (n + n_excl_at_max > lexcls->nalloc_a)
- {
- lexcls->nalloc_a = over_alloc_large(n + n_excl_at_max);
- srenew(lexcls->a, lexcls->nalloc_a);
- }
+ int a_gl, mb, mt, mol, a_mol;
/* Copy the exclusions from the global top */
- lexcls->index[at] = n;
- a_gl = dd->globalAtomIndices[at];
+ a_gl = dd->globalAtomIndices[at];
global_atomnr_to_moltype_ind(dd->reverse_top, a_gl, &mb, &mt, &mol, &a_mol);
- excls = &moltype[mt].excls;
- for (j = excls->index[a_mol]; j < excls->index[a_mol + 1]; j++)
+ const auto excls = moltype[mt].excls[a_mol];
+ for (const int aj_mol : excls)
{
- const int aj_mol = excls->a[j];
-
if (const auto* jEntry = ga2la.find(a_gl + aj_mol - a_mol))
{
/* This check is not necessary, but it can reduce
*/
if (jAtomRange.isInRange(jEntry->la))
{
- lexcls->a[n++] = jEntry->la;
+ exclusionsForAtom.push_back(jEntry->la);
}
}
}
}
- else
- {
- /* We don't need exclusions for this atom */
- lexcls->index[at] = n;
- }
bool isExcludedAtom = !intermolecularExclusionGroup.empty()
&& std::find(intermolecularExclusionGroup.begin(),
if (isExcludedAtom)
{
- if (n + intermolecularExclusionGroup.ssize() > lexcls->nalloc_a)
- {
- lexcls->nalloc_a = over_alloc_large(n + intermolecularExclusionGroup.size());
- srenew(lexcls->a, lexcls->nalloc_a);
- }
for (int qmAtomGlobalIndex : intermolecularExclusionGroup)
{
if (const auto* entry = dd->ga2la->find(qmAtomGlobalIndex))
{
- lexcls->a[n++] = entry->la;
+ exclusionsForAtom.push_back(entry->la);
}
}
}
- }
-
- lexcls->index[lexcls->nr] = n;
- lexcls->nra = n;
-}
-
-/*! \brief Ensure we have enough space in \p ba for \p nindex_max indices */
-static void check_alloc_index(t_blocka* ba, int nindex_max)
-{
- if (nindex_max + 1 > ba->nalloc_index)
- {
- ba->nalloc_index = over_alloc_dd(nindex_max + 1);
- srenew(ba->index, ba->nalloc_index);
+ /* Append the exclusions for this atom to the topology */
+ lexcls->pushBack(exclusionsForAtom);
}
-}
-
-/*! \brief Ensure that we have enough space for exclusion storate in \p lexcls */
-static void check_exclusions_alloc(const gmx_domdec_t* dd, const gmx_domdec_zones_t* zones, t_blocka* lexcls)
-{
- const int nr = zones->iZones.back().iAtomRange.end();
-
- check_alloc_index(lexcls, nr);
- for (size_t thread = 1; thread < dd->reverse_top->th_work.size(); thread++)
- {
- check_alloc_index(&dd->reverse_top->th_work[thread].excl, nr);
- }
-}
-
-/*! \brief Set the total count indexes for the local exclusions, needed by several functions */
-static void finish_local_exclusions(gmx_domdec_t* dd, gmx_domdec_zones_t* zones, t_blocka* lexcls)
-{
- const gmx::Range<int> nonhomeIzonesAtomRange(zones->iZones[0].iAtomRange.end(),
- zones->iZones.back().iAtomRange.end());
-
- if (!dd->haveExclusions)
- {
- /* There are no exclusions involving non-home charge groups,
- * but we need to set the indices for neighborsearching.
- */
- for (int la : nonhomeIzonesAtomRange)
- {
- lexcls->index[la] = lexcls->nra;
- }
-
- /* nr is only used to loop over the exclusions for Ewald and RF,
- * so we can set it to the number of home atoms for efficiency.
- */
- lexcls->nr = nonhomeIzonesAtomRange.begin();
- }
- else
- {
- lexcls->nr = nonhomeIzonesAtomRange.end();
- }
+ GMX_RELEASE_ASSERT(
+ lexcls->ssize() - oldNumLists == at_end - at_start,
+ "The number of exclusion list should match the number of atoms in the range");
}
/*! \brief Clear a t_idef struct */
t_pbc* pbc_null,
rvec* cg_cm,
t_idef* idef,
- t_blocka* lexcls,
+ ListOfLists<int>* lexcls,
int* excl_count)
{
- int nzone_bondeds, nzone_excl;
+ int nzone_bondeds;
int cg0, cg1;
real rc2;
int nbonded_local;
nzone_bondeds = 1;
}
- if (dd->haveExclusions)
- {
- /* We only use exclusions from i-zones to i- and j-zones */
- nzone_excl = zones->iZones.size();
- }
- else
- {
- /* There are no exclusions and only zone 0 sees itself */
- nzone_excl = 1;
- }
-
- check_exclusions_alloc(dd, zones, lexcls);
+ /* We only use exclusions from i-zones to i- and j-zones */
+ const int numIZonesForExclusions = (dd->haveExclusions ? zones->iZones.size() : 0);
rt = dd->reverse_top;
clear_idef(idef);
nbonded_local = 0;
- lexcls->nr = 0;
- lexcls->nra = 0;
+ lexcls->clear();
*excl_count = 0;
for (int izone = 0; izone < nzone_bondeds; izone++)
{
try
{
- int cg0t, cg1t;
- t_idef* idef_t;
- t_blocka* excl_t;
+ int cg0t, cg1t;
+ t_idef* idef_t;
cg0t = cg0 + ((cg1 - cg0) * thread) / numThreads;
cg1t = cg0 + ((cg1 - cg0) * (thread + 1)) / numThreads;
dd, zones, mtop->molblock, bRCheckMB, rcheck, bRCheck2B, rc2, pbc_null,
cg_cm, idef->iparams, idef_t, izone, gmx::Range<int>(cg0t, cg1t));
- if (izone < nzone_excl)
+ if (izone < numIZonesForExclusions)
{
+ ListOfLists<int>* excl_t;
if (thread == 0)
{
+ // Thread 0 stores exclusions directly in the final storage
excl_t = lexcls;
}
else
{
- excl_t = &rt->th_work[thread].excl;
- excl_t->nr = 0;
- excl_t->nra = 0;
+ // Threads > 0 store in temporary storage, starting at list index 0
+ excl_t = &rt->th_work[thread].excl;
+ excl_t->clear();
}
/* No charge groups and no distance check required */
nbonded_local += th_work.nbonded;
}
- if (izone < nzone_excl)
+ if (izone < numIZonesForExclusions)
{
- if (rt->th_work.size() > 1)
+ for (std::size_t th = 1; th < rt->th_work.size(); th++)
{
- combine_blocka(lexcls, rt->th_work);
+ lexcls->appendListOfLists(rt->th_work[th].excl);
}
-
for (const thread_work_t& th_work : rt->th_work)
{
*excl_count += th_work.excl_count;
}
}
- /* Some zones might not have exclusions, but some code still needs to
- * loop over the index, so we set the indices here.
- */
- for (size_t iZone = nzone_excl; iZone < zones->iZones.size(); iZone++)
- {
- set_no_exclusions_zone(zones, iZone, lexcls);
- }
-
- finish_local_exclusions(dd, zones, lexcls);
if (debug)
{
- fprintf(debug, "We have %d exclusions, check count %d\n", lexcls->nra, *excl_count);
+ fprintf(debug, "We have %d exclusions, check count %d\n", lexcls->numElements(), *excl_count);
}
return nbonded_local;
/* Only need to check for dimensions where the part of the box
* that is not communicated is smaller than the cut-off.
*/
- if (d < npbcdim && dd->nc[d] > 1 && (dd->nc[d] - npulse[d]) * cellsize_min[d] < 2 * rc)
+ if (d < npbcdim && dd->numCells[d] > 1
+ && (dd->numCells[d] - npulse[d]) * cellsize_min[d] < 2 * rc)
{
- if (dd->nc[d] == 2)
+ if (dd->numCells[d] == 2)
{
rcheck[d] = TRUE;
bRCheckMB = TRUE;
{
if (fr->bMolPBC)
{
- pbc_null = set_pbc_dd(&pbc, fr->ePBC, dd->nc, TRUE, box);
+ pbc_null = set_pbc_dd(&pbc, fr->pbcType, dd->numCells, TRUE, box);
}
else
{
}
}
-t_blocka* makeBondedLinks(const gmx_mtop_t* mtop, cginfo_mb_t* cginfo_mb)
+t_blocka* makeBondedLinks(const gmx_mtop_t& mtop, gmx::ArrayRef<cginfo_mb_t> cginfo_mb)
{
t_blocka* link;
cginfo_mb_t* cgi_mb;
*/
reverse_ilist_t ril_intermol;
- if (mtop->bIntermolecularInteractions)
+ if (mtop.bIntermolecularInteractions)
{
t_atoms atoms;
- atoms.nr = mtop->natoms;
+ atoms.nr = mtop.natoms;
atoms.atom = nullptr;
- GMX_RELEASE_ASSERT(mtop->intermolecular_ilist,
+ GMX_RELEASE_ASSERT(mtop.intermolecular_ilist,
"We should have an ilist when intermolecular interactions are on");
- make_reverse_ilist(*mtop->intermolecular_ilist, &atoms, FALSE, FALSE, FALSE, TRUE, &ril_intermol);
+ make_reverse_ilist(*mtop.intermolecular_ilist, &atoms, FALSE, FALSE, FALSE, TRUE, &ril_intermol);
}
snew(link, 1);
- snew(link->index, mtop->natoms + 1);
+ snew(link->index, mtop.natoms + 1);
link->nalloc_a = 0;
link->a = nullptr;
link->index[0] = 0;
int cg_offset = 0;
int ncgi = 0;
- for (size_t mb = 0; mb < mtop->molblock.size(); mb++)
+ for (size_t mb = 0; mb < mtop.molblock.size(); mb++)
{
- const gmx_molblock_t& molb = mtop->molblock[mb];
+ const gmx_molblock_t& molb = mtop.molblock[mb];
if (molb.nmol == 0)
{
continue;
}
- const gmx_moltype_t& molt = mtop->moltype[molb.type];
+ const gmx_moltype_t& molt = mtop.moltype[molb.type];
/* Make a reverse ilist in which the interactions are linked
* to all atoms, not only the first atom as in gmx_reverse_top.
* The constraints are discarded here.
cgi_mb = &cginfo_mb[mb];
int mol;
- for (mol = 0; mol < (mtop->bIntermolecularInteractions ? molb.nmol : 1); mol++)
+ for (mol = 0; mol < (mtop.bIntermolecularInteractions ? molb.nmol : 1); mol++)
{
for (int a = 0; a < molt.atoms.nr; a++)
{
i += nral_rt(ftype);
}
- if (mtop->bIntermolecularInteractions)
+ if (mtop.bIntermolecularInteractions)
{
int i = ril_intermol.index[cg_gl];
while (i < ril_intermol.index[cg_gl + 1])
if (debug)
{
- fprintf(debug, "Of the %d atoms %d are linked via bonded interactions\n", mtop->natoms, ncgi);
+ fprintf(debug, "Of the %d atoms %d are linked via bonded interactions\n", mtop.natoms, ncgi);
}
return link;
}
if (bExcl)
{
- const t_blocka* excls = &molt->excls;
- for (int ai = 0; ai < excls->nr; ai++)
+ const auto& excls = molt->excls;
+ for (gmx::index ai = 0; ai < excls.ssize(); ai++)
{
- for (int j = excls->index[ai]; j < excls->index[ai + 1]; j++)
+ for (const int aj : excls[ai])
{
- int aj = excls->a[j];
if (ai != aj)
{
real rij2 = distance2(cg_cm[ai], cg_cm[aj]);
static void bonded_distance_intermol(const InteractionLists& ilists_intermol,
gmx_bool bBCheck,
const rvec* x,
- int ePBC,
+ PbcType pbcType,
const matrix box,
bonded_distance_t* bd_2b,
bonded_distance_t* bd_mb)
{
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (int ftype = 0; ftype < F_NRE; ftype++)
{
//! Returns coordinates not broken over PBC for a molecule
static void getWholeMoleculeCoordinates(const gmx_moltype_t* molt,
const gmx_ffparams_t* ffparams,
- int ePBC,
+ PbcType pbcType,
t_graph* graph,
const matrix box,
const rvec* x,
{
int n, i;
- if (ePBC != epbcNONE)
+ if (pbcType != PbcType::No)
{
- mk_mshift(nullptr, graph, ePBC, box, x);
+ mk_mshift(nullptr, graph, pbcType, box, x);
shift_x(graph, box, x, xs);
/* By doing an extra mk_mshift the molecules that are broken
* will be made whole again. Such are the healing powers
* of GROMACS.
*/
- mk_mshift(nullptr, graph, ePBC, box, xs);
+ mk_mshift(nullptr, graph, pbcType, box, xs);
}
else
{
}
}
- construct_vsites(nullptr, xs, 0.0, nullptr, ffparams->iparams.data(), ilist, epbcNONE, TRUE,
- nullptr, nullptr);
+ construct_vsites(nullptr, xs, 0.0, nullptr, ffparams->iparams.data(), ilist, PbcType::No,
+ TRUE, nullptr, nullptr);
}
}
}
else
{
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
mk_graph_moltype(molt, &graph);
}
snew(xs, molt.atoms.nr);
for (int mol = 0; mol < molb.nmol; mol++)
{
- getWholeMoleculeCoordinates(&molt, &mtop->ffparams, ir->ePBC, &graph, box,
+ getWholeMoleculeCoordinates(&molt, &mtop->ffparams, ir->pbcType, &graph, box,
x + at_offset, xs);
bonded_distance_t bd_mol_2b = { 0, -1, -1, -1 };
at_offset += molt.atoms.nr;
}
sfree(xs);
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
done_graph(&graph);
}
GMX_RELEASE_ASSERT(mtop->intermolecular_ilist,
"We should have an ilist when intermolecular interactions are on");
- bonded_distance_intermol(*mtop->intermolecular_ilist, bBCheck, x, ir->ePBC, box, &bd_2b, &bd_mb);
+ bonded_distance_intermol(*mtop->intermolecular_ilist, bBCheck, x, ir->pbcType, box, &bd_2b, &bd_mb);
}
*r_2b = sqrt(bd_2b.r2);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,2010 by the GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2005,2006,2007,2008,2009 by the GROMACS development team.
+ * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
else
{
- if (d < ddbox->npbcdim && dd->nc[d] > 1)
+ if (d < ddbox->npbcdim && dd->numCells[d] > 1)
{
tric[d][i] = box[i][d] / box[i][i];
}
}
sprintf(fname, "%s_%s.pdb", fn, gmx_step_str(step, buf));
out = gmx_fio_fopen(fname, "w");
- gmx_write_pdb_box(out, dd->unitCellInfo.haveScrewPBC ? epbcSCREW : epbcXYZ, box);
+ gmx_write_pdb_box(out, dd->unitCellInfo.haveScrewPBC ? PbcType::Screw : PbcType::Xyz, box);
a = 1;
for (i = 0; i < dd->nnodes; i++)
{
out = gmx_fio_fopen(fname, "w");
fprintf(out, "TITLE %s\n", title);
- gmx_write_pdb_box(out, dd->unitCellInfo.haveScrewPBC ? epbcSCREW : epbcXYZ, box);
+ gmx_write_pdb_box(out, dd->unitCellInfo.haveScrewPBC ? PbcType::Screw : PbcType::Xyz, box);
int molb = 0;
for (int i = 0; i < natoms; i++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param [in] mpi_comm_mysim communicator used for simulation
* \param [in] streamLocal local NB CUDA stream.
* \param [in] streamNonLocal non-local NB CUDA stream.
+ * \param [in] pulse the communication pulse for this instance
*/
- GpuHaloExchange(gmx_domdec_t* dd, MPI_Comm mpi_comm_mysim, void* streamLocal, void* streamNonLocal);
+ GpuHaloExchange(gmx_domdec_t* dd, MPI_Comm mpi_comm_mysim, void* streamLocal, void* streamNonLocal, int pulse);
~GpuHaloExchange();
/*! \brief
* \param [in] d_coordinateBuffer pointer to coordinates buffer in GPU memory
* \param [in] d_forcesBuffer pointer to coordinates buffer in GPU memory
*/
- void reinitHalo(DeviceBuffer<float> d_coordinateBuffer, DeviceBuffer<float> d_forcesBuffer);
+ void reinitHalo(DeviceBuffer<RVec> d_coordinateBuffer, DeviceBuffer<RVec> d_forcesBuffer);
/*! \brief GPU halo exchange of coordinates buffer.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
GpuHaloExchange::GpuHaloExchange(gmx_domdec_t* /* dd */,
MPI_Comm /* mpi_comm_mysim */,
void* /*streamLocal */,
- void* /*streamNonLocal */) :
+ void* /*streamNonLocal */,
+ int /*pulse */) :
impl_(nullptr)
{
GMX_ASSERT(false,
GpuHaloExchange::~GpuHaloExchange() = default;
/*!\brief init halo exhange stub. */
-void GpuHaloExchange::reinitHalo(DeviceBuffer<float> /* d_coordinatesBuffer */,
- DeviceBuffer<float> /* d_forcesBuffer */)
+void GpuHaloExchange::reinitHalo(DeviceBuffer<RVec> /* d_coordinatesBuffer */,
+ DeviceBuffer<RVec> /* d_forcesBuffer */)
{
GMX_ASSERT(false,
"A CPU stub for GPU Halo Exchange was called insted of the correct implementation.");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/cudautils.cuh"
#include "gromacs/gpu_utils/devicebuffer.h"
#include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
+#include "gromacs/gpu_utils/typecasts.cuh"
#include "gromacs/gpu_utils/vectype_ops.cuh"
+#include "gromacs/math/vectypes.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/utility/gmxmpi.h"
d_f_ = d_forcesBuffer;
cudaStream_t stream = nonLocalStream_;
- int nzone = 1;
const gmx_domdec_comm_t& comm = *dd_->comm;
const gmx_domdec_comm_dim_t& cd = comm.cd[0];
- const gmx_domdec_ind_t& ind = cd.ind[0];
- int newSize = ind.nsend[nzone + 1];
+ const gmx_domdec_ind_t& ind = cd.ind[pulse_];
+ int newSize = ind.nsend[nzone_ + 1];
- GMX_RELEASE_ASSERT(cd.numPulses() == 1,
- "Multiple pulses are not yet supported in GPU halo exchange");
GMX_ASSERT(cd.receiveInPlace, "Out-of-place receive is not yet supported in GPU halo exchange");
// reallocates only if needed
// Coordinates buffer:
#if GMX_MPI
- void* recvPtr = static_cast<void*>(&d_coordinatesBuffer[numHomeAtoms_]);
+ int pulseOffset = 0;
+ for (int p = pulse_ - 1; p >= 0; p--)
+ {
+ pulseOffset += cd.ind[p].nrecv[nzone_ + 1];
+ }
+ // void* recvPtr = static_cast<void*>(&d_coordinatesBuffer[numHomeAtoms_ + pulseOffset]);
+ void* recvPtr = static_cast<void*>(&d_x_[numHomeAtoms_ + pulseOffset]);
MPI_Sendrecv(&recvPtr, sizeof(void*), MPI_BYTE, recvRankX_, 0, &remoteXPtr_, sizeof(void*),
MPI_BYTE, sendRankX_, 0, mpi_comm_mysim_, MPI_STATUS_IGNORE);
MPI_BYTE, sendRankF_, 0, mpi_comm_mysim_, MPI_STATUS_IGNORE);
#endif
-
return;
}
GpuEventSynchronizer* coordinatesReadyOnDeviceEvent)
{
- // ensure stream waits until coordinate data is available on device
- coordinatesReadyOnDeviceEvent->enqueueWaitEvent(nonLocalStream_);
+ if (pulse_ == 0)
+ {
+ // ensure stream waits until coordinate data is available on device
+ coordinatesReadyOnDeviceEvent->enqueueWaitEvent(nonLocalStream_);
+ }
// launch kernel to pack send buffer
KernelLaunchConfig config;
float3* d_f = d_f_;
- if (!accumulateForces)
+ if (pulse_ == (dd_->comm->cd[0].numPulses() - 1))
{
- // Clear local portion of force array (in local stream)
- cudaMemsetAsync(d_f, 0, numHomeAtoms_ * sizeof(rvec), localStream_);
- }
+ if (!accumulateForces)
+ {
+ // Clear local portion of force array (in local stream)
+ cudaMemsetAsync(d_f, 0, numHomeAtoms_ * sizeof(rvec), localStream_);
+ }
- // ensure non-local stream waits for local stream, due to dependence on
- // the previous H2D copy of CPU forces (if accumulateForces is true)
- // or the above clearing.
- // TODO remove this dependency on localStream - edmine issue #3093
- GpuEventSynchronizer eventLocal;
- eventLocal.markEvent(localStream_);
- eventLocal.enqueueWaitEvent(nonLocalStream_);
+ // ensure non-local stream waits for local stream, due to dependence on
+ // the previous H2D copy of CPU forces (if accumulateForces is true)
+ // or the above clearing.
+ // TODO remove this dependency on localStream - edmine issue #3093
+ GpuEventSynchronizer eventLocal;
+ eventLocal.markEvent(localStream_);
+ eventLocal.enqueueWaitEvent(nonLocalStream_);
+ }
// Unpack halo buffer into force array
const int* indexMap = d_indexMap_;
const int size = fRecvSize_;
+ if (pulse_ > 0)
+ {
+ // We need to accumulate rather than set, since it is possible
+ // that, in this pulse, a value could be written to a location
+ // corresponding to the halo region of a following pulse.
+ accumulateForces = true;
+ }
+
if (size > 0)
{
auto kernelFn = accumulateForces ? unpackRecvBufKernel<true> : unpackRecvBufKernel<false>;
launchGpuKernel(kernelFn, config, nullptr, "Domdec GPU Apply F Halo Exchange", kernelArgs);
}
- fReadyOnDevice_.markEvent(nonLocalStream_);
+
+ if (pulse_ == 0)
+ {
+ fReadyOnDevice_.markEvent(nonLocalStream_);
+ }
}
}
else
{
- sendPtr = static_cast<void*>(&(d_ptr[numHomeAtoms_]));
+ int recvOffset = dd_->comm->atomRanges.end(DDAtomRanges::Type::Zones);
+ for (int p = pulse_; p < dd_->comm->cd[0].numPulses(); p++)
+ {
+ recvOffset -= dd_->comm->cd[0].ind[p].nrecv[nzone_ + 1];
+ }
+ sendPtr = static_cast<void*>(&(d_ptr[recvOffset]));
sendSize = fSendSize_;
remotePtr = remoteFPtr_;
sendRank = sendRankF_;
}
/*! \brief Create Domdec GPU object */
-GpuHaloExchange::Impl::Impl(gmx_domdec_t* dd, MPI_Comm mpi_comm_mysim, void* localStream, void* nonLocalStream) :
+GpuHaloExchange::Impl::Impl(gmx_domdec_t* dd,
+ MPI_Comm mpi_comm_mysim,
+ void* localStream,
+ void* nonLocalStream,
+ int pulse) :
dd_(dd),
sendRankX_(dd->neighbor[0][1]),
recvRankX_(dd->neighbor[0][0]),
haloDataTransferLaunched_(new GpuEventSynchronizer()),
mpi_comm_mysim_(mpi_comm_mysim),
localStream_(*static_cast<cudaStream_t*>(localStream)),
- nonLocalStream_(*static_cast<cudaStream_t*>(nonLocalStream))
+ nonLocalStream_(*static_cast<cudaStream_t*>(nonLocalStream)),
+ pulse_(pulse)
{
GMX_RELEASE_ASSERT(GMX_THREAD_MPI,
delete haloDataTransferLaunched_;
}
-GpuHaloExchange::GpuHaloExchange(gmx_domdec_t* dd, MPI_Comm mpi_comm_mysim, void* localStream, void* nonLocalStream) :
- impl_(new Impl(dd, mpi_comm_mysim, localStream, nonLocalStream))
+GpuHaloExchange::GpuHaloExchange(gmx_domdec_t* dd,
+ MPI_Comm mpi_comm_mysim,
+ void* localStream,
+ void* nonLocalStream,
+ int pulse) :
+ impl_(new Impl(dd, mpi_comm_mysim, localStream, nonLocalStream, pulse))
{
}
GpuHaloExchange::~GpuHaloExchange() = default;
-void GpuHaloExchange::reinitHalo(DeviceBuffer<float> d_coordinatesBuffer, DeviceBuffer<float> d_forcesBuffer)
+void GpuHaloExchange::reinitHalo(DeviceBuffer<RVec> d_coordinatesBuffer, DeviceBuffer<RVec> d_forcesBuffer)
{
- impl_->reinitHalo(reinterpret_cast<float3*>(d_coordinatesBuffer),
- reinterpret_cast<float3*>(d_forcesBuffer));
+ impl_->reinitHalo(asFloat3(d_coordinatesBuffer), asFloat3(d_forcesBuffer));
}
void GpuHaloExchange::communicateHaloCoordinates(const matrix box,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param [in] mpi_comm_mysim communicator used for simulation
* \param [in] localStream local NB CUDA stream
* \param [in] nonLocalStream non-local NB CUDA stream
+ * \param [in] pulse the communication pulse for this instance
*/
- Impl(gmx_domdec_t* dd, MPI_Comm mpi_comm_mysim, void* localStream, void* nonLocalStream);
+ Impl(gmx_domdec_t* dd, MPI_Comm mpi_comm_mysim, void* localStream, void* nonLocalStream, int pulse);
~Impl();
/*! \brief
float3* d_f_ = nullptr;
//! An event recorded once the exchanged forces are ready on the GPU
GpuEventSynchronizer fReadyOnDevice_;
+ //! The pulse corresponding to this halo exchange instance
+ int pulse_ = 0;
+ //! Number of zones. Always 1 for 1-D case.
+ const int nzone_ = 1;
};
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief Global indices of the atoms in this set. */
const std::vector<int> globalIndex_;
/*! \brief Maps indices on this rank [0..num_atoms_local_) to global atom indicices,
- * so that localIndex[i] = globalIndex[collectiveIndex[i]].
+ * so that localIndex[i] identifies the same atom as globalIndex[collectiveIndex[i]].
*
* This translation of locally dense atom data to global representation,
* allows to adresses per-atom properties, e.g., scattering factors,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/mshift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/mtop_util.h"
}
}
- if (!usingDomDec && ir->ePBC != epbcNONE && !fr->bMolPBC)
+ if (!usingDomDec && ir->pbcType != PbcType::No && !fr->bMolPBC)
{
GMX_ASSERT(graph != nullptr, "We use a graph with PBC (no periodic mols) and without DD");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/ga2la.h"
#include "gromacs/domdec/localatomsetmanager.h"
#include "gromacs/domdec/mdsetup.h"
-#include "gromacs/ewald/pme.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/imd/imd.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/nbnxm/nbnxm.h"
if (applyPbc)
{
/* Take the minimum to avoid double communication */
- numPulsesMin = std::min(numPulses, dd->nc[dim] - 1 - numPulses);
+ numPulsesMin = std::min(numPulses, dd->numCells[dim] - 1 - numPulses);
}
else
{
for (int pulse = 0; pulse < numPulses; pulse++)
{
/* Communicate all the zone information backward */
- bool receiveValidData = (applyPbc || dd->ci[dim] < dd->nc[dim] - 1);
+ bool receiveValidData = (applyPbc || dd->ci[dim] < dd->numCells[dim] - 1);
static_assert(
sizeof(gmx_ddzone_t) == c_ddzoneNumReals * sizeof(real),
*/
buf_s[i] = buf_r[i];
}
- if (((applyPbc || dd->ci[dim] + numPulses < dd->nc[dim]) && pulse == numPulses - 1)
- || (!applyPbc && dd->ci[dim] + 1 + pulse == dd->nc[dim] - 1))
+ if (((applyPbc || dd->ci[dim] + numPulses < dd->numCells[dim]) && pulse == numPulses - 1)
+ || (!applyPbc && dd->ci[dim] + 1 + pulse == dd->numCells[dim] - 1))
{
/* Store the extremes */
int pos = 0;
{
if (fr != nullptr)
{
- const cginfo_mb_t* cginfo_mb = fr->cginfo_mb;
- gmx::ArrayRef<int> cginfo = fr->cginfo;
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb = fr->cginfo_mb;
+ gmx::ArrayRef<int> cginfo = fr->cginfo;
for (int cg = cg0; cg < cg1; cg++)
{
dim = dd->dim[dim_ind];
/* Without PBC we don't have restrictions on the outer cells */
- if (!(dim >= ddbox->npbcdim && (dd->ci[dim] == 0 || dd->ci[dim] == dd->nc[dim] - 1))
+ if (!(dim >= ddbox->npbcdim && (dd->ci[dim] == 0 || dd->ci[dim] == dd->numCells[dim] - 1))
&& isDlbOn(comm)
&& (comm->cell_x1[dim] - comm->cell_x0[dim]) * ddbox->skew_fac[dim] < comm->cellsize_min[dim])
{
load->mdf = 0;
load->pme = 0;
int pos = 0;
- for (int i = 0; i < dd->nc[dim]; i++)
+ for (int i = 0; i < dd->numCells[dim]; i++)
{
load->sum += load->load[pos++];
load->max = std::max(load->max, load->load[pos]);
}
if (isDlbOn(comm) && rowMaster->dlbIsLimited)
{
- load->sum_m *= dd->nc[dim];
+ load->sum_m *= dd->numCells[dim];
load->flags |= (1 << d);
}
}
{
comm->load[d].sum_m = comm->load[d].sum;
- int nc = dd->nc[dd->dim[d]];
+ int nc = dd->numCells[dd->dim[d]];
for (int i = 0; i < nc; i++)
{
rowMaster->cellFrac[i] = i / static_cast<real>(nc);
const int* recv_i,
gmx::ArrayRef<gmx::RVec> x,
gmx::ArrayRef<const gmx::RVec> recv_vr,
- cginfo_mb_t* cginfo_mb,
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb,
gmx::ArrayRef<int> cginfo)
{
gmx_domdec_ind_t *ind, *ind_p;
gmx_domdec_comm_t* comm;
gmx_domdec_zones_t* zones;
gmx_domdec_comm_dim_t* cd;
- cginfo_mb_t* cginfo_mb;
gmx_bool bBondComm, bDist2B, bDistMB, bDistBonded;
dd_corners_t corners;
rvec * normal, *v_d, *v_0 = nullptr, *v_1 = nullptr;
v_1 = ddbox->v[dim1];
}
- zone_cg_range = zones->cg_range;
- cginfo_mb = fr->cginfo_mb;
+ zone_cg_range = zones->cg_range;
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb = fr->cginfo_mb;
zone_cg_range[0] = 0;
zone_cg_range[1] = dd->ncg_home;
}
/*! \brief Check whether bonded interactions are missing, if appropriate */
-void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int totalNumberOfBondedInteractions,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box,
- bool* shouldCheckNumberOfBondedInteractions)
+void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int totalNumberOfBondedInteractions,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box,
+ bool* shouldCheckNumberOfBondedInteractions)
{
if (*shouldCheckNumberOfBondedInteractions)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param[in] box Box matrix for the error message
* \param[in,out] shouldCheckNumberOfBondedInteractions Whether we should do the check. Always set to false.
*/
-void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int totalNumberOfBondedInteractions,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box,
- bool* shouldCheckNumberOfBondedInteractions);
+void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int totalNumberOfBondedInteractions,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box,
+ bool* shouldCheckNumberOfBondedInteractions);
#endif
flag |= DD_FLAG_BW(d);
if (firstMoveDimValue == -1)
{
- if (dd.nc[dim] > 2)
+ if (dd.numCells[dim] > 2)
{
firstMoveDimValue = d * 2 + 1;
}
/* Do pbc and check DD cell boundary crossings */
for (int d = DIM - 1; d >= 0; d--)
{
- if (dd->nc[d] > 1)
+ if (dd->numCells[d] > 1)
{
bool bScrew = (dd->unitCellInfo.haveScrewPBC && d == XX);
/* Determine the location of this cg in lattice coordinates */
cm_new, cm_new, pos_d);
}
dev[d] = 1;
- if (dd->ci[d] == dd->nc[d] - 1)
+ if (dd->ci[d] == dd->numCells[d] - 1)
{
rvec_dec(cm_new, state->box[d]);
if (bScrew)
/* Do pbc and check DD cell boundary crossings */
for (int d = DIM - 1; d >= 0; d--)
{
- if (dd->nc[d] > 1)
+ if (dd->numCells[d] > 1)
{
/* Determine the location of this COG in lattice coordinates */
real pos_d = cog[d];
cogOld, cog, pos_d);
}
dev[d] = 1;
- if (dd->ci[d] == dd->nc[d] - 1)
+ if (dd->ci[d] == dd->numCells[d] - 1)
{
rvec_dec(cog, state->box[d]);
}
{
cell_x0[d] = comm->cell_x0[d];
}
- if (d >= npbcdim && dd->ci[d] == dd->nc[d] - 1)
+ if (d >= npbcdim && dd->ci[d] == dd->numCells[d] - 1)
{
cell_x1[d] = GMX_FLOAT_MAX;
}
/* We reuse the intBuffer without reacquiring since we are in the same scope */
DDBufferAccess<int>& flagBuffer = moveBuffer;
- const cginfo_mb_t* cginfo_mb = fr->cginfo_mb;
+ gmx::ArrayRef<const cginfo_mb_t> cginfo_mb = fr->cginfo_mb;
/* Temporarily store atoms passed to our rank at the end of the range */
int home_pos_cg = dd->ncg_home;
const int dim = dd->dim[d];
int ncg_recv = 0;
int nvr = 0;
- for (int dir = 0; dir < (dd->nc[dim] == 2 ? 1 : 2); dir++)
+ for (int dir = 0; dir < (dd->numCells[dim] == 2 ? 1 : 2); dir++)
{
const int cdd = d * 2 + dir;
/* Communicate the cg and atom counts */
int flag = flagBuffer.buffer[cg * DD_CGIBS + 1];
const gmx::RVec& cog = rvecBuffer.buffer[buf_pos];
- if (dim >= npbcdim && dd->nc[dim] > 2)
+ if (dim >= npbcdim && dd->numCells[dim] > 2)
{
/* No pbc in this dim and more than one domain boundary.
* We do a separate check if a charge group didn't move too far.
* so we do not need to handle boundary crossings.
* This also means we do not have to handle PBC here.
*/
- if (!((dd->ci[dim2] == dd->nc[dim2] - 1 && (flag & DD_FLAG_FW(d2)))
+ if (!((dd->ci[dim2] == dd->numCells[dim2] - 1 && (flag & DD_FLAG_FW(d2)))
|| (dd->ci[dim2] == 0 && (flag & DD_FLAG_BW(d2)))))
{
/* Clear the two flags for this dimension */
* to an adjacent cell because of the
* staggering.
*/
- if (pos_d >= cell_x1[dim2] && dd->ci[dim2] != dd->nc[dim2] - 1)
+ if (pos_d >= cell_x1[dim2] && dd->ci[dim2] != dd->numCells[dim2] - 1)
{
flag |= DD_FLAG_FW(d2);
}
}
else if (flag & DD_FLAG_BW(d2))
{
- if (dd->nc[dd->dim[d2]] > 2)
+ if (dd->numCells[dd->dim[d2]] > 2)
{
mc = d2 * 2 + 1;
}
#include "gromacs/gpu_utils/hostallocator.h"
#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/utility/arrayref.h"
#include "domdec_internal.h"
void check_screw_box(const matrix box);
/*! \brief Return the charge group information flags for charge group cg */
-static inline int ddcginfo(const cginfo_mb_t* cginfo_mb, int cg)
+static inline int ddcginfo(gmx::ArrayRef<const cginfo_mb_t> cginfo_mb, int cg)
{
- while (cg >= cginfo_mb->cg_end)
+ size_t index = 0;
+ while (cg >= cginfo_mb[index].cg_end)
{
- cginfo_mb++;
+ index++;
}
+ const cginfo_mb_t& cgimb = cginfo_mb[index];
- return cginfo_mb->cginfo[(cg - cginfo_mb->cg_start) % cginfo_mb->cg_mod];
+ return cgimb.cginfo[(cg - cgimb.cg_start) % cgimb.cg_mod];
};
/*! \brief Returns the number of MD steps for which load has been recorded */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Remove PBC, make molecule(s) subject to ED whole. */
snew(x_pbc, mtop->natoms);
copy_rvecn(globalState->x.rvec_array(), x_pbc, 0, mtop->natoms);
- do_pbc_first_mtop(nullptr, ir->ePBC, globalState->box, mtop, x_pbc);
+ do_pbc_first_mtop(nullptr, ir->pbcType, globalState->box, mtop, x_pbc);
}
/* Reset pointer to first ED data set which contains the actual ED data */
auto edi = ed->edpar.begin();
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
+
+
+set(PME_OCL_KERNEL_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/pme_gpu_utils.clh"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pme_solve.clh"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pme_gather.clh"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pme_spread.clh")
+
+if(CLANG_TIDY_EXE)
+ set(OCL_COMPILER "${CLANG_TIDY_EXE}")
+ set(CLANG_TIDY_ARGS "-quiet;-checks=*,-readability-implicit-bool-conversion,-llvm-header-guard,-hicpp-signed-bitwise,-clang-analyzer-deadcode.DeadStores,-google-readability-todo,-clang-diagnostic-padded,-fcomment-block-commands=internal;--;${CMAKE_C_COMPILER}")
+else()
+ set(OCL_COMPILER "${CMAKE_C_COMPILER}")
+endif()
+
+# TODO: test all warp sizes on all vendor targets?
+foreach(VENDOR AMD NVIDIA INTEL)
+ foreach(WARPSIZE 16 32 64)
+ math(EXPR SPREAD_WG_SIZE "8*${WARPSIZE}")
+ math(EXPR SOLVE_WG_SIZE "8*${WARPSIZE}")
+ math(EXPR GATHER_WG_SIZE "4*${WARPSIZE}")
+ set(OBJ_FILE pme_ocl_kernel_warpSize${WARPSIZE}_${VENDOR}.o)
+ add_custom_command(OUTPUT ${OBJ_FILE} COMMAND ${OCL_COMPILER}
+ ${CMAKE_CURRENT_SOURCE_DIR}/pme_program.cl ${CLANG_TIDY_ARGS}
+ -Xclang -finclude-default-header -D_${VENDOR}_SOURCE_
+ -Dwarp_size=${WARPSIZE}
+ -Dorder=4
+ -DthreadsPerAtom=16
+ -Dc_pmeMaxUnitcellShift=2
+ -Dc_usePadding=true
+ -Dc_skipNeutralAtoms=false
+ -Dc_virialAndEnergyCount=7
+ -Dc_spreadWorkGroupSize=${SPREAD_WG_SIZE}
+ -Dc_solveMaxWorkGroupSize=${SOLVE_WG_SIZE}
+ -Dc_gatherWorkGroupSize=${GATHER_WG_SIZE}
+ -DDIM=3 -DXX=0 -DYY=1 -DZZ=2
+ -DwrapX=true -DwrapY=true
+ -c -I ${CMAKE_SOURCE_DIR}/src -std=cl1.2
+ -Weverything -Wno-conversion -Wno-missing-variable-declarations -Wno-used-but-marked-unused
+ -Wno-cast-align -Wno-incompatible-pointer-types
+ # to avoid "warning: unknown command tag name" for \internal
+ -Wno-documentation-unknown-command
+ # to avoid pme_gpu_types.h:100:52: warning: padding struct 'struct PmeGpuConstParams' with 4 bytes to align 'd_virialAndEnergy'
+ -Wno-padded
+ -o${OBJ_FILE}
+ )
+ list(APPEND PME_OCL_KERNELS ${OBJ_FILE})
+ endforeach()
+endforeach()
+
+add_custom_target(ocl_pme_kernels DEPENDS ${PME_OCL_KERNELS} )
+gmx_set_custom_target_output(ocl_pme_kernels ${PME_OCL_KERNELS})
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
-#include "pme_internal.h"
-
static void make_dft_mod(real* mod, const double* data, int splineOrder, int ndata)
{
for (int i = 0; i < ndata; i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_EWALD_CALCULATE_SPLINE_MODULI_H
#define GMX_EWALD_CALCULATE_SPLINE_MODULI_H
-#include "pme_internal.h"
+#include "spline_vectors.h"
/* Calulate plain SPME B-spline interpolation */
void make_bspline_moduli(splinevec bsp_mod, int nx, int ny, int nz, int order);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
-#include "pme_internal.h"
-
/* There's nothing special to do here if just masses are perturbed,
* but if either charge or type is perturbed then the implementation
* requires that B states are defined for both charge and type, and
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int nthread,
PmeRunMode runMode,
PmeGpu* pmeGpu,
- const gmx_device_info_t* gpuInfo,
- PmeGpuProgramHandle pmeGpuProgram,
+ const DeviceInformation* deviceInfo,
+ const PmeGpuProgram* pmeGpuProgram,
const gmx::MDLogger& /*mdlog*/)
{
int use_threads, sum_use_threads, i;
}
pme->bUseThreads = (sum_use_threads > 0);
- if (ir->ePBC == epbcSCREW)
+ if (ir->pbcType == PbcType::Screw)
{
gmx_fatal(FARGS, "pme does not (yet) work with pbc = screw");
}
pme->atc.emplace_back(pme->mpi_comm_d[1], pme->nthread, pme->pme_order, secondDimIndex, doSpread);
}
- if (pme_gpu_active(pme.get()))
+ // Initial check of validity of the input for running on the GPU
+ if (pme->runMode != PmeRunMode::CPU)
{
- if (!pme->gpu)
+ std::string errorString;
+ bool canRunOnGpu = pme_gpu_check_restrictions(pme.get(), &errorString);
+ if (!canRunOnGpu)
{
- // Initial check of validity of the data
- std::string errorString;
- bool canRunOnGpu = pme_gpu_check_restrictions(pme.get(), &errorString);
- if (!canRunOnGpu)
- {
- GMX_THROW(gmx::NotImplementedError(errorString));
- }
+ GMX_THROW(gmx::NotImplementedError(errorString));
}
-
- pme_gpu_reinit(pme.get(), gpuInfo, pmeGpuProgram);
}
+ pme_gpu_reinit(pme.get(), deviceInfo, pmeGpuProgram);
pme_init_all_work(&pme->solve_work, pme->nthread, pme->nkx);
// TODO: This would be better as just copying a sub-structure that contains
// all the PME parameters and nothing else.
t_inputrec irc;
- irc.ePBC = ir->ePBC;
+ irc.pbcType = ir->pbcType;
irc.coulombtype = ir->coulombtype;
irc.vdwtype = ir->vdwtype;
irc.efep = ir->efep;
destroy_pme_spline_work(pme->spline_work);
- if (pme_gpu_active(pme) && pme->gpu)
+ if (pme->gpu != nullptr)
{
pme_gpu_destroy(pme->gpu);
}
void gmx_pme_reinit_atoms(gmx_pme_t* pme, const int numAtoms, const real* charges)
{
- if (pme_gpu_active(pme))
+ if (pme->gpu != nullptr)
{
pme_gpu_reinit_atoms(pme->gpu, numAtoms, charges);
}
// TODO: set the charges here as well
}
}
+
+bool gmx_pme_grid_matches(const gmx_pme_t& pme, const ivec grid_size)
+{
+ return (pme.nkx == grid_size[XX] && pme.nky == grid_size[YY] && pme.nkz == grid_size[ZZ]);
+}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/gpu_utils/gpu_macros.h"
#include "gromacs/math/vectypes.h"
-#include "gromacs/timing/walltime_accounting.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
struct gmx_hw_info_t;
-struct interaction_const_t;
struct t_commrec;
-struct t_forcerec;
struct t_inputrec;
struct t_nrnb;
struct PmeGpu;
struct gmx_wallclock_gpu_pme_t;
-struct gmx_device_info_t;
+struct DeviceInformation;
struct gmx_enerdata_t;
struct gmx_mtop_t;
struct gmx_pme_t;
enum class GpuTaskCompletion;
class PmeGpuProgram;
class GpuEventSynchronizer;
-//! Convenience name.
-using PmeGpuProgramHandle = const PmeGpuProgram*;
namespace gmx
{
-class PmePpCommGpu;
class ForceWithVirial;
class MDLogger;
enum class PinningPolicy : int;
Mixed, //!< Mixed mode: only spread and gather run on GPU; FFT and solving are done on CPU.
};
-//! PME gathering output forces treatment
-enum class PmeForceOutputHandling
-{
- Set, /**< Gather simply writes into provided force buffer */
- ReduceWithInput, /**< Gather adds its output to the buffer.
- On GPU, that means additional H2D copy before the kernel launch. */
-};
-
/*! \brief Return the smallest allowed PME grid size for \p pmeOrder */
int minimalPmeGridSize(int pmeOrder);
+//! Return whether the grid of \c pme is identical to \c grid_size.
+bool gmx_pme_grid_matches(const gmx_pme_t& pme, const ivec grid_size);
+
/*! \brief Check restrictions on pme_order and the PME grid nkx,nky,nkz.
*
* With errorsAreFatal=true, an exception or fatal error is generated
* \returns Pointer to newly allocated and initialized PME data.
*
* \todo We should evolve something like a \c GpuManager that holds \c
- * gmx_device_info_t * and \c PmeGpuProgramHandle and perhaps other
+ * DeviceInformation* and \c PmeGpuProgram* and perhaps other
* related things whose lifetime can/should exceed that of a task (or
* perhaps task manager). See Redmine #2522.
*/
int nthread,
PmeRunMode runMode,
PmeGpu* pmeGpu,
- const gmx_device_info_t* gpuInfo,
- PmeGpuProgramHandle pmeGpuProgram,
+ const DeviceInformation* deviceInfo,
+ const PmeGpuProgram* pmeGpuProgram,
const gmx::MDLogger& mdlog);
+/*! \brief As gmx_pme_init, but takes most settings, except the grid/Ewald coefficients, from
+ * pme_src. This is only called when the PME cut-off/grid size changes.
+ */
+void gmx_pme_reinit(gmx_pme_t** pmedata,
+ const t_commrec* cr,
+ gmx_pme_t* pme_src,
+ const t_inputrec* ir,
+ const ivec grid_size,
+ real ewaldcoeff_q,
+ real ewaldcoeff_lj);
+
/*! \brief Destroys the PME data structure.*/
void gmx_pme_destroy(gmx_pme_t* pme);
real* dvdlambda_lj,
int flags);
-/*! \brief Called on the nodes that do PME exclusively */
-int gmx_pmeonly(struct gmx_pme_t* pme,
- const t_commrec* cr,
- t_nrnb* mynrnb,
- gmx_wallcycle* wcycle,
- gmx_walltime_accounting_t walltime_accounting,
- t_inputrec* ir,
- PmeRunMode runMode);
-
/*! \brief Calculate the PME grid energy V for n charges.
*
* The potential (found in \p pme) must have been found already with a
*/
void gmx_pme_calc_energy(gmx_pme_t* pme, gmx::ArrayRef<const gmx::RVec> x, gmx::ArrayRef<const real> q, real* V);
-/*! \brief Send the charges and maxshift to out PME-only node. */
-void gmx_pme_send_parameters(const t_commrec* cr,
- const interaction_const_t* ic,
- gmx_bool bFreeEnergy_q,
- gmx_bool bFreeEnergy_lj,
- real* chargeA,
- real* chargeB,
- real* sqrt_c6A,
- real* sqrt_c6B,
- real* sigmaA,
- real* sigmaB,
- int maxshift_x,
- int maxshift_y);
-
-/*! \brief Send the coordinates to our PME-only node and request a PME calculation */
-void gmx_pme_send_coordinates(t_forcerec* fr,
- const t_commrec* cr,
- const matrix box,
- const rvec* x,
- real lambda_q,
- real lambda_lj,
- gmx_bool bEnerVir,
- int64_t step,
- bool useGpuPmePpComms,
- bool reinitGpuPmePpComms,
- bool sendCoordinatesFromGpu,
- GpuEventSynchronizer* coordinatesReadyOnDeviceEvent,
- gmx_wallcycle* wcycle);
-
-/*! \brief Tell our PME-only node to finish */
-void gmx_pme_send_finish(const t_commrec* cr);
-
-/*! \brief Tell our PME-only node to reset all cycle and flop counters */
-void gmx_pme_send_resetcounters(const t_commrec* cr, int64_t step);
-
-/*! \brief PP nodes receive the long range forces from the PME nodes */
-void gmx_pme_receive_f(gmx::PmePpCommGpu* pmePpCommGpu,
- const t_commrec* cr,
- gmx::ForceWithVirial* forceWithVirial,
- real* energy_q,
- real* energy_lj,
- real* dvdlambda_q,
- real* dvdlambda_lj,
- bool useGpuPmePpComms,
- bool receivePmeForceToGpu,
- float* pme_cycles);
-
/*! \brief
* This function updates the local atom data on GPU after DD (charges, coordinates, etc.).
* TODO: it should update the PME CPU atom data as well.
*
* \param[in] pme The PME data structure.
* \param[in] wcycle The wallclock counter.
- * \param[in] forceTreatment Tells how data should be treated. The gathering kernel either
- * stores the output reciprocal forces into the host array, or copies its contents to the GPU first
- * and accumulates. The reduction is non-atomic.
*/
GPU_FUNC_QUALIFIER void pme_gpu_launch_gather(const gmx_pme_t* GPU_FUNC_ARGUMENT(pme),
- gmx_wallcycle* GPU_FUNC_ARGUMENT(wcycle),
- PmeForceOutputHandling GPU_FUNC_ARGUMENT(forceTreatment)) GPU_FUNC_TERM;
+ gmx_wallcycle* GPU_FUNC_ARGUMENT(wcycle)) GPU_FUNC_TERM;
/*! \brief
* Attempts to complete PME GPU tasks.
GPU_FUNC_QUALIFIER void pme_gpu_reinit_computation(const gmx_pme_t* GPU_FUNC_ARGUMENT(pme),
gmx_wallcycle* GPU_FUNC_ARGUMENT(wcycle)) GPU_FUNC_TERM;
-
-/*! \brief Get pointer to device copy of coordinate data.
- * \param[in] pme The PME data structure.
- * \returns Pointer to coordinate data
- */
-GPU_FUNC_QUALIFIER DeviceBuffer<float> pme_gpu_get_device_x(const gmx_pme_t* GPU_FUNC_ARGUMENT(pme))
- GPU_FUNC_TERM_WITH_RETURN(DeviceBuffer<float>{});
-
/*! \brief Set pointer to device copy of coordinate data.
* \param[in] pme The PME data structure.
* \param[in] d_x The pointer to the positions buffer to be set
*/
-GPU_FUNC_QUALIFIER void pme_gpu_set_device_x(const gmx_pme_t* GPU_FUNC_ARGUMENT(pme),
- DeviceBuffer<float> GPU_FUNC_ARGUMENT(d_x)) GPU_FUNC_TERM;
+GPU_FUNC_QUALIFIER void pme_gpu_set_device_x(const gmx_pme_t* GPU_FUNC_ARGUMENT(pme),
+ DeviceBuffer<gmx::RVec> GPU_FUNC_ARGUMENT(d_x)) GPU_FUNC_TERM;
/*! \brief Get pointer to device copy of force data.
* \param[in] pme The PME data structure.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Controls if the atom and charge data is prefeched into shared memory or loaded per thread from global
static const bool c_useAtomDataPrefetch = true;
+/*! \brief Asserts if the argument is finite.
+ *
+ * The function works for any data type, that can be casted to float. Note that there is also
+ * a specialized implementation for float3 data type.
+ *
+ * \param[in] arg Argument to check.
+ */
+template<typename T>
+__device__ inline void assertIsFinite(T arg);
+
+template<>
+__device__ inline void assertIsFinite(float3 arg)
+{
+ assert(isfinite(float(arg.x)));
+ assert(isfinite(float(arg.y)));
+ assert(isfinite(float(arg.z)));
+}
+
+template<typename T>
+__device__ inline void assertIsFinite(T arg)
+{
+ assert(isfinite(float(arg)));
+}
+
/*! \brief
* General purpose function for loading atom-related data from global to shared memory.
*
pme_gpu_check_atom_data_index(globalIndex, kernelParams.atoms.nAtoms * dataCountPerAtom);
if ((localIndex < atomsPerBlock * dataCountPerAtom) & globalCheck)
{
- assert(isfinite(float(gm_source[globalIndex])));
+ assertIsFinite(gm_source[globalIndex]);
sm_destination[localIndex] = gm_source[globalIndex];
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_PMECOORDINATERECEIVERGPU_H
#define GMX_PMECOORDINATERECEIVERGPU_H
-#include "gromacs/ewald/pme.h"
-#include "gromacs/ewald/pme_force_sender_gpu.h"
+#include "gromacs/gpu_utils/devicebuffer_datatype.h"
+#include "gromacs/math/vectypes.h"
#include "gromacs/utility/classhelpers.h"
#include "gromacs/utility/gmxmpi.h"
+struct PpRanks;
+
namespace gmx
{
+template<typename>
+class ArrayRef;
+
class PmeCoordinateReceiverGpu
{
* \param[in] comm Communicator used for simulation
* \param[in] ppRanks List of PP ranks
*/
- PmeCoordinateReceiverGpu(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
+ PmeCoordinateReceiverGpu(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
~PmeCoordinateReceiverGpu();
/*! \brief
* send coordinates buffer address to PP rank
* \param[in] d_x coordinates buffer in GPU memory
*/
- void sendCoordinateBufferAddressToPpRanks(rvec* d_x);
+ void sendCoordinateBufferAddressToPpRanks(DeviceBuffer<RVec> d_x);
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "config.h"
#include "gromacs/ewald/pme_coordinate_receiver_gpu.h"
+#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/gmxassert.h"
#if GMX_GPU != GMX_GPU_CUDA
};
/*!\brief Constructor stub. */
-PmeCoordinateReceiverGpu::PmeCoordinateReceiverGpu(void gmx_unused* pmeStream,
- MPI_Comm gmx_unused comm,
- gmx::ArrayRef<PpRanks> gmx_unused ppRanks) :
+PmeCoordinateReceiverGpu::PmeCoordinateReceiverGpu(const void* /* pmeStream */,
+ MPI_Comm /* comm */,
+ gmx::ArrayRef<PpRanks> /* ppRanks */) :
impl_(nullptr)
{
GMX_ASSERT(false,
PmeCoordinateReceiverGpu::~PmeCoordinateReceiverGpu() = default;
/*!\brief init PME-PP GPU communication stub */
-void PmeCoordinateReceiverGpu::sendCoordinateBufferAddressToPpRanks(rvec gmx_unused* d_x)
+void PmeCoordinateReceiverGpu::sendCoordinateBufferAddressToPpRanks(DeviceBuffer<RVec> /* d_x */)
{
GMX_ASSERT(false,
"A CPU stub for PME-PP GPU communication initialization was called instead of the "
"correct implementation.");
}
-void PmeCoordinateReceiverGpu::launchReceiveCoordinatesFromPpCudaDirect(int gmx_unused ppRank)
+void PmeCoordinateReceiverGpu::launchReceiveCoordinatesFromPpCudaDirect(int /* ppRank */)
{
GMX_ASSERT(false,
"A CPU stub for PME-PP GPU communication was called instead of the correct "
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "config.h"
-#include <assert.h>
-#include <stdio.h>
-
-#include "gromacs/ewald/pme.h"
+#include "gromacs/ewald/pme_force_sender_gpu.h"
#include "gromacs/gpu_utils/cudautils.cuh"
#include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
#include "gromacs/utility/gmxmpi.h"
namespace gmx
{
-PmeCoordinateReceiverGpu::Impl::Impl(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks) :
- pmeStream_(*static_cast<cudaStream_t*>(pmeStream)),
+PmeCoordinateReceiverGpu::Impl::Impl(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks) :
+ pmeStream_(*static_cast<const cudaStream_t*>(pmeStream)),
comm_(comm),
ppRanks_(ppRanks)
{
PmeCoordinateReceiverGpu::Impl::~Impl() = default;
-void PmeCoordinateReceiverGpu::Impl::sendCoordinateBufferAddressToPpRanks(rvec* d_x)
+void PmeCoordinateReceiverGpu::Impl::sendCoordinateBufferAddressToPpRanks(DeviceBuffer<RVec> d_x)
{
int ind_start = 0;
}
}
-PmeCoordinateReceiverGpu::PmeCoordinateReceiverGpu(void* pmeStream,
+PmeCoordinateReceiverGpu::PmeCoordinateReceiverGpu(const void* pmeStream,
MPI_Comm comm,
gmx::ArrayRef<PpRanks> ppRanks) :
impl_(new Impl(pmeStream, comm, ppRanks))
PmeCoordinateReceiverGpu::~PmeCoordinateReceiverGpu() = default;
-void PmeCoordinateReceiverGpu::sendCoordinateBufferAddressToPpRanks(rvec* d_x)
+void PmeCoordinateReceiverGpu::sendCoordinateBufferAddressToPpRanks(DeviceBuffer<RVec> d_x)
{
impl_->sendCoordinateBufferAddressToPpRanks(d_x);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#define GMX_PMECOORDINATERECEIVERGPU_IMPL_H
#include "gromacs/ewald/pme_coordinate_receiver_gpu.h"
-#include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
+#include "gromacs/utility/arrayref.h"
+
+class GpuEventSynchronizer;
namespace gmx
{
* \param[in] comm Communicator used for simulation
* \param[in] ppRanks List of PP ranks
*/
- Impl(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
+ Impl(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
~Impl();
/*! \brief
* send coordinates buffer address to PP rank
* \param[in] d_x coordinates buffer in GPU memory
*/
- void sendCoordinateBufferAddressToPpRanks(rvec* d_x);
+ void sendCoordinateBufferAddressToPpRanks(DeviceBuffer<RVec> d_x);
/*! \brief
* launch receive of coordinate data from PP rank
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param[in] comm Communicator used for simulation
* \param[in] ppRanks List of PP ranks
*/
- PmeForceSenderGpu(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
+ PmeForceSenderGpu(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
~PmeForceSenderGpu();
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
};
/*!\brief Constructor stub. */
-PmeForceSenderGpu::PmeForceSenderGpu(void gmx_unused* pmeStream,
- MPI_Comm gmx_unused comm,
- gmx::ArrayRef<PpRanks> gmx_unused ppRanks) :
+PmeForceSenderGpu::PmeForceSenderGpu(const void* /*pmeStream */,
+ MPI_Comm /* comm */,
+ gmx::ArrayRef<PpRanks> /* ppRanks */) :
impl_(nullptr)
{
GMX_ASSERT(false,
PmeForceSenderGpu::~PmeForceSenderGpu() = default;
/*!\brief init PME-PP GPU communication stub */
-void PmeForceSenderGpu::sendForceBufferAddressToPpRanks(rvec gmx_unused* d_f)
+void PmeForceSenderGpu::sendForceBufferAddressToPpRanks(rvec* /* d_f */)
{
GMX_ASSERT(false,
"A CPU stub for PME-PP GPU communication initialization was called instead of the "
"correct implementation.");
}
-void PmeForceSenderGpu::sendFToPpCudaDirect(int gmx_unused ppRank)
+void PmeForceSenderGpu::sendFToPpCudaDirect(int /* ppRank */)
{
GMX_ASSERT(false,
"A CPU stub for PME-PP GPU communication was called instead of the correct "
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
/*! \brief Create PME-PP GPU communication object */
-PmeForceSenderGpu::Impl::Impl(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks) :
- pmeStream_(*static_cast<cudaStream_t*>(pmeStream)),
+PmeForceSenderGpu::Impl::Impl(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks) :
+ pmeStream_(*static_cast<const cudaStream_t*>(pmeStream)),
comm_(comm),
ppRanks_(ppRanks)
{
#endif
}
-PmeForceSenderGpu::PmeForceSenderGpu(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks) :
+PmeForceSenderGpu::PmeForceSenderGpu(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks) :
impl_(new Impl(pmeStream, comm, ppRanks))
{
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param[in] comm Communicator used for simulation
* \param[in] ppRanks List of PP ranks
*/
- Impl(void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
+ Impl(const void* pmeStream, MPI_Comm comm, gmx::ArrayRef<PpRanks> ppRanks);
~Impl();
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* - atomsPerBlock which expresses how many atoms are processed by a single work group
* - order which is a PME interpolation order
- * - overwriteForces must evaluate to either true or false to specify whether the kernel
- * overwrites or reduces into the forces buffer
* - wrapX and wrapY must evaluate to either true or false to specify whether the grid overlap
* in dimension X/Y is to be used
*
case XX: return realGridSizeFP[XX];
case YY: return realGridSizeFP[YY];
case ZZ: return realGridSizeFP[ZZ];
+ default: assert(false); break;
}
assert(false);
- return 0.0f;
+ return 0.0F;
}
/*! \brief Reduce the partial force contributions.
{
/* These are the atom indices - for the shared and global memory */
const int atomIndexLocal = get_local_id(ZZ);
- const int atomIndexOffset = get_group_id(XX) * atomsPerBlock;
+ const int atomIndexOffset = (int)get_group_id(XX) * atomsPerBlock;
const int atomIndexGlobal = atomIndexOffset + atomIndexLocal;
/* Some sizes which are defines and not consts because they go into the array size */
const int ithy = get_local_id(YY);
const int ithz = get_local_id(XX);
- const int threadLocalId = (get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0)
- + get_local_id(0);
+ assert((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0) + get_local_id(0)
+ <= MAX_INT);
+ const int threadLocalId =
+ (int)((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0)
+ + get_local_id(0));
/* These are the spline contribution indices in shared memory */
- const int splineIndex = (get_local_id(1) * get_local_size(0)
- + get_local_id(0)); /* Relative to the current particle , 0..15 for order 4 */
- const int lineIndex = threadLocalId; /* And to all the block's particles */
+ assert((get_local_id(1) * get_local_size(0) + get_local_id(0)) <= MAX_INT);
+ const int splineIndex =
+ (int)(get_local_id(1) * get_local_size(0)
+ + get_local_id(0)); /* Relative to the current particle , 0..15 for order 4 */
+ const int lineIndex = threadLocalId; /* And to all the block's particles */
/* Staging the atom gridline indices, DIM * atomsPerBlock threads */
const int localGridlineIndicesIndex = threadLocalId;
const int globalGridlineIndicesIndex =
- get_group_id(XX) * gridlineIndicesSize + localGridlineIndicesIndex;
+ (int)get_group_id(XX) * gridlineIndicesSize + localGridlineIndicesIndex;
const int globalCheckIndices =
pme_gpu_check_atom_data_index(globalGridlineIndicesIndex, kernelParams.atoms.nAtoms * DIM);
if ((localGridlineIndicesIndex < gridlineIndicesSize) & globalCheckIndices)
assert(sm_gridlineIndices[localGridlineIndicesIndex] >= 0);
}
/* Staging the spline parameters, DIM * order * atomsPerBlock threads */
- const int localSplineParamsIndex = threadLocalId;
- const int globalSplineParamsIndex = get_group_id(XX) * splineParamsSize + localSplineParamsIndex;
+ const int localSplineParamsIndex = threadLocalId;
+ const int globalSplineParamsIndex = (int)get_group_id(XX) * splineParamsSize + localSplineParamsIndex;
const int globalCheckSplineParams = pme_gpu_check_atom_data_index(
globalSplineParamsIndex, kernelParams.atoms.nAtoms * DIM * order);
if ((localSplineParamsIndex < splineParamsSize) && globalCheckSplineParams)
}
barrier(CLK_LOCAL_MEM_FENCE);
- float fx = 0.0f;
- float fy = 0.0f;
- float fz = 0.0f;
+ float fx = 0.0F;
+ float fy = 0.0F;
+ float fz = 0.0F;
const int globalCheck = pme_gpu_check_atom_data_index(atomIndexGlobal, kernelParams.atoms.nAtoms);
const int chargeCheck = pme_gpu_check_atom_charge(gm_coefficients[atomIndexGlobal]);
for (int i = 0; i < numIter; i++)
{
const int outputIndexLocal = i * iterThreads + threadLocalId;
- const int outputIndexGlobal = get_group_id(XX) * blockForcesSize + outputIndexLocal;
+ const int outputIndexGlobal = (int)get_group_id(XX) * blockForcesSize + outputIndexLocal;
const int globalOutputCheck =
pme_gpu_check_atom_data_index(outputIndexGlobal, kernelParams.atoms.nAtoms * DIM);
if (globalOutputCheck)
{
const float outputForceComponent = sm_forces[outputIndexLocal];
- if (overwriteForces)
- {
- gm_forces[outputIndexGlobal] = outputForceComponent;
- }
- else
- {
- gm_forces[outputIndexGlobal] += outputForceComponent;
- }
+ gm_forces[outputIndexGlobal] = outputForceComponent;
}
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <cassert>
#include "gromacs/gpu_utils/cuda_kernel_utils.cuh"
+#include "gromacs/gpu_utils/typecasts.cuh"
#include "pme.cuh"
#include "pme_calculate_splines.cuh"
* The grid is assumed to be wrapped in dimension Z.
*
* \tparam[in] order The PME order (must be 4 currently).
- * \tparam[in] overwriteForces True: the forces are written to the output buffer;
- * False: the forces are added non-atomically to the output buffer (e.g. to the bonded forces).
* \tparam[in] wrapX Tells if the grid is wrapped in the X dimension.
* \tparam[in] wrapY Tells if the grid is wrapped in the Y dimension.
* \tparam[in] readGlobal Tells if we should read spline values from global memory
- * \tparam[in] useOrderThreads Tells if we should use order threads per atom (order*order used if false)
+ * \tparam[in] useOrderThreads Tells if we should use order threads per atom
+ * (order*order used if false)
* \param[in] kernelParams All the PME GPU data.
*/
-template<const int order, const bool overwriteForces, const bool wrapX, const bool wrapY, const bool readGlobal, const bool useOrderThreads>
+template<const int order, const bool wrapX, const bool wrapY, const bool readGlobal, const bool useOrderThreads>
__launch_bounds__(c_gatherMaxThreadsPerBlock, c_gatherMinBlocksPerMP) __global__
void pme_gather_kernel(const PmeGpuCudaKernelParams kernelParams)
{
}
else
{
+ const float3* __restrict__ gm_coordinates = asFloat3(kernelParams.atoms.d_coordinates);
/* Recaclulate Splines */
if (c_useAtomDataPrefetch)
{
// charges
__shared__ float sm_coefficients[atomsPerBlock];
// Coordinates
- __shared__ float sm_coordinates[DIM * atomsPerBlock];
+ __shared__ float3 sm_coordinates[atomsPerBlock];
/* Staging coefficients/charges */
- pme_gpu_stage_atom_data<float, atomsPerBlock, 1>(kernelParams, sm_coefficients,
- kernelParams.atoms.d_coefficients);
+ pme_gpu_stage_atom_data<float, atomsPerBlock, 1>(kernelParams, sm_coefficients, gm_coefficients);
/* Staging coordinates */
- pme_gpu_stage_atom_data<float, atomsPerBlock, DIM>(kernelParams, sm_coordinates,
- kernelParams.atoms.d_coordinates);
+ pme_gpu_stage_atom_data<float3, atomsPerBlock, 1>(kernelParams, sm_coordinates, gm_coordinates);
__syncthreads();
- atomX.x = sm_coordinates[atomIndexLocal * DIM + XX];
- atomX.y = sm_coordinates[atomIndexLocal * DIM + YY];
- atomX.z = sm_coordinates[atomIndexLocal * DIM + ZZ];
+ atomX = sm_coordinates[atomIndexLocal];
atomCharge = sm_coefficients[atomIndexLocal];
}
else
{
+ atomX = gm_coordinates[atomIndexGlobal];
atomCharge = gm_coefficients[atomIndexGlobal];
- atomX.x = kernelParams.atoms.d_coordinates[atomIndexGlobal * DIM + XX];
- atomX.y = kernelParams.atoms.d_coordinates[atomIndexGlobal * DIM + YY];
- atomX.z = kernelParams.atoms.d_coordinates[atomIndexGlobal * DIM + ZZ];
}
calculate_splines<order, atomsPerBlock, atomsPerWarp, true, false>(
kernelParams, atomIndexOffset, atomX, atomCharge, sm_theta, sm_dtheta, sm_gridlineIndices);
if (globalOutputCheck)
{
const float outputForceComponent = ((float*)sm_forces)[outputIndexLocal];
- if (overwriteForces)
- {
- gm_forces[outputIndexGlobal] = outputForceComponent;
- }
- else
- {
- gm_forces[outputIndexGlobal] += outputForceComponent;
- }
+ gm_forces[outputIndexGlobal] = outputForceComponent;
}
}
}
}
//! Kernel instantiations
-template __global__ void pme_gather_kernel<4, true, true, true, true, true>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, true, true, true, true, false>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, false, true, true, true, true>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, false, true, true, true, false>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, true, true, true, false, true>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, true, true, true, false, false>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, false, true, true, false, true>(const PmeGpuCudaKernelParams);
-template __global__ void pme_gather_kernel<4, false, true, true, false, false>(const PmeGpuCudaKernelParams);
+template __global__ void pme_gather_kernel<4, true, true, true, true>(const PmeGpuCudaKernelParams);
+template __global__ void pme_gather_kernel<4, true, true, true, false>(const PmeGpuCudaKernelParams);
+template __global__ void pme_gather_kernel<4, true, true, false, true>(const PmeGpuCudaKernelParams);
+template __global__ void pme_gather_kernel<4, true, true, false, false>(const PmeGpuCudaKernelParams);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/stringutil.h"
#include "pme_gpu_internal.h"
+#include "pme_gpu_settings.h"
+#include "pme_gpu_timings.h"
+#include "pme_gpu_types_host.h"
#include "pme_grid.h"
#include "pme_internal.h"
#include "pme_solve.h"
+/*! \brief
+ * Finds out if PME is currently running on GPU.
+ *
+ * \todo The GPU module should not be constructed (or at least called)
+ * when it is not active, so there should be no need to check whether
+ * it is active. An assertion that this is true makes sense.
+ *
+ * \param[in] pme The PME structure.
+ * \returns True if PME runs on GPU currently, false otherwise.
+ */
+static inline bool pme_gpu_active(const gmx_pme_t* pme)
+{
+ return (pme != nullptr) && (pme->runMode != PmeRunMode::CPU);
+}
+
void pme_gpu_reset_timings(const gmx_pme_t* pme)
{
if (pme_gpu_active(pme))
gmx_wallcycle_t wcycle)
{
GMX_ASSERT(gridIndex == 0, "Only single grid supported");
- if (pme_gpu_performs_FFT(pme->gpu))
+ if (pme_gpu_settings(pme->gpu).performGPUFFT)
{
wallcycle_start_nocount(wcycle, ewcLAUNCH_GPU);
wallcycle_sub_start_nocount(wcycle, ewcsLAUNCH_GPU_PME);
wallcycle_sub_stop(wcycle, ewcsLAUNCH_GPU_PME);
wallcycle_stop(wcycle, ewcLAUNCH_GPU);
- if (!pme_gpu_performs_solve(pmeGpu))
+ if (!pme_gpu_settings(pmeGpu).performGPUSolve)
{
// TODO remove code duplication and add test coverage
matrix scaledBox;
void pme_gpu_launch_complex_transforms(gmx_pme_t* pme, gmx_wallcycle* wcycle)
{
- PmeGpu* pmeGpu = pme->gpu;
- const bool computeEnergyAndVirial = (pmeGpu->settings.currentFlags & GMX_PME_CALC_ENER_VIR) != 0;
- const bool performBackFFT = (pmeGpu->settings.currentFlags & (GMX_PME_CALC_F | GMX_PME_CALC_POT)) != 0;
+ PmeGpu* pmeGpu = pme->gpu;
+ const auto& settings = pmeGpu->settings;
+ const bool computeEnergyAndVirial = (settings.currentFlags & GMX_PME_CALC_ENER_VIR) != 0;
+ const bool performBackFFT = (settings.currentFlags & (GMX_PME_CALC_F | GMX_PME_CALC_POT)) != 0;
const unsigned int gridIndex = 0;
t_complex* cfftgrid = pme->cfftgrid[gridIndex];
- if (pmeGpu->settings.currentFlags & GMX_PME_SPREAD)
+ if (settings.currentFlags & GMX_PME_SPREAD)
{
- if (!pme_gpu_performs_FFT(pmeGpu))
+ if (!settings.performGPUFFT)
{
wallcycle_start(wcycle, ewcWAIT_GPU_PME_SPREAD);
pme_gpu_sync_spread_grid(pme->gpu);
try
{
- if (pmeGpu->settings.currentFlags & GMX_PME_SOLVE)
+ if (settings.currentFlags & GMX_PME_SOLVE)
{
/* do R2C 3D-FFT */
parallel_3dfft_execute_gpu_wrapper(pme, gridIndex, GMX_FFT_REAL_TO_COMPLEX, wcycle);
/* solve in k-space for our local cells */
- if (pme_gpu_performs_solve(pmeGpu))
+ if (settings.performGPUSolve)
{
- const auto gridOrdering = pme_gpu_uses_dd(pmeGpu) ? GridOrdering::YZX : GridOrdering::XYZ;
+ // TODO grid ordering should be set up at pme init time.
+ const auto gridOrdering =
+ settings.useDecomposition ? GridOrdering::YZX : GridOrdering::XYZ;
wallcycle_start_nocount(wcycle, ewcLAUNCH_GPU);
wallcycle_sub_start_nocount(wcycle, ewcsLAUNCH_GPU_PME);
pme_gpu_solve(pmeGpu, cfftgrid, gridOrdering, computeEnergyAndVirial);
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
-void pme_gpu_launch_gather(const gmx_pme_t* pme, gmx_wallcycle gmx_unused* wcycle, PmeForceOutputHandling forceTreatment)
+void pme_gpu_launch_gather(const gmx_pme_t* pme, gmx_wallcycle gmx_unused* wcycle)
{
GMX_ASSERT(pme_gpu_active(pme), "This should be a GPU run of PME but it is not enabled.");
- if (!pme_gpu_performs_gather(pme->gpu))
+ if (!pme_gpu_settings(pme->gpu).performGPUGather)
{
return;
}
wallcycle_sub_start_nocount(wcycle, ewcsLAUNCH_GPU_PME);
const unsigned int gridIndex = 0;
real* fftgrid = pme->fftgrid[gridIndex];
- pme_gpu_gather(pme->gpu, forceTreatment, reinterpret_cast<float*>(fftgrid));
+ pme_gpu_gather(pme->gpu, reinterpret_cast<float*>(fftgrid));
wallcycle_sub_stop(wcycle, ewcsLAUNCH_GPU_PME);
wallcycle_stop(wcycle, ewcLAUNCH_GPU);
}
wallcycle_stop(wcycle, ewcLAUNCH_GPU);
}
-DeviceBuffer<float> pme_gpu_get_device_x(const gmx_pme_t* pme)
-{
- GMX_ASSERT((pme && pme_gpu_active(pme)),
- "PME GPU coordinates buffer was requested from uninitialized PME module");
- return pme_gpu_get_kernelparam_coordinates(pme->gpu);
-}
-
void* pme_gpu_get_device_f(const gmx_pme_t* pme)
{
if (!pme || !pme_gpu_active(pme))
return pme_gpu_get_kernelparam_forces(pme->gpu);
}
-void pme_gpu_set_device_x(const gmx_pme_t* pme, DeviceBuffer<float> d_x)
+void pme_gpu_set_device_x(const gmx_pme_t* pme, DeviceBuffer<gmx::RVec> d_x)
{
GMX_ASSERT(pme != nullptr, "Null pointer is passed as a PME to the set coordinates function.");
GMX_ASSERT(pme_gpu_active(pme), "This should be a GPU run of PME but it is not enabled.");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
complexGridSizePadded[i] = kernelParamsPtr->grid.complexGridSizePadded[i];
}
- GMX_RELEASE_ASSERT(!pme_gpu_uses_dd(pmeGpu), "FFT decomposition not implemented");
+ GMX_RELEASE_ASSERT(!pme_gpu_settings(pmeGpu).useDecomposition,
+ "FFT decomposition not implemented");
const int complexGridSizePaddedTotal =
complexGridSizePadded[XX] * complexGridSizePadded[YY] * complexGridSizePadded[ZZ];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// Extracting all the data from PME GPU
std::array<size_t, DIM> realGridSize, realGridSizePadded, complexGridSizePadded;
- GMX_RELEASE_ASSERT(!pme_gpu_uses_dd(pmeGpu), "FFT decomposition not implemented");
+ GMX_RELEASE_ASSERT(!pme_gpu_settings(pmeGpu).useDecomposition,
+ "FFT decomposition not implemented");
PmeGpuKernelParamsBase* kernelParamsPtr = pmeGpu->kernelParams.get();
for (int i = 0; i < DIM; i++)
{
pmeGpu->settings.transferKind, nullptr);
}
-void pme_gpu_realloc_coordinates(const PmeGpu* pmeGpu)
-{
- const size_t newCoordinatesSize = pmeGpu->nAtomsAlloc * DIM;
- GMX_ASSERT(newCoordinatesSize > 0, "Bad number of atoms in PME GPU");
- reallocateDeviceBuffer(&pmeGpu->kernelParams->atoms.d_coordinates, newCoordinatesSize,
- &pmeGpu->archSpecific->coordinatesSize,
- &pmeGpu->archSpecific->coordinatesSizeAlloc, pmeGpu->archSpecific->context);
- if (c_usePadding)
- {
- const size_t paddingIndex = DIM * pmeGpu->kernelParams->atoms.nAtoms;
- const size_t paddingCount = DIM * pmeGpu->nAtomsAlloc - paddingIndex;
- if (paddingCount > 0)
- {
- clearDeviceBufferAsync(&pmeGpu->kernelParams->atoms.d_coordinates, paddingIndex,
- paddingCount, pmeGpu->archSpecific->pmeStream);
- }
- }
-}
-
-void pme_gpu_free_coordinates(const PmeGpu* pmeGpu)
-{
- freeDeviceBuffer(&pmeGpu->kernelParams->atoms.d_coordinates);
-}
-
-void pme_gpu_realloc_and_copy_input_coefficients(const PmeGpu* pmeGpu, const float* h_coefficients)
+void pme_gpu_realloc_and_copy_input_coefficients(PmeGpu* pmeGpu, const float* h_coefficients)
{
GMX_ASSERT(h_coefficients, "Bad host-side charge buffer in PME GPU");
const size_t newCoefficientsSize = pmeGpu->nAtomsAlloc;
#elif GMX_GPU == GMX_GPU_OPENCL
cl_command_queue_properties queueProperties =
pmeGpu->archSpecific->useTiming ? CL_QUEUE_PROFILING_ENABLE : 0;
- cl_device_id device_id = pmeGpu->deviceInfo->ocl_gpu_id.ocl_device_id;
+ cl_device_id device_id = pmeGpu->deviceInfo->oclDeviceId;
cl_int clError;
pmeGpu->archSpecific->pmeStream =
clCreateCommandQueue(pmeGpu->archSpecific->context, device_id, queueProperties, &clError);
void pme_gpu_reinit_3dfft(const PmeGpu* pmeGpu)
{
- if (pme_gpu_performs_FFT(pmeGpu))
+ if (pme_gpu_settings(pmeGpu).performGPUFFT)
{
pmeGpu->archSpecific->fftSetup.resize(0);
for (int i = 0; i < pmeGpu->common->ngrids; i++)
// on the else branch
if (haveComputedEnergyAndVirial)
{
- if (pme_gpu_performs_solve(pmeGpu))
+ if (pme_gpu_settings(pmeGpu).performGPUSolve)
{
pme_gpu_getEnergyAndVirial(pme, &output);
}
kernelParamsPtr->grid.complexGridSizePadded[i] = kernelParamsPtr->grid.realGridSize[i];
}
/* FFT: n real elements correspond to (n / 2 + 1) complex elements in minor dimension */
- if (!pme_gpu_performs_FFT(pmeGpu))
+ if (!pme_gpu_settings(pmeGpu).performGPUFFT)
{
// This allows for GPU spreading grid and CPU fftgrid to have the same layout, so that we can copy the data directly
kernelParamsPtr->grid.realGridSizePadded[ZZ] =
* TODO: this should become PmeGpu::PmeGpu()
*
* \param[in,out] pme The PME structure.
- * \param[in,out] gpuInfo The GPU information structure.
+ * \param[in,out] deviceInfo The GPU device information structure.
* \param[in] pmeGpuProgram The handle to the program/kernel data created outside (e.g. in unit tests/runner)
*/
-static void pme_gpu_init(gmx_pme_t* pme, const gmx_device_info_t* gpuInfo, PmeGpuProgramHandle pmeGpuProgram)
+static void pme_gpu_init(gmx_pme_t* pme, const DeviceInformation* deviceInfo, const PmeGpuProgram* pmeGpuProgram)
{
pme->gpu = new PmeGpu();
PmeGpu* pmeGpu = pme->gpu;
/* These settings are set here for the whole run; dynamic ones are set in pme_gpu_reinit() */
/* A convenience variable. */
- pmeGpu->settings.useDecomposition = (pme->nnodes == 1);
+ pmeGpu->settings.useDecomposition = (pme->nnodes != 1);
/* TODO: CPU gather with GPU spread is broken due to different theta/dtheta layout. */
pmeGpu->settings.performGPUGather = true;
// By default GPU-side reduction is off (explicitly set here for tests, otherwise reset per-step)
pme_gpu_set_testing(pmeGpu, false);
- pmeGpu->deviceInfo = gpuInfo;
+ pmeGpu->deviceInfo = deviceInfo;
GMX_ASSERT(pmeGpuProgram != nullptr, "GPU kernels must be already compiled");
pmeGpu->programHandle_ = pmeGpuProgram;
}
}
-void pme_gpu_reinit(gmx_pme_t* pme, const gmx_device_info_t* gpuInfo, PmeGpuProgramHandle pmeGpuProgram)
+void pme_gpu_reinit(gmx_pme_t* pme, const DeviceInformation* deviceInfo, const PmeGpuProgram* pmeGpuProgram)
{
- if (!pme_gpu_active(pme))
+ GMX_ASSERT(pme != nullptr, "Need valid PME object");
+ if (pme->runMode == PmeRunMode::CPU)
{
+ GMX_ASSERT(pme->gpu == nullptr, "Should not have PME GPU object");
return;
}
if (!pme->gpu)
{
/* First-time initialization */
- pme_gpu_init(pme, gpuInfo, pmeGpuProgram);
+ pme_gpu_init(pme, deviceInfo, pmeGpuProgram);
}
else
{
}
/* GPU FFT will only get used for a single rank.*/
pme->gpu->settings.performGPUFFT =
- (pme->gpu->common->runMode == PmeRunMode::GPU) && !pme_gpu_uses_dd(pme->gpu);
+ (pme->gpu->common->runMode == PmeRunMode::GPU) && !pme->gpu->settings.useDecomposition;
pme->gpu->settings.performGPUSolve = (pme->gpu->common->runMode == PmeRunMode::GPU);
/* Reinit active timers */
pme_gpu_select_best_performing_pme_spreadgather_kernels(pmeGpu);
}
+/*! \internal \brief
+ * Returns raw timing event from the corresponding GpuRegionTimer (if timings are enabled).
+ * In CUDA result can be nullptr stub, per GpuRegionTimer implementation.
+ *
+ * \param[in] pmeGpu The PME GPU data structure.
+ * \param[in] PMEStageId The PME GPU stage gtPME_ index from the enum in src/gromacs/timing/gpu_timing.h
+ */
+static CommandEvent* pme_gpu_fetch_timing_event(const PmeGpu* pmeGpu, size_t PMEStageId)
+{
+ CommandEvent* timingEvent = nullptr;
+ if (pme_gpu_timings_enabled(pmeGpu))
+ {
+ GMX_ASSERT(PMEStageId < pmeGpu->archSpecific->timingEvents.size(),
+ "Wrong PME GPU timing event index");
+ timingEvent = pmeGpu->archSpecific->timingEvents[PMEStageId].fetchNextEvent();
+ }
+ return timingEvent;
+}
+
void pme_gpu_3dfft(const PmeGpu* pmeGpu, gmx_fft_direction dir, int grid_index)
{
int timerId = (dir == GMX_FFT_REAL_TO_COMPLEX) ? gtPME_FFT_R2C : gtPME_FFT_C2R;
// only needed with CUDA on PP+PME ranks, not on separate PME ranks, in unit tests
// nor in OpenCL as these cases use a single stream (hence xReadyOnDevice == nullptr).
GMX_ASSERT(xReadyOnDevice != nullptr || (GMX_GPU != GMX_GPU_CUDA)
- || pmeGpu->common->isRankPmeOnly || pme_gpu_is_testing(pmeGpu),
+ || pmeGpu->common->isRankPmeOnly || pme_gpu_settings(pmeGpu).copyAllOutputs,
"Need a valid coordinate synchronizer on PP+PME ranks with CUDA.");
if (xReadyOnDevice)
{
launchGpuKernel(kernelPtr, config, timingEvent, "PME spline/spread", kernelArgs);
pme_gpu_stop_timing(pmeGpu, timingId);
- const bool copyBackGrid =
- spreadCharges && (pme_gpu_is_testing(pmeGpu) || !pme_gpu_performs_FFT(pmeGpu));
+ const auto& settings = pmeGpu->settings;
+ const bool copyBackGrid = spreadCharges && (!settings.performGPUFFT || settings.copyAllOutputs);
if (copyBackGrid)
{
pme_gpu_copy_output_spread_grid(pmeGpu, h_grid);
}
const bool copyBackAtomData =
- computeSplines && (pme_gpu_is_testing(pmeGpu) || !pme_gpu_performs_gather(pmeGpu));
+ computeSplines && (!settings.performGPUGather || settings.copyAllOutputs);
if (copyBackAtomData)
{
pme_gpu_copy_output_spread_atom_data(pmeGpu);
void pme_gpu_solve(const PmeGpu* pmeGpu, t_complex* h_grid, GridOrdering gridOrdering, bool computeEnergyAndVirial)
{
- const bool copyInputAndOutputGrid = pme_gpu_is_testing(pmeGpu) || !pme_gpu_performs_FFT(pmeGpu);
+ const auto& settings = pmeGpu->settings;
+ const bool copyInputAndOutputGrid = !settings.performGPUFFT || settings.copyAllOutputs;
auto* kernelParamsPtr = pmeGpu->kernelParams.get();
* \param[in] pmeGpu The PME GPU structure.
* \param[in] useOrderThreadsPerAtom bool controlling if we should use order or order*order threads per atom
* \param[in] readSplinesFromGlobal bool controlling if we should write spline data to global memory
- * \param[in] forceTreatment Controls if the forces from the gather should increment or replace the input forces.
*
* \return Pointer to CUDA kernel
*/
-inline auto selectGatherKernelPtr(const PmeGpu* pmeGpu,
- bool useOrderThreadsPerAtom,
- bool readSplinesFromGlobal,
- PmeForceOutputHandling forceTreatment)
+inline auto selectGatherKernelPtr(const PmeGpu* pmeGpu, bool useOrderThreadsPerAtom, bool readSplinesFromGlobal)
{
PmeGpuProgramImpl::PmeKernelHandle kernelPtr = nullptr;
{
if (useOrderThreadsPerAtom)
{
- kernelPtr = (forceTreatment == PmeForceOutputHandling::Set)
- ? pmeGpu->programHandle_->impl_->gatherKernelReadSplinesThPerAtom4
- : pmeGpu->programHandle_->impl_->gatherReduceWithInputKernelReadSplinesThPerAtom4;
+ kernelPtr = pmeGpu->programHandle_->impl_->gatherKernelReadSplinesThPerAtom4;
}
else
{
- kernelPtr = (forceTreatment == PmeForceOutputHandling::Set)
- ? pmeGpu->programHandle_->impl_->gatherKernelReadSplines
- : pmeGpu->programHandle_->impl_->gatherReduceWithInputKernelReadSplines;
+ kernelPtr = pmeGpu->programHandle_->impl_->gatherKernelReadSplines;
}
}
else
{
if (useOrderThreadsPerAtom)
{
- kernelPtr = (forceTreatment == PmeForceOutputHandling::Set)
- ? pmeGpu->programHandle_->impl_->gatherKernelThPerAtom4
- : pmeGpu->programHandle_->impl_->gatherReduceWithInputKernelThPerAtom4;
+ kernelPtr = pmeGpu->programHandle_->impl_->gatherKernelThPerAtom4;
}
else
{
- kernelPtr = (forceTreatment == PmeForceOutputHandling::Set)
- ? pmeGpu->programHandle_->impl_->gatherKernel
- : pmeGpu->programHandle_->impl_->gatherReduceWithInputKernel;
+ kernelPtr = pmeGpu->programHandle_->impl_->gatherKernel;
}
}
return kernelPtr;
}
-void pme_gpu_gather(PmeGpu* pmeGpu, PmeForceOutputHandling forceTreatment, const float* h_grid)
+void pme_gpu_gather(PmeGpu* pmeGpu, const float* h_grid)
{
- /* Copying the input CPU forces for reduction */
- if (forceTreatment != PmeForceOutputHandling::Set)
- {
- pme_gpu_copy_input_forces(pmeGpu);
- }
-
- if (!pme_gpu_performs_FFT(pmeGpu) || pme_gpu_is_testing(pmeGpu))
+ const auto& settings = pmeGpu->settings;
+ if (!settings.performGPUFFT || settings.copyAllOutputs)
{
pme_gpu_copy_input_gather_grid(pmeGpu, const_cast<float*>(h_grid));
}
- if (pme_gpu_is_testing(pmeGpu))
+ if (settings.copyAllOutputs)
{
pme_gpu_copy_input_gather_atom_data(pmeGpu);
}
// TODO test different cache configs
- int timingId = gtPME_GATHER;
- PmeGpuProgramImpl::PmeKernelHandle kernelPtr = selectGatherKernelPtr(
- pmeGpu, useOrderThreadsPerAtom, readGlobal || (!recalculateSplines), forceTreatment);
+ int timingId = gtPME_GATHER;
+ PmeGpuProgramImpl::PmeKernelHandle kernelPtr =
+ selectGatherKernelPtr(pmeGpu, useOrderThreadsPerAtom, readGlobal || (!recalculateSplines));
// TODO design kernel selection getters and make PmeGpu a friend of PmeGpuProgramImpl
pme_gpu_start_timing(pmeGpu, timingId);
}
}
-DeviceBuffer<float> pme_gpu_get_kernelparam_coordinates(const PmeGpu* pmeGpu)
-{
- GMX_ASSERT(pmeGpu && pmeGpu->kernelParams,
- "PME GPU device buffer was requested in non-GPU build or before the GPU PME was "
- "initialized.");
-
- return pmeGpu->kernelParams->atoms.d_coordinates;
-}
-
void* pme_gpu_get_kernelparam_forces(const PmeGpu* pmeGpu)
{
if (pmeGpu && pmeGpu->kernelParams)
}
}
-/*! \brief Check the validity of the device buffer.
- *
- * Checks if the buffer is not nullptr and, when possible, if it is big enough.
- *
- * \todo Split and move this function to gpu_utils.
- *
- * \param[in] buffer Device buffer to be checked.
- * \param[in] requiredSize Number of elements that the buffer will have to accommodate.
- *
- * \returns If the device buffer can be set.
- */
-template<typename T>
-static bool checkDeviceBuffer(gmx_unused DeviceBuffer<T> buffer, gmx_unused int requiredSize)
-{
-#if GMX_GPU == GMX_GPU_CUDA
- GMX_ASSERT(buffer != nullptr, "The device pointer is nullptr");
- return buffer != nullptr;
-#elif GMX_GPU == GMX_GPU_OPENCL
- size_t size;
- int retval = clGetMemObjectInfo(buffer, CL_MEM_SIZE, sizeof(size), &size, nullptr);
- GMX_ASSERT(retval == CL_SUCCESS,
- gmx::formatString("clGetMemObjectInfo failed with error code #%d", retval).c_str());
- GMX_ASSERT(static_cast<int>(size) >= requiredSize,
- "Number of atoms in device buffer is smaller then required size.");
- return retval == CL_SUCCESS && static_cast<int>(size) >= requiredSize;
-#elif GMX_GPU == GMX_GPU_NONE
- GMX_ASSERT(false, "Setter for device-side coordinates was called in non-GPU build.");
- return false;
-#endif
-}
-
-void pme_gpu_set_kernelparam_coordinates(const PmeGpu* pmeGpu, DeviceBuffer<float> d_x)
+void pme_gpu_set_kernelparam_coordinates(const PmeGpu* pmeGpu, DeviceBuffer<gmx::RVec> d_x)
{
GMX_ASSERT(pmeGpu && pmeGpu->kernelParams,
"PME GPU device buffer can not be set in non-GPU builds or before the GPU PME was "
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_EWALD_PME_GPU_INTERNAL_H
#define GMX_EWALD_PME_GPU_INTERNAL_H
-#include "gromacs/fft/fft.h" // for the gmx_fft_direction enum
+#include "gromacs/fft/fft.h" // for the gmx_fft_direction enum
+#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/gpu_utils/gpu_macros.h" // for the GPU_FUNC_ macros
#include "gromacs/utility/arrayref.h"
-#include "pme_gpu_types_host.h" // for the inline functions accessing PmeGpu members
+#include "pme_gpu_types_host.h"
+#include "pme_output.h"
+class GpuEventSynchronizer;
+struct DeviceInformation;
struct gmx_hw_info_t;
struct gmx_gpu_opt_t;
struct gmx_pme_t; // only used in pme_gpu_reinit
-struct gmx_wallclock_gpu_pme_t;
+struct gmx_wallcycle;
class PmeAtomComm;
+enum class PmeForceOutputHandling;
+struct PmeGpu;
+class PmeGpuProgram;
+struct PmeGpuStaging;
+struct PmeGpuSettings;
struct t_complex;
namespace gmx
*/
bool pme_gpu_stream_query(const PmeGpu* pmeGpu);
-/*! \libinternal \brief
- * Reallocates the input coordinates buffer on the GPU (and clears the padded part if needed).
- *
- * \param[in] pmeGpu The PME GPU structure.
- *
- * Needs to be called on every DD step/in the beginning.
- */
-void pme_gpu_realloc_coordinates(const PmeGpu* pmeGpu);
-
-/*! \libinternal \brief
- * Frees the coordinates on the GPU.
- *
- * \param[in] pmeGpu The PME GPU structure.
- */
-void pme_gpu_free_coordinates(const PmeGpu* pmeGpu);
-
/*! \libinternal \brief
* Reallocates the buffer on the GPU and copies the charges/coefficients from the CPU buffer.
* Clears the padded part if needed.
* Does not need to be done for every PME computation, only whenever the local charges change.
* (So, in the beginning of the run, or on DD step).
*/
-void pme_gpu_realloc_and_copy_input_coefficients(const PmeGpu* pmeGpu, const float* h_coefficients);
+void pme_gpu_realloc_and_copy_input_coefficients(PmeGpu* pmeGpu, const float* h_coefficients);
/*! \libinternal \brief
* Frees the charges/coefficients on the GPU.
*/
void pme_gpu_destroy_3dfft(const PmeGpu* pmeGpu);
-/* Several GPU event-based timing functions that live in pme_gpu_timings.cpp */
-
-/*! \libinternal \brief
- * Finalizes all the active PME GPU stage timings for the current computation. Should be called at the end of every computation.
- *
- * \param[in] pmeGpu The PME GPU structure.
- */
-void pme_gpu_update_timings(const PmeGpu* pmeGpu);
-
-/*! \libinternal \brief
- * Updates the internal list of active PME GPU stages (if timings are enabled).
- *
- * \param[in] pmeGpu The PME GPU data structure.
- */
-void pme_gpu_reinit_timings(const PmeGpu* pmeGpu);
-
-/*! \brief
- * Resets the PME GPU timings. To be called at the reset MD step.
- *
- * \param[in] pmeGpu The PME GPU structure.
- */
-void pme_gpu_reset_timings(const PmeGpu* pmeGpu);
-
-/*! \libinternal \brief
- * Copies the PME GPU timings to the gmx_wallclock_gpu_t structure (for log output). To be called at the run end.
- *
- * \param[in] pmeGpu The PME GPU structure.
- * \param[in] timings The gmx_wallclock_gpu_pme_t structure.
- */
-void pme_gpu_get_timings(const PmeGpu* pmeGpu, gmx_wallclock_gpu_pme_t* timings);
-
/* The PME stages themselves */
/*! \libinternal \brief
* A GPU force gathering function.
*
* \param[in] pmeGpu The PME GPU structure.
- * \param[in] forceTreatment Tells how data in h_forces should be treated.
- * TODO: determine efficiency/balance of host/device-side
* reductions. \param[in] h_grid The host-side grid buffer (used only in testing mode)
*/
-GPU_FUNC_QUALIFIER void pme_gpu_gather(PmeGpu* GPU_FUNC_ARGUMENT(pmeGpu),
- PmeForceOutputHandling GPU_FUNC_ARGUMENT(forceTreatment),
+GPU_FUNC_QUALIFIER void pme_gpu_gather(PmeGpu* GPU_FUNC_ARGUMENT(pmeGpu),
const float* GPU_FUNC_ARGUMENT(h_grid)) GPU_FUNC_TERM;
-/*! \brief Return pointer to device copy of coordinate data.
- * \param[in] pmeGpu The PME GPU structure.
- * \returns Pointer to coordinate data
- */
-GPU_FUNC_QUALIFIER DeviceBuffer<float> pme_gpu_get_kernelparam_coordinates(const PmeGpu* GPU_FUNC_ARGUMENT(pmeGpu))
- GPU_FUNC_TERM_WITH_RETURN(DeviceBuffer<float>{});
-
/*! \brief Sets the device pointer to coordinate data
* \param[in] pmeGpu The PME GPU structure.
* \param[in] d_x Pointer to coordinate data
*/
GPU_FUNC_QUALIFIER void pme_gpu_set_kernelparam_coordinates(const PmeGpu* GPU_FUNC_ARGUMENT(pmeGpu),
- DeviceBuffer<float> GPU_FUNC_ARGUMENT(d_x)) GPU_FUNC_TERM;
+ DeviceBuffer<gmx::RVec> GPU_FUNC_ARGUMENT(d_x)) GPU_FUNC_TERM;
/*! \brief Return pointer to device copy of force data.
* \param[in] pmeGpu The PME GPU structure.
GPU_FUNC_QUALIFIER GpuEventSynchronizer* pme_gpu_get_forces_ready_synchronizer(
const PmeGpu* GPU_FUNC_ARGUMENT(pmeGpu)) GPU_FUNC_TERM_WITH_RETURN(nullptr);
-/* The inlined convenience PME GPU status getters */
-
-/*! \libinternal \brief
- * Tells if PME runs on multiple GPUs with the decomposition.
- *
- * \param[in] pmeGpu The PME GPU structure.
- * \returns True if PME runs on multiple GPUs, false otherwise.
- */
-inline bool pme_gpu_uses_dd(const PmeGpu* pmeGpu)
-{
- return !pmeGpu->settings.useDecomposition;
-}
-
/*! \libinternal \brief
- * Tells if PME performs the gathering stage on GPU.
+ * Returns the PME GPU settings
*
* \param[in] pmeGpu The PME GPU structure.
- * \returns True if the gathering is performed on GPU, false otherwise.
+ * \returns The settings for PME on GPU
*/
-inline bool pme_gpu_performs_gather(const PmeGpu* pmeGpu)
+inline const PmeGpuSettings& pme_gpu_settings(const PmeGpu* pmeGpu)
{
- return pmeGpu->settings.performGPUGather;
+ return pmeGpu->settings;
}
/*! \libinternal \brief
- * Tells if PME performs the FFT stages on GPU.
+ * Returns the PME GPU staging object
*
* \param[in] pmeGpu The PME GPU structure.
- * \returns True if FFT is performed on GPU, false otherwise.
+ * \returns The staging object for PME on GPU
*/
-inline bool pme_gpu_performs_FFT(const PmeGpu* pmeGpu)
+inline const PmeGpuStaging& pme_gpu_staging(const PmeGpu* pmeGpu)
{
- return pmeGpu->settings.performGPUFFT;
+ return pmeGpu->staging;
}
/*! \libinternal \brief
- * Tells if PME performs the grid (un-)wrapping on GPU.
+ * Sets whether the PME module is running in testing mode
*
* \param[in] pmeGpu The PME GPU structure.
- * \returns True if (un-)wrapping is performed on GPU, false otherwise.
- */
-inline bool pme_gpu_performs_wrapping(const PmeGpu* pmeGpu)
-{
- return pmeGpu->settings.useDecomposition;
-}
-
-/*! \libinternal \brief
- * Tells if PME performs the grid solving on GPU.
- *
- * \param[in] pmeGpu The PME GPU structure.
- * \returns True if solving is performed on GPU, false otherwise.
- */
-inline bool pme_gpu_performs_solve(const PmeGpu* pmeGpu)
-{
- return pmeGpu->settings.performGPUSolve;
-}
-
-/*! \libinternal \brief
- * Enables or disables the testing mode.
- * Testing mode only implies copying all the outputs, even the intermediate ones, to the host,
- * and also makes the copies synchronous.
- *
- * \param[in] pmeGpu The PME GPU structure.
- * \param[in] testing Should the testing mode be enabled, or disabled.
+ * \param[in] testing Whether testing mode is on.
*/
inline void pme_gpu_set_testing(PmeGpu* pmeGpu, bool testing)
{
}
}
-/*! \libinternal \brief
- * Tells if PME is in the testing mode.
- *
- * \param[in] pmeGpu The PME GPU structure.
- * \returns true if testing mode is enabled, false otherwise.
- */
-inline bool pme_gpu_is_testing(const PmeGpu* pmeGpu)
-{
- return pmeGpu->settings.copyAllOutputs;
-}
-
/* A block of C++ functions that live in pme_gpu_internal.cpp */
/*! \libinternal \brief
* (Re-)initializes the PME GPU data at the beginning of the run or on DLB.
*
* \param[in,out] pme The PME structure.
- * \param[in] gpuInfo The GPU information structure.
+ * \param[in] deviceInfo The GPU device information structure.
* \param[in] pmeGpuProgram The PME GPU program data
* \throws gmx::NotImplementedError if this generally valid PME structure is not valid for GPU runs.
*/
GPU_FUNC_QUALIFIER void pme_gpu_reinit(gmx_pme_t* GPU_FUNC_ARGUMENT(pme),
- const gmx_device_info_t* GPU_FUNC_ARGUMENT(gpuInfo),
- PmeGpuProgramHandle GPU_FUNC_ARGUMENT(pmeGpuProgram)) GPU_FUNC_TERM;
+ const DeviceInformation* GPU_FUNC_ARGUMENT(deviceInfo),
+ const PmeGpuProgram* GPU_FUNC_ARGUMENT(pmeGpuProgram)) GPU_FUNC_TERM;
/*! \libinternal \brief
* Destroys the PME GPU data at the end of the run.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
+#include "gromacs/utility/gmxassert.h"
+
#include "pme_gpu_program_impl.h"
-PmeGpuProgram::PmeGpuProgram(const gmx_device_info_t* deviceInfo) :
+PmeGpuProgram::PmeGpuProgram(const DeviceInformation* deviceInfo) :
impl_(std::make_unique<PmeGpuProgramImpl>(deviceInfo))
{
}
PmeGpuProgram::~PmeGpuProgram() = default;
-PmeGpuProgramStorage buildPmeGpuProgram(const gmx_device_info_t* deviceInfo)
+PmeGpuProgramStorage buildPmeGpuProgram(const DeviceInformation* deviceInfo)
{
- if (!deviceInfo)
- {
- // This workaround is only needed for CodePath::CPU dummy in testhardwarecontexts.cpp
- return nullptr;
- }
+ GMX_RELEASE_ASSERT(
+ deviceInfo != nullptr,
+ "Device information can not be nullptr when building PME GPU program object.");
return std::make_unique<PmeGpuProgram>(deviceInfo);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
struct PmeGpuProgramImpl;
-struct gmx_device_info_t;
+struct DeviceInformation;
class PmeGpuProgram
{
public:
- explicit PmeGpuProgram(const gmx_device_info_t* deviceInfo);
+ explicit PmeGpuProgram(const DeviceInformation* deviceInfo);
~PmeGpuProgram();
// TODO: design getters for information inside, if needed for PME, and make this private?
*/
using PmeGpuProgramStorage = std::unique_ptr<PmeGpuProgram>;
-/*! \brief This is a handle for passing references to PME GPU program data.
- * TODO: it should be a const reference, but for that the PmeGpu types need to be C++
- */
-using PmeGpuProgramHandle = const PmeGpuProgram*;
-
/*! \brief
* Factory function used to build persistent PME GPU program for the device at once.
*/
-PmeGpuProgramStorage buildPmeGpuProgram(const gmx_device_info_t* /*deviceInfo*/);
+PmeGpuProgramStorage buildPmeGpuProgram(const DeviceInformation* /*deviceInfo*/);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "pme_gpu_program_impl.h"
-PmeGpuProgramImpl::PmeGpuProgramImpl(const gmx_device_info_t* /*unused*/) :
+PmeGpuProgramImpl::PmeGpuProgramImpl(const DeviceInformation* /* deviceInfo */) :
warpSize(0),
spreadWorkGroupSize(0),
gatherWorkGroupSize(0),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
extern template void pme_solve_kernel<GridOrdering::YZX, false>(const PmeGpuCudaKernelParams);
extern template void pme_solve_kernel<GridOrdering::YZX, true>(const PmeGpuCudaKernelParams);
-template<const int order, const bool overwriteForces, const bool wrapX, const bool wrapY, const bool readGlobal, const bool orderThreads>
+template<const int order, const bool wrapX, const bool wrapY, const bool readGlobal, const bool orderThreads>
void pme_gather_kernel(const PmeGpuCudaKernelParams kernelParams);
// Add extern declarations to inform that there will be a definition
// provided in another translation unit.
-extern template void pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, true, true>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, false, true>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, true, true>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, false, true>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, true, false>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, false, false>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, true, false>(const PmeGpuCudaKernelParams);
-extern template void pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, false, false>(const PmeGpuCudaKernelParams);
+extern template void pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, true, true>(const PmeGpuCudaKernelParams);
+extern template void pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, false, true>(const PmeGpuCudaKernelParams);
+extern template void pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, true, false>(const PmeGpuCudaKernelParams);
+extern template void pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, false, false>(const PmeGpuCudaKernelParams);
-PmeGpuProgramImpl::PmeGpuProgramImpl(const gmx_device_info_t*)
+PmeGpuProgramImpl::PmeGpuProgramImpl(const DeviceInformation* /* deviceInfo */)
{
// kernel parameters
warpSize = warp_size;
spreadKernel = pme_spline_and_spread_kernel<c_pmeOrder, false, true, c_wrapX, c_wrapY, true, false>;
spreadKernelThPerAtom4 =
pme_spline_and_spread_kernel<c_pmeOrder, false, true, c_wrapX, c_wrapY, true, true>;
- gatherKernel = pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, false, false>;
- gatherKernelThPerAtom4 = pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, false, true>;
- gatherKernelReadSplines = pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, true, false>;
- gatherKernelReadSplinesThPerAtom4 = pme_gather_kernel<c_pmeOrder, true, c_wrapX, c_wrapY, true, true>;
- gatherReduceWithInputKernel = pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, false, false>;
- gatherReduceWithInputKernelThPerAtom4 =
- pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, false, true>;
- gatherReduceWithInputKernelReadSplines =
- pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, true, false>;
- gatherReduceWithInputKernelReadSplinesThPerAtom4 =
- pme_gather_kernel<c_pmeOrder, false, c_wrapX, c_wrapY, true, true>;
- solveXYZKernel = pme_solve_kernel<GridOrdering::XYZ, false>;
- solveXYZEnergyKernel = pme_solve_kernel<GridOrdering::XYZ, true>;
- solveYZXKernel = pme_solve_kernel<GridOrdering::YZX, false>;
- solveYZXEnergyKernel = pme_solve_kernel<GridOrdering::YZX, true>;
+ gatherKernel = pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, false, false>;
+ gatherKernelThPerAtom4 = pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, false, true>;
+ gatherKernelReadSplines = pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, true, false>;
+ gatherKernelReadSplinesThPerAtom4 = pme_gather_kernel<c_pmeOrder, c_wrapX, c_wrapY, true, true>;
+ solveXYZKernel = pme_solve_kernel<GridOrdering::XYZ, false>;
+ solveXYZEnergyKernel = pme_solve_kernel<GridOrdering::XYZ, true>;
+ solveYZXKernel = pme_solve_kernel<GridOrdering::YZX, false>;
+ solveYZXEnergyKernel = pme_solve_kernel<GridOrdering::YZX, true>;
}
PmeGpuProgramImpl::~PmeGpuProgramImpl() {}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/gputraits.h"
#include "gromacs/utility/classhelpers.h"
-struct gmx_device_info_t;
+struct DeviceInformation;
/*! \internal
* \brief
*/
size_t gatherWorkGroupSize;
- PmeKernelHandle gatherReduceWithInputKernel;
- PmeKernelHandle gatherReduceWithInputKernelThPerAtom4;
PmeKernelHandle gatherKernel;
PmeKernelHandle gatherKernelThPerAtom4;
- PmeKernelHandle gatherReduceWithInputKernelReadSplines;
- PmeKernelHandle gatherReduceWithInputKernelReadSplinesThPerAtom4;
PmeKernelHandle gatherKernelReadSplines;
PmeKernelHandle gatherKernelReadSplinesThPerAtom4;
//@}
PmeGpuProgramImpl() = delete;
//! Constructor for the given device
- explicit PmeGpuProgramImpl(const gmx_device_info_t* deviceInfo);
+ explicit PmeGpuProgramImpl(const DeviceInformation* deviceInfo);
~PmeGpuProgramImpl();
GMX_DISALLOW_COPY_AND_ASSIGN(PmeGpuProgramImpl);
private:
// Compiles kernels, if supported. Called by the constructor.
- void compileKernels(const gmx_device_info_t* deviceInfo);
+ void compileKernels(const DeviceInformation* deviceInfo);
};
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "pme_gpu_types_host.h"
#include "pme_grid.h"
-PmeGpuProgramImpl::PmeGpuProgramImpl(const gmx_device_info_t* deviceInfo)
+PmeGpuProgramImpl::PmeGpuProgramImpl(const DeviceInformation* deviceInfo)
{
// Context creation (which should happen outside of this class: #2522)
- cl_platform_id platformId = deviceInfo->ocl_gpu_id.ocl_platform_id;
- cl_device_id deviceId = deviceInfo->ocl_gpu_id.ocl_device_id;
+ cl_platform_id platformId = deviceInfo->oclPlatformId;
+ cl_device_id deviceId = deviceInfo->oclDeviceId;
cl_context_properties contextProperties[3];
contextProperties[0] = CL_CONTEXT_PLATFORM;
contextProperties[1] = reinterpret_cast<cl_context_properties>(platformId);
stat |= clReleaseKernel(splineKernel);
stat |= clReleaseKernel(spreadKernel);
stat |= clReleaseKernel(gatherKernel);
- stat |= clReleaseKernel(gatherReduceWithInputKernel);
stat |= clReleaseKernel(solveXYZKernel);
stat |= clReleaseKernel(solveXYZEnergyKernel);
stat |= clReleaseKernel(solveYZXKernel);
* smaller than the minimum order^2 required in spread/gather ATM which
* we need to check for.
*/
-static void checkRequiredWarpSize(cl_kernel kernel, const char* kernelName, const gmx_device_info_t* deviceInfo)
+static void checkRequiredWarpSize(cl_kernel kernel, const char* kernelName, const DeviceInformation* deviceInfo)
{
- if (deviceInfo->vendor_e == OCL_VENDOR_INTEL)
+ if (deviceInfo->deviceVendor == DeviceVendor::Intel)
{
- size_t kernelWarpSize = gmx::ocl::getKernelWarpSize(kernel, deviceInfo->ocl_gpu_id.ocl_device_id);
+ size_t kernelWarpSize = gmx::ocl::getKernelWarpSize(kernel, deviceInfo->oclDeviceId);
if (kernelWarpSize < c_pmeSpreadGatherMinWarpSize)
{
}
}
-void PmeGpuProgramImpl::compileKernels(const gmx_device_info_t* deviceInfo)
+void PmeGpuProgramImpl::compileKernels(const DeviceInformation* deviceInfo)
{
// We might consider storing program as a member variable if it's needed later
cl_program program = nullptr;
const std::string commonDefines = gmx::formatString(
"-Dwarp_size=%zd "
"-Dorder=%d "
- "-DatomsPerWarp=%zd "
"-DthreadsPerAtom=%d "
// forwarding from pme_grid.h, used for spline computation table sizes only
"-Dc_pmeMaxUnitcellShift=%f "
"-DDIM=%d -DXX=%d -DYY=%d -DZZ=%d "
// decomposition parameter placeholders
"-DwrapX=true -DwrapY=true ",
- warpSize, c_pmeGpuOrder, warpSize / c_pmeSpreadGatherThreadsPerAtom,
- c_pmeSpreadGatherThreadsPerAtom, static_cast<float>(c_pmeMaxUnitcellShift),
- static_cast<int>(c_usePadding), static_cast<int>(c_skipNeutralAtoms), c_virialAndEnergyCount,
- spreadWorkGroupSize, solveMaxWorkGroupSize, gatherWorkGroupSize, DIM, XX, YY, ZZ);
+ warpSize, c_pmeGpuOrder, c_pmeSpreadGatherThreadsPerAtom,
+ static_cast<float>(c_pmeMaxUnitcellShift), static_cast<int>(c_usePadding),
+ static_cast<int>(c_skipNeutralAtoms), c_virialAndEnergyCount, spreadWorkGroupSize,
+ solveMaxWorkGroupSize, gatherWorkGroupSize, DIM, XX, YY, ZZ);
try
{
/* TODO when we have a proper MPI-aware logging module,
the log output here should be written there */
- program = gmx::ocl::compileProgram(stderr, "gromacs/ewald", "pme_program.cl", commonDefines,
- context, deviceInfo->ocl_gpu_id.ocl_device_id,
- deviceInfo->vendor_e);
+ program = gmx::ocl::compileProgram(stderr, "gromacs/ewald", "pme_program.cl",
+ commonDefines, context, deviceInfo->oclDeviceId,
+ deviceInfo->deviceVendor);
}
catch (gmx::GromacsException& e)
{
gatherKernelReadSplines = kernel;
checkRequiredWarpSize(gatherKernel, kernelNamesBuffer.data(), deviceInfo);
}
- else if (!strcmp(kernelNamesBuffer.data(), "pmeGatherReduceWithInputKernel"))
- {
- gatherReduceWithInputKernel = kernel;
- gatherReduceWithInputKernelReadSplines = kernel;
- checkRequiredWarpSize(gatherReduceWithInputKernel, kernelNamesBuffer.data(), deviceInfo);
- }
else if (!strcmp(kernelNamesBuffer.data(), "pmeSolveYZXKernel"))
{
solveYZXKernel = kernel;
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+
+/*! \libinternal \file
+ * \brief Defines the PME GPU settings data structures.
+ * \todo Some renaming/refactoring, which does not impair the performance:
+ * -- PmeGpuSettings -> PmeGpuTasks
+ *
+ * \author Aleksei Iupinov <a.yupinov@gmail.com>
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_ewald
+ */
+
+#ifndef GMX_EWALD_PME_GPU_SETTINGS_H
+#define GMX_EWALD_PME_GPU_SETTINGS_H
+
+#include "gromacs/gpu_utils/gpu_utils.h" // for GpuApiCallBehavior
+
+/*! \internal \brief
+ * The PME GPU settings structure, included in the main PME GPU structure by value.
+ */
+struct PmeGpuSettings
+{
+ /* Permanent settings set on initialization */
+ /*! \brief A boolean which tells if the solving is performed on GPU. Currently always true */
+ bool performGPUSolve;
+ /*! \brief A boolean which tells if the gathering is performed on GPU. Currently always true */
+ bool performGPUGather;
+ /*! \brief A boolean which tells if the FFT is performed on GPU. Currently true for a single MPI rank. */
+ bool performGPUFFT;
+ /*! \brief A convenience boolean which tells if PME decomposition is used. */
+ bool useDecomposition;
+ /*! \brief True if PME forces are reduced on-GPU, false if reduction is done on the CPU;
+ * in the former case transfer does not need to happen.
+ *
+ * Note that this flag may change per-step.
+ */
+ bool useGpuForceReduction;
+
+ /*! \brief A boolean which tells if any PME GPU stage should copy all of its outputs to the
+ * host. Only intended to be used by the test framework.
+ */
+ bool copyAllOutputs;
+ /*! \brief An enum which tells whether most PME GPU D2H/H2D data transfers should be synchronous. */
+ GpuApiCallBehavior transferKind;
+ /*! \brief Various flags for the current PME computation, corresponding to the GMX_PME_ flags in pme.h. */
+ int currentFlags;
+ /*! \brief
+ * Currently only supported by CUDA.
+ * Controls if we should use order (i.e. 4) threads per atom for the GPU
+ * or order*order (i.e. 16) threads per atom.
+ */
+ bool useOrderThreadsPerAtom;
+ /*! \brief
+ * Currently only supported by CUDA.
+ * Controls if we should recalculate the splines in the gather or
+ * save the values in the spread and reload in the gather.
+ */
+ bool recalculateSplines;
+};
+
+#endif
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+
+/*! \libinternal \file
+ * \brief Defines the host-side PME GPU data structures.
+ * \todo Some renaming/refactoring, which does not impair the performance:
+ * -- bringing the function names up to guidelines
+ * -- PmeGpuSettings -> PmeGpuTasks
+ * -- refining GPU notation application (#2053)
+ * -- renaming coefficients to charges (?)
+ *
+ * \author Aleksei Iupinov <a.yupinov@gmail.com>
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_ewald
+ */
+
+#ifndef GMX_EWALD_PME_GPU_STAGING_H
+#define GMX_EWALD_PME_GPU_STAGING_H
+
+#include <vector>
+
+#include "gromacs/gpu_utils/hostallocator.h"
+#include "gromacs/math/vectypes.h"
+
+/*! \internal \brief
+ * The PME GPU intermediate buffers structure, included in the main PME GPU structure by value.
+ * Buffers are managed by the PME GPU module.
+ */
+struct PmeGpuStaging
+{
+ //! Host-side force buffer
+ gmx::PaddedHostVector<gmx::RVec> h_forces;
+
+ /*! \brief Virial and energy intermediate host-side buffer. Size is PME_GPU_VIRIAL_AND_ENERGY_COUNT. */
+ float* h_virialAndEnergy;
+ /*! \brief B-spline values intermediate host-side buffer. */
+ float* h_splineModuli;
+
+ /*! \brief Pointer to the host memory with B-spline values. Only used for host-side gather, or unit tests */
+ float* h_theta;
+ /*! \brief Pointer to the host memory with B-spline derivative values. Only used for host-side gather, or unit tests */
+ float* h_dtheta;
+ /*! \brief Pointer to the host memory with ivec atom gridline indices. Only used for host-side gather, or unit tests */
+ int* h_gridlineIndices;
+};
+
+#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "pme_gpu_types_host.h"
#include "pme_gpu_types_host_impl.h"
-/*! \brief
- * Tells if CUDA-based performance tracking is enabled for PME.
- *
- * \param[in] pmeGpu The PME GPU data structure.
- * \returns True if timings are enabled, false otherwise.
- */
-inline bool pme_gpu_timings_enabled(const PmeGpu* pmeGpu)
+bool pme_gpu_timings_enabled(const PmeGpu* pmeGpu)
{
return pmeGpu->archSpecific->useTiming;
}
}
}
-CommandEvent* pme_gpu_fetch_timing_event(const PmeGpu* pmeGpu, size_t PMEStageId)
-{
- CommandEvent* timingEvent = nullptr;
- if (pme_gpu_timings_enabled(pmeGpu))
- {
- GMX_ASSERT(PMEStageId < pmeGpu->archSpecific->timingEvents.size(),
- "Wrong PME GPU timing event index");
- timingEvent = pmeGpu->archSpecific->timingEvents[PMEStageId].fetchNextEvent();
- }
- return timingEvent;
-}
-
void pme_gpu_stop_timing(const PmeGpu* pmeGpu, size_t PMEStageId)
{
if (pme_gpu_timings_enabled(pmeGpu))
{
pmeGpu->archSpecific->activeTimers.clear();
pmeGpu->archSpecific->activeTimers.insert(gtPME_SPLINEANDSPREAD);
+ const auto& settings = pme_gpu_settings(pmeGpu);
// TODO: no separate gtPME_SPLINE and gtPME_SPREAD as they are not used currently
- if (pme_gpu_performs_FFT(pmeGpu))
+ if (settings.performGPUFFT)
{
pmeGpu->archSpecific->activeTimers.insert(gtPME_FFT_C2R);
pmeGpu->archSpecific->activeTimers.insert(gtPME_FFT_R2C);
}
- if (pme_gpu_performs_solve(pmeGpu))
+ if (settings.performGPUSolve)
{
pmeGpu->archSpecific->activeTimers.insert(gtPME_SOLVE);
}
- if (pme_gpu_performs_gather(pmeGpu))
+ if (settings.performGPUGather)
{
pmeGpu->archSpecific->activeTimers.insert(gtPME_GATHER);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_EWALD_PME_GPU_TIMINGS_H
#define GMX_EWALD_PME_GPU_TIMINGS_H
-#include "config.h"
-
-#if GMX_GPU == GMX_GPU_CUDA
-# include "gromacs/gpu_utils/gputraits.cuh"
-#elif GMX_GPU == GMX_GPU_OPENCL
-# include "gromacs/gpu_utils/gputraits_ocl.h"
-#endif
+#include <cstddef>
+struct gmx_wallclock_gpu_pme_t;
struct PmeGpu;
/*! \libinternal \brief
void pme_gpu_start_timing(const PmeGpu* pmeGpu, size_t PMEStageId);
/*! \libinternal \brief
- * Returns raw timing event from the corresponding GpuRegionTimer (if timings are enabled).
- * In CUDA result can be nullptr stub, per GpuRegionTimer implementation.
+ * Stops timing the certain PME GPU stage during a single computation (if timings are enabled).
*
* \param[in] pmeGpu The PME GPU data structure.
* \param[in] PMEStageId The PME GPU stage gtPME_ index from the enum in src/gromacs/timing/gpu_timing.h
*/
-CommandEvent* pme_gpu_fetch_timing_event(const PmeGpu* pmeGpu, size_t PMEStageId);
+void pme_gpu_stop_timing(const PmeGpu* pmeGpu, size_t PMEStageId);
+
+/*! \brief
+ * Tells if CUDA-based performance tracking is enabled for PME.
+ *
+ * \param[in] pmeGpu The PME GPU data structure.
+ * \returns True if timings are enabled, false otherwise.
+ */
+bool pme_gpu_timings_enabled(const PmeGpu* pmeGpu);
/*! \libinternal \brief
- * Stops timing the certain PME GPU stage during a single computation (if timings are enabled).
+ * Finalizes all the active PME GPU stage timings for the current computation. Should be called at the end of every computation.
+ *
+ * \param[in] pmeGpu The PME GPU structure.
+ */
+void pme_gpu_update_timings(const PmeGpu* pmeGpu);
+
+/*! \libinternal \brief
+ * Updates the internal list of active PME GPU stages (if timings are enabled).
*
* \param[in] pmeGpu The PME GPU data structure.
- * \param[in] PMEStageId The PME GPU stage gtPME_ index from the enum in src/gromacs/timing/gpu_timing.h
*/
-void pme_gpu_stop_timing(const PmeGpu* pmeGpu, size_t PMEStageId);
+void pme_gpu_reinit_timings(const PmeGpu* pmeGpu);
+
+/*! \brief
+ * Resets the PME GPU timings. To be called at the reset MD step.
+ *
+ * \param[in] pmeGpu The PME GPU structure.
+ */
+void pme_gpu_reset_timings(const PmeGpu* pmeGpu);
+
+/*! \libinternal \brief
+ * Copies the PME GPU timings to the gmx_wallclock_gpu_t structure (for log output). To be called at the run end.
+ *
+ * \param[in] pmeGpu The PME GPU structure.
+ * \param[in] timings The gmx_wallclock_gpu_pme_t structure.
+ */
+void pme_gpu_get_timings(const PmeGpu* pmeGpu, gmx_wallclock_gpu_pme_t* timings);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
/*! \brief Electrostatics coefficient = ONE_4PI_EPS0 / pme->epsilon_r */
float elFactor;
- /*! \brief Virial and energy GPU array. Size is PME_GPU_ENERGY_AND_VIRIAL_COUNT (7) floats.
+ /*! \brief Virial and energy GPU array. Size is c_virialAndEnergyCount (7) floats.
* The element order is virxx, viryy, virzz, virxy, virxz, viryz, energy. */
HIDE_FROM_OPENCL_COMPILER(DeviceBuffer<float>) d_virialAndEnergy;
};
* The coordinates themselves change and need to be copied to the GPU for every PME computation,
* but reallocation happens only at DD.
*/
- HIDE_FROM_OPENCL_COMPILER(DeviceBuffer<float>) d_coordinates;
+ HIDE_FROM_OPENCL_COMPILER(DeviceBuffer<gmx::RVec>) d_coordinates;
/*! \brief Global GPU memory array handle with input atom charges.
* The charges only need to be reallocated and copied to the GPU at DD step.
*/
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_gpu_program.h"
#include "gromacs/gpu_utils/clfftinitializer.h"
-#include "gromacs/gpu_utils/gpu_utils.h" // for GpuApiCallBehavior
#include "gromacs/gpu_utils/hostallocator.h"
#include "gromacs/math/vectypes.h"
+#include "pme_gpu_settings.h"
+#include "pme_gpu_staging.h"
+
+namespace gmx
+{
+class PmeDeviceBuffers;
+} // namespace gmx
+
#if GMX_GPU != GMX_GPU_NONE
struct PmeGpuSpecific;
#else
typedef int PmeGpuKernelParams;
#endif
-struct gmx_device_info_t;
-
-/*! \internal \brief
- * The PME GPU settings structure, included in the main PME GPU structure by value.
- */
-struct PmeGpuSettings
-{
- /* Permanent settings set on initialization */
- /*! \brief A boolean which tells if the solving is performed on GPU. Currently always true */
- bool performGPUSolve;
- /*! \brief A boolean which tells if the gathering is performed on GPU. Currently always true */
- bool performGPUGather;
- /*! \brief A boolean which tells if the FFT is performed on GPU. Currently true for a single MPI rank. */
- bool performGPUFFT;
- /*! \brief A convenience boolean which tells if PME decomposition is used. */
- bool useDecomposition;
- /*! \brief True if PME forces are reduced on-GPU, false if reduction is done on the CPU;
- * in the former case transfer does not need to happen.
- *
- * Note that this flag may change per-step.
- */
- bool useGpuForceReduction;
-
- /*! \brief A boolean which tells if any PME GPU stage should copy all of its outputs to the
- * host. Only intended to be used by the test framework.
- */
- bool copyAllOutputs;
- /*! \brief An enum which tells whether most PME GPU D2H/H2D data transfers should be synchronous. */
- GpuApiCallBehavior transferKind;
- /*! \brief Various flags for the current PME computation, corresponding to the GMX_PME_ flags in pme.h. */
- int currentFlags;
- /*! \brief
- * Currently only supported by CUDA.
- * Controls if we should use order (i.e. 4) threads per atom for the GPU
- * or order*order (i.e. 16) threads per atom.
- */
- bool useOrderThreadsPerAtom;
- /*! \brief
- * Currently only supported by CUDA.
- * Controls if we should recalculate the splines in the gather or
- * save the values in the spread and reload in the gather.
- */
- bool recalculateSplines;
-};
-
-// TODO There's little value in computing the Coulomb and LJ virial
-// separately, so we should simplify that.
-// TODO The matrices might be best as a view, but not currently
-// possible. Use mdspan?
-struct PmeOutput
-{
- gmx::ArrayRef<gmx::RVec> forces_; //!< Host staging area for PME forces
- bool haveForceOutput_ =
- false; //!< True if forces have been staged other false (when forces are reduced on the GPU).
- real coulombEnergy_ = 0; //!< Host staging area for PME coulomb energy
- matrix coulombVirial_ = { { 0 } }; //!< Host staging area for PME coulomb virial contributions
- real lennardJonesEnergy_ = 0; //!< Host staging area for PME LJ energy
- matrix lennardJonesVirial_ = { { 0 } }; //!< Host staging area for PME LJ virial contributions
-};
-
-/*! \internal \brief
- * The PME GPU intermediate buffers structure, included in the main PME GPU structure by value.
- * Buffers are managed by the PME GPU module.
- */
-struct PmeGpuStaging
-{
- //! Host-side force buffer
- gmx::PaddedHostVector<gmx::RVec> h_forces;
-
- /*! \brief Virial and energy intermediate host-side buffer. Size is PME_GPU_VIRIAL_AND_ENERGY_COUNT. */
- float* h_virialAndEnergy;
- /*! \brief B-spline values intermediate host-side buffer. */
- float* h_splineModuli;
-
- /*! \brief Pointer to the host memory with B-spline values. Only used for host-side gather, or unit tests */
- float* h_theta;
- /*! \brief Pointer to the host memory with B-spline derivative values. Only used for host-side gather, or unit tests */
- float* h_dtheta;
- /*! \brief Pointer to the host memory with ivec atom gridline indices. Only used for host-side gather, or unit tests */
- int* h_gridlineIndices;
-};
+struct DeviceInformation;
/*! \internal \brief
* The PME GPU structure for all the data copied directly from the CPU PME structure.
std::shared_ptr<PmeShared> common; // TODO: make the CPU structure use the same type
//! A handle to the program created by buildPmeGpuProgram()
- PmeGpuProgramHandle programHandle_;
+ const PmeGpuProgram* programHandle_;
//! Handle that ensures the clFFT library has been initialized once per process.
std::unique_ptr<gmx::ClfftInitializer> initializedClfftLibrary_;
int nAtomsAlloc;
/*! \brief A pointer to the device used during the execution. */
- const gmx_device_info_t* deviceInfo;
+ const DeviceInformation* deviceInfo;
/*! \brief Kernel scheduling grid width limit in X - derived from deviceinfo compute capability in CUDA.
* Declared as very large int to make it useful in computations with type promotion, to avoid overflows.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param[in] paramIndexBase Must be result of getSplineParamIndexBase().
* \param[in] dimIndex Dimension index (from 0 to 2)
* \param[in] splineIndex Spline contribution index (from 0 to \p order - 1)
- * \param[in] order PME order
- * \param[in] atomsPerWarp Number of atoms processed by a warp
*
* \returns Index into theta or dtheta array using GPU layout.
*/
/*! \brief
* A function for checking the global atom data indices against the atom data array sizes.
*
- * \param[in] atomDataIndexGlobal The atom data index.
* \param[in] nAtomData The atom data array element count.
* \returns Non-0 if index is within bounds (or PME data padding is enabled), 0 otherwise.
*
*/
inline int pme_gpu_check_atom_charge(const float coefficient)
{
- return c_skipNeutralAtoms ? (coefficient != 0.0f) : 1;
+ return c_skipNeutralAtoms ? (coefficient != 0.0F) : 1;
}
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "config.h"
+#include <vector>
+
#include "gromacs/math/gmxcomplex.h"
+#include "gromacs/utility/alignedallocator.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/defaultinitializationallocator.h"
#include "gromacs/utility/gmxmpi.h"
-#include "gromacs/utility/smalloc.h"
-#include "pme_gpu_types_host.h"
+#include "spline_vectors.h"
//! A repeat of typedef from parallel_3dfft.h
typedef struct gmx_parallel_3dfft* gmx_parallel_3dfft_t;
struct t_inputrec;
struct PmeGpu;
+enum class PmeRunMode;
+
//@{
//! Grid indices for A state for charge and Lennard-Jones C6
#define PME_GRID_QA 0
*/
#define PME_ORDER_MAX 12
-/*! \brief As gmx_pme_init, but takes most settings, except the grid/Ewald coefficients, from
- * pme_src. This is only called when the PME cut-off/grid size changes.
- */
-void gmx_pme_reinit(struct gmx_pme_t** pmedata,
- const t_commrec* cr,
- struct gmx_pme_t* pme_src,
- const t_inputrec* ir,
- const ivec grid_size,
- real ewaldcoeff_q,
- real ewaldcoeff_lj);
-
/* Temporary suppression until these structs become opaque and don't live in
* a header that is included by other headers. Also, until then I have no
FastVector<int> i;
};
-/*! \brief Helper typedef for spline vectors */
-typedef real* splinevec[DIM];
-
/*! \internal
* \brief Coefficients for theta or dtheta
*/
//! @endcond
-/*! \brief
- * Finds out if PME is currently running on GPU.
- * TODO: should this be removed eventually?
- *
- * \param[in] pme The PME structure.
- * \returns True if PME runs on GPU currently, false otherwise.
- */
-inline bool pme_gpu_active(const gmx_pme_t* pme)
-{
- return (pme != nullptr) && (pme->runMode != PmeRunMode::CPU);
-}
-
-/*! \brief Tell our PME-only node to switch to a new grid size */
-void gmx_pme_send_switchgrid(const t_commrec* cr, ivec grid_size, real ewaldcoeff_q, real ewaldcoeff_lj);
-
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/dispersioncorrection.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdtypes/commrec.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/timing/wallcycle.h"
+#include "gromacs/timing/walltime_accounting.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/strconvert.h"
#include "pme_internal.h"
+#include "pme_pp.h"
/*! \brief Parameters and settings for one PP-PME setup */
struct pme_setup_t
pme_lb->elimited = epmelblimMAXSCALING;
}
- if (OK && ir.ePBC != epbcNONE)
+ if (OK && ir.pbcType != PbcType::No)
{
- OK = (gmx::square(pme_lb->setup[pme_lb->cur + 1].rlistOuter) <= max_cutoff2(ir.ePBC, box));
+ OK = (gmx::square(pme_lb->setup[pme_lb->cur + 1].rlistOuter)
+ <= max_cutoff2(ir.pbcType, box));
if (!OK)
{
pme_lb->elimited = epmelblimBOX;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_EWALD_PME_LOAD_BALANCING_H
#define GMX_EWALD_PME_LOAD_BALANCING_H
-#include "gromacs/mdtypes/forcerec.h"
-#include "gromacs/mdtypes/interaction_const.h"
+#include "gromacs/math/vectypes.h"
#include "gromacs/timing/wallcycle.h"
struct nonbonded_verlet_t;
struct t_commrec;
+struct t_forcerec;
struct t_inputrec;
+struct interaction_const_t;
+struct gmx_pme_t;
class t_state;
namespace gmx
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gmxpre.h"
+#include "pme_only.h"
+
#include "config.h"
#include <cassert>
#include "gromacs/utility/smalloc.h"
#include "pme_gpu_internal.h"
-#include "pme_internal.h"
+#include "pme_output.h"
#include "pme_pp_communication.h"
/*! \brief environment variable to enable GPU P2P communication */
for (auto& pme : *pmedata)
{
GMX_ASSERT(pme, "Bad PME tuning list element pointer");
- if (pme->nkx == grid_size[XX] && pme->nky == grid_size[YY] && pme->nkz == grid_size[ZZ])
+ if (gmx_pme_grid_matches(*pme, grid_size))
{
/* Here we have found an existing PME data structure that suits us.
* However, in the GPU case, we have to reinitialize it - there's only one GPU structure.
"but PME run mode is not PmeRunMode::GPU\n");
// This rank will have its data accessed directly by PP rank, so needs to send the remote addresses.
- rvec* d_x = nullptr;
- rvec* d_f = nullptr;
-# if (GMX_GPU == GMX_GPU_CUDA) // avoid invalid cast for OpenCL
- d_x = reinterpret_cast<rvec*>(pme_gpu_get_device_x(pme));
- d_f = reinterpret_cast<rvec*>(pme_gpu_get_device_f(pme));
-# endif
- pme_pp->pmeCoordinateReceiverGpu->sendCoordinateBufferAddressToPpRanks(d_x);
- pme_pp->pmeForceSenderGpu->sendForceBufferAddressToPpRanks(d_f);
+ pme_pp->pmeCoordinateReceiverGpu->sendCoordinateBufferAddressToPpRanks(
+ stateGpu->getCoordinates());
+ pme_pp->pmeForceSenderGpu->sendForceBufferAddressToPpRanks(
+ reinterpret_cast<rvec*>(pme_gpu_get_device_f(pme)));
}
}
pmedata.push_back(pme);
auto pme_pp = gmx_pme_pp_init(cr);
+
+ std::unique_ptr<gmx::StatePropagatorDataGpu> stateGpu;
// TODO the variable below should be queried from the task assignment info
- const bool useGpuForPme = (runMode == PmeRunMode::GPU) || (runMode == PmeRunMode::Mixed);
- const void* commandStream = useGpuForPme ? pme_gpu_get_device_stream(pme) : nullptr;
- const void* deviceContext = useGpuForPme ? pme_gpu_get_device_context(pme) : nullptr;
- const int paddingSize = pme_gpu_get_padding_size(pme);
+ const bool useGpuForPme = (runMode == PmeRunMode::GPU) || (runMode == PmeRunMode::Mixed);
if (useGpuForPme)
{
+ const void* commandStream = pme_gpu_get_device_stream(pme);
+ const void* deviceContext = pme_gpu_get_device_context(pme);
+
changePinningPolicy(&pme_pp->chargeA, pme_get_pinning_policy());
changePinningPolicy(&pme_pp->x, pme_get_pinning_policy());
if (c_enableGpuPmePpComms)
{
pme_pp->pmeCoordinateReceiverGpu = std::make_unique<gmx::PmeCoordinateReceiverGpu>(
- pme_gpu_get_device_stream(pme), pme_pp->mpi_comm_mysim, pme_pp->ppRanks);
+ commandStream, pme_pp->mpi_comm_mysim, pme_pp->ppRanks);
pme_pp->pmeForceSenderGpu = std::make_unique<gmx::PmeForceSenderGpu>(
- pme_gpu_get_device_stream(pme), pme_pp->mpi_comm_mysim, pme_pp->ppRanks);
+ commandStream, pme_pp->mpi_comm_mysim, pme_pp->ppRanks);
}
- }
-
- std::unique_ptr<gmx::StatePropagatorDataGpu> stateGpu;
- if (useGpuForPme)
- {
// TODO: Special PME-only constructor is used here. There is no mechanism to prevent from using the other constructor here.
// This should be made safer.
stateGpu = std::make_unique<gmx::StatePropagatorDataGpu>(
- commandStream, deviceContext, GpuApiCallBehavior::Async, paddingSize, wcycle);
+ commandStream, deviceContext, GpuApiCallBehavior::Async,
+ pme_gpu_get_padding_size(pme), wcycle);
}
-
clear_nrnb(mynrnb);
count = 0;
pme_gpu_launch_spread(pme, xReadyOnDevice, wcycle);
pme_gpu_launch_complex_transforms(pme, wcycle);
- pme_gpu_launch_gather(pme, wcycle, PmeForceOutputHandling::Set);
+ pme_gpu_launch_gather(pme, wcycle);
output = pme_gpu_wait_finish_task(pme, pmeFlags, wcycle);
pme_gpu_reinit_computation(pme, wcycle);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \libinternal \file
+ *
+ * \brief This file contains function declarations necessary for
+ * running on an MPI rank doing only PME long-ranged work.
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \inlibraryapi
+ * \ingroup module_ewald
+ */
-#ifndef GMX_NBNXN_CONSTANTS_H
-#define GMX_NBNXN_CONSTANTS_H
+#ifndef GMX_EWALD_PME_ONLY_H
+#define GMX_EWALD_PME_ONLY_H
-// Lower limit for square interaction distances in nonbonded kernels.
-// For smaller values we will overflow when calculating r^-1 or r^-12, but
-// to keep it simple we always apply the limit from the tougher r^-12 condition.
-#if GMX_DOUBLE
-// Some double precision SIMD architectures use single precision in the first
-// step, so although the double precision criterion would allow smaller rsq,
-// we need to stay in single precision with some margin for the N-R iterations.
-# define NBNXN_MIN_RSQ 1.0e-36
-#else
-// The worst intermediate value we might evaluate is r^-12, which
-// means we should ensure r^2 stays above pow(GMX_FLOAT_MAX,-1.0/6.0)*1.01 (some margin)
-# define NBNXN_MIN_RSQ 3.82e-07f // r > 6.2e-4
-#endif
+#include <string>
+#include "gromacs/timing/walltime_accounting.h"
-/* The number of clusters in a super-cluster, used for GPU */
-#define c_nbnxnGpuNumClusterPerSupercluster 8
+struct t_commrec;
+struct t_inputrec;
+struct t_nrnb;
+struct gmx_pme_t;
+struct gmx_wallcycle;
-/* With GPU kernels we group cluster pairs in 4 to optimize memory usage
- * of integers containing 32 bits.
- */
-#define c_nbnxnGpuJgroupSize (32 / c_nbnxnGpuNumClusterPerSupercluster)
+enum class PmeRunMode;
+
+/*! \brief Called on the nodes that do PME exclusively */
+int gmx_pmeonly(gmx_pme_t* pme,
+ const t_commrec* cr,
+ t_nrnb* mynrnb,
+ gmx_wallcycle* wcycle,
+ gmx_walltime_accounting_t walltime_accounting,
+ t_inputrec* ir,
+ PmeRunMode runMode);
#endif
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+
+/*! \libinternal \file
+ * \brief Defines a struct useful for transferring the PME output
+ * values
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_ewald
+ */
+
+#ifndef GMX_EWALD_PME_OUTPUT_H
+#define GMX_EWALD_PME_OUTPUT_H
+
+#include "gromacs/math/vectypes.h"
+#include "gromacs/utility/arrayref.h"
+
+// TODO There's little value in computing the Coulomb and LJ virial
+// separately, so we should simplify that.
+// TODO The matrices might be best as a view, but not currently
+// possible. Use mdspan?
+struct PmeOutput
+{
+ //!< Host staging area for PME forces
+ gmx::ArrayRef<gmx::RVec> forces_;
+ //!< True if forces have been staged other false (when forces are reduced on the GPU).
+ bool haveForceOutput_ = false;
+ //!< Host staging area for PME coulomb energy
+ real coulombEnergy_ = 0;
+ //!< Host staging area for PME coulomb virial contributions
+ matrix coulombVirial_ = { { 0 } };
+ //!< Host staging area for PME LJ energy
+ real lennardJonesEnergy_ = 0;
+ //!< Host staging area for PME LJ virial contributions
+ matrix lennardJonesVirial_ = { { 0 } };
+};
+
+#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gmxpre.h"
+#include "pme_pp.h"
+
#include "config.h"
#include <cstdio>
#include "gromacs/utility/gmxmpi.h"
#include "gromacs/utility/smalloc.h"
-#include "pme_internal.h"
#include "pme_pp_communication.h"
/*! \brief Block to wait for communication to PME ranks to complete
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ *
+ * \brief This file contains function declarations necessary for
+ * mananging the PP side of PME-only ranks.
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_ewald
+ */
+
+#ifndef GMX_EWALD_PME_PP_H
+#define GMX_EWALD_PME_PP_H
+
+#include "gromacs/math/vectypes.h"
+#include "gromacs/utility/basedefinitions.h"
+
+struct gmx_wallcycle;
+struct interaction_const_t;
+struct t_commrec;
+struct t_forcerec;
+
+class GpuEventSynchronizer;
+
+namespace gmx
+{
+class ForceWithVirial;
+class PmePpCommGpu;
+} // namespace gmx
+
+/*! \brief Send the charges and maxshift to out PME-only node. */
+void gmx_pme_send_parameters(const t_commrec* cr,
+ const interaction_const_t* ic,
+ gmx_bool bFreeEnergy_q,
+ gmx_bool bFreeEnergy_lj,
+ real* chargeA,
+ real* chargeB,
+ real* sqrt_c6A,
+ real* sqrt_c6B,
+ real* sigmaA,
+ real* sigmaB,
+ int maxshift_x,
+ int maxshift_y);
+
+/*! \brief Send the coordinates to our PME-only node and request a PME calculation */
+void gmx_pme_send_coordinates(t_forcerec* fr,
+ const t_commrec* cr,
+ const matrix box,
+ const rvec* x,
+ real lambda_q,
+ real lambda_lj,
+ gmx_bool bEnerVir,
+ int64_t step,
+ bool useGpuPmePpComms,
+ bool reinitGpuPmePpComms,
+ bool sendCoordinatesFromGpu,
+ GpuEventSynchronizer* coordinatesReadyOnDeviceEvent,
+ gmx_wallcycle* wcycle);
+
+/*! \brief Tell our PME-only node to finish */
+void gmx_pme_send_finish(const t_commrec* cr);
+
+/*! \brief Tell our PME-only node to reset all cycle and flop counters */
+void gmx_pme_send_resetcounters(const t_commrec* cr, int64_t step);
+
+/*! \brief PP nodes receive the long range forces from the PME nodes */
+void gmx_pme_receive_f(gmx::PmePpCommGpu* pmePpCommGpu,
+ const t_commrec* cr,
+ gmx::ForceWithVirial* forceWithVirial,
+ real* energy_q,
+ real* energy_lj,
+ real* dvdlambda_q,
+ real* dvdlambda_lj,
+ bool useGpuPmePpComms,
+ bool receivePmeForceToGpu,
+ float* pme_cycles);
+
+/*! \brief Tell our PME-only node to switch to a new grid size */
+void gmx_pme_send_switchgrid(const t_commrec* cr, ivec grid_size, real ewaldcoeff_q, real ewaldcoeff_lj);
+
+#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
// Assert placeholders, to not rip them out from OpenCL implementation - hopefully they come in handy some day with OpenCL 2
-#define static_assert(a, b)
#define assert(a)
#define PmeOpenCLKernelParams PmeGpuKernelParamsBase
/* SPREAD/SPLINE */
#define atomsPerBlock (c_spreadWorkGroupSize / threadsPerAtom)
+#define atomsPerWarp (warp_size / threadsPerAtom)
// spline/spread fused
#define computeSplines 1
#define atomsPerBlock (c_gatherWorkGroupSize / threadsPerAtom)
// gather
-#define overwriteForces 1
#define CUSTOMIZED_KERNEL_NAME(x) pmeGatherKernel
#include "pme_gather.clh"
-#undef overwriteForces
-#undef CUSTOMIZED_KERNEL_NAME
-
-// gather with reduction
-#define overwriteForces 0
-#define CUSTOMIZED_KERNEL_NAME(x) pmeGatherReduceWithInputKernel
-#include "pme_gather.clh"
-#undef overwriteForces
#undef CUSTOMIZED_KERNEL_NAME
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \author Aleksei Iupinov <a.yupinov@gmail.com>
*/
-#include "pme_gpu_types.h"
#include "gromacs/gpu_utils/vectype_ops.clh"
+#include "pme_gpu_types.h"
+
/*! \brief
* PME complex grid solver kernel function.
* Please see the file description for additional defines which this kernel expects.
__global float2* __restrict__ gm_grid)
{
/* This kernel supports 2 different grid dimension orderings: YZX and XYZ */
- int majorDim, middleDim, minorDim;
+ int majorDim;
+ int middleDim;
+ int minorDim;
if (gridOrdering == YZX)
{
majorDim = YY;
gm_splineModuli + kernelParams.grid.splineValuesOffset[minorDim];
/* Various grid sizes and indices */
- const int localOffsetMinor = 0, localOffsetMajor = 0, localOffsetMiddle = 0; // unused
- const int localSizeMinor = kernelParams.grid.complexGridSizePadded[minorDim];
- const int localSizeMiddle = kernelParams.grid.complexGridSizePadded[middleDim];
- const int localCountMiddle = kernelParams.grid.complexGridSize[middleDim];
- const int localCountMinor = kernelParams.grid.complexGridSize[minorDim];
- const int nMajor = kernelParams.grid.realGridSize[majorDim];
- const int nMiddle = kernelParams.grid.realGridSize[middleDim];
- const int nMinor = kernelParams.grid.realGridSize[minorDim];
- const int maxkMajor = (nMajor + 1) / 2; // X or Y
- const int maxkMiddle = (nMiddle + 1) / 2; // Y OR Z => only check for !YZX
- const int maxkMinor = (nMinor + 1) / 2; // Z or X => only check for YZX
+ const int localOffsetMinor = 0; // unused
+ const int localOffsetMajor = 0; // unused
+ const int localOffsetMiddle = 0; // unused
+ const int localSizeMinor = kernelParams.grid.complexGridSizePadded[minorDim];
+ const int localSizeMiddle = kernelParams.grid.complexGridSizePadded[middleDim];
+ const int localCountMiddle = kernelParams.grid.complexGridSize[middleDim];
+ const int localCountMinor = kernelParams.grid.complexGridSize[minorDim];
+ const int nMajor = kernelParams.grid.realGridSize[majorDim];
+ const int nMiddle = kernelParams.grid.realGridSize[middleDim];
+ const int nMinor = kernelParams.grid.realGridSize[minorDim];
+ const int maxkMajor = (nMajor + 1) / 2; // X or Y
+ const int maxkMiddle = (nMiddle + 1) / 2; // Y OR Z => only check for !YZX
+ const int maxkMinor = (nMinor + 1) / 2; // Z or X => only check for YZX
/* Each thread works on one cell of the Fourier space complex 3D grid (gm_grid).
* Each block handles up to c_solveMaxWorkGroupSize cells -
const int gridLineIndex = threadLocalId / gridLineSize;
const int gridLineCellIndex = threadLocalId - gridLineSize * gridLineIndex;
const int gridLinesPerBlock = max((int)(get_local_size(XX)) / gridLineSize, 1);
- const int activeWarps = (get_local_size(XX) / warp_size);
- const int indexMinor = get_group_id(XX) * get_local_size(XX) + gridLineCellIndex;
- const int indexMiddle = get_group_id(YY) * gridLinesPerBlock + gridLineIndex;
- const int indexMajor = get_group_id(ZZ);
+ const int activeWarps = ((int)get_local_size(XX) / warp_size);
+ assert((get_group_id(XX) * get_local_size(XX)) < MAX_INT);
+ const int indexMinor = (int)get_group_id(XX) * (int)get_local_size(XX) + gridLineCellIndex;
+ const int indexMiddle = (int)get_group_id(YY) * gridLinesPerBlock + gridLineIndex;
+ const int indexMajor = (int)get_group_id(ZZ);
/* Optional outputs */
- float energy = 0.0f;
- float virxx = 0.0f;
- float virxy = 0.0f;
- float virxz = 0.0f;
- float viryy = 0.0f;
- float viryz = 0.0f;
- float virzz = 0.0f;
+ float energy = 0.0F;
+ float virxx = 0.0F;
+ float virxy = 0.0F;
+ float virxz = 0.0F;
+ float viryy = 0.0F;
+ float viryz = 0.0F;
+ float virzz = 0.0F;
assert(indexMajor < kernelParams.grid.complexGridSize[majorDim]);
if ((indexMiddle < localCountMiddle) & (indexMinor < localCountMinor)
const int kMajor = indexMajor + localOffsetMajor;
/* Checking either X in XYZ, or Y in YZX cases */
- const float mMajor = (kMajor < maxkMajor) ? kMajor : (kMajor - nMajor);
+ const float mMajor = (float)((kMajor < maxkMajor) ? kMajor : (kMajor - nMajor));
const int kMiddle = indexMiddle + localOffsetMiddle;
- float mMiddle = kMiddle;
+ float mMiddle = (float)kMiddle;
/* Checking Y in XYZ case */
if (gridOrdering == XYZ)
{
- mMiddle = (kMiddle < maxkMiddle) ? kMiddle : (kMiddle - nMiddle);
+ mMiddle = (float)((kMiddle < maxkMiddle) ? kMiddle : (kMiddle - nMiddle));
}
const int kMinor = localOffsetMinor + indexMinor;
- float mMinor = kMinor;
+ float mMinor = (float)kMinor;
/* Checking X in YZX case */
if (gridOrdering == YZX)
{
- mMinor = (kMinor < maxkMinor) ? kMinor : (kMinor - nMinor);
+ mMinor = (float)((kMinor < maxkMinor) ? kMinor : (kMinor - nMinor));
}
/* We should skip the k-space point (0,0,0) */
const bool notZeroPoint = (kMinor > 0) | (kMajor > 0) | (kMiddle > 0);
- float mX, mY, mZ;
+ float mX;
+ float mY;
+ float mZ;
if (gridOrdering == YZX)
{
mX = mMinor;
}
/* 0.5 correction factor for the first and last components of a Z dimension */
- float corner_fac = 1.0f;
+ float corner_fac = 1.0F;
+ const float z_corner_fac = 0.5F;
if (gridOrdering == YZX)
{
if ((kMiddle == 0) | (kMiddle == maxkMiddle))
{
- corner_fac = 0.5f;
+ corner_fac = z_corner_fac;
}
}
if (gridOrdering == XYZ)
{
if ((kMinor == 0) | (kMinor == maxkMinor))
{
- corner_fac = 0.5f;
+ corner_fac = z_corner_fac;
}
}
+ mZ * kernelParams.current.recipBox[ZZ][ZZ];
const float m2k = mhxk * mhxk + mhyk * mhyk + mhzk * mhzk;
- assert(m2k != 0.0f);
+ assert(m2k != 0.0F);
const float denom = m2k * M_PI_F * kernelParams.current.boxVolume * gm_splineValueMajor[kMajor]
* gm_splineValueMiddle[kMiddle] * gm_splineValueMinor[kMinor];
assert(isfinite(denom));
- assert(denom != 0.0f);
+ assert(denom != 0.0F);
const float tmp1 = exp(-kernelParams.grid.ewaldFactor * m2k);
const float etermk = kernelParams.constants.elFactor * tmp1 / denom;
if (computeEnergyAndVirial)
{
const float tmp1k =
- 2.0f * (gridValue.x * oldGridValue.x + gridValue.y * oldGridValue.y);
+ 2.0F * (gridValue.x * oldGridValue.x + gridValue.y * oldGridValue.y);
- const float vfactor = (kernelParams.grid.ewaldFactor + 1.0f / m2k) * 2.0f;
+ const float vfactor = (kernelParams.grid.ewaldFactor + 1.0F / m2k) * 2.0F;
const float ets2 = corner_fac * tmp1k;
energy = ets2;
sm_virialAndEnergy[2 * warp_size + lane] = virzz;
sm_virialAndEnergy[3 * warp_size + lane] = virxy;
sm_virialAndEnergy[4 * warp_size + lane] = virxz;
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers)
sm_virialAndEnergy[5 * warp_size + lane] = viryz;
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers)
sm_virialAndEnergy[6 * warp_size + lane] = energy;
}
barrier(CLK_LOCAL_MEM_FENCE);
atomicAdd_l_f(sm_virialAndEnergy + 2 * warp_size + lane, virzz);
atomicAdd_l_f(sm_virialAndEnergy + 3 * warp_size + lane, virxy);
atomicAdd_l_f(sm_virialAndEnergy + 4 * warp_size + lane, virxz);
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers)
atomicAdd_l_f(sm_virialAndEnergy + 5 * warp_size + lane, viryz);
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers)
atomicAdd_l_f(sm_virialAndEnergy + 6 * warp_size + lane, energy);
}
barrier(CLK_LOCAL_MEM_FENCE);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/smalloc.h"
#include "pme_internal.h"
+#include "pme_output.h"
#if GMX_SIMD_HAVE_REAL
/* Turn on arbitrary width SIMD intrinsics for PME solve */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \author Aleksei Iupinov <a.yupinov@gmail.com>
*/
+#include "gromacs/gpu_utils/vectype_ops.clh"
+
#include "pme_gpu_types.h"
#include "pme_gpu_utils.clh"
-#include "gromacs/gpu_utils/vectype_ops.clh"
/*
* This define affects the spline calculation behaviour in the kernel.
__global const float* __restrict__ gm_source,
const int dataCountPerAtom)
{
- const size_t threadLocalIndex =
- ((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0) + get_local_id(0));
- const size_t localIndex = threadLocalIndex;
- const size_t globalIndexBase = get_group_id(XX) * atomsPerBlock * dataCountPerAtom;
- const size_t globalIndex = globalIndexBase + localIndex;
- const int globalCheck =
+ assert((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0) + get_local_id(0)
+ < MAX_INT);
+ const int threadLocalIndex =
+ (int)((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0)
+ + get_local_id(0));
+ const int localIndex = threadLocalIndex;
+ const int globalIndexBase = (int)get_group_id(XX) * atomsPerBlock * dataCountPerAtom;
+ const int globalIndex = globalIndexBase + localIndex;
+ const int globalCheck =
pme_gpu_check_atom_data_index(globalIndex, kernelParams.atoms.nAtoms * dataCountPerAtom);
if ((localIndex < atomsPerBlock * dataCountPerAtom) & globalCheck)
{
* \param[in] gm_fractShiftsTable Atom fractional coordinates correction table
* \param[in] gm_gridlineIndicesTable Atom fractional coordinates correction table
*/
-inline void calculate_splines(const struct PmeOpenCLKernelParams kernelParams,
- const int atomIndexOffset,
- __local const float* __restrict__ sm_coordinates,
- __local const float* __restrict__ sm_coefficients,
- __local float* __restrict__ sm_theta,
- __local int* __restrict__ sm_gridlineIndices,
- __local float* __restrict__ sm_fractCoords,
- __global float* __restrict__ gm_theta,
- __global float* __restrict__ gm_dtheta,
- __global int* __restrict__ gm_gridlineIndices,
- __global const float* __restrict__ gm_fractShiftsTable,
- __global const int* __restrict__ gm_gridlineIndicesTable)
+gmx_opencl_inline void calculate_splines(const struct PmeOpenCLKernelParams kernelParams,
+ const int atomIndexOffset,
+ __local const float* __restrict__ sm_coordinates,
+ __local const float* __restrict__ sm_coefficients,
+ __local float* __restrict__ sm_theta,
+ __local int* __restrict__ sm_gridlineIndices,
+ __local float* __restrict__ sm_fractCoords,
+ __global float* __restrict__ gm_theta,
+ __global float* __restrict__ gm_dtheta,
+ __global int* __restrict__ gm_gridlineIndices,
+ __global const float* __restrict__ gm_fractShiftsTable,
+ __global const int* __restrict__ gm_gridlineIndicesTable)
{
/* Thread index w.r.t. block */
+ assert((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0) + get_local_id(0)
+ < MAX_INT);
const int threadLocalIndex =
- ((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0) + get_local_id(0));
+ (int)((get_local_id(2) * get_local_size(1) + get_local_id(1)) * get_local_size(0)
+ + get_local_id(0));
/* Warp index w.r.t. block - could probably be obtained easier? */
const int warpIndex = threadLocalIndex / warp_size;
/* Thread index w.r.t. warp */
/* Indices interpolation */
if (orderIndex == 0)
{
- int tableIndex, tInt;
- float n, t;
+ int tableIndex;
+ int tInt;
+ float n;
+ float t;
const float3 x = vload3(atomIndexLocal, sm_coordinates);
/* Accessing fields in fshOffset/nXYZ/recipbox/... with dimIndex offset
.z
* kernelParams.current.recipBox[dimIndex][ZZ];
break;
+ default:
+ assert(false);
+ return;
+ break;
}
const float shift = c_pmeMaxUnitcellShift;
/* Fractional coordinates along box vectors, adding a positive shift to ensure t is positive for triclinic boxes */
t = (t + shift) * n;
tInt = (int)t;
- sm_fractCoords[sharedMemoryIndex] = t - tInt;
+ sm_fractCoords[sharedMemoryIndex] = t - (float)tInt;
tableIndex += tInt;
assert(tInt >= 0);
assert(tInt < c_pmeNeighborUnitcellCount * n);
assert(isfinite(dr));
/* dr is relative offset from lower cell limit */
- *SPLINE_DATA_PTR(order - 1) = 0.0f;
+ *SPLINE_DATA_PTR(order - 1) = 0.0F;
*SPLINE_DATA_PTR(1) = dr;
- *SPLINE_DATA_PTR(0) = 1.0f - dr;
+ *SPLINE_DATA_PTR(0) = 1.0F - dr;
# pragma unroll order
for (int k = 3; k < order; k++)
{
- div = 1.0f / (k - 1.0f);
+ div = 1.0F / ((float)k - 1.0F);
*SPLINE_DATA_PTR(k - 1) = div * dr * SPLINE_DATA(k - 2);
# pragma unroll
for (int l = 1; l < (k - 1); l++)
{
- *SPLINE_DATA_PTR(k - l - 1) = div
- * ((dr + l) * SPLINE_DATA(k - l - 2)
- + (k - l - dr) * SPLINE_DATA(k - l - 1));
+ *SPLINE_DATA_PTR(k - l - 1) =
+ div
+ * ((dr + (float)l) * SPLINE_DATA(k - l - 2)
+ + ((float)k - (float)l - dr) * SPLINE_DATA(k - l - 1));
}
- *SPLINE_DATA_PTR(0) = div * (1.0f - dr) * SPLINE_DATA(0);
+ *SPLINE_DATA_PTR(0) = div * (1.0F - dr) * SPLINE_DATA(0);
}
const int thetaIndexBase = getSplineParamIndexBase(warpIndex, atomWarpIndex);
const int thetaIndex = getSplineParamIndex(thetaIndexBase, dimIndex, o);
const int thetaGlobalIndex = thetaGlobalOffsetBase + thetaIndex;
- const float dtheta = ((o > 0) ? SPLINE_DATA(o - 1) : 0.0f) - SPLINE_DATA(o);
+ const float dtheta = ((o > 0) ? SPLINE_DATA(o - 1) : 0.0F) - SPLINE_DATA(o);
assert(isfinite(dtheta));
gm_dtheta[thetaGlobalIndex] = dtheta;
}
- div = 1.0f / (order - 1.0f);
+ div = 1.0F / (order - 1.0F);
*SPLINE_DATA_PTR(order - 1) = div * dr * SPLINE_DATA(order - 2);
# pragma unroll
for (int k = 1; k < (order - 1); k++)
{
*SPLINE_DATA_PTR(order - k - 1) = div
- * ((dr + k) * SPLINE_DATA(order - k - 2)
+ * ((dr + (float)k) * SPLINE_DATA(order - k - 2)
+ (order - k - dr) * SPLINE_DATA(order - k - 1));
}
- *SPLINE_DATA_PTR(0) = div * (1.0f - dr) * SPLINE_DATA(0);
+ *SPLINE_DATA_PTR(0) = div * (1.0F - dr) * SPLINE_DATA(0);
/* Storing the spline values (theta) */
# if !PME_GPU_PARALLEL_SPLINE
* sm_gridlineIndices Atom gridline indices in the shared memory. \param[in] sm_theta Atom spline
* values in the shared memory. \param[out] gm_grid Global 3D grid for spreading.
*/
-inline void spread_charges(const struct PmeOpenCLKernelParams kernelParams,
- int atomIndexOffset,
- __local const float* __restrict__ sm_coefficients,
- __local const int* __restrict__ sm_gridlineIndices,
- __local const float* __restrict__ sm_theta,
- __global float* __restrict__ gm_grid)
+gmx_opencl_inline void spread_charges(const struct PmeOpenCLKernelParams kernelParams,
+ int atomIndexOffset,
+ __local const float* __restrict__ sm_coefficients,
+ __local const int* __restrict__ sm_gridlineIndices,
+ __local const float* __restrict__ sm_theta,
+ __global float* __restrict__ gm_grid)
{
const int nx = kernelParams.grid.realGridSize[XX];
const int ny = kernelParams.grid.realGridSize[YY];
const int pny = kernelParams.grid.realGridSizePadded[YY];
const int pnz = kernelParams.grid.realGridSizePadded[ZZ];
- const int offx = 0, offy = 0, offz = 0; // unused for now
+ const int offx = 0;
+ const int offy = 0;
+ const int offz = 0;
const int atomIndexLocal = get_local_id(ZZ);
const int atomIndexGlobal = atomIndexOffset + atomIndexLocal;
// Staging coordinates - only for spline computation
__local float sm_coordinates[DIM * atomsPerBlock];
- const int atomIndexOffset = get_group_id(XX) * atomsPerBlock;
+ const int atomIndexOffset = (int)get_group_id(XX) * atomsPerBlock;
/* Staging coefficients/charges for both spline and spread */
pme_gpu_stage_atom_data(kernelParams, sm_coefficients, gm_coefficients, 1);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "pme_internal.h"
#include "pme_simd.h"
#include "pme_spline_work.h"
+#include "spline_vectors.h"
/* TODO consider split of pme-spline from this file */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013-2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <cassert>
#include "gromacs/gpu_utils/cuda_kernel_utils.cuh"
+#include "gromacs/gpu_utils/typecasts.cuh"
#include "pme.cuh"
#include "pme_calculate_splines.cuh"
* Optional second stage of the spline_and_spread_kernel.
*
* \tparam[in] order PME interpolation order.
- * \tparam[in] wrapX A boolean which tells if the grid overlap in dimension X should
- * be wrapped. \tparam[in] wrapY A boolean which tells if the grid overlap in
- * dimension Y should be wrapped. \tparam[in] useOrderThreads A boolean which Tells if we
- * should use order threads per atom (order*order used if false) \param[in] kernelParams Input PME
- * CUDA data in constant memory. \param[in] atomIndexOffset Starting atom index for the
- * execution block w.r.t. global memory. \param[in] atomCharge Atom charge/coefficient of
- * atom processed by thread. \param[in] sm_gridlineIndices Atom gridline indices in the shared
- * memory. \param[in] sm_theta Atom spline values in the shared memory.
+ * \tparam[in] wrapX Whether the grid overlap in dimension X should be wrapped.
+ * \tparam[in] wrapY Whether the grid overlap in dimension Y should be wrapped.
+ * \tparam[in] useOrderThreads Whether we should use order threads per atom (order*order used if false).
+ *
+ * \param[in] kernelParams Input PME CUDA data in constant memory.
+ * \param[in] atomIndexOffset Starting atom index for the execution block w.r.t. global memory.
+ * \param[in] atomCharge Atom charge/coefficient of atom processed by thread.
+ * \param[in] sm_gridlineIndices Atom gridline indices in the shared memory.
+ * \param[in] sm_theta Atom spline values in the shared memory.
*/
template<const int order, const bool wrapX, const bool wrapY, const bool useOrderThreads>
__device__ __forceinline__ void spread_charges(const PmeGpuCudaKernelParams kernelParams,
if (computeSplines)
{
+ const float3* __restrict__ gm_coordinates = asFloat3(kernelParams.atoms.d_coordinates);
if (c_useAtomDataPrefetch)
{
// Coordinates
- __shared__ float sm_coordinates[DIM * atomsPerBlock];
+ __shared__ float3 sm_coordinates[atomsPerBlock];
/* Staging coordinates */
- pme_gpu_stage_atom_data<float, atomsPerBlock, DIM>(kernelParams, sm_coordinates,
- kernelParams.atoms.d_coordinates);
+ pme_gpu_stage_atom_data<float3, atomsPerBlock, 1>(kernelParams, sm_coordinates, gm_coordinates);
__syncthreads();
- atomX.x = sm_coordinates[atomIndexLocal * DIM + XX];
- atomX.y = sm_coordinates[atomIndexLocal * DIM + YY];
- atomX.z = sm_coordinates[atomIndexLocal * DIM + ZZ];
+ atomX = sm_coordinates[atomIndexLocal];
}
else
{
- atomX.x = kernelParams.atoms.d_coordinates[atomIndexGlobal * DIM + XX];
- atomX.y = kernelParams.atoms.d_coordinates[atomIndexGlobal * DIM + YY];
- atomX.z = kernelParams.atoms.d_coordinates[atomIndexGlobal * DIM + ZZ];
+ atomX = gm_coordinates[atomIndexGlobal];
}
calculate_splines<order, atomsPerBlock, atomsPerWarp, false, writeGlobal>(
kernelParams, atomIndexOffset, atomX, atomCharge, sm_theta, &dtheta, sm_gridlineIndices);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-/*! \libinternal \file
- * \brief Sets gmx_nbnxn_gpu_t to the correct type depending on the build
+/*! \internal \file
*
- * \ingroup module_nbnxm
+ * \brief This file declares a type useful for spline vectors
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_ewald
*/
-#ifndef GMX_NBNXN_GPU_TYPES_H
-#define GMX_NBNXN_GPU_TYPES_H
-
-#include "config.h"
-
-#ifndef DOXYGEN
-
-# if GMX_GPU == GMX_GPU_OPENCL
-struct gmx_nbnxn_ocl_t;
-using gmx_nbnxn_gpu_t = gmx_nbnxn_ocl_t;
-# endif
-
-# if GMX_GPU == GMX_GPU_CUDA
-struct gmx_nbnxn_cuda_t;
-using gmx_nbnxn_gpu_t = gmx_nbnxn_cuda_t;
-# endif
+#ifndef GMX_EWALD_SPLINE_VECTORS_H
+#define GMX_EWALD_SPLINE_VECTORS_H
-# if GMX_GPU == GMX_GPU_NONE
-using gmx_nbnxn_gpu_t = int;
-# endif
+#include "gromacs/math/vectypes.h"
+#include "gromacs/utility/real.h"
-#endif // !DOXYGEN
+/*! \brief Helper typedef for spline vectors */
+typedef real* splinevec[DIM];
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
using PmeBSplineModuliFailureTest = PmeBSplineModuliTest;
TEST_P(PmeBSplineModuliFailureTest, Throws)
{
- EXPECT_THROW(runTest(), InconsistentInputError);
+ EXPECT_THROW_GMX(runTest(), InconsistentInputError);
}
//! Correctness test alias
using PmeBSplineModuliCorrectnessTest = PmeBSplineModuliTest;
TEST_P(PmeBSplineModuliCorrectnessTest, ReproducesValues)
{
- EXPECT_NO_THROW(runTest());
+ EXPECT_NO_THROW_GMX(runTest());
}
/* Invalid input instances */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* The rest of the atom-related input data - gridline indices, spline theta values, spline dtheta
* values, atom charges - is looked up in the inputAtomDataSets_ test fixture variable.
*/
-typedef std::tuple<Matrix3x3, int, IVec, SparseRealGridValuesInput, PmeForceOutputHandling, size_t> GatherInputParameters;
+typedef std::tuple<Matrix3x3, int, IVec, SparseRealGridValuesInput, size_t> GatherInputParameters;
//! Test fixture
class PmeGatherTest : public ::testing::TestWithParam<GatherInputParameters>
IVec gridSize;
size_t atomCount;
SparseRealGridValuesInput nonZeroGridValues;
- PmeForceOutputHandling inputForceTreatment;
- std::tie(box, pmeOrder, gridSize, nonZeroGridValues, inputForceTreatment, atomCount) = GetParam();
+ std::tie(box, pmeOrder, gridSize, nonZeroGridValues, atomCount) = GetParam();
auto inputAtomData = s_inputAtomDataSets_[atomCount];
auto inputAtomSplineData = inputAtomData.splineDataByPmeOrder[pmeOrder];
if (!supportedInput)
{
/* Testing the failure for the unsupported input */
- EXPECT_THROW(pmeInitWrapper(&inputRec, codePath, nullptr, nullptr, box), NotImplementedError);
+ EXPECT_THROW_GMX(pmeInitWrapper(&inputRec, codePath, nullptr, nullptr, box),
+ NotImplementedError);
continue;
}
/* Describing the test uniquely */
SCOPED_TRACE(
formatString("Testing force gathering with %s %sfor PME grid size %d %d %d"
- ", order %d, %zu atoms, %s",
+ ", order %d, %zu atoms",
codePathToString(codePath), context->getDescription().c_str(),
- gridSize[XX], gridSize[YY], gridSize[ZZ], pmeOrder, atomCount,
- (inputForceTreatment == PmeForceOutputHandling::ReduceWithInput)
- ? "with reduction"
- : "without reduction"));
+ gridSize[XX], gridSize[YY], gridSize[ZZ], pmeOrder, atomCount));
PmeSafePointer pmeSafe = pmeInitWrapper(&inputRec, codePath, context->getDeviceInfo(),
context->getPmeGpuProgram(), box);
auto forces = ForcesVector(inputForcesFull).subArray(0, atomCount);
/* Running the force gathering itself */
- pmePerformGather(pmeSafe.get(), codePath, inputForceTreatment, forces);
+ pmePerformGather(pmeSafe.get(), codePath, forces);
pmeFinalizeTest(pmeSafe.get(), codePath);
/* Check the output forces correctness */
//! Test for PME force gathering
TEST_P(PmeGatherTest, ReproducesOutputs)
{
- EXPECT_NO_THROW(runTest());
+ EXPECT_NO_THROW_GMX(runTest());
}
//! Instantiation of the PME gathering test
::testing::ValuesIn(pmeOrders),
::testing::ValuesIn(c_sampleGridSizes),
::testing::ValuesIn(c_sampleGrids),
- ::testing::Values(PmeForceOutputHandling::Set,
- PmeForceOutputHandling::ReduceWithInput),
::testing::ValuesIn(atomCounts)));
} // namespace
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (!supportedInput)
{
/* Testing the failure for the unsupported input */
- EXPECT_THROW(pmeInitEmpty(&inputRec, codePath, nullptr, nullptr, box, ewaldCoeff_q,
- ewaldCoeff_lj),
- NotImplementedError);
+ EXPECT_THROW_GMX(pmeInitEmpty(&inputRec, codePath, nullptr, nullptr, box,
+ ewaldCoeff_q, ewaldCoeff_lj),
+ NotImplementedError);
continue;
}
/*! \brief Test for PME solving */
TEST_P(PmeSolveTest, ReproducesOutputs)
{
- EXPECT_NO_THROW(runTest());
+ EXPECT_NO_THROW_GMX(runTest());
}
/* Valid input instances */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (!supportedInput)
{
/* Testing the failure for the unsupported input */
- EXPECT_THROW(pmeInitWrapper(&inputRec, codePath, nullptr, nullptr, box), NotImplementedError);
+ EXPECT_THROW_GMX(pmeInitWrapper(&inputRec, codePath, nullptr, nullptr, box),
+ NotImplementedError);
continue;
}
/*! \brief Test for spline parameter computation and charge spreading. */
TEST_P(PmeSplineAndSpreadTest, ReproducesOutputs)
{
- EXPECT_NO_THROW(runTest());
+ EXPECT_NO_THROW_GMX(runTest());
}
/* Valid input instances */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/domdec.h"
#include "gromacs/ewald/pme_gather.h"
#include "gromacs/ewald/pme_gpu_internal.h"
+#include "gromacs/ewald/pme_gpu_staging.h"
#include "gromacs/ewald/pme_grid.h"
#include "gromacs/ewald/pme_internal.h"
#include "gromacs/ewald/pme_redistribute.h"
//! PME initialization
PmeSafePointer pmeInitWrapper(const t_inputrec* inputRec,
const CodePath mode,
- const gmx_device_info_t* gpuInfo,
- PmeGpuProgramHandle pmeGpuProgram,
+ const DeviceInformation* deviceInfo,
+ const PmeGpuProgram* pmeGpuProgram,
const Matrix3x3& box,
const real ewaldCoeff_q,
const real ewaldCoeff_lj)
NumPmeDomains numPmeDomains = { 1, 1 };
gmx_pme_t* pmeDataRaw =
gmx_pme_init(&dummyCommrec, numPmeDomains, inputRec, false, false, true, ewaldCoeff_q,
- ewaldCoeff_lj, 1, runMode, nullptr, gpuInfo, pmeGpuProgram, dummyLogger);
+ ewaldCoeff_lj, 1, runMode, nullptr, deviceInfo, pmeGpuProgram, dummyLogger);
PmeSafePointer pme(pmeDataRaw); // taking ownership
// TODO get rid of this with proper matrix type
boxTemp[i][j] = box[i * DIM + j];
}
}
- const char* boxError = check_box(-1, boxTemp);
+ const char* boxError = check_box(PbcType::Unset, boxTemp);
GMX_RELEASE_ASSERT(boxError == nullptr, boxError);
switch (mode)
//! Simple PME initialization based on input, no atom data
PmeSafePointer pmeInitEmpty(const t_inputrec* inputRec,
const CodePath mode,
- const gmx_device_info_t* gpuInfo,
- PmeGpuProgramHandle pmeGpuProgram,
+ const DeviceInformation* deviceInfo,
+ const PmeGpuProgram* pmeGpuProgram,
const Matrix3x3& box,
real ewaldCoeff_q,
real ewaldCoeff_lj)
{
- return pmeInitWrapper(inputRec, mode, gpuInfo, pmeGpuProgram, box, ewaldCoeff_q, ewaldCoeff_lj);
+ return pmeInitWrapper(inputRec, mode, deviceInfo, pmeGpuProgram, box, ewaldCoeff_q, ewaldCoeff_lj);
// hiding the fact that PME actually needs to know the number of atoms in advance
}
}
//! PME force gathering
-void pmePerformGather(gmx_pme_t* pme, CodePath mode, PmeForceOutputHandling inputTreatment, ForcesVector& forces)
+void pmePerformGather(gmx_pme_t* pme, CodePath mode, ForcesVector& forces)
{
PmeAtomComm* atc = &(pme->atc[0]);
const index atomCount = atc->numAtoms();
GMX_RELEASE_ASSERT(forces.ssize() == atomCount, "Invalid force buffer size");
- const bool forceReductionWithInput = (inputTreatment == PmeForceOutputHandling::ReduceWithInput);
- const real scale = 1.0;
- const size_t threadIndex = 0;
- const size_t gridIndex = 0;
- real* pmegrid = pme->pmegrid[gridIndex].grid.grid;
- real* fftgrid = pme->fftgrid[gridIndex];
+ const real scale = 1.0;
+ const size_t threadIndex = 0;
+ const size_t gridIndex = 0;
+ real* pmegrid = pme->pmegrid[gridIndex].grid.grid;
+ real* fftgrid = pme->fftgrid[gridIndex];
switch (mode)
{
}
copy_fftgrid_to_pmegrid(pme, fftgrid, pmegrid, gridIndex, pme->nthread, threadIndex);
unwrap_periodic_pmegrid(pme, pmegrid);
- gather_f_bsplines(pme, pmegrid, !forceReductionWithInput, atc, &atc->spline[threadIndex], scale);
+ gather_f_bsplines(pme, pmegrid, true, atc, &atc->spline[threadIndex], scale);
break;
case CodePath::GPU:
PmeOutput output = pme_gpu_getOutput(*pme, GMX_PME_CALC_F);
GMX_ASSERT(forces.size() == output.forces_.size(),
"Size of force buffers did not match");
- if (forceReductionWithInput)
- {
- std::copy(std::begin(forces), std::end(forces), std::begin(output.forces_));
- }
- pme_gpu_gather(pme->gpu, inputTreatment, reinterpret_cast<float*>(fftgrid));
+ pme_gpu_gather(pme->gpu, reinterpret_cast<float*>(fftgrid));
std::copy(std::begin(output.forces_), std::end(output.forces_), std::begin(forces));
}
break;
switch (mode)
{
case CodePath::GPU:
- memcpy(pme->gpu->staging.h_gridlineIndices, gridLineIndices.data(),
+ memcpy(pme_gpu_staging(pme->gpu).h_gridlineIndices, gridLineIndices.data(),
atomCount * sizeof(gridLineIndices[0]));
break;
{
case CodePath::GPU:
gridLineIndices = arrayRefFromArray(
- reinterpret_cast<IVec*>(pme->gpu->staging.h_gridlineIndices), atomCount);
+ reinterpret_cast<IVec*>(pme_gpu_staging(pme->gpu).h_gridlineIndices), atomCount);
break;
case CodePath::CPU: gridLineIndices = atc->idx; break;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! PME initialization
PmeSafePointer pmeInitWrapper(const t_inputrec* inputRec,
CodePath mode,
- const gmx_device_info_t* gpuInfo,
- PmeGpuProgramHandle pmeGpuProgram,
+ const DeviceInformation* deviceInfo,
+ const PmeGpuProgram* pmeGpuProgram,
const Matrix3x3& box,
real ewaldCoeff_q = 1.0F,
real ewaldCoeff_lj = 1.0F);
//! Simple PME initialization (no atom data)
PmeSafePointer pmeInitEmpty(const t_inputrec* inputRec,
CodePath mode = CodePath::CPU,
- const gmx_device_info_t* gpuInfo = nullptr,
- PmeGpuProgramHandle pmeGpuProgram = nullptr,
+ const DeviceInformation* deviceInfo = nullptr,
+ const PmeGpuProgram* pmeGpuProgram = nullptr,
const Matrix3x3& box = { { 1.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 1.0F } },
real ewaldCoeff_q = 0.0F,
real ewaldCoeff_lj = 0.0F);
GridOrdering gridOrdering,
bool computeEnergyAndVirial);
//! PME force gathering
-void pmePerformGather(gmx_pme_t* pme,
- CodePath mode,
- PmeForceOutputHandling inputTreatment,
- ForcesVector& forces); //NOLINT(google-runtime-references)
+void pmePerformGather(gmx_pme_t* pme,
+ CodePath mode,
+ ForcesVector& forces); //NOLINT(google-runtime-references)
//! PME test finalization before fetching the outputs
void pmeFinalizeTest(const gmx_pme_t* pme, CodePath mode);
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-4.2362713136143704</Real>
- <Real Name="Y">-2.3275379753649541</Real>
- <Real Name="Z">-11.746263473883745</Real>
+ <Real Name="X">-3.4582204419484599</Real>
+ <Real Name="Y">-3.9969224751666577</Real>
+ <Real Name="Z">-9.9756355772564991</Real>
</Vector>
<Vector>
- <Real Name="X">0.57636324498554081</Real>
- <Real Name="Y">-0.013594713514657464</Real>
- <Real Name="Z">-6.1436686744664879</Real>
+ <Real Name="X">-0.067954884757908562</Real>
+ <Real Name="Y">-0.85449341275494772</Real>
+ <Real Name="Z">-5.12573966904852</Real>
</Vector>
</Sequence>
</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">2.6940571045158022</Real>
- <Real Name="Y">2.1019189996213141</Real>
- <Real Name="Z">-0.21251856629141863</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.19104463336113997</Real>
- <Real Name="Y">-16.083563532509753</Real>
- <Real Name="Z">2.8065205292802267</Real>
- </Vector>
- <Vector>
- <Real Name="X">-2.6398356036393578</Real>
- <Real Name="Y">-0.91018032292522766</Real>
- <Real Name="Z">0.93368498675769429</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-8.0544456082501288</Real>
- <Real Name="Y">-11.923968234039531</Real>
- <Real Name="Z">1.9257328983388657</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-0.59903073971265186</Real>
- <Real Name="Y">-1.6350310136998707</Real>
- <Real Name="Z">-2.6446765062295143</Real>
- </Vector>
- <Vector>
- <Real Name="X">-7.7106240328717144</Real>
- <Real Name="Y">-1.2779139061856373</Real>
- <Real Name="Z">2.2200763403785335</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.060088412760632121</Real>
- <Real Name="Y">-1.4519790167692483</Real>
- <Real Name="Z">0.24378158880830342</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-1.3603736897226484</Real>
- <Real Name="Y">-1.4452674741283262</Real>
- <Real Name="Z">-0.088156767496452001</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-8.0344456086971636</Real>
- <Real Name="Y">-11.05396822927116</Real>
- <Real Name="Z">2.8757328864179366</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-0.5790307401596867</Real>
- <Real Name="Y">-0.76503100893149911</Real>
- <Real Name="Z">-1.6946765181504433</Real>
- </Vector>
- <Vector>
- <Real Name="X">-7.0506240066456707</Real>
- <Real Name="Y">-0.60791388949633673</Real>
- <Real Name="Z">2.6000763356101619</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.76991157055006731</Real>
- <Real Name="Y">-1.1419790143850626</Real>
- <Real Name="Z">0.9737816078817898</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">-1.0903736789938123</Real>
- <Real Name="Y">-0.46526745505483991</Real>
- <Real Name="Z">0.7418432158142475</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-9.4063956103865909</Real>
- <Real Name="Y">1.0613765111849376</Real>
- <Real Name="Z">1.4765278904032615</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">1.6526713761104288</Real>
- <Real Name="Y">1.789898728665017</Real>
- <Real Name="Z">-0.59016766968693601</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.82999998331069946</Real>
- <Real Name="Y">0.31000000238418579</Real>
- <Real Name="Z">0.73000001907348633</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-3.3126533138132714</Real>
- <Real Name="Y">-8.6003366303629782</Real>
- <Real Name="Z">-22.745529254386152</Real>
+ <Real Name="X">-2.9109058261904628</Real>
+ <Real Name="Y">-11.975420811795583</Real>
+ <Real Name="Z">-18.523630115333241</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.82959875104586944</Real>
- <Real Name="Y">-20.491954418617421</Real>
- <Real Name="Z">2.8871516559459058</Real>
- </Vector>
- <Vector>
- <Real Name="X">-2.7217414105226196</Real>
- <Real Name="Y">-1.2127254019801541</Real>
- <Real Name="Z">0.55819396762823659</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-9.3863956108336257</Real>
- <Real Name="Y">1.9313765159533092</Real>
- <Real Name="Z">2.4265278784823323</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">2.3126714023364725</Real>
- <Real Name="Y">2.4598987453543177</Real>
- <Real Name="Z">-0.2101676744553076</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.00040123226483002039</Real>
- <Real Name="Y">-20.181954416233236</Real>
- <Real Name="Z">3.6171516750193922</Real>
- </Vector>
- <Vector>
- <Real Name="X">-2.0117414319802918</Real>
- <Real Name="Y">-1.1527254033212586</Real>
- <Real Name="Z">0.90819396166777211</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-6.5442370567032295</Real>
- <Real Name="Y">-14.904960292549413</Real>
- <Real Name="Z">2.4825316419739121</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-0.48671247601652962</Real>
- <Real Name="Y">-2.0437887671248385</Real>
- <Real Name="Z">-1.9489107480528729</Real>
- </Vector>
- <Vector>
- <Real Name="X">-6.2648820267082685</Real>
- <Real Name="Y">-1.5973923827320464</Real>
- <Real Name="Z">1.9008625299783468</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.0488218353680136</Real>
- <Real Name="Y">-1.8149737709615605</Real>
- <Real Name="Z">0.30251804902903451</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-1.1053036228996518</Real>
- <Real Name="Y">-1.8065843426604078</Real>
- <Real Name="Z">0.051190455240391619</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-6.5242370571502644</Real>
- <Real Name="Y">-14.034960287781042</Real>
- <Real Name="Z">3.4325316300529831</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-0.46671247646356445</Real>
- <Real Name="Y">-1.1737887623564669</Real>
- <Real Name="Z">-0.99891075997380185</Real>
- </Vector>
- <Vector>
- <Real Name="X">-5.6048820004822248</Real>
- <Real Name="Y">-0.92739236604274589</Real>
- <Real Name="Z">2.280862525209975</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.78117814794268581</Real>
- <Real Name="Y">-1.5049737685773747</Real>
- <Real Name="Z">1.0325180681025208</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.83530361217081572</Real>
- <Real Name="Y">-0.82658432358692147</Real>
- <Real Name="Z">0.88119043855109114</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">0.55642797645760989</Real>
- <Real Name="Y">0.3723331315116295</Real>
- <Real Name="Z">1.6306575619901507</Real>
+ <Real Name="X">-10.129964503493252</Real>
+ <Real Name="Y">1.0239161111946309</Real>
+ <Real Name="Z">-8.1365401298928379</Real>
</Vector>
</Sequence>
</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">3.4320122274828666</Real>
- <Real Name="Y">-0.81224418229071649</Real>
- <Real Name="Z">-0.764761636476889</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">12.870589400646217</Real>
- <Real Name="Y">2.4002360860135794</Real>
- <Real Name="Z">-2.7526346195710181</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-3.9130491664545959</Real>
- <Real Name="Y">-0.62204635074971815</Real>
- <Real Name="Z">1.1633583220151211</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">4.1305407769409488</Real>
- <Real Name="Y">-0.46469970389626269</Real>
- <Real Name="Z">-3.6193285397896875</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.1597567999404905</Real>
- <Real Name="Y">-0.73800016335319685</Real>
- <Real Name="Z">-0.54897393926970917</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">2.2124223213639174</Real>
- <Real Name="Y">-16.220145737822616</Real>
- <Real Name="Z">2.8258755564357965</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">3.4520122270358318</Real>
- <Real Name="Y">0.057755822477655094</Real>
- <Real Name="Z">0.18523835160218205</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">13.530589426872261</Real>
- <Real Name="Y">3.0702361027028799</Real>
- <Real Name="Z">-2.3726346243393897</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-3.8930491669016307</Real>
- <Real Name="Y">0.24795365401865344</Real>
- <Real Name="Z">2.1133583100941919</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">4.9605407602516483</Real>
- <Real Name="Y">-0.1546997015120769</Real>
- <Real Name="Z">-2.8893285207162012</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.55024317860183736</Real>
- <Real Name="Y">-0.67800016469430135</Real>
- <Real Name="Z">-0.19897394523017364</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">2.4824223320927534</Real>
- <Real Name="Y">-15.24014571874913</Real>
- <Real Name="Z">3.6558755397464959</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-16.500695458472016</Real>
- <Real Name="Y">-15.572010667113076</Real>
- <Real Name="Z">6.0618364657657224</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-0.56750283571532234</Real>
- <Real Name="Y">-0.70603611451836135</Real>
- <Real Name="Z">-0.73298662849655538</Real>
- </Vector>
- <Vector>
- <Real Name="X">-7.5662986143550031</Real>
- <Real Name="Y">-4.9570092424793035</Real>
- <Real Name="Z">0.22987632186540616</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-8.3516260207559565</Real>
- <Real Name="Y">-0.89155680381272195</Real>
- <Real Name="Z">1.9626024243687374</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-10.991689448063681</Real>
- <Real Name="Y">-17.399473852314976</Real>
- <Real Name="Z">1.9943402280115583</Real>
- </Vector>
- <Vector>
- <Real Name="X">-1.5304702532285459</Real>
- <Real Name="Y">-2.0431421404374799</Real>
- <Real Name="Z">-2.0385186389652117</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-7.0292328592073234</Real>
- <Real Name="Y">-14.608255429729208</Real>
- <Real Name="Z">3.679921612389506</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.67546778632879001</Real>
- <Real Name="Y">-0.07424836221296291</Real>
- <Real Name="Z">0.089381774901316297</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-16.480695458919051</Real>
- <Real Name="Y">-14.702010662344705</Real>
- <Real Name="Z">7.0118364538447935</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44047122348806367</Real>
- <Real Name="Y">0.3871114065335613</Real>
- <Real Name="Z">2.3221153764227829</Real>
+ <Real Name="X">1.7797999435035388</Real>
+ <Real Name="Y">1.7267257437615944</Real>
+ <Real Name="Z">1.3771557011554771</Real>
</Vector>
</Sequence>
</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-0.54750283616235718</Real>
- <Real Name="Y">0.16396389025001024</Real>
- <Real Name="Z">0.21701335958251566</Real>
- </Vector>
- <Vector>
- <Real Name="X">-6.9062985881289594</Real>
- <Real Name="Y">-4.287009225790003</Real>
- <Real Name="Z">0.6098763170970346</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-8.3316260212029913</Real>
- <Real Name="Y">-0.021556799044350372</Real>
- <Real Name="Z">2.9126024124478085</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-10.161689464752982</Real>
- <Real Name="Y">-17.089473849930791</Real>
- <Real Name="Z">2.7243402470850446</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.82047027468621803</Real>
- <Real Name="Y">-1.9831421417785844</Real>
- <Real Name="Z">-1.6885186449256762</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">-6.7592328484784874</Real>
- <Real Name="Y">-13.628255410655722</Real>
- <Real Name="Z">4.5099215957002059</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.38546779467344028</Real>
- <Real Name="Y">0.02575163927715321</Real>
- <Real Name="Z">0.76938178205387364</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">2.788509934829829</Real>
- <Real Name="Y">-1.0153052278633954</Real>
- <Real Name="Z">-0.5654353231810999</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">10.457353888025052</Real>
- <Real Name="Y">3.0002951075169739</Real>
- <Real Name="Z">-2.4443752014337479</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-3.1793524477443595</Real>
- <Real Name="Y">-0.77755793843714771</Real>
- <Real Name="Z">0.99148224011632069</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">3.3560643812645212</Real>
- <Real Name="Y">-0.58087462987032856</Real>
- <Real Name="Z">-2.8401295588358915</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.12980239995164852</Real>
- <Real Name="Y">-0.92250020419149636</Real>
- <Real Name="Z">-0.37393805370732247</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">1.7975931361081829</Real>
- <Real Name="Y">-20.275182172278267</Real>
- <Real Name="Z">3.4378840352447644</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">2.8085099343827942</Real>
- <Real Name="Y">-0.14530522309502381</Real>
- <Real Name="Z">0.38456466489797114</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">11.117353914251096</Real>
- <Real Name="Y">3.6702951242062745</Real>
- <Real Name="Z">-2.0643752062021195</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-3.1593524481913944</Real>
- <Real Name="Y">0.092442066331223871</Real>
- <Real Name="Z">1.9414822281953916</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">4.1860643645752207</Real>
- <Real Name="Y">-0.27087462748614277</Real>
- <Real Name="Z">-2.1101295397624051</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.58019757859067933</Real>
- <Real Name="Y">-0.86250020553260087</Real>
- <Real Name="Z">-0.023938059667786948</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">2.067593146837019</Real>
- <Real Name="Y">-19.295182153204781</Real>
- <Real Name="Z">4.2678840185554634</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-13.406815060008514</Real>
- <Real Name="Y">-19.465013333891342</Real>
- <Real Name="Z">6.0748932006495915</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-3.4931516109310436</Real>
- <Real Name="Y">-1.1695586621622649</Real>
- <Real Name="Z">0.37948711624127879</Real>
- </Vector>
- <Vector>
- <Real Name="X">-6.1476176241634404</Real>
- <Real Name="Y">-6.196261553099129</Real>
- <Real Name="Z">0.61604971101077255</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-8.1581138200755436</Real>
- <Real Name="Y">-14.70340061881376</Real>
- <Real Name="Z">-8.9453847792568535</Real>
+ <Real Name="X">-0.89341403958785948</Real>
+ <Real Name="Y">-19.76870795422418</Real>
+ <Real Name="Z">-5.5136166998409726</Real>
</Vector>
<Vector>
- <Real Name="X">-8.4309497156824804</Real>
- <Real Name="Y">-11.184451168201075</Real>
- <Real Name="Z">-7.7012318674352152</Real>
+ <Real Name="X">-2.9311061344089753</Real>
+ <Real Name="Y">-1.1699232689408006</Real>
+ <Real Name="Z">-3.2719141904858438</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-6.7856961418642161</Real>
- <Real Name="Y">-1.1144460047659024</Real>
- <Real Name="Z">1.6740807570530818</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-8.9307476765517411</Real>
- <Real Name="Y">-21.749342315393726</Real>
- <Real Name="Z">2.9757623819770487</Real>
- </Vector>
- <Vector>
- <Real Name="X">-1.2435070807481936</Real>
- <Real Name="Y">-2.5539276755468499</Real>
- <Real Name="Z">-1.4344239512261392</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-5.7112516981059507</Real>
- <Real Name="Y">-18.260319287161511</Real>
- <Real Name="Z">4.0572521792161034</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.5488175763921419</Real>
- <Real Name="Y">-0.092810452766203616</Real>
- <Real Name="Z">0.081070341914709868</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-13.386815060455548</Real>
- <Real Name="Y">-18.59501332912297</Real>
- <Real Name="Z">7.0248931887286625</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-3.4731516113780785</Real>
- <Real Name="Y">-0.29955865739389331</Real>
- <Real Name="Z">1.3294871043203498</Real>
- </Vector>
- <Vector>
- <Real Name="X">-5.4876175979373967</Real>
- <Real Name="Y">-5.5262615364098284</Real>
- <Real Name="Z">0.99604970624240097</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">-6.7656961423112509</Real>
- <Real Name="Y">-0.24444599999753081</Real>
- <Real Name="Z">2.6240807451321526</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-8.1007476932410416</Real>
- <Real Name="Y">-21.43934231300954</Real>
- <Real Name="Z">3.705762401050535</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.53350710220586572</Real>
- <Real Name="Y">-2.4939276768879544</Real>
- <Real Name="Z">-1.0844239571866037</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">-5.4412516873771146</Real>
- <Real Name="Y">-17.280319268088025</Real>
- <Real Name="Z">4.8872521625268028</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.25881758473679217</Real>
- <Real Name="Y">0.0071895487239125033</Real>
- <Real Name="Z">0.76107034906726723</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">0.57642797601057505</Real>
- <Real Name="Y">1.242333136280001</Real>
- <Real Name="Z">2.5806575500692217</Real>
+ <Real Name="X">-7.0476399072188638</Real>
+ <Real Name="Y">-14.378902132683789</Real>
+ <Real Name="Z">-14.272277552262375</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-0.52415189724857048</Real>
+ <Real Name="Y">-1.9716549447673803</Real>
+ <Real Name="Z">-18.815861243981043</Real>
</Vector>
<Vector>
- <Real Name="X">1.1004712497141074</Real>
- <Real Name="Y">1.0571114232228618</Real>
- <Real Name="Z">2.7021153716544113</Real>
+ <Real Name="X">-6.7467960287627502</Real>
+ <Real Name="Y">-1.5410137489785949</Real>
+ <Real Name="Z">-1.2290404991250639</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-7.3281138367648442</Real>
- <Real Name="Y">-14.393400616429574</Real>
- <Real Name="Z">-8.2153847601833672</Real>
+ <Real Name="X">-0.052577361165553116</Real>
+ <Real Name="Y">-1.7509157833241376</Real>
+ <Real Name="Z">-0.070066070618527432</Real>
</Vector>
<Vector>
- <Real Name="X">-7.7209497371401525</Real>
- <Real Name="Y">-11.12445116954218</Real>
- <Real Name="Z">-7.3512318733956796</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
+ <Real Name="X">-1.1903269785073174</Real>
+ <Real Name="Y">-1.7428224529077028</Real>
+ <Real Name="Z">-4.3636777044640338</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-16.205517527929572</Real>
- <Real Name="Y">-7.3188043172213684</Real>
- <Real Name="Z">-7.9336359387100472</Real>
+ <Real Name="X">-8.2305961590882664</Real>
+ <Real Name="Y">1.2798951389932887</Real>
+ <Real Name="Z">-6.3929958163443716</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-3.4582204419484599</Real>
- <Real Name="Y">-3.9969224751666577</Real>
- <Real Name="Z">-9.9756355772564991</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.067954884757908562</Real>
- <Real Name="Y">-0.85449341275494772</Real>
- <Real Name="Z">-5.12573966904852</Real>
+ <Real Name="X">1.4460874540966253</Real>
+ <Real Name="Y">2.1584071797019928</Real>
+ <Real Name="Z">1.0820509080507321</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
+ <Real Name="X">-0.72589890716513583</Real>
+ <Real Name="Y">-24.710884942780222</Real>
+ <Real Name="Z">-4.3321274070179072</Real>
+ </Vector>
+ <Vector>
+ <Real Name="X">-2.3815237342072924</Real>
+ <Real Name="Y">-1.4624040861760008</Real>
+ <Real Name="Z">-2.5707897210960202</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Y">0</Real>
<Real Name="Z">0</Real>
</Vector>
- <Vector>
- <Real Name="X">-2.9109058261904628</Real>
- <Real Name="Y">-11.975420811795583</Real>
- <Real Name="Z">-18.523630115333241</Real>
- </Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Y">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-16.185517528376607</Real>
- <Real Name="Y">-6.4488043124529968</Real>
- <Real Name="Z">-6.9836359506309762</Real>
+ <Real Name="X">-5.7262074246153265</Real>
+ <Real Name="Y">-17.973627665854735</Real>
+ <Real Name="Z">-11.213932362491866</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-3.4382204423954947</Real>
- <Real Name="Y">-3.1269224703982861</Real>
- <Real Name="Z">-9.025635589177428</Real>
+ <Real Name="X">-0.42587341651446342</Real>
+ <Real Name="Y">-2.4645686809592258</Real>
+ <Real Name="Z">-14.783890977413678</Real>
</Vector>
<Vector>
- <Real Name="X">0.59204514146813514</Real>
- <Real Name="Y">-0.18449339606564719</Real>
- <Real Name="Z">-4.7457396738168915</Real>
+ <Real Name="X">-5.4817717733697346</Real>
+ <Real Name="Y">-1.9262671862232437</Real>
+ <Real Name="Z">-0.96567467788397876</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.82999998331069946</Real>
- <Real Name="Y">0.31000000238418579</Real>
- <Real Name="Z">0.73000001907348633</Real>
+ <Real Name="X">-0.0427191059470119</Real>
+ <Real Name="Y">-2.1886447291551718</Real>
+ <Real Name="Z">-0.055051912628842979</Real>
</Vector>
<Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-2.6409058154616267</Real>
- <Real Name="Y">-10.995420792722097</Real>
- <Real Name="Z">-17.693630132022541</Real>
+ <Real Name="X">-0.96714067003719539</Real>
+ <Real Name="Y">-2.1785280661346289</Real>
+ <Real Name="Z">-3.4286039106503119</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-10.129964503493252</Real>
- <Real Name="Y">1.0239161111946307</Real>
- <Real Name="Z">-8.1365401298928379</Real>
+ <Real Name="X">3.0030106990475081</Real>
+ <Real Name="Y">-0.97947087544725719</Real>
+ <Real Name="Z">0.52873130622863018</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">1.7797999435035388</Real>
- <Real Name="Y">1.7267257437615944</Real>
- <Real Name="Z">1.3771557011554771</Real>
+ <Real Name="X">11.261765725565441</Real>
+ <Real Name="Y">2.8944021905057711</Real>
+ <Real Name="Z">8.1326966202729416</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
+ <Real Name="X">-3.423918020647772</Real>
+ <Real Name="Y">-0.75011467859246217</Real>
+ <Real Name="Z">-0.37339673869951689</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.89341403958785948</Real>
- <Real Name="Y">-19.76870795422418</Real>
- <Real Name="Z">-5.5136166998409726</Real>
+ <Real Name="X">3.6142231798233309</Real>
+ <Real Name="Y">-0.5603731435929743</Real>
+ <Real Name="Z">-15.314157091800631</Real>
</Vector>
<Vector>
- <Real Name="X">-2.9311061344089753</Real>
- <Real Name="Y">-1.1699232689408006</Real>
- <Real Name="Z">-3.2719141904858438</Real>
+ <Real Name="X">-0.13978719994792918</Real>
+ <Real Name="Y">-0.88994132779279667</Real>
+ <Real Name="Z">-4.3663155404400467</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
+ <Real Name="X">1.935869531193428</Real>
+ <Real Name="Y">-19.559586503779869</Real>
+ <Real Name="Z">4.8894339493261105</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-10.109964503940287</Real>
- <Real Name="Y">1.8939161159630022</Real>
- <Real Name="Z">-7.1865401418137669</Real>
+ <Real Name="X">-14.438108526163012</Real>
+ <Real Name="Y">-18.778011899791231</Real>
+ <Real Name="Z">-7.4710258563699679</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-0.49656498125090714</Real>
+ <Real Name="Y">-0.85139644735204068</Real>
+ <Real Name="Z">-6.170384440946111</Real>
</Vector>
<Vector>
- <Real Name="X">2.4397999697295827</Real>
- <Real Name="Y">2.3967257604508951</Real>
- <Real Name="Z">1.7571556963871056</Real>
+ <Real Name="X">-6.6205112875606282</Real>
+ <Real Name="Y">-5.9775696621654237</Real>
+ <Real Name="Z">-16.795786276144295</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-7.3076727681614635</Real>
+ <Real Name="Y">-1.0751125611988102</Real>
+ <Real Name="Z">-3.5350277386547013</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.063414056277160014</Real>
- <Real Name="Y">-19.458707951839994</Real>
- <Real Name="Z">-4.7836166807674863</Real>
+ <Real Name="X">-9.6177282670557229</Real>
+ <Real Name="Y">-20.98171739240464</Real>
+ <Real Name="Z">-24.469455185751023</Real>
</Vector>
<Vector>
- <Real Name="X">-2.2211061558666474</Real>
- <Real Name="Y">-1.1099232702819051</Real>
- <Real Name="Z">-2.9219141964463082</Real>
+ <Real Name="X">-1.3391614715749778</Real>
+ <Real Name="Y">-2.4637889252880081</Real>
+ <Real Name="Z">-17.156428586866937</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
+ <Real Name="X">-6.1505787518064086</Real>
+ <Real Name="Y">-17.61583652610614</Real>
+ <Real Name="Z">-4.4618914487107055</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">-0.59103431303769127</Real>
+ <Real Name="Y">-0.089534785133402892</Real>
+ <Real Name="Z">-0.71108816991442636</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">0.70483443211617736</Real>
- <Real Name="Y">1.1678665099776753</Real>
- <Real Name="Z">3.0253823397028992</Real>
+ <Real Name="X">-19.945252342067167</Real>
+ <Real Name="Y">-5.8550434537770943</Real>
+ <Real Name="Z">-10.097354831085514</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-7.0476399072188638</Real>
- <Real Name="Y">-14.378902132683789</Real>
- <Real Name="Z">-14.272277552262375</Real>
+ <Real Name="X">2.4399461929761004</Real>
+ <Real Name="Y">-1.2243385943090714</Real>
+ <Real Name="Z">0.41543174060820942</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-0.52415189724857048</Real>
- <Real Name="Y">-1.9716549447673803</Real>
- <Real Name="Z">-18.815861243981043</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-6.7467960287627502</Real>
- <Real Name="Y">-1.5410137489785949</Real>
- <Real Name="Z">-1.2290404991250639</Real>
+ <Real Name="X">9.1501846520219203</Real>
+ <Real Name="Y">3.6180027381322137</Real>
+ <Real Name="Z">6.3899759159287406</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
+ <Real Name="X">-2.7819333917763145</Real>
+ <Real Name="Y">-0.93764334824057782</Real>
+ <Real Name="Z">-0.2933831518353347</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.052577361165553116</Real>
- <Real Name="Y">-1.7509157833241376</Real>
- <Real Name="Z">-0.070066070618527432</Real>
+ <Real Name="X">2.9365563336064566</Real>
+ <Real Name="Y">-0.70046642949121796</Real>
+ <Real Name="Z">-12.032552000700495</Real>
</Vector>
<Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
+ <Real Name="X">-0.11357709995769247</Real>
+ <Real Name="Y">-1.112426659740996</Real>
+ <Real Name="Z">-3.4306764960600371</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-1.1903269785073174</Real>
- <Real Name="Y">-1.7428224529077028</Real>
- <Real Name="Z">-4.3636777044640338</Real>
+ <Real Name="X">1.5728939940946602</Real>
+ <Real Name="Y">-24.449483129724836</Real>
+ <Real Name="Z">3.8416981030419435</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-7.0276399076658986</Real>
- <Real Name="Y">-13.508902127915418</Real>
- <Real Name="Z">-13.322277564183304</Real>
+ <Real Name="X">-11.730963177507448</Real>
+ <Real Name="Y">-23.472514874739037</Real>
+ <Real Name="Z">-5.870091744290689</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-0.50415189769560531</Real>
- <Real Name="Y">-1.1016549399990088</Real>
- <Real Name="Z">-17.865861255901972</Real>
+ <Real Name="X">-3.0565076595646632</Real>
+ <Real Name="Y">-1.4103500790664754</Real>
+ <Real Name="Z">-4.9677026084105016</Real>
</Vector>
<Vector>
- <Real Name="X">-6.0867960025367065</Real>
- <Real Name="Y">-0.87101373228929435</Real>
- <Real Name="Z">-0.84904050389343544</Real>
+ <Real Name="X">-5.3791654211430107</Real>
+ <Real Name="Y">-7.4719620777067792</Real>
+ <Real Name="Z">-13.196689216970519</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-5.9374841241311893</Real>
+ <Real Name="Y">-1.3438907014985126</Real>
+ <Real Name="Z">-2.7775217946572655</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.77742262214514635</Real>
- <Real Name="Y">-1.4409157809399518</Real>
- <Real Name="Z">0.6599339484549589</Real>
+ <Real Name="X">-7.8144042169827745</Real>
+ <Real Name="Y">-26.227146740505805</Real>
+ <Real Name="Z">-19.226000503090088</Real>
</Vector>
<Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
+ <Real Name="X">-1.0880686956546695</Real>
+ <Real Name="Y">-3.0797361566100099</Real>
+ <Real Name="Z">-13.480051032538309</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.92032696777848133</Real>
- <Real Name="Y">-0.76282243383421644</Real>
- <Real Name="Z">-3.5336777211533343</Real>
+ <Real Name="X">-4.9973452358427064</Real>
+ <Real Name="Y">-22.019795657632674</Real>
+ <Real Name="Z">-3.5057718525584116</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">-0.48021537934312419</Real>
+ <Real Name="Y">-0.1119184814167536</Real>
+ <Real Name="Z">-0.55871213350419213</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-8.2305961590882664</Real>
- <Real Name="Y">1.2798951389932887</Real>
- <Real Name="Z">-6.3929958163443734</Real>
+ <Real Name="X">0.78266792292938536</Real>
+ <Real Name="Y">0.24701126089639641</Real>
+ <Real Name="Z">0.075197087339731225</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">1.4460874540966253</Real>
- <Real Name="Y">2.1584071797019928</Real>
- <Real Name="Z">1.0820509080507321</Real>
+ <Real Name="X">0.61956391875244121</Real>
+ <Real Name="Y">0.25681538531643089</Real>
+ <Real Name="Z">0.264650385589911</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.72589890716513583</Real>
- <Real Name="Y">-24.710884942780222</Real>
- <Real Name="Z">-4.3321274070179072</Real>
+ <Real Name="X">-11.475149109556806</Real>
+ <Real Name="Y">-9.7544516427343577</Real>
+ <Real Name="Z">3.0247422457903341</Real>
</Vector>
<Vector>
- <Real Name="X">-2.3815237342072924</Real>
- <Real Name="Y">-1.4624040861760008</Real>
- <Real Name="Z">-2.5707897210960202</Real>
+ <Real Name="X">-11.858918281399532</Real>
+ <Real Name="Y">-7.4199289605932677</Real>
+ <Real Name="Z">3.011716132619819</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-8.2105961595353012</Real>
- <Real Name="Y">2.1498951437616602</Real>
- <Real Name="Z">-5.4429958282653024</Real>
+ <Real Name="X">-22.79457410521962</Real>
+ <Real Name="Y">-4.8554021376267826</Real>
+ <Real Name="Z">5.6800905790772545</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-4.2562713131673355</Real>
+ <Real Name="Y">-3.1975379801333257</Real>
+ <Real Name="Z">-12.696263461962817</Real>
</Vector>
<Vector>
- <Real Name="X">1.2021184551344297</Real>
- <Real Name="Y">0.97968914191614953</Real>
- <Real Name="Z">3.3354195652242611</Real>
+ <Real Name="X">-0.083636781240502847</Real>
+ <Real Name="Y">-0.683594730203958</Real>
+ <Real Name="Z">-6.5236686696981163</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-4.8643100721912402</Real>
+ <Real Name="Y">-2.6516169976273649</Real>
+ <Real Name="Z">-0.25116456753339361</Real>
</Vector>
<Vector>
- <Real Name="X">2.1060874803226692</Real>
- <Real Name="Y">2.8284071963912933</Real>
- <Real Name="Z">1.4620509032823605</Real>
+ <Real Name="X">-0.09558489284628896</Real>
+ <Real Name="Y">-0.56688346388984168</Real>
+ <Real Name="Z">-0.94910028423615156</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.10410107614556363</Real>
- <Real Name="Y">-24.400884940396036</Real>
- <Real Name="Z">-3.6021273879444209</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-1.6715237556649645</Real>
- <Real Name="Y">-1.4024040875171053</Real>
- <Real Name="Z">-2.2207897270564847</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
+ <Real Name="X">-4.0944609423338374</Real>
+ <Real Name="Y">-7.9446698242436193</Real>
+ <Real Name="Z">-1.3877955568392644</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-5.7262074246153265</Real>
- <Real Name="Y">-17.973627665854735</Real>
- <Real Name="Z">-11.213932362491866</Real>
+ <Real Name="X">0.63591768738012566</Real>
+ <Real Name="Y">0.3087640761204955</Real>
+ <Real Name="Z">0.03426844856107035</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-0.42587341651446342</Real>
- <Real Name="Y">-2.4645686809592258</Real>
- <Real Name="Z">-14.783890977413678</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-5.4817717733697346</Real>
- <Real Name="Y">-1.9262671862232437</Real>
- <Real Name="Z">-0.96567467788397876</Real>
+ <Real Name="X">0.50339568398635848</Real>
+ <Real Name="Y">0.32101923164553864</Real>
+ <Real Name="Z">0.18363175660878781</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.0427191059470119</Real>
- <Real Name="Y">-2.1886447291551718</Real>
- <Real Name="Z">-0.055051912628842979</Real>
+ <Real Name="X">-9.3235586515149063</Real>
+ <Real Name="Y">-12.193064553417946</Real>
+ <Real Name="Z">3.2071979869138385</Real>
+ </Vector>
+ <Vector>
+ <Real Name="X">-9.6353711036371195</Real>
+ <Real Name="Y">-9.2749112007415846</Real>
+ <Real Name="Z">3.0222260742447977</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Y">0</Real>
<Real Name="Z">0</Real>
</Vector>
- <Vector>
- <Real Name="X">-0.96714067003719539</Real>
- <Real Name="Y">-2.1785280661346289</Real>
- <Real Name="Z">-3.4286039106503119</Real>
- </Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Y">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-5.7062074250623613</Real>
- <Real Name="Y">-17.103627661086364</Real>
- <Real Name="Z">-10.263932374412795</Real>
+ <Real Name="X">-18.520591460490941</Real>
+ <Real Name="Y">-6.0692526720334774</Real>
+ <Real Name="Z">5.0076479125818185</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-0.40587341696149826</Real>
- <Real Name="Y">-1.5945686761908542</Real>
- <Real Name="Z">-13.833890989334607</Real>
+ <Real Name="X">-3.9522519336553823</Real>
+ <Real Name="Y">-3.3145212470342056</Real>
+ <Real Name="Z">0.041856812732197594</Real>
</Vector>
<Vector>
- <Real Name="X">-4.8217717471436909</Real>
- <Real Name="Y">-1.2562671695339431</Real>
- <Real Name="Z">-0.58567468265235034</Real>
+ <Real Name="X">-0.077662725437609784</Real>
+ <Real Name="Y">-0.70860432986230215</Real>
+ <Real Name="Z">-0.70184026829559087</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.78728087736368757</Real>
- <Real Name="Y">-1.878644726770986</Real>
- <Real Name="Z">0.67494810644464331</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.69714065930835933</Real>
- <Real Name="Y">-1.1985280470611426</Real>
- <Real Name="Z">-2.5986039273396124</Real>
+ <Real Name="X">-3.326749515646243</Real>
+ <Real Name="Y">-9.9308372803045231</Real>
+ <Real Name="Z">-0.45425921737202102</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">3.0030106990475081</Real>
- <Real Name="Y">-0.97947087544725719</Real>
- <Real Name="Z">0.52873130622863018</Real>
+ <Real Name="X">-11.577102289706572</Real>
+ <Real Name="Y">0.84910120894795016</Real>
+ <Real Name="Z">1.8482439089193423</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">11.261765725565441</Real>
- <Real Name="Y">2.8944021905057711</Real>
- <Real Name="Z">8.1326966202729416</Real>
+ <Real Name="X">2.0340570782897585</Real>
+ <Real Name="Y">1.4319189829320136</Real>
+ <Real Name="Z">-0.59251856152304705</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-9.2107554875515074</Real>
- <Real Name="Y">-11.452720492666822</Real>
- <Real Name="Z">-10.655035154526145</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-9.6665535176822637</Real>
- <Real Name="Y">-8.8875609359019645</Real>
- <Real Name="Z">-9.4515678372416474</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
+ <Real Name="X">-3.5826533245421075</Real>
+ <Real Name="Y">-9.5803366494364646</Real>
+ <Real Name="Z">-23.575529237696852</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-3.423918020647772</Real>
- <Real Name="Y">-0.75011467859246217</Real>
- <Real Name="Z">-0.37339673869951695</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">3.6142231798233309</Real>
- <Real Name="Y">-0.5603731435929743</Real>
- <Real Name="Z">-15.314157091800631</Real>
+ <Real Name="X">-1.0210446166718394</Real>
+ <Real Name="Y">-16.393563534893939</Real>
+ <Real Name="Z">2.0765205102067403</Real>
</Vector>
<Vector>
- <Real Name="X">-0.13978719994792918</Real>
- <Real Name="Y">-0.88994132779279667</Real>
- <Real Name="Z">-4.3663155404400467</Real>
+ <Real Name="X">-3.3498355821816856</Real>
+ <Real Name="Y">-0.97018032158412315</Real>
+ <Real Name="Z">0.58368499271815877</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">1.935869531193428</Real>
- <Real Name="Y">-19.559586503779869</Real>
- <Real Name="Z">4.8894339493261105</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">3.0230106986004732</Real>
- <Real Name="Y">-0.10947087067888561</Real>
- <Real Name="Z">1.4787312943077011</Real>
+ <Real Name="X">-8.0544456082501288</Real>
+ <Real Name="Y">-11.923968234039531</Real>
+ <Real Name="Z">1.9257328983388657</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-0.59903073971265186</Real>
+ <Real Name="Y">-1.6350310136998707</Real>
+ <Real Name="Z">-2.6446765062295143</Real>
</Vector>
<Vector>
- <Real Name="X">11.921765751791485</Real>
- <Real Name="Y">3.5644022071950716</Real>
- <Real Name="Z">8.51269661550457</Real>
+ <Real Name="X">-7.7106240328717144</Real>
+ <Real Name="Y">-1.2779139061856373</Real>
+ <Real Name="Z">2.2200763403785335</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-3.4039180210948068</Real>
- <Real Name="Y">0.11988532617590941</Real>
- <Real Name="Z">0.57660324937955409</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">4.4442231631340299</Real>
- <Real Name="Y">-0.25037314120878851</Real>
- <Real Name="Z">-14.584157072727145</Real>
+ <Real Name="X">-0.060088412760632121</Real>
+ <Real Name="Y">-1.4519790167692483</Real>
+ <Real Name="Z">0.24378158880830342</Real>
</Vector>
<Vector>
- <Real Name="X">0.57021277859439867</Real>
- <Real Name="Y">-0.82994132913390117</Real>
- <Real Name="Z">-4.0163155464005111</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">2.2058695419222643</Real>
- <Real Name="Y">-18.579586484706383</Real>
- <Real Name="Z">5.71943393263681</Real>
+ <Real Name="X">-1.3603736897226484</Real>
+ <Real Name="Y">-1.4452674741283262</Real>
+ <Real Name="Z">-0.088156767496452001</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-14.438108526163015</Real>
- <Real Name="Y">-18.778011899791231</Real>
- <Real Name="Z">-7.4710258563699679</Real>
+ <Real Name="X">-9.4063956103865909</Real>
+ <Real Name="Y">1.0613765111849378</Real>
+ <Real Name="Z">1.4765278904032617</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-0.49656498125090714</Real>
- <Real Name="Y">-0.85139644735204068</Real>
- <Real Name="Z">-6.170384440946111</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-6.6205112875606282</Real>
- <Real Name="Y">-5.9775696621654237</Real>
- <Real Name="Z">-16.795786276144295</Real>
+ <Real Name="X">1.6526713761104288</Real>
+ <Real Name="Y">1.789898728665017</Real>
+ <Real Name="Z">-0.59016766968693601</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-7.3076727681614635</Real>
- <Real Name="Y">-1.0751125611988102</Real>
- <Real Name="Z">-3.5350277386547013</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-9.6177282670557229</Real>
- <Real Name="Y">-20.98171739240464</Real>
- <Real Name="Z">-24.469455185751023</Real>
+ <Real Name="X">-0.82959875104586944</Real>
+ <Real Name="Y">-20.491954418617421</Real>
+ <Real Name="Z">2.8871516559459058</Real>
</Vector>
<Vector>
- <Real Name="X">-1.3391614715749778</Real>
- <Real Name="Y">-2.4637889252880081</Real>
- <Real Name="Z">-17.156428586866937</Real>
+ <Real Name="X">-2.7217414105226196</Real>
+ <Real Name="Y">-1.2127254019801541</Real>
+ <Real Name="Z">0.55819396762823659</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-6.1505787518064086</Real>
- <Real Name="Y">-17.61583652610614</Real>
- <Real Name="Z">-4.4618914487107055</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.59103431303769127</Real>
- <Real Name="Y">-0.089534785133402892</Real>
- <Real Name="Z">-0.71108816991442636</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-14.41810852661005</Real>
- <Real Name="Y">-17.90801189502286</Real>
- <Real Name="Z">-6.5210258682908968</Real>
+ <Real Name="X">-6.5442370567032295</Real>
+ <Real Name="Y">-14.904960292549413</Real>
+ <Real Name="Z">2.4825316419739121</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-0.47656498169794198</Real>
- <Real Name="Y">0.018603557416330907</Real>
- <Real Name="Z">-5.22038445286704</Real>
+ <Real Name="X">-0.48671247601652962</Real>
+ <Real Name="Y">-2.0437887671248385</Real>
+ <Real Name="Z">-1.9489107480528729</Real>
</Vector>
<Vector>
- <Real Name="X">-5.9605112613345845</Real>
- <Real Name="Y">-5.3075696454761232</Real>
- <Real Name="Z">-16.415786280912666</Real>
+ <Real Name="X">-6.2648820267082685</Real>
+ <Real Name="Y">-1.5973923827320464</Real>
+ <Real Name="Z">1.9008625299783468</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-7.2876727686084983</Real>
- <Real Name="Y">-0.20511255643043858</Real>
- <Real Name="Z">-2.5850277505756303</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-8.7877282837450235</Real>
- <Real Name="Y">-20.671717390020454</Real>
- <Real Name="Z">-23.739455166677537</Real>
+ <Real Name="X">-0.0488218353680136</Real>
+ <Real Name="Y">-1.8149737709615605</Real>
+ <Real Name="Z">0.30251804902903451</Real>
</Vector>
<Vector>
- <Real Name="X">-0.6291614930326499</Real>
- <Real Name="Y">-2.4037889266291126</Real>
- <Real Name="Z">-16.806428592827402</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-5.8805787410775725</Real>
- <Real Name="Y">-16.635836507032653</Real>
- <Real Name="Z">-3.6318914654000061</Real>
+ <Real Name="X">-1.1053036228996518</Real>
+ <Real Name="Y">-1.8065843426604078</Real>
+ <Real Name="Z">0.051190455240391619</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.30103432138234154</Real>
- <Real Name="Y">0.010465216356713228</Real>
- <Real Name="Z">-0.031088162761868987</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-19.945252342067167</Real>
- <Real Name="Y">-5.8550434537770943</Real>
- <Real Name="Z">-10.097354831085514</Real>
+ <Real Name="X">0.55642797645760989</Real>
+ <Real Name="Y">0.3723331315116295</Real>
+ <Real Name="Z">1.6306575619901507</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">2.4399461929761004</Real>
- <Real Name="Y">-1.2243385943090714</Real>
- <Real Name="Z">0.41543174060820942</Real>
+ <Real Name="X">3.4320122274828666</Real>
+ <Real Name="Y">-0.81224418229071649</Real>
+ <Real Name="Z">-0.764761636476889</Real>
</Vector>
</Sequence>
</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">9.1501846520219203</Real>
- <Real Name="Y">3.6180027381322137</Real>
- <Real Name="Z">6.3899759159287406</Real>
+ <Real Name="X">12.870589400646217</Real>
+ <Real Name="Y">2.4002360860135794</Real>
+ <Real Name="Z">-2.7526346195710181</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-2.7819333917763145</Real>
- <Real Name="Y">-0.93764334824057782</Real>
- <Real Name="Z">-0.29338315183533475</Real>
+ <Real Name="X">-3.9130491664545959</Real>
+ <Real Name="Y">-0.62204635074971815</Real>
+ <Real Name="Z">1.1633583220151211</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">2.9365563336064566</Real>
- <Real Name="Y">-0.70046642949121796</Real>
- <Real Name="Z">-12.032552000700495</Real>
+ <Real Name="X">4.1305407769409488</Real>
+ <Real Name="Y">-0.46469970389626269</Real>
+ <Real Name="Z">-3.6193285397896875</Real>
</Vector>
<Vector>
- <Real Name="X">-0.11357709995769247</Real>
- <Real Name="Y">-1.112426659740996</Real>
- <Real Name="Z">-3.4306764960600371</Real>
+ <Real Name="X">-0.1597567999404905</Real>
+ <Real Name="Y">-0.73800016335319685</Real>
+ <Real Name="Z">-0.54897393926970917</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">1.5728939940946602</Real>
- <Real Name="Y">-24.449483129724836</Real>
- <Real Name="Z">3.8416981030419435</Real>
+ <Real Name="X">2.2124223213639174</Real>
+ <Real Name="Y">-16.220145737822616</Real>
+ <Real Name="Z">2.8258755564357965</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">2.4599461925290655</Real>
- <Real Name="Y">-0.35433858954069986</Real>
- <Real Name="Z">1.3654317286872804</Real>
+ <Real Name="X">-16.500695458472013</Real>
+ <Real Name="Y">-15.572010667113076</Real>
+ <Real Name="Z">6.0618364657657224</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
+ <Real Name="X">-0.56750283571532234</Real>
+ <Real Name="Y">-0.70603611451836135</Real>
+ <Real Name="Z">-0.73298662849655538</Real>
</Vector>
<Vector>
- <Real Name="X">9.810184678247964</Real>
- <Real Name="Y">4.2880027548215143</Real>
- <Real Name="Z">6.769975911160369</Real>
+ <Real Name="X">-7.5662986143550031</Real>
+ <Real Name="Y">-4.9570092424793035</Real>
+ <Real Name="Z">0.22987632186540616</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-2.7619333922233493</Real>
- <Real Name="Y">-0.067643343472206241</Real>
- <Real Name="Z">0.65661683624373635</Real>
+ <Real Name="X">-8.3516260207559565</Real>
+ <Real Name="Y">-0.89155680381272195</Real>
+ <Real Name="Z">1.9626024243687374</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">3.7665563169171561</Real>
- <Real Name="Y">-0.39046642710703217</Real>
- <Real Name="Z">-11.302551981627008</Real>
+ <Real Name="X">-10.991689448063681</Real>
+ <Real Name="Y">-17.399473852314976</Real>
+ <Real Name="Z">1.9943402280115583</Real>
</Vector>
<Vector>
- <Real Name="X">0.59642287858463539</Real>
- <Real Name="Y">-1.0524266610821005</Real>
- <Real Name="Z">-3.0806765020205016</Real>
+ <Real Name="X">-1.5304702532285459</Real>
+ <Real Name="Y">-2.0431421404374799</Real>
+ <Real Name="Z">-2.0385186389652117</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">1.8428940048234963</Real>
- <Real Name="Y">-23.46948311065135</Real>
- <Real Name="Z">4.6716980863526434</Real>
+ <Real Name="X">-7.0292328592073234</Real>
+ <Real Name="Y">-14.608255429729208</Real>
+ <Real Name="Z">3.679921612389506</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
+ <Real Name="X">-0.67546778632879001</Real>
+ <Real Name="Y">-0.07424836221296291</Real>
+ <Real Name="Z">0.089381774901316297</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-11.73096317750745</Real>
- <Real Name="Y">-23.472514874739037</Real>
- <Real Name="Z">-5.870091744290689</Real>
+ <Real Name="X">2.788509934829829</Real>
+ <Real Name="Y">-1.0153052278633954</Real>
+ <Real Name="Z">-0.5654353231810999</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-3.0565076595646632</Real>
- <Real Name="Y">-1.4103500790664754</Real>
- <Real Name="Z">-4.9677026084105016</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-5.3791654211430107</Real>
- <Real Name="Y">-7.4719620777067792</Real>
- <Real Name="Z">-13.196689216970519</Real>
+ <Real Name="X">10.457353888025052</Real>
+ <Real Name="Y">3.0002951075169739</Real>
+ <Real Name="Z">-2.4443752014337479</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-5.9374841241311893</Real>
- <Real Name="Y">-1.3438907014985126</Real>
- <Real Name="Z">-2.7775217946572655</Real>
+ <Real Name="X">-3.1793524477443595</Real>
+ <Real Name="Y">-0.77755793843714771</Real>
+ <Real Name="Z">0.99148224011632069</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-7.8144042169827745</Real>
- <Real Name="Y">-26.227146740505805</Real>
- <Real Name="Z">-19.226000503090088</Real>
+ <Real Name="X">3.3560643812645212</Real>
+ <Real Name="Y">-0.58087462987032856</Real>
+ <Real Name="Z">-2.8401295588358915</Real>
</Vector>
<Vector>
- <Real Name="X">-1.0880686956546695</Real>
- <Real Name="Y">-3.0797361566100099</Real>
- <Real Name="Z">-13.480051032538309</Real>
+ <Real Name="X">-0.12980239995164852</Real>
+ <Real Name="Y">-0.92250020419149636</Real>
+ <Real Name="Z">-0.37393805370732247</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-4.9973452358427064</Real>
- <Real Name="Y">-22.019795657632674</Real>
- <Real Name="Z">-3.5057718525584116</Real>
+ <Real Name="X">1.7975931361081829</Real>
+ <Real Name="Y">-20.275182172278267</Real>
+ <Real Name="Z">3.4378840352447644</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.48021537934312419</Real>
- <Real Name="Y">-0.1119184814167536</Real>
- <Real Name="Z">-0.55871213350419213</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-11.710963177954484</Real>
- <Real Name="Y">-22.602514869970666</Real>
- <Real Name="Z">-4.920091756211618</Real>
+ <Real Name="X">-13.406815060008512</Real>
+ <Real Name="Y">-19.465013333891342</Real>
+ <Real Name="Z">6.0748932006495915</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-4.2562713131673355</Real>
- <Real Name="Y">-3.1975379801333257</Real>
- <Real Name="Z">-12.696263461962817</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.083636781240502847</Real>
- <Real Name="Y">-0.683594730203958</Real>
- <Real Name="Z">-6.5236686696981163</Real>
+ <Real Name="X">0.44047122348806367</Real>
+ <Real Name="Y">0.3871114065335613</Real>
+ <Real Name="Z">2.3221153764227829</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">2</Int>
<Vector>
- <Real Name="X">-3.036507660011698</Real>
- <Real Name="Y">-0.54035007429810378</Real>
- <Real Name="Z">-4.0177026203314306</Real>
+ <Real Name="X">-3.4931516109310436</Real>
+ <Real Name="Y">-1.1695586621622649</Real>
+ <Real Name="Z">0.37948711624127879</Real>
</Vector>
<Vector>
- <Real Name="X">-4.719165394916967</Real>
- <Real Name="Y">-6.8019620610174787</Real>
- <Real Name="Z">-12.816689221738891</Real>
+ <Real Name="X">-6.1476176241634404</Real>
+ <Real Name="Y">-6.196261553099129</Real>
+ <Real Name="Z">0.61604971101077255</Real>
</Vector>
</Sequence>
</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">13</Int>
<Vector>
- <Real Name="X">-5.9174841245782241</Real>
- <Real Name="Y">-0.47389069673014106</Real>
- <Real Name="Z">-1.8275218065781944</Real>
+ <Real Name="X">-6.7856961418642161</Real>
+ <Real Name="Y">-1.1144460047659024</Real>
+ <Real Name="Z">1.6740807570530818</Real>
</Vector>
<Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-6.9844042336720751</Real>
- <Real Name="Y">-25.91714673812162</Real>
- <Real Name="Z">-18.496000484016601</Real>
+ <Real Name="X">-8.9307476765517411</Real>
+ <Real Name="Y">-21.749342315393726</Real>
+ <Real Name="Z">2.9757623819770487</Real>
</Vector>
<Vector>
- <Real Name="X">-0.37806871711234158</Real>
- <Real Name="Y">-3.0197361579511144</Real>
- <Real Name="Z">-13.130051038498774</Real>
+ <Real Name="X">-1.2435070807481936</Real>
+ <Real Name="Y">-2.5539276755468499</Real>
+ <Real Name="Z">-1.4344239512261392</Real>
</Vector>
<Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-4.7273452251138703</Real>
- <Real Name="Y">-21.039795638559188</Real>
- <Real Name="Z">-2.6757718692477122</Real>
+ <Real Name="X">-5.7112516981059507</Real>
+ <Real Name="Y">-18.260319287161511</Real>
+ <Real Name="Z">4.0572521792161034</Real>
</Vector>
<Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">-0.19021538768777446</Real>
- <Real Name="Y">-0.011918479926637485</Real>
- <Real Name="Z">0.12128787364836524</Real>
+ <Real Name="X">-0.5488175763921419</Real>
+ <Real Name="Y">-0.092810452766203616</Real>
+ <Real Name="Z">0.081070341914709868</Real>
</Vector>
<Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
+ <Real Name="X">0</Real>
+ <Real Name="Y">0</Real>
+ <Real Name="Z">0</Real>
</Vector>
</Sequence>
</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">0.78266792292938536</Real>
- <Real Name="Y">0.24701126089639641</Real>
- <Real Name="Z">0.075197087339731225</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.61956391875244121</Real>
- <Real Name="Y">0.25681538531643089</Real>
- <Real Name="Z">0.264650385589911</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-11.475149109556806</Real>
- <Real Name="Y">-9.7544516427343577</Real>
- <Real Name="Z">3.0247422457903341</Real>
- </Vector>
- <Vector>
- <Real Name="X">-11.858918281399532</Real>
- <Real Name="Y">-7.4199289605932677</Real>
- <Real Name="Z">3.011716132619819</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">0.80266792248235053</Real>
- <Real Name="Y">1.1170112656647679</Real>
- <Real Name="Z">1.0251970754188022</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">1.2795639449784848</Real>
- <Real Name="Y">0.92681540200573143</Real>
- <Real Name="Z">0.64465038082153936</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-10.645149126246107</Real>
- <Real Name="Y">-9.4444516403501719</Real>
- <Real Name="Z">3.7547422648638205</Real>
- </Vector>
- <Vector>
- <Real Name="X">-11.148918302857204</Real>
- <Real Name="Y">-7.3599289619343722</Real>
- <Real Name="Z">3.3617161266593545</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-22.79457410521962</Real>
- <Real Name="Y">-4.8554021376267826</Real>
- <Real Name="Z">5.6800905790772545</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-4.8643100721912402</Real>
- <Real Name="Y">-2.6516169976273649</Real>
- <Real Name="Z">-0.25116456753339361</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.09558489284628896</Real>
- <Real Name="Y">-0.56688346388984168</Real>
- <Real Name="Z">-0.94910028423615156</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Real Name="Z">0</Real>
</Vector>
<Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
+ <Real Name="X">-8.1581138200755436</Real>
+ <Real Name="Y">-14.70340061881376</Real>
+ <Real Name="Z">-8.9453847792568535</Real>
+ </Vector>
+ <Vector>
+ <Real Name="X">-8.4309497156824804</Real>
+ <Real Name="Y">-11.184451168201075</Real>
+ <Real Name="Z">-7.7012318674352152</Real>
</Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Y">0</Real>
<Real Name="Z">0</Real>
</Vector>
- <Vector>
- <Real Name="X">-3.5826533245421075</Real>
- <Real Name="Y">-9.5803366494364646</Real>
- <Real Name="Z">-23.575529237696852</Real>
- </Vector>
<Vector>
<Real Name="X">0</Real>
<Real Name="Y">0</Real>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-4.0944609423338374</Real>
- <Real Name="Y">-7.9446698242436193</Real>
- <Real Name="Z">-1.3877955568392644</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-22.774574105666655</Real>
- <Real Name="Y">-3.9854021328584111</Real>
- <Real Name="Z">6.6300905671563255</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-4.8443100726382751</Real>
- <Real Name="Y">-1.7816169928589933</Real>
- <Real Name="Z">0.69883542054567749</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.56441513337975469</Real>
- <Real Name="Y">0.10311655279945886</Real>
- <Real Name="Z">-0.56910028900452314</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.82999998331069946</Real>
- <Real Name="Y">0.31000000238418579</Real>
- <Real Name="Z">0.73000001907348633</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">-3.8244609316050013</Real>
- <Real Name="Y">-6.964669805170133</Real>
- <Real Name="Z">-0.5577955735285649</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">0.63591768738012566</Real>
- <Real Name="Y">0.3087640761204955</Real>
- <Real Name="Z">0.03426844856107035</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.50339568398635848</Real>
- <Real Name="Y">0.32101923164553864</Real>
- <Real Name="Z">0.18363175660878781</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-9.3235586515149063</Real>
- <Real Name="Y">-12.193064553417946</Real>
- <Real Name="Z">3.2071979869138385</Real>
- </Vector>
- <Vector>
- <Real Name="X">-9.6353711036371195</Real>
- <Real Name="Y">-9.2749112007415846</Real>
- <Real Name="Z">3.0222260742447977</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">0.65591768693309083</Real>
- <Real Name="Y">1.1787640808888671</Real>
- <Real Name="Z">0.98426843664014141</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">1.1633957102124022</Real>
- <Real Name="Y">0.99101924833483923</Real>
- <Real Name="Z">0.56363175184041625</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">-8.4935586682042068</Real>
- <Real Name="Y">-11.88306455103376</Real>
- <Real Name="Z">3.9371980059873248</Real>
- </Vector>
- <Vector>
- <Real Name="X">-8.9253711250947916</Real>
- <Real Name="Y">-9.2149112020826891</Real>
- <Real Name="Z">3.3722260682843332</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.27000001072883606</Real>
- <Real Name="Y">0.98000001907348633</Real>
- <Real Name="Z">0.82999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
<Sequence Name="Forces">
<Int Name="Length">1</Int>
<Vector>
- <Real Name="X">-19.925252342514202</Real>
- <Real Name="Y">-4.9850434490087228</Real>
- <Real Name="Z">-9.1473548430064433</Real>
+ <Real Name="X">-16.205517527929572</Real>
+ <Real Name="Y">-7.3188043172213684</Real>
+ <Real Name="Z">-7.9336359387100472</Real>
</Vector>
</Sequence>
</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-18.520591460490941</Real>
- <Real Name="Y">-6.0692526720334774</Real>
- <Real Name="Z">5.0076479125818185</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-3.9522519336553823</Real>
- <Real Name="Y">-3.3145212470342056</Real>
- <Real Name="Z">0.041856812732197594</Real>
- </Vector>
- <Vector>
- <Real Name="X">-0.077662725437609784</Real>
- <Real Name="Y">-0.70860432986230215</Real>
- <Real Name="Z">-0.70184026829559087</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-3.326749515646243</Real>
- <Real Name="Y">-9.9308372803045231</Real>
- <Real Name="Z">-0.45425921737202102</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-18.500591460937976</Real>
- <Real Name="Y">-5.1992526672651058</Real>
- <Real Name="Z">5.9576479006608896</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">-3.9322519341024171</Real>
- <Real Name="Y">-2.444521242265834</Real>
- <Real Name="Z">0.99185680081126859</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.58233730078843393</Real>
- <Real Name="Y">-0.038604313173001614</Real>
- <Real Name="Z">-0.32184027306396246</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0.019999999552965164</Real>
- <Real Name="Y">0.87000000476837158</Real>
- <Real Name="Z">0.94999998807907104</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.6600000262260437</Real>
- <Real Name="Y">0.67000001668930054</Real>
- <Real Name="Z">0.37999999523162842</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.44999998807907104</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.93999999761581421</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.54000002145767212</Real>
- <Real Name="Y">0.75999999046325684</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.82999998331069946</Real>
- <Real Name="Y">0.31000000238418579</Real>
- <Real Name="Z">0.73000001907348633</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.70999997854232788</Real>
- <Real Name="Y">0.059999998658895493</Real>
- <Real Name="Z">0.34999999403953552</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.31999999284744263</Real>
- <Real Name="Y">0.34999999403953552</Real>
- <Real Name="Z">0.61000001430511475</Real>
- </Vector>
- <Vector>
- <Real Name="X">-3.0567495049174069</Real>
- <Real Name="Y">-8.9508372612310367</Real>
- <Real Name="Z">0.37574076593867844</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.10999999940395355</Real>
- <Real Name="Y">0.30000001192092896</Real>
- <Real Name="Z">0.41999998688697815</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.94999998807907104</Real>
- <Real Name="Y">0.68999999761581421</Real>
- <Real Name="Z">0.57999998331069946</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.28999999165534973</Real>
- <Real Name="Y">0.10000000149011612</Real>
- <Real Name="Z">0.68000000715255737</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.93999999761581421</Real>
- <Real Name="Y">0.62000000476837158</Real>
- <Real Name="Z">0.50999999046325684</Real>
- </Vector>
- <Vector>
- <Real Name="X">0.4699999988079071</Real>
- <Real Name="Y">0.039999999105930328</Real>
- <Real Name="Z">0.4699999988079071</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-11.577102289706572</Real>
- <Real Name="Y">0.84910120894795005</Real>
- <Real Name="Z">1.8482439089193421</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">2</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">2.0340570782897585</Real>
- <Real Name="Y">1.4319189829320136</Real>
- <Real Name="Z">-0.59251856152304705</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">13</Int>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">-1.0210446166718394</Real>
- <Real Name="Y">-16.393563534893939</Real>
- <Real Name="Z">2.0765205102067403</Real>
- </Vector>
- <Vector>
- <Real Name="X">-3.3498355821816856</Real>
- <Real Name="Y">-0.97018032158412315</Real>
- <Real Name="Z">0.58368499271815877</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- <Vector>
- <Real Name="X">0</Real>
- <Real Name="Y">0</Real>
- <Real Name="Z">0</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
+++ /dev/null
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
-<ReferenceData>
- <Sequence Name="Forces">
- <Int Name="Length">1</Int>
- <Vector>
- <Real Name="X">-11.557102290153606</Real>
- <Real Name="Y">1.7191012137163217</Real>
- <Real Name="Z">2.7982438969984131</Real>
- </Vector>
- </Sequence>
-</ReferenceData>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void PmeTestEnvironment::SetUp()
{
- hardwareContexts_.emplace_back(std::make_unique<TestHardwareContext>(CodePath::CPU, "", nullptr));
+ hardwareContexts_.emplace_back(std::make_unique<TestHardwareContext>(CodePath::CPU, "(CPU) ", nullptr));
hardwareInfo_ = hardwareInit();
if (!pme_gpu_supports_build(nullptr) || !pme_gpu_supports_hardware(*hardwareInfo_, nullptr))
// Constructing contexts for all compatible GPUs - will be empty on non-GPU builds
for (int gpuIndex : getCompatibleGpus(hardwareInfo_->gpu_info))
{
- const gmx_device_info_t* deviceInfo = getDeviceInfo(hardwareInfo_->gpu_info, gpuIndex);
+ const DeviceInformation* deviceInfo = getDeviceInfo(hardwareInfo_->gpu_info, gpuIndex);
init_gpu(deviceInfo);
char stmp[200] = {};
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/ewald/pme_gpu_program.h"
#include "gromacs/hardware/gpu_hw_info.h"
+#include "gromacs/utility/gmxassert.h"
struct gmx_hw_info_t;
//! Readable description
std::string description_;
//! Device information pointer
- const gmx_device_info_t* deviceInfo_;
+ const DeviceInformation* deviceInfo_;
//! Persistent compiled GPU kernels for PME.
PmeGpuProgramStorage program_;
//! Returns a human-readable context description line
std::string getDescription() const { return description_; }
//! Returns the device info pointer
- const gmx_device_info_t* getDeviceInfo() const { return deviceInfo_; }
+ const DeviceInformation* getDeviceInfo() const { return deviceInfo_; }
//! Returns the persistent PME GPU kernels
- PmeGpuProgramHandle getPmeGpuProgram() const { return program_.get(); }
+ const PmeGpuProgram* getPmeGpuProgram() const { return program_.get(); }
//! Constructs the context
- TestHardwareContext(CodePath codePath, const char* description, const gmx_device_info_t* deviceInfo) :
+ TestHardwareContext(CodePath codePath, const char* description, const DeviceInformation* deviceInfo) :
codePath_(codePath),
description_(description),
- deviceInfo_(deviceInfo),
- program_(buildPmeGpuProgram(deviceInfo_))
+ deviceInfo_(deviceInfo)
{
+ if (codePath == CodePath::GPU)
+ {
+ program_ = buildPmeGpuProgram(deviceInfo_);
+ }
}
~TestHardwareContext();
};
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2003 Erik Lindahl, David van der Spoel, University of Groningen.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx::MdModulesCheckpointReadingDataOnMaster mdModuleCheckpointReadingDataOnMaster = {
mdModuleCheckpointParameterTree, fileVersion
};
- mdModulesNotifier.notifier_.notify(mdModuleCheckpointReadingDataOnMaster);
+ mdModulesNotifier.checkpointingNotifications_.notify(mdModuleCheckpointReadingDataOnMaster);
}
}
gmx::KeyValueTreeBuilder builder;
gmx::MdModulesWriteCheckpointData mdModulesWriteCheckpoint = { builder.rootObject(),
headerContents.file_version };
- mdModulesNotifier.notifier_.notify(mdModulesWriteCheckpoint);
+ mdModulesNotifier.checkpointingNotifications_.notify(mdModulesWriteCheckpoint);
auto tree = builder.build();
gmx::FileIOXdrSerializer serializer(fp);
gmx::serializeKeyValueTree(tree, &serializer);
{
gmx_bcast(sizeof(headerContents.step), &headerContents.step, cr);
gmx::MdModulesCheckpointReadingBroadcast broadcastCheckPointData = { *cr, headerContents.file_version };
- mdModulesNotifier.notifier_.notify(broadcastCheckPointData);
+ mdModulesNotifier.checkpointingNotifications_.notify(broadcastCheckPointData);
}
ir->bContinuation = TRUE;
// TODO Should the following condition be <=? Currently if you
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const t_atoms* atoms,
const rvec x[],
const rvec* v,
- int ePBC,
+ PbcType pbcType,
const matrix box,
int nindex,
int index[])
case efENT:
case efPQR:
out = gmx_fio_fopen(outfile, "w");
- write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, nullptr,
- ftp == efPQR);
+ write_pdbfile_indexed(out, title, atoms, x, pbcType, box, ' ', -1, nindex, index,
+ nullptr, ftp == efPQR);
gmx_fio_fclose(out);
break;
case efESP:
const t_atoms* atoms,
const rvec x[],
const rvec* v,
- int ePBC,
+ PbcType pbcType,
const matrix box)
{
FILE* out;
case efBRK:
case efENT:
out = gmx_fio_fopen(outfile, "w");
- write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, nullptr);
+ write_pdbfile(out, title, atoms, x, pbcType, box, ' ', -1, nullptr);
gmx_fio_fclose(out);
break;
case efESP:
const gmx_mtop_t* mtop,
const rvec x[],
const rvec* v,
- int ePBC,
+ PbcType pbcType,
const matrix box)
{
int ftp;
*/
atoms = gmx_mtop_global_atoms(mtop);
- write_sto_conf(outfile, title, &atoms, x, v, ePBC, box);
+ write_sto_conf(outfile, title, &atoms, x, v, pbcType, box);
done_atom(&atoms);
break;
t_atoms* atoms,
rvec x[],
rvec* v,
- int* ePBC,
+ PbcType* pbcType,
matrix box)
{
FILE* in;
gmx_mem("Uninitialized array atom");
}
- if (ePBC)
+ if (pbcType)
{
- *ePBC = -1;
+ *pbcType = PbcType::Unset;
}
ftp = fn2ftp(infile);
break;
case efPDB:
case efBRK:
- case efENT: gmx_pdb_read_conf(infile, symtab, name, atoms, x, ePBC, box); break;
+ case efENT: gmx_pdb_read_conf(infile, symtab, name, atoms, x, pbcType, box); break;
case efESP: gmx_espresso_read_conf(infile, symtab, name, atoms, x, v, box); break;
default: gmx_incons("Not supported in read_stx_conf");
}
t_symtab* symtab,
char** name,
t_atoms* atoms,
- int* ePBC,
+ PbcType* pbcType,
rvec** x,
rvec** v,
matrix box)
{
bool haveTopology;
gmx_mtop_t mtop;
- readConfAndTopology(infile, &haveTopology, &mtop, ePBC, x, v, box);
+ readConfAndTopology(infile, &haveTopology, &mtop, pbcType, x, v, box);
*symtab = mtop.symtab;
*name = gmx_strdup(*mtop.name);
*atoms = gmx_mtop_global_atoms(&mtop);
{
snew(*v, natoms);
}
- read_stx_conf(infile, symtab, name, atoms, *x, (v == nullptr) ? nullptr : *v, ePBC, box);
+ read_stx_conf(infile, symtab, name, atoms, *x, (v == nullptr) ? nullptr : *v, pbcType, box);
if (xIsNull)
{
sfree(*x);
}
}
-void readConfAndTopology(const char* infile, bool* haveTopology, gmx_mtop_t* mtop, int* ePBC, rvec** x, rvec** v, matrix box)
+void readConfAndTopology(const char* infile,
+ bool* haveTopology,
+ gmx_mtop_t* mtop,
+ PbcType* pbcType,
+ rvec** x,
+ rvec** v,
+ matrix box)
{
GMX_RELEASE_ASSERT(mtop != nullptr, "readConfAndTopology requires mtop!=NULL");
- if (ePBC != nullptr)
+ if (pbcType != nullptr)
{
- *ePBC = -1;
+ *pbcType = PbcType::Unset;
}
*haveTopology = fn2bTPX(infile);
{
snew(*v, header.natoms);
}
- int natoms;
- int ePBC_tmp = read_tpx(infile, nullptr, box, &natoms, (x == nullptr) ? nullptr : *x,
- (v == nullptr) ? nullptr : *v, mtop);
- if (ePBC != nullptr)
+ int natoms;
+ PbcType pbcType_tmp = read_tpx(infile, nullptr, box, &natoms, (x == nullptr) ? nullptr : *x,
+ (v == nullptr) ? nullptr : *v, mtop);
+ if (pbcType != nullptr)
{
- *ePBC = ePBC_tmp;
+ *pbcType = pbcType_tmp;
}
}
else
open_symtab(&symtab);
- readConfAndAtoms(infile, &symtab, &name, &atoms, ePBC, x, v, box);
+ readConfAndAtoms(infile, &symtab, &name, &atoms, pbcType, x, v, box);
convertAtomsToMtop(&symtab, put_symtab(&symtab, name), &atoms, mtop);
sfree(name);
}
}
-gmx_bool read_tps_conf(const char* infile, t_topology* top, int* ePBC, rvec** x, rvec** v, matrix box, gmx_bool requireMasses)
+gmx_bool read_tps_conf(const char* infile, t_topology* top, PbcType* pbcType, rvec** x, rvec** v, matrix box, gmx_bool requireMasses)
{
bool haveTopology;
gmx_mtop_t mtop;
- readConfAndTopology(infile, &haveTopology, &mtop, ePBC, x, v, box);
+ readConfAndTopology(infile, &haveTopology, &mtop, pbcType, x, v, box);
*top = gmx_mtop_t_to_t_topology(&mtop, true);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_atoms;
struct t_symtab;
struct t_topology;
+enum class PbcType : int;
void write_sto_conf_indexed(const char* outfile,
const char* title,
const t_atoms* atoms,
const rvec x[],
const rvec* v,
- int ePBC,
+ PbcType pbcType,
const matrix box,
int nindex,
int index[]);
const t_atoms* atoms,
const rvec x[],
const rvec* v,
- int ePBC,
+ PbcType pbcType,
const matrix box);
/* write atoms, x, v (if .gro and not NULL) and box (if not NULL)
* to an STO (.gro or .pdb) file */
const gmx_mtop_t* mtop,
const rvec x[],
const rvec* v,
- int ePBC,
+ PbcType pbcType,
const matrix box);
/* As write_sto_conf, but uses a gmx_mtop_t struct */
* \param[in] infile Input file name
* \param[out] haveTopology true when a topology was read and stored in mtop
* \param[out] mtop The topology, either complete or only atom data
- * \param[out] ePBC Enum reporting the type of PBC
+ * \param[out] pbcType Enum reporting the type of PBC
* \param[in,out] x Coordinates will be stored when *x!=NULL
* \param[in,out] v Velocities will be stored when *v!=NULL
* \param[out] box Box dimensions
void readConfAndTopology(const char* infile,
bool* haveTopology,
gmx_mtop_t* mtop,
- int* ePBC,
+ PbcType* pbcType,
rvec** x,
rvec** v,
matrix box);
* \param[out] symtab The symbol table
* \param[out] name The title of the molecule, e.g. from pdb TITLE record
* \param[out] atoms The global t_atoms struct
- * \param[out] ePBC Enum reporting the type of PBC
+ * \param[out] pbcType Enum reporting the type of PBC
* \param[in,out] x Coordinates will be stored when *x!=NULL
* \param[in,out] v Velocities will be stored when *v!=NULL
* \param[out] box Box dimensions
t_symtab* symtab,
char** name,
t_atoms* atoms,
- int* ePBC,
+ PbcType* pbcType,
rvec** x,
rvec** v,
matrix box);
*
* \param[in] infile Input file name
* \param[out] top The topology, either complete or only atom data. Caller is
- * responsible for calling done_top(). \param[out] ePBC Enum reporting the type of PBC
+ * responsible for calling done_top().
+ * \param[out] pbcType Enum reporting the type of PBC
* \param[in,out] x Coordinates will be stored when *x!=NULL
* \param[in,out] v Velocities will be stored when *v!=NULL
* \param[out] box Box dimensions
*/
gmx_bool read_tps_conf(const char* infile,
struct t_topology* top,
- int* ePBC,
+ PbcType* pbcType,
rvec** x,
rvec** v,
matrix box,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2005, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2005, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2014,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2014,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
-void gmx_write_pdb_box(FILE* out, int ePBC, const matrix box)
+void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box)
{
real alpha, beta, gamma;
- if (ePBC == -1)
+ if (pbcType == PbcType::Unset)
{
- ePBC = guess_ePBC(box);
+ pbcType = guessPbcType(box);
}
- if (ePBC == epbcNONE)
+ if (pbcType == PbcType::No)
{
return;
}
gamma = 90;
}
fprintf(out, "REMARK THIS IS A SIMULATION BOX\n");
- if (ePBC != epbcSCREW)
+ if (pbcType != PbcType::Screw)
{
fprintf(out, "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d\n", 10 * norm(box[XX]),
10 * norm(box[YY]), 10 * norm(box[ZZ]), alpha, beta, gamma, "P 1", 1);
}
}
-static void read_cryst1(char* line, int* ePBC, matrix box)
+static void read_cryst1(char* line, PbcType* pbcType, matrix box)
{
#define SG_SIZE 11
- char sa[12], sb[12], sc[12], sg[SG_SIZE + 1], ident;
- double fa, fb, fc, alpha, beta, gamma, cosa, cosb, cosg, sing;
- int syma, symb, symc;
- int ePBC_file;
+ char sa[12], sb[12], sc[12], sg[SG_SIZE + 1], ident;
+ double fa, fb, fc, alpha, beta, gamma, cosa, cosb, cosg, sing;
+ int syma, symb, symc;
+ PbcType pbcTypeFile;
sscanf(line, "%*s%s%s%s%lf%lf%lf", sa, sb, sc, &alpha, &beta, &gamma);
- ePBC_file = -1;
+ pbcTypeFile = PbcType::Unset;
if (strlen(line) >= 55)
{
strncpy(sg, line + 55, SG_SIZE);
sscanf(sg, "%c %d %d %d", &ident, &syma, &symb, &symc);
if (ident == 'P' && syma == 1 && symb <= 1 && symc <= 1)
{
- fc = strtod(sc, nullptr) * 0.1;
- ePBC_file = (fc > 0 ? epbcXYZ : epbcXY);
+ fc = strtod(sc, nullptr) * 0.1;
+ pbcTypeFile = (fc > 0 ? PbcType::Xyz : PbcType::XY);
}
if (ident == 'P' && syma == 21 && symb == 1 && symc == 1)
{
- ePBC_file = epbcSCREW;
+ pbcTypeFile = PbcType::Screw;
}
}
- if (ePBC)
+ if (pbcType)
{
- *ePBC = ePBC_file;
+ *pbcType = pbcTypeFile;
}
if (box)
fa = strtod(sa, nullptr) * 0.1;
fb = strtod(sb, nullptr) * 0.1;
fc = strtod(sc, nullptr) * 0.1;
- if (ePBC_file == epbcSCREW)
+ if (pbcTypeFile == PbcType::Screw)
{
fa *= 0.5;
}
const char* title,
const t_atoms* atoms,
const rvec x[],
- int ePBC,
+ PbcType pbcType,
const matrix box,
char chainid,
int model_nr,
fprintf(out, "TITLE %s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
if (box && ((norm2(box[XX]) != 0.0F) || (norm2(box[YY]) != 0.0F) || (norm2(box[ZZ]) != 0.0F)))
{
- gmx_write_pdb_box(out, ePBC, box);
+ gmx_write_pdb_box(out, pbcType, box);
}
if (atoms->havePdbInfo)
{
const char* title,
const t_atoms* atoms,
const rvec x[],
- int ePBC,
+ PbcType pbcType,
const matrix box,
char chainid,
int model_nr,
{
index[i] = i;
}
- write_pdbfile_indexed(out, title, atoms, x, ePBC, box, chainid, model_nr, atoms->nr, index,
+ write_pdbfile_indexed(out, title, atoms, x, pbcType, box, chainid, model_nr, atoms->nr, index,
conect, false);
sfree(index);
}
t_atoms* atoms,
t_symtab* symtab,
rvec x[],
- int* ePBC,
+ PbcType* pbcType,
matrix box,
gmx_bool bChange,
gmx_conect conect)
int natom, chainnum;
gmx_bool bStop = FALSE;
- if (ePBC)
+ if (pbcType)
{
/* Only assume pbc when there is a CRYST1 entry */
- *ePBC = epbcNONE;
+ *pbcType = PbcType::No;
}
if (box != nullptr)
{
}
break;
- case epdbCRYST1: read_cryst1(line, ePBC, box); break;
+ case epdbCRYST1: read_cryst1(line, pbcType, box); break;
case epdbTITLE:
case epdbHEADER:
}
}
-void gmx_pdb_read_conf(const char* infile, t_symtab* symtab, char** name, t_atoms* atoms, rvec x[], int* ePBC, matrix box)
+void gmx_pdb_read_conf(const char* infile, t_symtab* symtab, char** name, t_atoms* atoms, rvec x[], PbcType* pbcType, matrix box)
{
FILE* in = gmx_fio_fopen(infile, "r");
char title[STRLEN];
- read_pdbfile(in, title, nullptr, atoms, symtab, x, ePBC, box, TRUE, nullptr);
+ read_pdbfile(in, title, nullptr, atoms, symtab, x, pbcType, box, TRUE, nullptr);
if (name != nullptr)
{
*name = gmx_strdup(title);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_atoms;
struct t_symtab;
struct t_topology;
+enum class PbcType : int;
typedef struct gmx_conect_t* gmx_conect;
/* set read_pdbatoms to read upto 'TER' or 'ENDMDL' (default, bSet=FALSE).
This function is fundamentally broken as far as thread-safety is concerned.*/
-void gmx_write_pdb_box(FILE* out, int ePBC, const matrix box);
+void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box);
/* write the box in the CRYST1 record,
- * with ePBC=-1 the pbc is guessed from the box
+ * with pbcType=PbcType::Unset the pbc is guessed from the box
* This function is fundamentally broken as far as thread-safety is concerned.
*/
const char* title,
const t_atoms* atoms,
const rvec x[],
- int ePBC,
+ PbcType pbcType,
const matrix box,
char chain,
int model_nr,
const char* title,
const t_atoms* atoms,
const rvec x[],
- int ePBC,
+ PbcType pbcType,
const matrix box,
char chain,
int model_nr,
struct t_atoms* atoms,
struct t_symtab* symtab,
rvec x[],
- int* ePBC,
+ PbcType* pbcType,
matrix box,
gmx_bool bChange,
gmx_conect conect);
/* Function returns number of atoms found.
- * ePBC and gmx_conect structure may be NULL.
+ * pbcType and gmx_conect structure may be NULL.
*/
-void gmx_pdb_read_conf(const char* infile, t_symtab* symtab, char** name, t_atoms* atoms, rvec x[], int* ePBC, matrix box);
+void gmx_pdb_read_conf(const char* infile,
+ t_symtab* symtab,
+ char** name,
+ t_atoms* atoms,
+ rvec x[],
+ PbcType* pbcType,
+ matrix box);
/* Read a pdb file and extract ATOM and HETATM fields.
* Read a box from the CRYST1 line, return 0 box when no CRYST1 is found.
- * ePBC may be NULL.
+ * pbcType may be NULL.
*
* If name is not nullptr, gmx_strdup the title string into it. */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
mrcdensitymapheader.cpp
readinp.cpp
fileioxdrserializer.cpp
+ xvgio.cpp
)
if (GMX_USE_TNG)
list(APPEND test_sources tngio.cpp)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/fileio/filetypes.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/atoms.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/topology/topology.h"
void writeReferenceFile()
{
write_sto_conf(referenceFilename_.c_str(), *refTop_->name, &refTop_->atoms,
- as_rvec_array(refX_.data()), nullptr, -1, refBox_);
+ as_rvec_array(refX_.data()), nullptr, PbcType::Unset, refBox_);
}
void readReferenceFileTps()
{
snew(testTop_, 1);
- int ePBC = -2;
- read_tps_conf(referenceFilename_.c_str(), testTop_, &ePBC, &testX_, nullptr, testBox_, FALSE);
+ PbcType pbcType = PbcType::Unset;
+ read_tps_conf(referenceFilename_.c_str(), testTop_, &pbcType, &testX_, nullptr, testBox_, FALSE);
}
void testTopologies()
void writeTestFileAndTest()
{
write_sto_conf(testFilename_.c_str(), *testTop_->name, &testTop_->atoms, testX_, nullptr,
- -1, testBox_);
+ PbcType::Unset, testBox_);
testFilesEqual(referenceFilename_, testFilename_);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Implements tests for xvg file operations
+ *
+ * \author Joe Jordan <ejjordan@kth.se>
+ */
+#include "gmxpre.h"
+
+#include <numeric>
+
+#include <gtest/gtest.h>
+
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/utility/smalloc.h"
+#include "gromacs/utility/textwriter.h"
+
+#include "testutils/testfilemanager.h"
+#include "testutils/testoptions.h"
+
+namespace gmx
+{
+namespace test
+{
+
+class XvgioTester
+{
+public:
+ XvgioTester() { referenceFilename_ = fileManager_.getTemporaryFilePath("ref.xvg"); }
+
+ const std::string& referenceFilename() const { return referenceFilename_; }
+
+ const std::string& referenceContents() const { return referenceContents_; }
+
+ void useStringAsXvgFile(const std::string& xvgString) { referenceContents_ = xvgString; }
+
+ void writeXvgFile()
+ {
+ gmx::TextWriter::writeFileFromString(referenceFilename(), referenceContents());
+ }
+
+ void compareValues(basic_mdspan<const double, dynamicExtents2D> ref,
+ basic_mdspan<const double, dynamicExtents2D> test)
+ {
+ // The xvg reading routines use a column-major layout, while we would
+ // like to enforce row major behaviour everywhere else. This requires
+ // this test to swap the orders between reference data and test data.
+ // Hence, we compare extent(0) with extent(1) and [i][j] with [j][i].
+ EXPECT_EQ(ref.extent(0), test.extent(1));
+ EXPECT_EQ(ref.extent(1), test.extent(0));
+
+ for (std::ptrdiff_t i = 0; i < ref.extent(0); i++)
+ {
+ for (std::ptrdiff_t j = 0; j < ref.extent(1); j++)
+ {
+ EXPECT_DOUBLE_EQ(ref[i][j], test[j][i]);
+ }
+ }
+ }
+
+private:
+ gmx::test::TestFileManager fileManager_;
+ std::string referenceFilename_;
+ std::string referenceContents_;
+};
+
+TEST(XvgioTest, readXvgIntWorks)
+{
+ XvgioTester xvgioTester;
+ xvgioTester.useStringAsXvgFile(
+ "1 2 3\n"
+ "4 5 6\n");
+ xvgioTester.writeXvgFile();
+ MultiDimArray<std::vector<double>, dynamicExtents2D> xvgTestData =
+ readXvgData(xvgioTester.referenceFilename());
+
+ const int numRows = 2;
+ const int numColumns = 3;
+ MultiDimArray<std::vector<double>, dynamicExtents2D> xvgRefData(numRows, numColumns);
+ std::iota(begin(xvgRefData), end(xvgRefData), 1);
+
+ xvgioTester.compareValues(xvgRefData.asConstView(), xvgTestData.asConstView());
+}
+
+TEST(XvgioTest, readXvgRealWorks)
+{
+ XvgioTester xvgioTester;
+ xvgioTester.useStringAsXvgFile(
+ "1.1 2.2\n"
+ "3.3 4.4\n"
+ "5.5 6.6\n");
+ xvgioTester.writeXvgFile();
+ MultiDimArray<std::vector<double>, dynamicExtents2D> xvgTestData =
+ readXvgData(xvgioTester.referenceFilename());
+
+ const int numRows = 3;
+ const int numColumns = 2;
+ MultiDimArray<std::vector<double>, dynamicExtents2D> xvgRefData(numRows, numColumns);
+ std::generate(begin(xvgRefData), end(xvgRefData), [n = 0.0]() mutable {
+ n += 1.1;
+ return n;
+ });
+ xvgioTester.compareValues(xvgRefData.asConstView(), xvgTestData.asConstView());
+}
+
+TEST(XvgioTest, readXvgIgnoreCommentLineWorks)
+{
+ XvgioTester xvgioTester;
+ xvgioTester.useStringAsXvgFile(
+ "1 2 3\n"
+ "#comment\n"
+ "4 5 6\n");
+ xvgioTester.writeXvgFile();
+
+ MultiDimArray<std::vector<double>, dynamicExtents2D> xvgTestData =
+ readXvgData(xvgioTester.referenceFilename());
+
+ const int numRows = 2;
+ const int numColumns = 3;
+ MultiDimArray<std::vector<double>, dynamicExtents2D> xvgRefData(numRows, numColumns);
+ std::iota(begin(xvgRefData), end(xvgRefData), 1);
+
+ xvgioTester.compareValues(xvgRefData.asConstView(), xvgTestData.asConstView());
+}
+
+// Todo: Remove this test once all calls to read_xvg have been ported to readXvgData
+TEST(XvgioTest, readXvgDeprecatedWorks)
+{
+ XvgioTester xvgioTester;
+ xvgioTester.useStringAsXvgFile(
+ "1 2 3\n"
+ "4 5 6\n");
+ xvgioTester.writeXvgFile();
+ std::vector<std::vector<double>> xvgData = { { 1, 4 }, { 2, 5 }, { 3, 6 } };
+
+ double** xvgTestData = nullptr;
+ int testNumColumns;
+ int testNumRows = read_xvg(xvgioTester.referenceFilename().c_str(), &xvgTestData, &testNumColumns);
+
+ double** xvgRefData = nullptr;
+ int refNumColumns = 3;
+ int refNumRows = 2;
+
+ EXPECT_EQ(refNumColumns, testNumColumns);
+ EXPECT_EQ(refNumRows, testNumRows);
+
+ // Set the reference data
+ snew(xvgRefData, refNumColumns);
+ for (int column = 0; column < refNumColumns; column++)
+ {
+ snew(xvgRefData[column], refNumRows);
+ for (int row = 0; row < refNumRows; row++)
+ {
+ xvgRefData[column][row] = xvgData[column][row];
+ }
+ }
+
+ // Check that the reference and test data match
+ for (int column = 0; column < refNumColumns; column++)
+ {
+ for (int row = 0; row < refNumRows; row++)
+ {
+ EXPECT_EQ(xvgRefData[column][row], xvgTestData[column][row]);
+ }
+ }
+
+ // Free the reference and test data memory
+ for (int column = 0; column < refNumColumns; column++)
+ {
+ sfree(xvgRefData[column]);
+ sfree(xvgTestData[column]);
+ }
+ sfree(xvgRefData);
+ sfree(xvgTestData);
+}
+
+} // namespace test
+} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
fepvals->sc_r_power = 6.0;
}
+ if (fepvals->sc_r_power != 6.0)
+ {
+ gmx_fatal(FARGS, "sc-r-power=48 is no longer supported");
+ }
serializer->doReal(&fepvals->sc_sigma);
if (serializer->reading())
{
serializer->doIntArray(block->index, block->nr + 1);
}
-static void do_blocka(gmx::ISerializer* serializer, t_blocka* block)
+static void doListOfLists(gmx::ISerializer* serializer, gmx::ListOfLists<int>* listOfLists)
{
- serializer->doInt(&block->nr);
- serializer->doInt(&block->nra);
+ int numLists = listOfLists->ssize();
+ serializer->doInt(&numLists);
+ int numElements = listOfLists->elementsView().ssize();
+ serializer->doInt(&numElements);
if (serializer->reading())
{
- block->nalloc_index = block->nr + 1;
- snew(block->index, block->nalloc_index);
- block->nalloc_a = block->nra;
- snew(block->a, block->nalloc_a);
+ std::vector<int> listRanges(numLists + 1);
+ serializer->doIntArray(listRanges.data(), numLists + 1);
+ std::vector<int> elements(numElements);
+ serializer->doIntArray(elements.data(), numElements);
+ *listOfLists = gmx::ListOfLists<int>(std::move(listRanges), std::move(elements));
+ }
+ else
+ {
+ serializer->doIntArray(const_cast<int*>(listOfLists->listRangesView().data()), numLists + 1);
+ serializer->doIntArray(const_cast<int*>(listOfLists->elementsView().data()), numElements);
}
- serializer->doIntArray(block->index, block->nr + 1);
- serializer->doIntArray(block->a, block->nra);
}
/* This is a primitive routine to make it possible to translate atomic numbers
sfree(cgs.index);
/* This used to be in the atoms struct */
- do_blocka(serializer, &molt->excls);
+ doListOfLists(serializer, &molt->excls);
}
static void do_molblock(gmx::ISerializer* serializer, gmx_molblock_t* molb, int numAtomsPerMolecule)
* \param[in] tpx The file header data.
* \param[in,out] ir Datastructure with simulation parameters.
*/
-static int do_tpx_ir(gmx::ISerializer* serializer, TpxFileHeader* tpx, t_inputrec* ir)
+static PbcType do_tpx_ir(gmx::ISerializer* serializer, TpxFileHeader* tpx, t_inputrec* ir)
{
- int ePBC;
+ PbcType pbcType;
gmx_bool bPeriodicMols;
/* Starting with tpx version 26, we have the inputrec
*
*
*/
- ePBC = -1;
+ pbcType = PbcType::Unset;
bPeriodicMols = FALSE;
do_test(serializer, tpx->bIr, ir);
/* Removed the pbc info from do_inputrec, since we always want it */
if (!serializer->reading())
{
- ePBC = ir->ePBC;
+ pbcType = ir->pbcType;
bPeriodicMols = ir->bPeriodicMols;
}
- serializer->doInt(&ePBC);
+ serializer->doInt(reinterpret_cast<int*>(&pbcType));
serializer->doBool(&bPeriodicMols);
}
if (tpx->fileGeneration <= tpx_generation && ir)
do_inputrec(serializer, ir, tpx->fileVersion);
if (tpx->fileVersion < 53)
{
- ePBC = ir->ePBC;
+ pbcType = ir->pbcType;
bPeriodicMols = ir->bPeriodicMols;
}
}
if (serializer->reading() && ir && tpx->fileVersion >= 53)
{
/* We need to do this after do_inputrec, since that initializes ir */
- ir->ePBC = ePBC;
+ ir->pbcType = pbcType;
ir->bPeriodicMols = bPeriodicMols;
}
}
- return ePBC;
+ return pbcType;
}
/*! \brief
* \param[in,out] v Individual velocities for processing, deprecated.
* \param[in,out] mtop Global topology.
*/
-static int do_tpx_body(gmx::ISerializer* serializer,
- TpxFileHeader* tpx,
- t_inputrec* ir,
- t_state* state,
- rvec* x,
- rvec* v,
- gmx_mtop_t* mtop)
+static PbcType do_tpx_body(gmx::ISerializer* serializer,
+ TpxFileHeader* tpx,
+ t_inputrec* ir,
+ t_state* state,
+ rvec* x,
+ rvec* v,
+ gmx_mtop_t* mtop)
{
if (state)
{
{
do_tpx_state_second(serializer, tpx, state, x, v);
}
- int ePBC = do_tpx_ir(serializer, tpx, ir);
+ PbcType pbcType = do_tpx_ir(serializer, tpx, ir);
if (serializer->reading())
{
do_tpx_finalize(tpx, ir, state, mtop);
}
- return ePBC;
+ return pbcType;
}
/*! \brief
* \param[in,out] ir Datastructures with simulation parameters.
* \param[in,out] mtop Global topology.
*/
-static int do_tpx_body(gmx::ISerializer* serializer, TpxFileHeader* tpx, t_inputrec* ir, gmx_mtop_t* mtop)
+static PbcType do_tpx_body(gmx::ISerializer* serializer, TpxFileHeader* tpx, t_inputrec* ir, gmx_mtop_t* mtop)
{
return do_tpx_body(serializer, tpx, ir, nullptr, nullptr, nullptr, mtop);
}
partialDeserializedTpr.header = *tpx;
doTpxBodyBuffer(serializer, partialDeserializedTpr.body);
- partialDeserializedTpr.ePBC =
+ partialDeserializedTpr.pbcType =
completeTprDeserialization(&partialDeserializedTpr, ir, state, x, v, mtop);
}
else
{
- partialDeserializedTpr.ePBC = do_tpx_body(serializer, tpx, ir, state, x, v, mtop);
+ partialDeserializedTpr.pbcType = do_tpx_body(serializer, tpx, ir, state, x, v, mtop);
}
// Update header to system info for communication to nodes.
// As we only need to communicate the inputrec and mtop to other nodes,
close_tpx(fio);
}
-int completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
- t_inputrec* ir,
- t_state* state,
- rvec* x,
- rvec* v,
- gmx_mtop_t* mtop)
+PbcType completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
+ t_inputrec* ir,
+ t_state* state,
+ rvec* x,
+ rvec* v,
+ gmx_mtop_t* mtop)
{
// Long-term we should move to use little endian in files to avoid extra byte swapping,
// but since we just used the default XDR format (which is big endian) for the TPR
return do_tpx_body(&tprBodyDeserializer, &partialDeserializedTpr->header, ir, state, x, v, mtop);
}
-int completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
- t_inputrec* ir,
- gmx_mtop_t* mtop)
+PbcType completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
+ t_inputrec* ir,
+ gmx_mtop_t* mtop)
{
return completeTprDeserialization(partialDeserializedTpr, ir, nullptr, nullptr, nullptr, mtop);
}
return partialDeserializedTpr;
}
-int read_tpx(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, gmx_mtop_t* mtop)
+PbcType read_tpx(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, gmx_mtop_t* mtop)
{
t_fileio* fio;
t_state state;
{
copy_mat(state.box, box);
}
- return partialDeserializedTpr.ePBC;
+ return partialDeserializedTpr.pbcType;
}
-int read_tpx_top(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, t_topology* top)
+PbcType read_tpx_top(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, t_topology* top)
{
gmx_mtop_t mtop;
- int ePBC;
+ PbcType pbcType;
- ePBC = read_tpx(fn, ir, box, natoms, x, v, &mtop);
+ pbcType = read_tpx(fn, ir, box, natoms, x, v, &mtop);
*top = gmx_mtop_t_to_t_topology(&mtop, true);
- return ePBC;
+ return pbcType;
}
gmx_bool fn2bTPX(const char* file)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
#include "gromacs/math/vectypes.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
//! The file body.
std::vector<char> body;
//! Flag for PBC needed by legacy implementation.
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
};
/*
*
* \returns PBC flag.
*/
-int completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
- t_inputrec* ir,
- t_state* state,
- rvec* x,
- rvec* v,
- gmx_mtop_t* mtop);
+PbcType completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
+ t_inputrec* ir,
+ t_state* state,
+ rvec* x,
+ rvec* v,
+ gmx_mtop_t* mtop);
//! Overload for final TPR deserialization when not using state vectors.
-int completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
- t_inputrec* ir,
- gmx_mtop_t* mtop);
+PbcType completeTprDeserialization(PartialDeserializedTprFile* partialDeserializedTpr,
+ t_inputrec* ir,
+ gmx_mtop_t* mtop);
/*! \brief
* Read a file to set up a simulation and close it after reading.
* \param[out] x Positions to be filled from file, or nullptr.
* \param[out] v Velocities to be filled from file, or nullptr.
* \param[out] mtop Topology to be populated, or nullptr.
- * \returns ir->ePBC if it was read from the file.
+ * \returns ir->pbcType if it was read from the file.
*/
-int read_tpx(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, gmx_mtop_t* mtop);
+PbcType read_tpx(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, gmx_mtop_t* mtop);
-int read_tpx_top(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, t_topology* top);
+PbcType read_tpx_top(const char* fn, t_inputrec* ir, matrix box, int* natoms, rvec* x, rvec* v, t_topology* top);
/* As read_tpx, but for the old t_topology struct */
gmx_bool fn2bTPX(const char* file);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
fr->v = nullptr;
fr->f = nullptr;
clear_mat(fr->box);
- fr->bPBC = FALSE;
- fr->ePBC = -1;
+ fr->bPBC = FALSE;
+ fr->pbcType = PbcType::Unset;
}
}
-void set_trxframe_ePBC(t_trxframe* fr, int ePBC)
+void setTrxFramePbcType(t_trxframe* fr, PbcType pbcType)
{
- fr->bPBC = (ePBC == -1);
- fr->ePBC = ePBC;
+ fr->bPBC = (pbcType == PbcType::Unset);
+ fr->pbcType = pbcType;
}
int write_trxframe_indexed(t_trxstatus* status, const t_trxframe* fr, int nind, const int* ind, gmx_conect gc)
}
else
{
- write_pdbfile_indexed(gmx_fio_getfp(status->fio), title, fr->atoms, fr->x, -1,
- fr->box, ' ', fr->step, nind, ind, gc, FALSE);
+ write_pdbfile_indexed(gmx_fio_getfp(status->fio), title, fr->atoms, fr->x,
+ PbcType::Unset, fr->box, ' ', fr->step, nind, ind, gc, FALSE);
}
break;
case efG96:
else
{
write_pdbfile(gmx_fio_getfp(status->fio), title, fr->atoms, fr->x,
- fr->bPBC ? fr->ePBC : -1, fr->box, ' ', fr->step, gc);
+ fr->bPBC ? fr->pbcType : PbcType::Unset, fr->box, ' ', fr->step, gc);
}
break;
case efG96: write_g96_conf(gmx_fio_getfp(status->fio), title, fr, -1, nullptr); break;
// Initiate model_nr to -1 rather than NOTSET.
// It is not worthwhile introducing extra variables in the
// read_pdbfile call to verify that a model_nr was read.
- int ePBC, model_nr = -1, na;
- char title[STRLEN], *time, *step;
- double dbl;
+ PbcType pbcType;
+ int model_nr = -1, na;
+ char title[STRLEN], *time, *step;
+ double dbl;
atoms.nr = fr->natoms;
atoms.atom = nullptr;
/* the other pointers in atoms should not be accessed if these are NULL */
snew(symtab, 1);
open_symtab(symtab);
- na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &ePBC, boxpdb, TRUE, nullptr);
+ na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &pbcType, boxpdb, TRUE, nullptr);
free_symtab(symtab);
sfree(symtab);
- set_trxframe_ePBC(fr, ePBC);
+ setTrxFramePbcType(fr, pbcType);
if (nframes_read(status) == 0)
{
fprintf(stderr, " '%s', %d atoms\n", title, fr->natoms);
/***** T O P O L O G Y S T U F F ******/
-t_topology* read_top(const char* fn, int* ePBC)
+t_topology* read_top(const char* fn, PbcType* pbcType)
{
- int epbc, natoms;
+ int natoms;
+ PbcType pbcTypeFile;
t_topology* top;
snew(top, 1);
- epbc = read_tpx_top(fn, nullptr, nullptr, &natoms, nullptr, nullptr, top);
- if (ePBC)
+ pbcTypeFile = read_tpx_top(fn, nullptr, nullptr, &natoms, nullptr, nullptr, top);
+ if (pbcType)
{
- *ePBC = epbc;
+ *pbcType = pbcTypeFile;
}
return top;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* and all data to zero.
*/
-void set_trxframe_ePBC(struct t_trxframe* fr, int ePBC);
-/* Set the type of periodic boundary conditions, ePBC=-1 is not set */
+void setTrxFramePbcType(struct t_trxframe* fr, PbcType pbcType);
+/* Set the type of periodic boundary conditions, pbcType=PbcType::Unset is not set */
int nframes_read(t_trxstatus* status);
/* Returns the number of frames read from the trajectory */
void rewind_trj(t_trxstatus* status);
/* Rewind trajectory file as opened with read_first_x */
-struct t_topology* read_top(const char* fn, int* ePBC);
+struct t_topology* read_top(const char* fn, PbcType* pbcType);
/* Extract a topology data structure from a topology file.
- * If ePBC!=NULL *ePBC gives the pbc type.
+ * If pbcType!=NULL *pbcType gives the pbc type.
*/
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2012,2013,2014,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/oenv.h"
#include "gromacs/math/vec.h"
+#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/binaryinformation.h"
#include "gromacs/utility/coolstuff.h"
#include "gromacs/utility/cstringutil.h"
int read_xvg(const char* fn, double*** y, int* ny)
{
- return read_xvg_legend(fn, y, ny, nullptr, nullptr);
+ gmx::MultiDimArray<std::vector<double>, gmx::dynamicExtents2D> xvgData =
+ readXvgData(std::string(fn));
+
+ int numColumns = xvgData.extent(0);
+ int numRows = xvgData.extent(1);
+
+ double** yy = nullptr;
+ snew(yy, numColumns);
+ for (int column = 0; column < numColumns; column++)
+ {
+ snew(yy[column], numRows);
+ for (int row = 0; row < numRows; row++)
+ {
+ yy[column][row] = xvgData.asConstView()[column][row];
+ }
+ }
+
+ *y = yy;
+ *ny = numColumns;
+ int nx = numRows;
+ return nx;
+}
+
+gmx::MultiDimArray<std::vector<double>, gmx::dynamicExtents2D> readXvgData(const std::string& fn)
+{
+ FILE* fp = gmx_fio_fopen(fn.c_str(), "r");
+ char* ptr;
+ char* base = nullptr;
+ char* fmt = nullptr;
+ char* tmpbuf;
+ int len = STRLEN;
+
+ //! This only gets properly set after the first line of data is read
+ int numColumns = 0;
+ int numRows = 0;
+ snew(tmpbuf, len);
+ std::vector<double> xvgData;
+
+ for (int line = 0; (ptr = fgets3(fp, &tmpbuf, &len, 10 * STRLEN)) != nullptr && ptr[0] != '&'; ++line)
+ {
+ trim(ptr);
+ if (ptr[0] == '@' || ptr[0] == '#')
+ {
+ continue;
+ }
+ ++numRows;
+ if (numColumns == 0)
+ {
+ numColumns = wordcount(ptr);
+ if (numColumns == 0)
+ {
+ return {}; // There are no columns and hence no data to process
+ }
+ snew(fmt, 3 * numColumns + 1);
+ snew(base, 3 * numColumns + 1);
+ }
+ /* Initiate format string */
+ fmt[0] = '\0';
+ base[0] = '\0';
+ int columnCount = 0;
+ for (columnCount = 0; (columnCount < numColumns); columnCount++)
+ {
+ double lf;
+ std::strcpy(fmt, base);
+ std::strcat(fmt, "%lf");
+ int rval = sscanf(ptr, fmt, &lf);
+ if ((rval == EOF) || (rval == 0))
+ {
+ break;
+ }
+ xvgData.push_back(lf);
+ srenew(fmt, 3 * (numColumns + 1) + 1);
+ srenew(base, 3 * numColumns + 1);
+ std::strcat(base, "%*s");
+ }
+
+ if (columnCount != numColumns)
+ {
+ fprintf(stderr, "Only %d columns on line %d in file %s\n", columnCount, line, fn.c_str());
+ for (; (columnCount < numColumns); columnCount++)
+ {
+ xvgData.push_back(0.0);
+ }
+ }
+ }
+ gmx_fio_fclose(fp);
+
+ sfree(tmpbuf);
+ sfree(base);
+ sfree(fmt);
+
+ gmx::MultiDimArray<std::vector<double>, gmx::dynamicExtents2D> xvgDataAsArray(numRows, numColumns);
+ std::copy(std::begin(xvgData), std::end(xvgData), begin(xvgDataAsArray.asView()));
+
+ gmx::MultiDimArray<std::vector<double>, gmx::dynamicExtents2D> xvgDataAsArrayTransposed(
+ numColumns, numRows);
+ for (std::ptrdiff_t row = 0; row < numRows; ++row)
+ {
+ for (std::ptrdiff_t column = 0; column < numColumns; ++column)
+ {
+ xvgDataAsArrayTransposed(column, row) = xvgDataAsArray(row, column);
+ }
+ }
+
+ return xvgDataAsArrayTransposed;
}
void write_xvg(const char* fn, const char* title, int nx, int ny, real** y, const char** leg, const gmx_output_env_t* oenv)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <string>
#include <vector>
+#include "gromacs/math/multidimarray.h"
+#include "gromacs/mdspan/extensions.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
* 0 is the first y legend, the legend string will be NULL when not present.
*/
+/* \brief Read only the data from an xvg file for post processing.
+ *
+ * Note: this function is deprecated in favor of readXvg, which is
+ * used under the hood in this function.
+ *
+ * \param[out] nx Number of rows.
+ * \param[in] fn Xvg file to read.
+ * \param[in/out] y Pointer to 2D array (allocated by the routine).
+ * \param[in/out] ny Number of columns.
+ *
+ * Todo: Port all read_xvg calls to use readXvgData
+ */
int read_xvg(const char* fn, double*** y, int* ny);
-/* As read_xvg_legend, but does not read legends. */
+
+/* \brief Read only the data from an xvg file for post processing.
+ *
+ * \param[out] XvgData Data in row major.
+ * \param[in] fn Xvg file to read.
+ */
+gmx::MultiDimArray<std::vector<double>, gmx::dynamicExtents2D> readXvgData(const std::string& fn);
+
void write_xvg(const char* fn,
const char* title,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (pbc)
{
- set_pbc(pbc, -1, box);
+ set_pbc(pbc, PbcType::Unset, box);
}
if (bAngles)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static void project(const char* trajfile,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
matrix topbox,
const char* projfile,
const char* twodplotfile,
if (top)
{
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, nat);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, nat);
}
for (i = 0; i < nat; i++)
}
else
{
- write_sto_conf(threedplotfile, str, &atoms, x, nullptr, ePBC, box);
+ write_sto_conf(threedplotfile, str, &atoms, x, nullptr, pbcType, box);
}
done_atom(&atoms);
}
#define NPA asize(pa)
t_topology top;
- int ePBC = -1;
- const t_atoms* atoms = nullptr;
+ PbcType pbcType = PbcType::Unset;
+ const t_atoms* atoms = nullptr;
rvec * xtop, *xref1, *xref2, *xrefp = nullptr;
gmx_bool bDMR1, bDMA1, bDMR2, bDMA2;
int nvec1, nvec2, *eignr1 = nullptr, *eignr2 = nullptr;
}
else
{
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, topbox, bM);
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, topbox, bM);
atoms = &top.atoms;
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, atoms->nr);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, atoms->nr);
gmx_rmpbc(gpbc, atoms->nr, topbox, xtop);
/* Fitting is only required for the projection */
if (bProj && bFit1)
if (bProj)
{
- project(bTraj ? opt2fn("-f", NFILE, fnm) : nullptr, bTop ? &top : nullptr, ePBC, topbox,
+ project(bTraj ? opt2fn("-f", NFILE, fnm) : nullptr, bTop ? &top : nullptr, pbcType, topbox,
ProjOnVecFile, TwoDPlotFile, ThreeDPlotFile, FilterFile, skip, ExtremeFile,
bFirstLastSet, max, nextr, atoms, natoms, index, bFit1, xrefp, nfit, ifit, w_rls,
sqrtm, xav1, eignr1, eigvec1, noutvec, outvec, bSplit, oenv);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_trxstatus* status;
t_trxstatus* fpdb;
t_topology top;
- int ePBC;
+ PbcType pbcType;
rvec* xtop;
matrix box;
t_trxframe fr;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, box, TRUE);
bKink = opt2bSet("-ok", NFILE, fnm) || opt2bSet("-okr", NFILE, fnm) || opt2bSet("-okl", NFILE, fnm);
if (bKink)
}
read_first_frame(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &fr, TRX_NEED_X);
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, fr.natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, fr.natoms);
do
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real bfac_init,
t_atoms* atoms,
const rvec x[],
- int ePBC,
+ PbcType pbcType,
matrix box,
gmx_bool bPhi,
gmx_bool bPsi,
fprintf(fp,
"REMARK "
"B-factor field contains negative of dihedral order parameters\n");
- write_pdbfile(fp, nullptr, atoms, x, ePBC, box, ' ', 0, nullptr);
+ write_pdbfile(fp, nullptr, atoms, x, pbcType, box, ' ', 0, nullptr);
x0 = y0 = z0 = 1000.0;
for (i = 0; (i < atoms->nr); i++)
{
FILE* log;
int nlist, idum, nbin;
rvec* x;
- int ePBC;
+ PbcType pbcType;
matrix box;
char grpname[256];
t_dlist* dlist;
/* Find the chi angles using atoms struct and a list of amino acids */
t_topology* top;
snew(top, 1);
- read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &ePBC, &x, nullptr, box, FALSE);
+ read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &pbcType, &x, nullptr, box, FALSE);
t_atoms& atoms = top->atoms;
if (atoms.pdbinfo == nullptr)
{
/* Order parameters */
order_params(log, opt2fn("-o", NFILE, fnm), maxchi, nlist, dlist, ftp2fn_null(efPDB, NFILE, fnm),
- bfac_init, &atoms, x, ePBC, box, bPhi, bPsi, bChi, oenv);
+ bfac_init, &atoms, x, pbcType, box, bPhi, bPsi, bChi, oenv);
/* Print ramachandran maps! */
if (bRama)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_mat * rms, *orig = nullptr;
real* eigenvalues;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms useatoms;
real* eigenvectors;
if (bReadTraj)
{
/* don't read mass-database as masses (and top) are not used */
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtps, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtps, nullptr, box, TRUE);
if (bPBC)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, top.atoms.nr);
}
fprintf(stderr, "\nSelect group for least squares fit%s:\n", bReadMat ? "" : " and RMSD calculation");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2007, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Topology stuff */
t_trxframe fr;
TpxFileHeader tpxh;
- gmx_mtop_t* mtop = nullptr;
- int ePBC = -1;
+ gmx_mtop_t* mtop = nullptr;
+ PbcType pbcType = PbcType::Unset;
int ii, jj;
real temp, tfac;
/* Cluster size distribution (matrix) */
{
gmx_fatal(FARGS, "tpr (%d atoms) and trajectory (%d atoms) do not match!", tpxh.natoms, natoms);
}
- ePBC = read_tpx(tpr, nullptr, nullptr, &natoms, nullptr, nullptr, mtop);
+ pbcType = read_tpx(tpr, nullptr, nullptr, &natoms, nullptr, nullptr, mtop);
}
if (ndf <= -1)
{
{
if (bPBC)
{
- set_pbc(&pbc, ePBC, fr.box);
+ set_pbc(&pbc, pbcType, fr.box);
}
max_clust_size = 1;
max_clust_ind = -1;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
FILE* fp;
char * name1, *name2;
t_topology *top1, *top2;
- int ePBC1, ePBC2;
+ PbcType pbcType1, pbcType2;
t_atoms * atoms1, *atoms2;
int warn = 0;
int at;
/* reading reference structure from first structure file */
fprintf(stderr, "\nReading first structure file\n");
snew(top1, 1);
- read_tps_conf(conf1file, top1, &ePBC1, &x1, &v1, box1, TRUE);
+ read_tps_conf(conf1file, top1, &pbcType1, &x1, &v1, box1, TRUE);
atoms1 = &(top1->atoms);
fprintf(stderr, "%s\nContaining %d atoms in %d residues\n", *top1->name, atoms1->nr, atoms1->nres);
/* reading second structure file */
fprintf(stderr, "\nReading second structure file\n");
snew(top2, 1);
- read_tps_conf(conf2file, top2, &ePBC2, &x2, &v2, box2, TRUE);
+ read_tps_conf(conf2file, top2, &pbcType2, &x2, &v2, box2, TRUE);
atoms2 = &(top2->atoms);
fprintf(stderr, "%s\nContaining %d atoms in %d residues\n", *top2->name, atoms2->nr, atoms2->nres);
fp = gmx_ffopen(outfile, "w");
if (!bOne)
{
- write_pdbfile(fp, *top1->name, atoms1, x1, ePBC1, box1, ' ', 1, nullptr);
+ write_pdbfile(fp, *top1->name, atoms1, x1, pbcType1, box1, ' ', 1, nullptr);
}
- write_pdbfile(fp, *top2->name, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, nullptr);
+ write_pdbfile(fp, *top2->name, atoms2, x2, pbcType2, box2, ' ', bOne ? -1 : 2, nullptr);
gmx_ffclose(fp);
break;
case efGRO:
fprintf(stderr, "WARNING: cannot write the reference structure to %s file\n",
ftp2ext(fn2ftp(outfile)));
}
- write_sto_conf(outfile, *top2->name, atoms2, x2, v2, ePBC2, box2);
+ write_sto_conf(outfile, *top2->name, atoms2, x2, v2, pbcType2, box2);
break;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
FILE* out = nullptr; /* initialization makes all compilers happy */
t_trxstatus* status;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms* atoms;
rvec * x, *xread, *xref, *xav, *xproj;
matrix box, zerobox;
xpmfile = opt2fn_null("-xpm", NFILE, fnm);
xpmafile = opt2fn_null("-xpma", NFILE, fnm);
- read_tps_conf(fitfile, &top, &ePBC, &xref, nullptr, box, TRUE);
+ read_tps_conf(fitfile, &top, &pbcType, &xref, nullptr, box, TRUE);
atoms = &top.atoms;
if (bFit)
/* Prepare reference frame */
if (bPBC)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, atoms->nr);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, atoms->nr);
gmx_rmpbc(gpbc, atoms->nr, box, xref);
}
if (bFit)
}
}
write_sto_conf_indexed(opt2fn("-av", NFILE, fnm), "Average structure", atoms, xread, nullptr,
- epbcNONE, zerobox, natoms, index);
+ PbcType::No, zerobox, natoms, index);
sfree(xread);
fprintf(stderr, "Constructing covariance matrix (%dx%d) ...\n", static_cast<int>(ndim),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,2011,2012 by the GROMACS development team.
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
static void calc_mj(t_topology top,
- int ePBC,
+ PbcType pbcType,
matrix box,
gmx_bool bNoJump,
int isize,
if (!bNoJump)
{
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
}
clear_rvec(tmp);
gmx_bool bNoJump,
gmx_bool bACF,
gmx_bool bINT,
- int ePBC,
+ PbcType pbcType,
t_topology top,
t_trxframe fr,
real temp,
clear_rvec(mjd_tmp);
clear_rvec(mdvec);
clear_rvec(tmp);
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, fr.natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, fr.natoms);
do
{
gmx_rmpbc_trxfr(gpbc, &fr);
- calc_mj(top, ePBC, fr.box, bNoJump, nmols, indexm, fr.x, mtrans[nfr], mass2, qmol);
+ calc_mj(top, pbcType, fr.box, bNoJump, nmols, indexm, fr.x, mtrans[nfr], mass2, qmol);
for (i = 0; i < isize; i++)
{
int flags = 0;
gmx_bool bACF;
gmx_bool bINT;
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
int nmols;
int i;
real* qmol;
bACF = opt2bSet("-caf", NFILE, fnm);
bINT = opt2bSet("-mc", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, nullptr, nullptr, box, TRUE);
indexfn = ftp2fn_null(efNDX, NFILE, fnm);
snew(grpname, 1);
/* System information is read and prepared, dielectric() processes the frames
* and calculates the requested quantities */
- dielectric(fmj, fmd, outf, fcur, mcor, fmjdsp, bNoJump, bACF, bINT, ePBC, top, fr, temp, bfit, efit,
+ dielectric(fmj, fmd, outf, fcur, mcor, fmjdsp, bNoJump, bACF, bINT, pbcType, top, fr, temp, bfit, efit,
bvit, evit, status, isize, nmols, nshift, index0, indexm, mass2, qmol, eps_rf, oenv);
xvgrclose(fmj);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
double*** slDensity,
int* nslices,
t_topology* top,
- int ePBC,
+ PbcType pbcType,
int axis,
int nr_grps,
real* slWidth,
snew((*slDensity)[i], *nslices);
}
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, top->atoms.nr);
/*********** Start processing trajectory ***********/
do
{
double*** slDensity,
int* nslices,
t_topology* top,
- int ePBC,
+ PbcType pbcType,
int axis,
int nr_grps,
real* slWidth,
snew((*slDensity)[i], *nslices);
}
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, top->atoms.nr);
/*********** Start processing trajectory ***********/
snew(den_val, top->atoms.nr);
int* ngx; /* sizes of groups */
t_electron* el_tab; /* tabel with nr. of electrons*/
t_topology* top; /* topology */
- int ePBC;
+ PbcType pbcType;
int* index_center; /* index for centering group */
int** index; /* indices for all groups */
/* Calculate axis */
axis = toupper(axtitle[0]) - 'X';
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC); /* read topology file */
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType); /* read topology file */
snew(grpname, ngrps);
snew(index, ngrps);
nr_electrons = get_electrons(&el_tab, ftp2fn(efDAT, NFILE, fnm));
fprintf(stderr, "Read %d atomtypes from datafile\n", nr_electrons);
- calc_electron_density(ftp2fn(efTRX, NFILE, fnm), index, ngx, &density, &nslices, top, ePBC,
- axis, ngrps, &slWidth, el_tab, nr_electrons, bCenter, index_center,
- ncenter, bRelative, oenv);
+ calc_electron_density(ftp2fn(efTRX, NFILE, fnm), index, ngx, &density, &nslices, top,
+ pbcType, axis, ngrps, &slWidth, el_tab, nr_electrons, bCenter,
+ index_center, ncenter, bRelative, oenv);
}
else
{
- calc_density(ftp2fn(efTRX, NFILE, fnm), index, ngx, &density, &nslices, top, ePBC, axis,
+ calc_density(ftp2fn(efTRX, NFILE, fnm), index, ngx, &density, &nslices, top, pbcType, axis,
ngrps, &slWidth, bCenter, index_center, ncenter, bRelative, oenv, dens_opt);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
FILE* fp;
t_trxstatus* status;
t_topology top;
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
rvec * x, xcom[2], direction, center, dx;
matrix box;
real t, m, mtot;
if (ftp2bSet(efTPS, NFILE, fnm) || !ftp2bSet(efNDX, NFILE, fnm))
{
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, bRadial);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &x, nullptr, box, bRadial);
}
if (!bRadial)
{
}
else
{
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (i = 0; i < 2; i++)
{
if (gnx[i] == 1)
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int* zslices,
int* tblock,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
int axis,
gmx_bool bCenter,
gmx_bool bps1d,
/****Start trajectory processing***/
/*Initialize Densdevel and PBC-remove*/
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, top->atoms.nr);
*Densdevel = nullptr;
gmx_output_env_t* oenv;
t_topology* top;
char** grpname;
- int ePBC, *ngx;
+ PbcType pbcType;
+ int* ngx;
static real binw = 0.2;
static real binwz = 0.05;
static real dens1 = 0.00;
bRawOut = opt2bSet("-or", NFILE, fnm);
bGraph = opt2bSet("-og", NFILE, fnm);
bOut = opt2bSet("-o", NFILE, fnm);
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC);
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType);
snew(grpname, 1);
snew(index, 1);
snew(ngx, 1);
get_index(&top->atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, ngx, index, grpname);
density_in_time(ftp2fn(efTRX, NFILE, fnm), index, ngx, binw, binwz, nsttblock, &Densmap,
- &xslices, &yslices, &zslices, &tblock, top, ePBC, axis, bCenter, b1d, oenv);
+ &xslices, &yslices, &zslices, &tblock, top, pbcType, axis, bCenter, b1d, oenv);
if (ftorder > 0)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const int mindex[],
rvec x[],
rvec mu[],
- int ePBC,
+ PbcType pbcType,
const matrix box,
const t_atom* atom,
const int* nAtom)
}
}
}
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
grp0 = 0;
grp1 = ncos - 1;
for (i = 0; i < ngrp[grp0]; i++)
}
static void do_dip(const t_topology* top,
- int ePBC,
+ PbcType pbcType,
real volume,
const char* fn,
const char* out_mtot,
gkrbin = mk_gkrbin(rcut, rcmax, bPhi, ndegrees);
}
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natom);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natom);
/* Start while loop over frames */
t0 = t;
if (bGkr)
{
- do_gkr(gkrbin, ncos, gnx, molindex, mols->index, x, dipole, ePBC, box, atom, gkatom);
+ do_gkr(gkrbin, ncos, gnx, molindex, mols->index, x, dipole, pbcType, box, atom, gkatom);
}
if (bTotal)
int npargs;
t_pargs* ppa;
t_topology* top;
- int ePBC;
+ PbcType pbcType;
int k, natoms;
matrix box;
}
snew(top, 1);
- ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms, nullptr, nullptr, top);
+ pbcType = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms, nullptr, nullptr, top);
snew(gnx, ncos);
snew(grpname, ncos);
}
nFF[0] = nFA;
nFF[1] = nFB;
- do_dip(top, ePBC, det(box), ftp2fn(efTRX, NFILE, fnm), opt2fn("-o", NFILE, fnm),
+ do_dip(top, pbcType, det(box), ftp2fn(efTRX, NFILE, fnm), opt2fn("-o", NFILE, fnm),
opt2fn("-eps", NFILE, fnm), opt2fn("-a", NFILE, fnm), opt2fn("-d", NFILE, fnm),
opt2fn_null("-cos", NFILE, fnm), opt2fn_null("-dip3d", NFILE, fnm),
opt2fn_null("-adip", NFILE, fnm), bPairs, corrtype[0], opt2fn("-c", NFILE, fnm), bGkr,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/fcdata.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/mshift.h"
#include "gromacs/pbcutil/pbc.h"
g = nullptr;
pbc_null = nullptr;
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
if (ir->bPeriodicMols)
{
auto mdAtoms = gmx::makeMDAtoms(fplog, *topInfo.mtop(), *ir, false);
atoms2md(topInfo.mtop(), ir, -1, nullptr, ntopatoms, mdAtoms.get());
update_mdatoms(mdAtoms->mdatoms(), ir->fepvals->init_lambda);
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
- gpbc = gmx_rmpbc_init(&top.idef, ir->ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, ir->pbcType, natoms);
}
j = 0;
do
{
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
if (ir->bPeriodicMols)
{
- set_pbc(&pbc, ir->ePBC, box);
+ set_pbc(&pbc, ir->pbcType, box);
}
else
{
j++;
} while (read_next_x(oenv, status, &t, x, box));
close_trx(status);
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
gmx_rmpbc_done(gpbc);
}
if (bPDB)
{
write_sto_conf(opt2fn("-q", NFILE, fnm), "Coloured by average violation in Angstrom",
- atoms.get(), xav, nullptr, ir->ePBC, box);
+ atoms.get(), xav, nullptr, ir->pbcType, box);
}
dump_disre_matrix(opt2fn_null("-x", NFILE, fnm), &dr, fcd.disres.nres, j, &top.idef,
topInfo.mtop(), max_dr, nlevels, bThird);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const char * fnSCount, *fnArea, *fnTArea, *fnAArea;
const char* leg[] = { "Phobic", "Phylic" };
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms* atoms;
t_matrix mat;
int nres, nr0, naccr, nres_plus_separators;
fnAArea = opt2fn_null("-aa", NFILE, fnm);
bDoAccSurf = ((fnArea != nullptr) || (fnTArea != nullptr) || (fnAArea != nullptr));
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, nullptr, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xp, nullptr, box, FALSE);
atoms = &(top.atoms);
check_oo(atoms);
bPhbres = bPhobics(atoms);
accr = nullptr;
naccr = 0;
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
do
{
t = output_env_conv_time(oenv, t);
}
gmx_rmpbc(gpbc, natoms, box, x);
tapein = gmx_ffopen(pdbfile, "w");
- write_pdbfile_indexed(tapein, nullptr, atoms, x, ePBC, box, ' ', -1, gnx, index, nullptr, FALSE);
+ write_pdbfile_indexed(tapein, nullptr, atoms, x, pbcType, box, ' ', -1, gnx, index, nullptr, FALSE);
gmx_ffclose(tapein);
/* strip_dssp returns the number of lines found in the dssp file, i.e.
* the number of residues plus the separator lines */
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2011-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/index.h"
#include "gromacs/topology/topology.h"
#include "gromacs/trajectory/trajectoryframe.h"
};
FILE * fp, *fplog;
t_topology top;
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
t_trxframe fr;
matrix box;
int gnx;
please_cite(fplog, "Pascal2011a");
please_cite(fplog, "Caleman2011b");
- read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &pbcType, nullptr, nullptr, box, TRUE);
/* Handle index groups */
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &grpNatoms, &index, &grpname);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int natoms;
/*we rely on PBC autodetection (...currently)*/
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
real * rvalues = nullptr, *kappa2values = nullptr, *rhist = nullptr, *khist = nullptr;
t_pbc* pbc = nullptr;
if (bPBCdist)
{
- set_pbc(pbc, ePBC, fr.box);
+ set_pbc(pbc, pbcType, fr.box);
pbc_dx(pbc, donpos, accpos, dist);
}
else
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/do_fit.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pbcutil/rmpbc.h"
#include "gromacs/topology/index.h"
#include "gromacs/topology/topology.h"
const char * topfile, *lowfile, *highfile;
gmx_bool bTop = FALSE;
t_topology top;
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
rvec* xtop;
matrix topbox, *box, boxf;
char* grpname;
}
if (topfile)
{
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, topbox, TRUE);
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, topbox, TRUE);
if (bTop)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, top.atoms.nr);
gmx_rmpbc(gpbc, top.atoms.nr, topbox, xtop);
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
FILE* out;
t_trxstatus* status;
t_topology top;
- int ePBC;
+ PbcType pbcType;
rvec * x, *x_s;
rvec xcm, gvec, gvec1;
matrix box, trans;
printf("Will print radius normalised by charge\n");
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &x, nullptr, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
if (nmol > gnx || gnx % nmol != 0)
}
if (nz == 0)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
}
do
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real* slWidth,
int* nslices,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
int axis,
gmx_bool bMicel,
int micel[],
teller = 0;
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
/*********** Start processing trajectory ***********/
do
{
int ngx, /* nr. of atomsin sol group */
nmic = 0; /* nr. of atoms in micelle */
t_topology* top; /* topology */
- int ePBC;
+ PbcType pbcType;
int * index, /* indices for solvent group */
*micelle = nullptr;
gmx_bool bMicel = FALSE; /* think we're a micel */
}
bMicel = opt2bSet("-nm", NFILE, fnm);
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC); /* read topology file */
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType); /* read topology file */
rd_index(ftp2fn(efNDX, NFILE, fnm), 1, &ngx, &index, &grpname);
}
calc_h2order(ftp2fn(efTRX, NFILE, fnm), index, ngx, &slDipole, &slOrder, &slWidth, &nslices,
- top, ePBC, axis, bMicel, micelle, nmic, oenv);
+ top, pbcType, axis, bMicel, micelle, nmic, oenv);
h2order_plot(slDipole, slOrder, opt2fn("-o", NFILE, fnm), nslices, slWidth, oenv);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_fatal(FARGS, "Topology (%d atoms) does not match trajectory (%d atoms)", top.atoms.nr, natoms);
}
- bBox = (ir->ePBC != epbcNONE);
+ bBox = (ir->pbcType != PbcType::No);
grid = init_grid(bBox, box, (rcut > r2cut) ? rcut : r2cut, ngrid);
nabin = static_cast<int>(acut / abin);
nrbin = static_cast<int>(rcut / rbin);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int i, j, nall, nbb, nca, teller;
int * bbindex, *caindex, *allindex;
t_topology* top;
- int ePBC;
+ PbcType pbcType;
rvec * x, *xref;
real t;
real rms;
bRange = (opt2parg_bSet("-ahxstart", asize(pa), pa) && opt2parg_bSet("-ahxend", asize(pa), pa));
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC);
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType);
natoms = read_first_x(oenv, &status, opt2fn("-f", NFILE, fnm), &t, &x, box);
pr_bb(stdout, nres, bb);
}
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
teller = 0;
do
if (teller == 1)
{
write_sto_conf(opt2fn("-cz", NFILE, fnm), "Helix fitted to Z-Axis", &(top->atoms),
- x, nullptr, ePBC, box);
+ x, nullptr, pbcType, box);
}
xf[efhRAD].val = radius(xf[efhRAD].fp2, nca, caindex, x);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_pbc pbc;
matrix A;
- FILE *fpaxis, *fpcenter, *fptilt, *fprotation;
- FILE *fpradius, *fprise, *fptwist;
- FILE *fptheta1, *fptheta2, *fptheta3;
- FILE* fpbending;
- int ePBC;
+ FILE * fpaxis, *fpcenter, *fptilt, *fprotation;
+ FILE * fpradius, *fprise, *fptwist;
+ FILE * fptheta1, *fptheta2, *fptheta3;
+ FILE* fpbending;
+ PbcType pbcType;
gmx_output_env_t* oenv;
gmx_rmpbc_t gpbc = nullptr;
return 0;
}
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC);
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType);
for (i = 0; i < 3; i++)
{
unitaxes[1][1] = 1;
unitaxes[2][2] = 1;
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
do
{
/* initialisation for correct distance calculations */
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
/* make molecules whole again */
gmx_rmpbc(gpbc, natoms, box, x);
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/smalloc.h"
static void find_tetra_order_grid(t_topology top,
- int ePBC,
+ PbcType pbcType,
int natoms,
matrix box,
rvec x[],
snew(skmol, maxidx);
/* Must init pbc every step because of pressure coupling */
- set_pbc(&pbc, ePBC, box);
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ set_pbc(&pbc, pbcType, box);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
gmx_rmpbc(gpbc, natoms, box, x);
*sgmean = 0.0;
{
FILE * fpsg = nullptr, *fpsk = nullptr;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_trxstatus* status;
int natoms;
real t;
* i.e 1D Row-major order in (t,x,y) */
- read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, FALSE);
+ read_tps_conf(fnTPS, &top, &pbcType, &xtop, nullptr, box, FALSE);
*nslicex = static_cast<int>(box[XX][XX] / binw + onehalf); /*Calculate slicenr from binwidth*/
*nslicey = static_cast<int>(box[YY][YY] / binw + onehalf);
}
}
- find_tetra_order_grid(top, ePBC, natoms, box, x, isize[0], index[0], &sg, &sk, *nslicex,
+ find_tetra_order_grid(top, pbcType, natoms, box, x, isize[0], index[0], &sg, &sk, *nslicex,
*nslicey, nslicez, sg_grid, sk_grid);
GMX_RELEASE_ASSERT(sk_fravg != nullptr, "Trying to dereference NULL sk_fravg pointer");
for (i = 0; i < *nslicex; i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*to read topology file*/
t_topology top;
- int ePBC;
+ PbcType pbcType;
matrix topbox;
rvec* xtop;
gmx_bool bFit1;
read_eigenvectors(EigvecFile, &nav, &bFit1, &xref1, &edi_params.fitmas, &xav1,
&edi_params.pcamas, &nvec1, &eignr1, &eigvec1, &eigval1);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, topbox, false);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, topbox, false);
atoms = &top.atoms;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real trunc,
real** mdmat,
int** nmat,
- int ePBC,
+ PbcType pbcType,
matrix box)
{
int i, j, resi, resj;
t_pbc pbc;
rvec ddx;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
trunc2 = gmx::square(trunc);
for (resi = 0; (resi < nres); resi++)
{
FILE * out = nullptr, *fp;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms useatoms;
int isize;
int* index;
fprintf(stderr, "Will calculate number of different contacts\n");
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &x, nullptr, box, FALSE);
fprintf(stderr, "Select group for analysis\n");
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
rhi.g = 0.0;
rhi.b = 0.0;
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, trxnat);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, trxnat);
if (bFrames)
{
{
gmx_rmpbc(gpbc, trxnat, box, x);
nframes++;
- calc_mat(nres, natoms, rndx, x, index, truncate, mdmat, nmat, ePBC, box);
+ calc_mat(nres, natoms, rndx, x, index, truncate, mdmat, nmat, pbcType, box);
for (i = 0; (i < nres); i++)
{
for (j = 0; (j < natoms); j++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/smalloc.h"
-static void periodic_dist(int ePBC, matrix box, rvec x[], int n, const int index[], real* rmin, real* rmax, int* min_ind)
+static void
+periodic_dist(PbcType pbcType, matrix box, rvec x[], int n, const int index[], real* rmin, real* rmax, int* min_ind)
{
#define NSHIFT_MAX 26
int nsz, nshift, sx, sy, sz, i, j, s;
rvec shift[NSHIFT_MAX], d0, d;
sqr_box = std::min(norm2(box[XX]), norm2(box[YY]));
- if (ePBC == epbcXYZ)
+ if (pbcType == PbcType::Xyz)
{
sqr_box = std::min(sqr_box, norm2(box[ZZ]));
nsz = 1;
}
- else if (ePBC == epbcXY)
+ else if (pbcType == PbcType::XY)
{
nsz = 0;
}
else
{
- gmx_fatal(FARGS, "pbc = %s is not supported by g_mindist", epbc_names[ePBC]);
+ gmx_fatal(FARGS, "pbc = %s is not supported by g_mindist", c_pbcTypeNames[pbcType].c_str());
}
nshift = 0;
static void periodic_mindist_plot(const char* trxfn,
const char* outfn,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
int n,
int index[],
gmx_bool bSplit,
if (nullptr != top)
{
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
}
bFirst = TRUE;
gmx_rmpbc(gpbc, natoms, box, x);
}
- periodic_dist(ePBC, box, x, n, index, &rmin, &rmax, ind_min);
+ periodic_dist(pbcType, box, x, n, index, &rmin, &rmax, ind_min);
if (rmin < rmint)
{
rmint = rmin;
static void calc_dist(real rcut,
gmx_bool bPBC,
- int ePBC,
+ PbcType pbcType,
matrix box,
rvec x[],
int nx1,
/* Must init pbc every step because of pressure coupling */
if (bPBC)
{
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
}
if (index2)
{
int nres,
int* residue,
gmx_bool bPBC,
- int ePBC,
+ PbcType pbcType,
gmx_bool bGroup,
gmx_bool bEachResEachTime,
gmx_bool bPrintResName,
{
if (ng == 1)
{
- calc_dist(rcut, bPBC, ePBC, box, x0, gnx[0], gnx[0], index[0], index[0], bGroup,
+ calc_dist(rcut, bPBC, pbcType, box, x0, gnx[0], gnx[0], index[0], index[0], bGroup,
&dmin, &dmax, &nmin, &nmax, &min1, &min2, &max1, &max2);
fprintf(dist, " %12e", bMin ? dmin : dmax);
if (num)
{
for (k = i + 1; (k < ng); k++)
{
- calc_dist(rcut, bPBC, ePBC, box, x0, gnx[i], gnx[k], index[i], index[k],
+ calc_dist(rcut, bPBC, pbcType, box, x0, gnx[i], gnx[k], index[i], index[k],
bGroup, &dmin, &dmax, &nmin, &nmax, &min1, &min2, &max1, &max2);
fprintf(dist, " %12e", bMin ? dmin : dmax);
if (num)
GMX_RELEASE_ASSERT(ng > 1, "Must have more than one group when not using -matrix");
for (i = 1; (i < ng); i++)
{
- calc_dist(rcut, bPBC, ePBC, box, x0, gnx[0], gnx[i], index[0], index[i], bGroup,
+ calc_dist(rcut, bPBC, pbcType, box, x0, gnx[0], gnx[i], index[0], index[i], bGroup,
&dmin, &dmax, &nmin, &nmax, &min1, &min2, &max1, &max2);
fprintf(dist, " %12e", bMin ? dmin : dmax);
if (num)
{
for (j = 0; j < nres; j++)
{
- calc_dist(rcut, bPBC, ePBC, box, x0, residue[j + 1] - residue[j], gnx[i],
+ calc_dist(rcut, bPBC, pbcType, box, x0, residue[j + 1] - residue[j], gnx[i],
&(index[0][residue[j]]), index[i], bGroup, &dmin, &dmax, &nmin,
&nmax, &min1r, &min2r, &max1r, &max2r);
mindres[i - 1][j] = std::min(mindres[i - 1][j], dmin);
{ "-printresname", FALSE, etBOOL, { &bPrintResName }, "Write residue names" }
};
gmx_output_env_t* oenv;
- t_topology* top = nullptr;
- int ePBC = -1;
- rvec* x = nullptr;
+ t_topology* top = nullptr;
+ PbcType pbcType = PbcType::Unset;
+ rvec* x = nullptr;
matrix box;
gmx_bool bTop = FALSE;
if (tpsfnm || resfnm || !ndxfnm)
{
snew(top, 1);
- bTop = read_tps_conf(tpsfnm, top, &ePBC, &x, nullptr, box, FALSE);
+ bTop = read_tps_conf(tpsfnm, top, &pbcType, &x, nullptr, box, FALSE);
if (bPI && !bTop)
{
printf("\nWARNING: Without a run input file a trajectory with broken molecules will "
if (bPI)
{
- periodic_mindist_plot(trxfnm, distfnm, top, ePBC, gnx[0], index[0], bSplit, oenv);
+ periodic_mindist_plot(trxfnm, distfnm, top, pbcType, gnx[0], index[0], bSplit, oenv);
}
else
{
dist_plot(trxfnm, atmfnm, distfnm, numfnm, resfnm, oxfnm, rcutoff, bMat,
top ? &(top->atoms) : nullptr, ng, index, gnx, grpname, bSplit, !bMax, nres,
- residues, bPBC, ePBC, bGroup, bEachResEachTime, bPrintResName, oenv);
+ residues, bPBC, pbcType, bGroup, bEachResEachTime, bPrintResName, oenv);
}
do_view(oenv, distfnm, "-nxy");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const int* molindex,
const t_topology* top,
rvec* x,
- int ePBC,
+ PbcType pbcType,
matrix box,
const gmx_output_env_t* oenv)
{
{
pdbinfo[i].bfac *= scale;
}
- write_sto_conf(fn_pdb, "molecular MSD", &top->atoms, x, nullptr, ePBC, box);
+ write_sto_conf(fn_pdb, "molecular MSD", &top->atoms, x, nullptr, pbcType, box);
}
}
static int corr_loop(t_corr* curr,
const char* fn,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
gmx_bool bMol,
int gnx[],
int* index[],
if (bMol)
{
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
}
/* the loop over all frames */
real t_pdb,
int nrgrp,
t_topology* top,
- int ePBC,
+ PbcType pbcType,
gmx_bool bTen,
gmx_bool bMW,
gmx_bool bRmCOMM,
msd = std::make_unique<t_corr>(nrgrp, type, axis, dim_factor, mol_file == nullptr ? 0 : gnx[0],
bTen, bMW, dt, top, beginfit, endfit);
- nat_trx = corr_loop(msd.get(), trx_file, top, ePBC, mol_file ? gnx[0] != 0 : false, gnx.data(),
+ nat_trx = corr_loop(msd.get(), trx_file, top, pbcType, mol_file ? gnx[0] != 0 : false, gnx.data(),
index, (mol_file != nullptr) ? calc1_mol : (bMW ? calc1_mw : calc1_norm),
bTen, gnx_com, index_com, dt, t_pdb, pdb_file ? &x : nullptr, box, oenv);
{
snew(top->atoms.pdbinfo, top->atoms.nr);
}
- printmol(msd.get(), mol_file, pdb_file, index[0], top, x, ePBC, box, oenv);
+ printmol(msd.get(), mol_file, pdb_file, index[0], top, x, pbcType, box, oenv);
top->atoms.nr = i;
}
#define NFILE asize(fnm)
t_topology top;
- int ePBC;
+ PbcType pbcType;
matrix box;
const char * trx_file, *tps_file, *ndx_file, *msd_file, *mol_file, *pdb_file;
rvec* xdum;
gmx_fatal(FARGS, "Can only calculate the full tensor for 3D msd");
}
- bTop = read_tps_conf(tps_file, &top, &ePBC, &xdum, nullptr, box, bMW || bRmCOMM);
+ bTop = read_tps_conf(tps_file, &top, &pbcType, &xdum, nullptr, box, bMW || bRmCOMM);
if (mol_file && !bTop)
{
gmx_fatal(FARGS, "Could not read a topology from %s. Try a tpr file instead.", tps_file);
}
- do_corr(trx_file, ndx_file, msd_file, mol_file, pdb_file, t_pdb, ngroup, &top, ePBC, bTen, bMW,
- bRmCOMM, type, dim_factor, axis, dt, beginfit, endfit, oenv);
+ do_corr(trx_file, ndx_file, msd_file, mol_file, pdb_file, t_pdb, ngroup, &top, pbcType, bTen,
+ bMW, bRmCOMM, type, dim_factor, axis, dt, beginfit, endfit, oenv);
done_top(&top);
view_all(oenv, NFILE, fnm);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_trxstatus* out;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms* atoms;
rvec * xtop, *xref, *xav, *xout1, *xout2;
gmx_bool bDMR, bDMA, bFit;
read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit, &xref, &bDMR, &xav, &bDMA, &nvec,
&eignr, &eigvec, &eigval);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bDMA);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, box, bDMA);
atoms = &top.atoms;
printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n", natoms);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_trxstatus* out;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms* atoms;
rvec * xtop, *xref, *xav, *xout;
int nvec, *eignr = nullptr;
read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit, &xref, &bDMR, &xav, &bDMA, &nvec,
&eignr, &eigvec, &eigval);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bDMA);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, box, bDMA);
/* Find vectors and phases */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* P.J. van Maaren, November 2005 Added tetrahedral stuff */
/****************************************************************************/
-static void find_nearest_neighbours(int ePBC,
+static void find_nearest_neighbours(PbcType pbcType,
int natoms,
matrix box,
rvec x[],
snew(skmol, maxidx);
/* Must init pbc every step because of pressure coupling */
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
gmx_rmpbc(gpbc, natoms, box, x);
{
FILE * fpsg = nullptr, *fpsk = nullptr;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_trxstatus* status;
int natoms;
real t;
gmx_rmpbc_t gpbc = nullptr;
- read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, FALSE);
+ read_tps_conf(fnTPS, &top, &pbcType, &xtop, nullptr, box, FALSE);
snew(sg_slice, nslice);
snew(sk_slice, nslice);
fpsk = xvgropen(skfn, "S\\sk\\N Distance Order Parameter", "Time (ps)", "S\\sk\\N", oenv);
/* loop over frames */
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
nframes = 0;
do
{
- find_nearest_neighbours(ePBC, natoms, box, x, isize[0], index[0], &sg, &sk, nslice,
+ find_nearest_neighbours(pbcType, natoms, box, x, isize[0], index[0], &sg, &sk, nslice,
slice_dim, sg_slice, sk_slice, gpbc);
for (i = 0; (i < nslice); i++)
{
gmx_bool bSliced,
gmx_bool bUnsat,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
int ngrps,
int axis,
gmx_bool permolecule,
teller = 0;
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
/*********** Start processing trajectory ***********/
do
{
}
teller++;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
gmx_rmpbc_copy(gpbc, natoms, box, x0, x1);
/* Now loop over all groups. There are ngrps groups, the order parameter can
}
write_sto_conf(opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, nullptr,
- frout.ePBC, frout.box);
+ frout.pbcType, frout.box);
sfree(frout.x);
done_atom(&useatoms);
char** grpname; /* groupnames */
int ngrps, /* nr. of groups */
i, axis = 0; /* normal axis */
- t_topology* top; /* topology */
- int ePBC;
- int * index, /* indices for a */
- *a; /* atom numbers in each group */
- t_blocka* block; /* data from index file */
+ t_topology* top; /* topology */
+ PbcType pbcType; /* type of periodic boundary conditions */
+ int * index, /* indices for a */
+ *a; /* atom numbers in each group */
+ t_blocka* block; /* data from index file */
t_filenm fnm[] = {
/* files for g_order */
{ efTRX, "-f", nullptr, ffREAD }, /* trajectory file */
fprintf(stderr, "Taking carbons as unsaturated!\n");
}
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC); /* read topology file */
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType); /* read topology file */
block = init_index(ftp2fn(efNDX, NFILE, fnm), &grpname);
index = block->index; /* get indices from t_block block */
print_types(index, a, ngrps, grpname, top);
calc_order(ftp2fn(efTRX, NFILE, fnm), index, a, &order, &slOrder, &slWidth, nslices,
- bSliced, bUnsat, top, ePBC, ngrps, axis, permolecule, radial, distcalc,
+ bSliced, bUnsat, top, pbcType, ngrps, axis, permolecule, radial, distcalc,
opt2fn_null("-nr", NFILE, fnm), &distvals, oenv);
if (radial)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_topology* top;
gmx_output_env_t* oenv;
- int ePBC;
+ PbcType pbcType;
int isize, *index, nmol, *molind, mol, nat_min = 0, nat_max = 0;
char* grpname;
t_trxstatus* status;
}
snew(top, 1);
- ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms, nullptr, nullptr, top);
+ pbcType = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms, nullptr, nullptr, top);
fprintf(stderr, "Select a group of polymer mainchain atoms:\n");
get_index(&top->atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
sum_gyro_tot = 0;
sum_pers_tot = 0;
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
do
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
double*** slField,
int* nslices,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
int axis,
int nr_grps,
double* slWidth,
}
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
/*********** Start processing trajectory ***********/
do
char** grpname; /* groupnames */
int* ngx; /* sizes of groups */
t_topology* top; /* topology */
- int ePBC;
+ PbcType pbcType;
int** index; /* indices for all groups */
t_filenm fnm[] = {
/* files for g_order */
/* Calculate axis */
axis = toupper(axtitle[0]) - 'X';
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC); /* read topology file */
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType); /* read topology file */
snew(grpname, ngrps);
snew(index, ngrps);
calc_potential(ftp2fn(efTRX, NFILE, fnm), index, ngx, &potential, &charge, &field, &nslices,
- top, ePBC, axis, ngrps, &slWidth, fudge_z, bSpherical, bCorrect, oenv);
+ top, pbcType, axis, ngrps, &slWidth, fudge_z, bSpherical, bCorrect, oenv);
plot_potential(potential, charge, field, opt2fn("-o", NFILE, fnm), opt2fn("-oc", NFILE, fnm),
opt2fn("-of", NFILE, fnm), nslices, ngrps, grpname, slWidth, oenv);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_pargs pa[] = { { "-foo", FALSE, etBOOL, { &foo }, "Dummy option to avoid empty array" } };
t_trxstatus* status;
t_topology top;
- int ePBC;
+ PbcType pbcType;
real t;
rvec* x;
}
sfree(legend);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, nullptr, nullptr, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
do
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_bool bNorm, bAv, bFreq2, bFile2, bMat, bBond, bDelta, bMirror, bMass;
gmx_bool bFit, bReset;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_iatom* iatom = nullptr;
matrix box = { { 0 } };
}
}
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, nullptr, box, TRUE);
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xp, nullptr, box, TRUE);
snew(w_rls, top.atoms.nr);
snew(w_rms, top.atoms.nr);
/* Prepare reference frame */
if (bPBC)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, top.atoms.nr);
gmx_rmpbc(gpbc, top.atoms.nr, box, xp);
}
if (bReset)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/strdb.h"
-static void calc_dist(int nind, const int index[], const rvec x[], int ePBC, matrix box, real** d)
+static void calc_dist(int nind, const int index[], const rvec x[], PbcType pbcType, matrix box, real** d)
{
int i, j;
rvec dx;
real temp2;
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (i = 0; (i < nind - 1); i++)
{
const real* xi = x[index[i]];
static void calc_dist_tot(int nind,
const int index[],
rvec x[],
- int ePBC,
+ PbcType pbcType,
matrix box,
real** d,
real** dtot,
rvec dx;
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (i = 0; (i < nind - 1); i++)
{
xi = x[index[i]];
real t;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms* atoms;
matrix box;
rvec* x;
}
/* get topology and index */
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &x, nullptr, box, FALSE);
if (!bPBC)
{
- ePBC = epbcNONE;
+ pbcType = PbcType::No;
}
atoms = &(top.atoms);
}
/*set box type*/
- calc_dist(isize, index, x, ePBC, box, d_r);
+ calc_dist(isize, index, x, pbcType, box, d_r);
sfree(x);
/*open output files*/
do
{
- calc_dist_tot(isize, index, x, ePBC, box, d, dtot, dtot2, bNMR, dtot1_3, dtot1_6);
+ calc_dist_tot(isize, index, x, pbcType, box, d, dtot, dtot2, bNMR, dtot1_3, dtot1_6);
rmsnow = rms_diff(isize, d, d_r);
fprintf(fp, "%g %g\n", t, rmsnow);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real t, *w_rls;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms * pdbatoms, *refatoms;
matrix box, pdbbox;
devfn = opt2fn_null("-od", NFILE, fnm);
dirfn = opt2fn_null("-dir", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xref, nullptr, box, TRUE);
const char* title = *top.name;
snew(w_rls, top.atoms.nr);
if (bFit)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natom);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natom);
}
/* Now read the trj again to compute fluctuations */
{
rvec_inc(pdbx[index[i]], xcm);
}
- write_sto_conf_indexed(opt2fn("-oq", NFILE, fnm), title, pdbatoms, pdbx, nullptr, ePBC,
+ write_sto_conf_indexed(opt2fn("-oq", NFILE, fnm), title, pdbatoms, pdbx, nullptr, pbcType,
pdbbox, isize, index);
}
if (opt2bSet("-ox", NFILE, fnm))
}
}
/* Write a .pdb file with B-factors and optionally anisou records */
- write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, bFactorX, nullptr, ePBC,
- pdbbox, isize, index);
+ write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, bFactorX, nullptr,
+ pbcType, pdbbox, isize, index);
sfree(bFactorX);
}
if (bAniso)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real t, t0, t1, dt;
gmx_rmpbc_t gpbc = nullptr;
t_topology* top;
- int ePBC;
+ PbcType pbcType;
t_filenm fnm[] = { { efTRX, "-f", nullptr, ffREAD },
{ efTPR, nullptr, nullptr, ffREAD },
{ efNDX, nullptr, nullptr, ffREAD },
"these can not be atom doublets\n");
}
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC);
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType);
snew(c1, nvec);
for (i = 0; (i < nvec); i++)
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
snew(x_s, natoms);
- gpbc = gmx_rmpbc_init(&(top->idef), ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&(top->idef), pbcType, natoms);
/* Start the loop over frames */
t0 = t;
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2009-2017, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int* index,
gmx_bool bMW,
const t_topology* top,
- int ePBC,
+ PbcType pbcType,
rvec* x_ref)
{
int natoms, nfr_all, nfr, i, j, a, r, c, min_fr;
w_rls[a] = (bMW ? top->atoms.atom[index[a]].m : 1.0);
tot_mass += w_rls[a];
}
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, natoms);
do
{
FILE* out;
t_trxstatus* status;
t_topology top;
- int ePBC;
+ PbcType pbcType;
rvec * x_ref, *x;
matrix box, R;
real t;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x_ref, nullptr, box, bMW);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &x_ref, nullptr, box, bMW);
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, top.atoms.nr);
gmx_rmpbc(gpbc, top.atoms.nr, box, x_ref);
if (reffit[0][0] != 'n')
{
get_refx(oenv, ftp2fn(efTRX, NFILE, fnm), reffit[0][2] == 'z' ? 3 : 2, skip, gnx, index,
- bMW, &top, ePBC, x_ref);
+ bMW, &top, pbcType, x_ref);
}
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int nset[3] = { 0, 0, 0 };
t_topology* top;
- int ePBC;
+ PbcType pbcType;
char* buf;
t_trxstatus* status;
int i, j, k, m, nnn, teller, ncg;
return 0;
}
- top = read_top(ftp2fn(efTPR, NFILE, fnm), &ePBC);
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType);
cg = mk_charge(&top->atoms, &ncg);
snew(cgdist, ncg);
snew(nWithin, ncg);
srenew(time, teller + 1);
time[teller] = t;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (i = 0; (i < ncg); i++)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxana/gstat.h"
#include "gromacs/gmxana/nsfactor.h"
#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pbcutil/rmpbc.h"
#include "gromacs/topology/index.h"
#include "gromacs/topology/topology.h"
t_topology* top = nullptr;
gmx_rmpbc_t gpbc = nullptr;
gmx_bool bFFT = FALSE, bDEBYE = FALSE;
- gmx_bool bMC = FALSE;
- int ePBC = -1;
+ gmx_bool bMC = FALSE;
+ PbcType pbcType = PbcType::Unset;
matrix box;
rvec* x;
int natoms;
snew(grpname, 1);
snew(index, 1);
- read_tps_conf(fnTPX, top, &ePBC, &x, nullptr, box, TRUE);
+ read_tps_conf(fnTPX, top, &pbcType, &x, nullptr, box, TRUE);
printf("\nPlease select group for SANS spectra calculation:\n");
get_index(&(top->atoms), ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, grpname);
/* Prepare reference frame */
if (bPBC)
{
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, top->atoms.nr);
gmx_rmpbc(gpbc, top->atoms.nr, box, x);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int gmx_sorient(int argc, char* argv[])
{
t_topology top;
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
t_trxstatus* status;
int natoms;
real t;
bTPS = (opt2bSet("-s", NFILE, fnm) || !opt2bSet("-n", NFILE, fnm) || bCom);
if (bTPS)
{
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bCom);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, box, bCom);
}
/* get index groups */
rmin2 = gmx::square(rmin);
rmax2 = gmx::square(rmax);
- rcut = 0.99 * std::sqrt(max_cutoff2(guess_ePBC(box), box));
+ rcut = 0.99 * std::sqrt(max_cutoff2(guessPbcType(box), box));
if (rcut == 0)
{
rcut = 10 * rmax;
if (bTPS)
{
/* make molecules whole again */
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
}
/* start analysis of trajectory */
do
gmx_rmpbc(gpbc, natoms, box, x);
}
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
n = 0;
inp = 0;
for (p = 0; (p < nrefgrp); p++)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2007,2008,2009,2010,2011 by the GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
double MINBIN[3];
double MAXBIN[3];
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_trxframe fr;
rvec* xtop;
matrix box, box_pbc;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, box, TRUE);
sfree(xtop);
atoms = &(top.atoms);
if (bPBC)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
}
/* This is the main loop over frames */
do
if (bPBC)
{
gmx_rmpbc_trxfr(gpbc, &fr);
- set_pbc(&pbc, ePBC, box_pbc);
+ set_pbc(&pbc, pbcType, box_pbc);
}
for (i = 0; i < nidx; i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
-static void calc_com_pbc(int nrefat, const t_topology* top, rvec x[], t_pbc* pbc, const int index[], rvec xref, int ePBC)
+static void calc_com_pbc(int nrefat, const t_topology* top, rvec x[], t_pbc* pbc, const int index[], rvec xref, PbcType pbcType)
{
const real tol = 1e-4;
gmx_bool bChanged;
}
svmul(1 / mtot, xref, xref);
/* Now check if any atom is more than half the box from the COM */
- if (ePBC != epbcNONE)
+ if (pbcType != PbcType::No)
{
iter = 0;
do
}
snew(top, 1);
- // TODO: Only ePBC is used, not the full inputrec.
+ // TODO: Only pbcType is used, not the full inputrec.
t_inputrec irInstance;
t_inputrec* ir = &irInstance;
read_tpx_top(ftp2fn(efTPR, NFILE, fnm), ir, box, &natoms, nullptr, nullptr, top);
/* initialize reading trajectory: */
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
- rcut = 0.99 * std::sqrt(max_cutoff2(ir->ePBC, box));
+ rcut = 0.99 * std::sqrt(max_cutoff2(ir->pbcType, box));
if (rcut == 0)
{
rcut = 10 * rmax;
molindex = top->mols.index;
atom = top->atoms.atom;
- gpbc = gmx_rmpbc_init(&top->idef, ir->ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top->idef, ir->pbcType, natoms);
/* start analysis of trajectory */
do
/* make molecules whole again */
gmx_rmpbc(gpbc, natoms, box, x);
- set_pbc(&pbc, ir->ePBC, box);
+ set_pbc(&pbc, ir->pbcType, box);
if (bCom)
{
- calc_com_pbc(nrefat, top, x, &pbc, index[0], xref, ir->ePBC);
+ calc_com_pbc(nrefat, top, x, &pbc, index[0], xref, ir->pbcType);
}
for (m = 0; m < isize[1]; m++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
};
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_trxframe fr;
matrix box;
gmx_bool bTop;
return 0;
}
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, nullptr, nullptr, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
if (bMol)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const char* xname,
const char* title,
t_atoms* atoms,
- int ePBC,
+ PbcType pbcType,
matrix box,
int isize,
int* index,
atoms->pdbinfo[index[i]].bfac = sum[index[i]][onedim] * scale;
}
}
- write_sto_conf_indexed(fname, title, atoms, x, nullptr, ePBC, box, isize, index);
+ write_sto_conf_indexed(fname, title, atoms, x, nullptr, pbcType, box, isize, index);
}
}
FILE * outx = nullptr, *outv = nullptr, *outf = nullptr, *outb = nullptr, *outt = nullptr;
FILE * outekt = nullptr, *outekr = nullptr;
t_topology top;
- int ePBC;
+ PbcType pbcType;
real * mass, time;
const char* indexfn;
t_trxframe fr;
}
std::string sffmt6 = gmx::formatString("%s%s%s%s%s%s", sffmt, sffmt, sffmt, sffmt, sffmt, sffmt);
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, topbox,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, topbox,
bCom && (bOX || bOXT || bOV || bOT || bEKT || bEKR));
sfree(xtop);
if ((bMol || bCV || bCF) && !bTop)
if (bCom && bPBC)
{
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, fr.natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, fr.natoms);
}
do
{
if (nr_xfr > 1)
{
- if (ePBC != epbcNONE && !bNoJump)
+ if (pbcType != PbcType::No && !bNoJump)
{
fprintf(stderr,
"\nWARNING: More than one frame was used for option -cv or -cf\n"
if (bCV)
{
write_pdb_bfac(opt2fn("-cv", NFILE, fnm), opt2fn("-av", NFILE, fnm), "average velocity",
- &(top.atoms), ePBC, topbox, isize[0], index[0], nr_xfr, sumx, nr_vfr, sumv,
- bDim, scale, oenv);
+ &(top.atoms), pbcType, topbox, isize[0], index[0], nr_xfr, sumx, nr_vfr,
+ sumv, bDim, scale, oenv);
}
if (bCF)
{
write_pdb_bfac(opt2fn("-cf", NFILE, fnm), opt2fn("-af", NFILE, fnm), "average force",
- &(top.atoms), ePBC, topbox, isize[0], index[0], nr_xfr, sumx, nr_ffr, sumf,
- bDim, scale, oenv);
+ &(top.atoms), pbcType, topbox, isize[0], index[0], nr_xfr, sumx, nr_ffr,
+ sumf, bDim, scale, oenv);
}
/* view it */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_trxstatus* status;
gmx_bool bNShell, bPDBout;
t_topology top;
- int ePBC;
+ PbcType pbcType;
rvec * x, *xsol, xcom, dx;
matrix box;
t_pbc pbc;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &x, nullptr, box, TRUE);
sfree(x);
/* get index groups */
}
out = open_trx(opt2fn("-o", NFILE, fnm), "w");
}
- gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
+ gpbc = gmx_rmpbc_init(&top.idef, pbcType, natoms);
do
{
gmx_rmpbc(gpbc, natoms, box, x);
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
if (ref_a == -1)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_output_env_t* oenv;
const char * matfile, *otfile, *orfile;
t_topology top;
- int ePBC;
+ PbcType pbcType;
matrix boxtop, box, *sbox, avbox, corr;
rvec * xtop, *x, **sx;
int isize, nalloc, nallocn;
exit(0);
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, boxtop, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, &xtop, nullptr, boxtop, FALSE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
nalloc = 0;
fprintf(stderr, "\rProcessing frame %d", f);
fflush(stderr);
}
- if (ePBC != epbcNONE)
+ if (pbcType != PbcType::No)
{
/* Scale all the configuration to the average box */
gmx::invertBoxMatrix(sbox[f], corr);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/index.h"
#include "gromacs/topology/topology.h"
#include "gromacs/trajectory/trajectoryframe.h"
};
t_topology top;
- int ePBC = -1;
+ PbcType pbcType = PbcType::Unset;
t_trxframe fr;
matrix box;
gmx_bool bTPS = FALSE, bTop = FALSE;
if (bTPS)
{
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &pbcType, nullptr, nullptr, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
}
else
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_dih* dd;
gmx_rmpbc_t gpbc = nullptr;
- gpbc = gmx_rmpbc_init(xr->idef, xr->ePBC, xr->natoms);
+ gpbc = gmx_rmpbc_init(xr->idef, xr->pbcType, xr->natoms);
gmx_rmpbc(gpbc, xr->natoms, xr->box, xr->x);
gmx_rmpbc_done(gpbc);
t_topology* top;
real t;
- top = read_top(topfile, &xr->ePBC);
+ top = read_top(topfile, &xr->pbcType);
/*get_dih2(xr,top->idef.functype,&(top->idef.bondeds),&(top->atoms));*/
get_dih(xr, &(top->atoms));
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
rvec* x;
matrix box;
t_idef* idef;
- int ePBC;
+ PbcType pbcType;
gmx_output_env_t* oenv;
} t_xrama;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
char** grpname;
int** index;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_trxframe fr;
reduced_atom_t** red;
structure_factor* sf;
sf->energy = energy;
/* Read the topology informations */
- read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, TRUE);
+ read_tps_conf(fnTPS, &top, &pbcType, &xtop, nullptr, box, TRUE);
sfree(xtop);
/* groups stuff... */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2012,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2012,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/vec.h"
#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
+#include "gromacs/simd/simd.h"
#include "gromacs/utility/fatalerror.h"
-//! Enum for templating the soft-core treatment in the kernel
-enum class SoftCoreTreatment
+//! Scalar (non-SIMD) data types.
+struct ScalarDataTypes
{
- None, //!< No soft-core
- RPower6, //!< Soft-core with r-power = 6
- RPower48 //!< Soft-core with r-power = 48
+ using RealType = real; //!< The data type to use as real.
+ using IntType = int; //!< The data type to use as int.
+ static constexpr int simdRealWidth = 1; //!< The width of the RealType.
+ static constexpr int simdIntWidth = 1; //!< The width of the IntType.
};
-//! Most treatments are fine with float in mixed-precision mode.
-template<SoftCoreTreatment softCoreTreatment>
-struct SoftCoreReal
+#if GMX_SIMD_HAVE_REAL && GMX_SIMD_HAVE_INT32_ARITHMETICS
+//! SIMD data types.
+struct SimdDataTypes
{
- //! Real type for soft-core calculations
- using Real = real;
+ using RealType = gmx::SimdReal; //!< The data type to use as real.
+ using IntType = gmx::SimdInt32; //!< The data type to use as int.
+ static constexpr int simdRealWidth = GMX_SIMD_REAL_WIDTH; //!< The width of the RealType.
+ static constexpr int simdIntWidth = GMX_SIMD_FINT32_WIDTH; //!< The width of the IntType.
};
+#endif
-//! This treatment requires double precision for some computations.
-template<>
-struct SoftCoreReal<SoftCoreTreatment::RPower48>
-{
- //! Real type for soft-core calculations
- using Real = double;
-};
-
-//! Computes r^(1/p) and 1/r^(1/p) for the standard p=6
-template<SoftCoreTreatment softCoreTreatment>
-static inline void pthRoot(const real r, real* pthRoot, real* invPthRoot)
-{
- *invPthRoot = gmx::invsqrt(std::cbrt(r));
- *pthRoot = 1 / (*invPthRoot);
-}
-
-// We need a double version to make the specialization below work
-#if !GMX_DOUBLE
//! Computes r^(1/p) and 1/r^(1/p) for the standard p=6
-template<SoftCoreTreatment softCoreTreatment>
-static inline void pthRoot(const double r, real* pthRoot, double* invPthRoot)
+template<class RealType>
+static inline void pthRoot(const RealType r, RealType* pthRoot, RealType* invPthRoot)
{
*invPthRoot = gmx::invsqrt(std::cbrt(r));
*pthRoot = 1 / (*invPthRoot);
}
-#endif
-
-//! Computes r^(1/p) and 1/r^(1/p) for p=48
-template<>
-inline void pthRoot<SoftCoreTreatment::RPower48>(const double r, real* pthRoot, double* invPthRoot)
-{
- *pthRoot = std::pow(r, 1.0 / 48.0);
- *invPthRoot = 1 / (*pthRoot);
-}
-template<SoftCoreTreatment softCoreTreatment>
-static inline real calculateSigmaPow(const real sigma6)
+template<class RealType>
+static inline RealType calculateRinv6(const RealType rinvV)
{
- if (softCoreTreatment == SoftCoreTreatment::RPower6)
- {
- return sigma6;
- }
- else
- {
- real sigmaPow = sigma6 * sigma6; /* sigma^12 */
- sigmaPow = sigmaPow * sigmaPow; /* sigma^24 */
- sigmaPow = sigmaPow * sigmaPow; /* sigma^48 */
- return (sigmaPow);
- }
-}
-
-template<SoftCoreTreatment softCoreTreatment, class SCReal>
-static inline real calculateRinv6(const SCReal rinvV)
-{
- if (softCoreTreatment == SoftCoreTreatment::RPower6)
- {
- return rinvV;
- }
- else
- {
- real rinv6 = rinvV * rinvV;
- return (rinv6 * rinv6 * rinv6);
- }
+ RealType rinv6 = rinvV * rinvV;
+ return (rinv6 * rinv6 * rinv6);
}
-static inline real calculateVdw6(const real c6, const real rinv6)
+template<class RealType>
+static inline RealType calculateVdw6(const RealType c6, const RealType rinv6)
{
return (c6 * rinv6);
}
-static inline real calculateVdw12(const real c12, const real rinv6)
+template<class RealType>
+static inline RealType calculateVdw12(const RealType c12, const RealType rinv6)
{
return (c12 * rinv6 * rinv6);
}
/* reaction-field electrostatics */
-template<class SCReal>
-static inline SCReal
-reactionFieldScalarForce(const real qq, const real rinv, const SCReal r, const real krf, const real two)
+template<class RealType>
+static inline RealType reactionFieldScalarForce(const RealType qq,
+ const RealType rinv,
+ const RealType r,
+ const real krf,
+ const real two)
{
return (qq * (rinv - two * krf * r * r));
}
-template<class SCReal>
-static inline real
-reactionFieldPotential(const real qq, const real rinv, const SCReal r, const real krf, const real potentialShift)
+template<class RealType>
+static inline RealType reactionFieldPotential(const RealType qq,
+ const RealType rinv,
+ const RealType r,
+ const real krf,
+ const real potentialShift)
{
return (qq * (rinv + krf * r * r - potentialShift));
}
/* Ewald electrostatics */
-static inline real ewaldScalarForce(const real coulomb, const real rinv)
+template<class RealType>
+static inline RealType ewaldScalarForce(const RealType coulomb, const RealType rinv)
{
return (coulomb * rinv);
}
-static inline real ewaldPotential(const real coulomb, const real rinv, const real potentialShift)
+template<class RealType>
+static inline RealType ewaldPotential(const RealType coulomb, const RealType rinv, const real potentialShift)
{
return (coulomb * (rinv - potentialShift));
}
/* cutoff LJ */
-static inline real lennardJonesScalarForce(const real v6, const real v12)
+template<class RealType>
+static inline RealType lennardJonesScalarForce(const RealType v6, const RealType v12)
{
return (v12 - v6);
}
-static inline real lennardJonesPotential(const real v6,
- const real v12,
- const real c6,
- const real c12,
- const real repulsionShift,
- const real dispersionShift,
- const real onesixth,
- const real onetwelfth)
+template<class RealType>
+static inline RealType lennardJonesPotential(const RealType v6,
+ const RealType v12,
+ const RealType c6,
+ const RealType c12,
+ const real repulsionShift,
+ const real dispersionShift,
+ const real onesixth,
+ const real onetwelfth)
{
return ((v12 + c12 * repulsionShift) * onetwelfth - (v6 + c6 * dispersionShift) * onesixth);
}
}
/* LJ Potential switch */
-template<class SCReal>
-static inline SCReal potSwitchScalarForceMod(const SCReal fScalarInp,
- const real potential,
- const real sw,
- const SCReal r,
- const real rVdw,
- const real dsw,
- const real zero)
+template<class RealType>
+static inline RealType potSwitchScalarForceMod(const RealType fScalarInp,
+ const RealType potential,
+ const RealType sw,
+ const RealType r,
+ const RealType rVdw,
+ const RealType dsw,
+ const real zero)
{
if (r < rVdw)
{
- SCReal fScalar = fScalarInp * sw - r * potential * dsw;
+ real fScalar = fScalarInp * sw - r * potential * dsw;
return (fScalar);
}
return (zero);
}
-template<class SCReal>
-static inline real
-potSwitchPotentialMod(const real potentialInp, const real sw, const SCReal r, const real rVdw, const real zero)
+template<class RealType>
+static inline RealType potSwitchPotentialMod(const RealType potentialInp,
+ const RealType sw,
+ const RealType r,
+ const RealType rVdw,
+ const real zero)
{
if (r < rVdw)
{
//! Templated free-energy non-bonded kernel
-template<SoftCoreTreatment softCoreTreatment, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald, bool elecInteractionTypeIsEwald, bool vdwModifierIsPotSwitch>
+template<typename DataTypes, bool useSoftCore, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald, bool elecInteractionTypeIsEwald, bool vdwModifierIsPotSwitch>
static void nb_free_energy_kernel(const t_nblist* gmx_restrict nlist,
rvec* gmx_restrict xx,
gmx::ForceWithShiftForces* forceWithShiftForces,
nb_kernel_data_t* gmx_restrict kernel_data,
t_nrnb* gmx_restrict nrnb)
{
- using SCReal = typename SoftCoreReal<softCoreTreatment>::Real;
-
- constexpr bool useSoftCore = (softCoreTreatment != SoftCoreTreatment::None);
-
#define STATE_A 0
#define STATE_B 1
#define NSTATES 2
+ using RealType = typename DataTypes::RealType;
+ using IntType = typename DataTypes::IntType;
+
+ /* FIXME: How should these be handled with SIMD? */
constexpr real onetwelfth = 1.0 / 12.0;
constexpr real onesixth = 1.0 / 6.0;
constexpr real zero = 0.0;
const int* typeA = mdatoms->typeA;
const int* typeB = mdatoms->typeB;
const int ntype = fr->ntype;
- const real* nbfp = fr->nbfp;
+ const real* nbfp = fr->nbfp.data();
const real* nbfp_grid = fr->ljpme_c6grid;
real* Vv = kernel_data->energygrp_vdw;
const real lambda_coul = kernel_data->lambda[efptCOUL];
GMX_RELEASE_ASSERT(!(vdwInteractionTypeIsEwald && vdwModifierIsPotSwitch),
"Can not apply soft-core to switched Ewald potentials");
- SCReal dvdl_coul = 0; /* Needs double for sc_power==48 */
- SCReal dvdl_vdw = 0; /* Needs double for sc_power==48 */
+ real dvdl_coul = 0;
+ real dvdl_vdw = 0;
/* Lambda factor for state A, 1-lambda*/
real LFC[NSTATES], LFV[NSTATES];
DLF[STATE_B] = 1;
real lfac_coul[NSTATES], dlfac_coul[NSTATES], lfac_vdw[NSTATES], dlfac_vdw[NSTATES];
- constexpr real sc_r_power = (softCoreTreatment == SoftCoreTreatment::RPower48 ? 48.0_real : 6.0_real);
+ constexpr real sc_r_power = 6.0_real;
for (int i = 0; i < NSTATES; i++)
{
lfac_coul[i] = (lam_power == 2 ? (1 - LFC[i]) * (1 - LFC[i]) : (1 - LFC[i]));
for (int k = nj0; k < nj1; k++)
{
- int tj[NSTATES];
- const int jnr = jjnr[k];
- const int j3 = 3 * jnr;
- real c6[NSTATES], c12[NSTATES], qq[NSTATES], Vcoul[NSTATES], Vvdw[NSTATES];
- real r, rinv, rp, rpm2;
- real alpha_vdw_eff, alpha_coul_eff, sigma_pow[NSTATES];
- const real dx = ix - x[j3];
- const real dy = iy - x[j3 + 1];
- const real dz = iz - x[j3 + 2];
- const real rsq = dx * dx + dy * dy + dz * dz;
- SCReal FscalC[NSTATES], FscalV[NSTATES]; /* Needs double for sc_power==48 */
+ int tj[NSTATES];
+ const int jnr = jjnr[k];
+ const int j3 = 3 * jnr;
+ RealType c6[NSTATES], c12[NSTATES], qq[NSTATES], Vcoul[NSTATES], Vvdw[NSTATES];
+ RealType r, rinv, rp, rpm2;
+ RealType alpha_vdw_eff, alpha_coul_eff, sigma6[NSTATES];
+ const RealType dx = ix - x[j3];
+ const RealType dy = iy - x[j3 + 1];
+ const RealType dz = iz - x[j3 + 2];
+ const RealType rsq = dx * dx + dy * dy + dz * dz;
+ RealType FscalC[NSTATES], FscalV[NSTATES];
if (rsq >= rcutoff_max2)
{
r = 0;
}
- if (softCoreTreatment == SoftCoreTreatment::None)
+ if (useSoftCore)
+ {
+ rpm2 = rsq * rsq; /* r4 */
+ rp = rpm2 * rsq; /* r6 */
+ }
+ else
{
/* The soft-core power p will not affect the results
* with not using soft-core, so we use power of 0 which gives
rpm2 = rinv * rinv;
rp = 1;
}
- if (softCoreTreatment == SoftCoreTreatment::RPower6)
- {
- rpm2 = rsq * rsq; /* r4 */
- rp = rpm2 * rsq; /* r6 */
- }
- if (softCoreTreatment == SoftCoreTreatment::RPower48)
- {
- rp = rsq * rsq * rsq; /* r6 */
- rp = rp * rp; /* r12 */
- rp = rp * rp; /* r24 */
- rp = rp * rp; /* r48 */
- rpm2 = rp / rsq; /* r46 */
- }
- real Fscal = 0;
+ RealType Fscal = 0;
qq[STATE_A] = iqA * chargeA[jnr];
qq[STATE_B] = iqB * chargeB[jnr];
c12[i] = nbfp[tj[i] + 1];
if (useSoftCore)
{
- real sigma6[NSTATES];
if ((c6[i] > 0) && (c12[i] > 0))
{
/* c12 is stored scaled with 12.0 and c6 is scaled with 6.0 - correct for this */
{
sigma6[i] = sigma6_def;
}
- sigma_pow[i] = calculateSigmaPow<softCoreTreatment>(sigma6[i]);
}
}
Vcoul[i] = 0;
Vvdw[i] = 0;
- real rinvC, rinvV;
- SCReal rC, rV, rpinvC, rpinvV; /* Needs double for sc_power==48 */
+ RealType rinvC, rinvV, rC, rV, rpinvC, rpinvV;
/* Only spend time on A or B state if it is non-zero */
if ((qq[i] != 0) || (c6[i] != 0) || (c12[i] != 0))
{
- /* this section has to be inside the loop because of the dependence on sigma_pow */
+ /* this section has to be inside the loop because of the dependence on sigma6 */
if (useSoftCore)
{
- rpinvC = one / (alpha_coul_eff * lfac_coul[i] * sigma_pow[i] + rp);
- pthRoot<softCoreTreatment>(rpinvC, &rinvC, &rC);
+ rpinvC = one / (alpha_coul_eff * lfac_coul[i] * sigma6[i] + rp);
+ pthRoot(rpinvC, &rinvC, &rC);
if (scLambdasOrAlphasDiffer)
{
- rpinvV = one / (alpha_vdw_eff * lfac_vdw[i] * sigma_pow[i] + rp);
- pthRoot<softCoreTreatment>(rpinvV, &rinvV, &rV);
+ rpinvV = one / (alpha_vdw_eff * lfac_vdw[i] * sigma6[i] + rp);
+ pthRoot(rpinvV, &rinvV, &rV);
}
else
{
|| (!vdwInteractionTypeIsEwald && rV < rvdw);
if ((c6[i] != 0 || c12[i] != 0) && computeVdwInteraction)
{
- real rinv6;
- if (softCoreTreatment == SoftCoreTreatment::RPower6)
+ RealType rinv6;
+ if (useSoftCore)
{
- rinv6 = calculateRinv6<softCoreTreatment>(rpinvV);
+ rinv6 = rpinvV;
}
else
{
- rinv6 = calculateRinv6<softCoreTreatment>(rinvV);
+ rinv6 = calculateRinv6(rinvV);
}
- real Vvdw6 = calculateVdw6(c6[i], rinv6);
- real Vvdw12 = calculateVdw12(c12[i], rinv6);
+ RealType Vvdw6 = calculateVdw6(c6[i], rinv6);
+ RealType Vvdw12 = calculateVdw12(c12[i], rinv6);
Vvdw[i] = lennardJonesPotential(Vvdw6, Vvdw12, c6[i], c12[i], repulsionShift,
dispersionShift, onesixth, onetwelfth);
if (vdwModifierIsPotSwitch)
{
- real d = rV - ic->rvdw_switch;
- d = (d > zero) ? d : zero;
- const real d2 = d * d;
- const real sw = one + d2 * d * (vdw_swV3 + d * (vdw_swV4 + d * vdw_swV5));
- const real dsw = d2 * (vdw_swF2 + d * (vdw_swF3 + d * vdw_swF4));
+ RealType d = rV - ic->rvdw_switch;
+ d = (d > zero) ? d : zero;
+ const RealType d2 = d * d;
+ const RealType sw =
+ one + d2 * d * (vdw_swV3 + d * (vdw_swV4 + d * vdw_swV5));
+ const RealType dsw = d2 * (vdw_swF2 + d * (vdw_swF3 + d * vdw_swF4));
FscalV[i] = potSwitchScalarForceMod(FscalV[i], Vvdw[i], sw, rV,
rvdw, dsw, zero);
if (useSoftCore)
{
- dvdl_coul +=
- Vcoul[i] * DLF[i]
- + LFC[i] * alpha_coul_eff * dlfac_coul[i] * FscalC[i] * sigma_pow[i];
+ dvdl_coul += Vcoul[i] * DLF[i]
+ + LFC[i] * alpha_coul_eff * dlfac_coul[i] * FscalC[i] * sigma6[i];
dvdl_vdw += Vvdw[i] * DLF[i]
- + LFV[i] * alpha_vdw_eff * dlfac_vdw[i] * FscalV[i] * sigma_pow[i];
+ + LFV[i] * alpha_vdw_eff * dlfac_vdw[i] * FscalV[i] * sigma6[i];
}
else
{
* As there is no singularity, there is no need for soft-core.
*/
const real FF = -two * krf;
- real VV = krf * rsq - crf;
+ RealType VV = krf * rsq - crf;
if (ii == jnr)
{
*/
real v_lr, f_lr;
- const real ewrt = r * ewtabscale;
- int ewitab = static_cast<int>(ewrt);
- const real eweps = ewrt - ewitab;
- ewitab = 4 * ewitab;
- f_lr = ewtab[ewitab] + eweps * ewtab[ewitab + 1];
+ const RealType ewrt = r * ewtabscale;
+ IntType ewitab = static_cast<IntType>(ewrt);
+ const RealType eweps = ewrt - ewitab;
+ ewitab = 4 * ewitab;
+ f_lr = ewtab[ewitab] + eweps * ewtab[ewitab + 1];
v_lr = (ewtab[ewitab + 2] - ewtabhalfspace * eweps * (ewtab[ewitab] + f_lr));
f_lr *= rinv;
* r close to 0 for non-interacting pairs.
*/
- const real rs = rsq * rinv * ewtabscale;
- const int ri = static_cast<int>(rs);
- const real frac = rs - ri;
- const real f_lr = (1 - frac) * tab_ewald_F_lj[ri] + frac * tab_ewald_F_lj[ri + 1];
+ const RealType rs = rsq * rinv * ewtabscale;
+ const IntType ri = static_cast<IntType>(rs);
+ const RealType frac = rs - ri;
+ const RealType f_lr = (1 - frac) * tab_ewald_F_lj[ri] + frac * tab_ewald_F_lj[ri + 1];
/* TODO: Currently the Ewald LJ table does not contain
* the factor 1/6, we should add this.
*/
- const real FF = f_lr * rinv / six;
- real VV = (tab_ewald_V_lj[ri] - ewtabhalfspace * frac * (tab_ewald_F_lj[ri] + f_lr)) / six;
+ const RealType FF = f_lr * rinv / six;
+ RealType VV =
+ (tab_ewald_V_lj[ri] - ewtabhalfspace * frac * (tab_ewald_F_lj[ri] + f_lr)) / six;
if (ii == jnr)
{
nb_kernel_data_t* gmx_restrict kernel_data,
t_nrnb* gmx_restrict nrnb);
-template<SoftCoreTreatment softCoreTreatment, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald, bool elecInteractionTypeIsEwald>
-static KernelFunction dispatchKernelOnVdwModifier(const bool vdwModifierIsPotSwitch)
+template<bool useSoftCore, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald, bool elecInteractionTypeIsEwald, bool vdwModifierIsPotSwitch>
+static KernelFunction dispatchKernelOnUseSimd(const bool useSimd)
+{
+ if (useSimd)
+ {
+#if GMX_SIMD_HAVE_REAL && GMX_SIMD_HAVE_INT32_ARITHMETICS
+ /* FIXME: Here SimdDataTypes should be used to enable SIMD. So far, the code in nb_free_energy_kernel is not adapted to SIMD */
+ return (nb_free_energy_kernel<ScalarDataTypes, useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald, vdwModifierIsPotSwitch>);
+#else
+ return (nb_free_energy_kernel<ScalarDataTypes, useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald, vdwModifierIsPotSwitch>);
+#endif
+ }
+ else
+ {
+ return (nb_free_energy_kernel<ScalarDataTypes, useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald, vdwModifierIsPotSwitch>);
+ }
+}
+
+template<bool useSoftCore, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald, bool elecInteractionTypeIsEwald>
+static KernelFunction dispatchKernelOnVdwModifier(const bool vdwModifierIsPotSwitch, const bool useSimd)
{
if (vdwModifierIsPotSwitch)
{
- return (nb_free_energy_kernel<softCoreTreatment, scLambdasOrAlphasDiffer,
- vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald, true>);
+ return (dispatchKernelOnUseSimd<useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald, true>(useSimd));
}
else
{
- return (nb_free_energy_kernel<softCoreTreatment, scLambdasOrAlphasDiffer,
- vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald, false>);
+ return (dispatchKernelOnUseSimd<useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald, false>(useSimd));
}
}
-template<SoftCoreTreatment softCoreTreatment, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald>
+template<bool useSoftCore, bool scLambdasOrAlphasDiffer, bool vdwInteractionTypeIsEwald>
static KernelFunction dispatchKernelOnElecInteractionType(const bool elecInteractionTypeIsEwald,
- const bool vdwModifierIsPotSwitch)
+ const bool vdwModifierIsPotSwitch,
+ const bool useSimd)
{
if (elecInteractionTypeIsEwald)
{
- return (dispatchKernelOnVdwModifier<softCoreTreatment, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, true>(
- vdwModifierIsPotSwitch));
+ return (dispatchKernelOnVdwModifier<useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, true>(
+ vdwModifierIsPotSwitch, useSimd));
}
else
{
- return (dispatchKernelOnVdwModifier<softCoreTreatment, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, false>(
- vdwModifierIsPotSwitch));
+ return (dispatchKernelOnVdwModifier<useSoftCore, scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, false>(
+ vdwModifierIsPotSwitch, useSimd));
}
}
-template<SoftCoreTreatment softCoreTreatment, bool scLambdasOrAlphasDiffer>
+template<bool useSoftCore, bool scLambdasOrAlphasDiffer>
static KernelFunction dispatchKernelOnVdwInteractionType(const bool vdwInteractionTypeIsEwald,
const bool elecInteractionTypeIsEwald,
- const bool vdwModifierIsPotSwitch)
+ const bool vdwModifierIsPotSwitch,
+ const bool useSimd)
{
if (vdwInteractionTypeIsEwald)
{
- return (dispatchKernelOnElecInteractionType<softCoreTreatment, scLambdasOrAlphasDiffer, true>(
- elecInteractionTypeIsEwald, vdwModifierIsPotSwitch));
+ return (dispatchKernelOnElecInteractionType<useSoftCore, scLambdasOrAlphasDiffer, true>(
+ elecInteractionTypeIsEwald, vdwModifierIsPotSwitch, useSimd));
}
else
{
- return (dispatchKernelOnElecInteractionType<softCoreTreatment, scLambdasOrAlphasDiffer, false>(
- elecInteractionTypeIsEwald, vdwModifierIsPotSwitch));
+ return (dispatchKernelOnElecInteractionType<useSoftCore, scLambdasOrAlphasDiffer, false>(
+ elecInteractionTypeIsEwald, vdwModifierIsPotSwitch, useSimd));
}
}
-template<SoftCoreTreatment softCoreTreatment>
+template<bool useSoftCore>
static KernelFunction dispatchKernelOnScLambdasOrAlphasDifference(const bool scLambdasOrAlphasDiffer,
const bool vdwInteractionTypeIsEwald,
const bool elecInteractionTypeIsEwald,
- const bool vdwModifierIsPotSwitch)
+ const bool vdwModifierIsPotSwitch,
+ const bool useSimd)
{
if (scLambdasOrAlphasDiffer)
{
- return (dispatchKernelOnVdwInteractionType<softCoreTreatment, true>(
- vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald, vdwModifierIsPotSwitch));
+ return (dispatchKernelOnVdwInteractionType<useSoftCore, true>(
+ vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald, vdwModifierIsPotSwitch, useSimd));
}
else
{
- return (dispatchKernelOnVdwInteractionType<softCoreTreatment, false>(
- vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald, vdwModifierIsPotSwitch));
+ return (dispatchKernelOnVdwInteractionType<useSoftCore, false>(
+ vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald, vdwModifierIsPotSwitch, useSimd));
}
}
const bool vdwInteractionTypeIsEwald,
const bool elecInteractionTypeIsEwald,
const bool vdwModifierIsPotSwitch,
+ const bool useSimd,
const t_forcerec* fr)
{
if (fr->sc_alphacoul == 0 && fr->sc_alphavdw == 0)
{
- return (dispatchKernelOnScLambdasOrAlphasDifference<SoftCoreTreatment::None>(
+ return (dispatchKernelOnScLambdasOrAlphasDifference<false>(
scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald,
- vdwModifierIsPotSwitch));
- }
- else if (fr->sc_r_power == 6.0_real)
- {
- return (dispatchKernelOnScLambdasOrAlphasDifference<SoftCoreTreatment::RPower6>(
- scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald,
- vdwModifierIsPotSwitch));
+ vdwModifierIsPotSwitch, useSimd));
}
else
{
- return (dispatchKernelOnScLambdasOrAlphasDifference<SoftCoreTreatment::RPower48>(
+ return (dispatchKernelOnScLambdasOrAlphasDifference<true>(
scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald, elecInteractionTypeIsEwald,
- vdwModifierIsPotSwitch));
+ vdwModifierIsPotSwitch, useSimd));
}
}
const bool elecInteractionTypeIsEwald = (EEL_PME_EWALD(fr->ic->eeltype));
const bool vdwModifierIsPotSwitch = (fr->ic->vdw_modifier == eintmodPOTSWITCH);
bool scLambdasOrAlphasDiffer = true;
+ const bool useSimd = fr->use_simd_kernels;
if (fr->sc_alphacoul == 0 && fr->sc_alphavdw == 0)
{
scLambdasOrAlphasDiffer = false;
}
- else if (fr->sc_r_power == 6.0_real || fr->sc_r_power == 48.0_real)
+ else if (fr->sc_r_power == 6.0_real)
{
if (kernel_data->lambda[efptCOUL] == kernel_data->lambda[efptVDW] && fr->sc_alphacoul == fr->sc_alphavdw)
{
{
GMX_RELEASE_ASSERT(false, "Unsupported soft-core r-power");
}
- KernelFunction kernelFunc = dispatchKernel(scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
- elecInteractionTypeIsEwald, vdwModifierIsPotSwitch, fr);
+
+ KernelFunction kernelFunc;
+ kernelFunc = dispatchKernel(scLambdasOrAlphasDiffer, vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald, vdwModifierIsPotSwitch, useSimd, fr);
kernelFunc(nlist, xx, ff, fr, mdatoms, kernel_data, nrnb);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/gmxlib/nonbonded/nb_kernel.h"
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/nblist.h"
struct t_forcerec;
+struct t_mdatoms;
namespace gmx
{
class ForceWithShiftForces;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/forcerec.h"
-#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/utility/real.h"
struct t_blocka;
+struct t_mdatoms;
/* Structure to collect kernel data not available in forcerec or mdatoms structures.
* This is only used inside the nonbonded module.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
}
-static void visualize_images(const char* fn, int ePBC, matrix box)
+static void visualize_images(const char* fn, PbcType pbcType, matrix box)
{
t_atoms atoms;
rvec* img;
}
calc_triclinic_images(box, img + 1);
- write_sto_conf(fn, "Images", &atoms, img, nullptr, ePBC, box);
+ write_sto_conf(fn, "Images", &atoms, img, nullptr, pbcType, box);
done_atom(&atoms);
sfree(img);
int isize, ssize, numAlignmentAtoms;
int * index, *sindex, *aindex;
rvec * x, *v, gc, rmin, rmax, size;
- int ePBC;
+ PbcType pbcType;
matrix box, rotmatrix, trans;
rvec princd, tmpvec;
gmx_bool bIndex, bSetSize, bSetAng, bDist, bSetCenter, bAlign;
char* name;
t_atoms atoms;
open_symtab(&symtab);
- readConfAndAtoms(infile, &symtab, &name, &atoms, &ePBC, &x, &v, box);
+ readConfAndAtoms(infile, &symtab, &name, &atoms, &pbcType, &x, &v, box);
natom = atoms.nr;
if (atoms.pdbinfo == nullptr)
{
get_pdb_atomnumber(&atoms, &aps);
}
- if (ePBC != epbcNONE)
+ if (pbcType != PbcType::No)
{
real vol = det(box);
printf("Volume: %g nm^3, corresponds to roughly %d electrons\n", vol,
}
else if (visbox[0] == -1)
{
- visualize_images("images.pdb", ePBC, box);
+ visualize_images("images.pdb", pbcType, box);
}
/* remove pbc */
if ((btype[0] != nullptr) && (bSetSize || bDist || (btype[0][0] == 't' && bSetAng)))
{
- ePBC = epbcXYZ;
+ pbcType = PbcType::Xyz;
if (!(bSetSize || bDist))
{
for (i = 0; i < DIM; i++)
printf("new box volume :%7.2f (nm^3)\n", det(box));
}
- if (check_box(epbcXYZ, box))
+ if (check_box(PbcType::Xyz, box))
{
printf("\nWARNING: %s\n"
"See the GROMACS manual for a description of the requirements that\n"
"must be satisfied by descriptions of simulation cells.\n",
- check_box(epbcXYZ, box));
+ check_box(PbcType::Xyz, box));
}
if (bDist && btype[0][0] == 't')
if (outftp == efPDB)
{
out = gmx_ffopen(outfile, "w");
- write_pdbfile_indexed(out, name, &atoms, x, ePBC, box, ' ', 1, isize, index, conect, FALSE);
+ write_pdbfile_indexed(out, name, &atoms, x, pbcType, box, ' ', 1, isize, index, conect, FALSE);
gmx_ffclose(out);
}
else
{
- write_sto_conf_indexed(outfile, name, &atoms, x, bHaveV ? v : nullptr, ePBC, box, isize, index);
+ write_sto_conf_indexed(outfile, name, &atoms, x, bHaveV ? v : nullptr, pbcType, box,
+ isize, index);
}
sfree(grpname);
sfree(index);
{
index[i] = i;
}
- write_pdbfile_indexed(out, name, &atoms, x, ePBC, box, ' ', -1, atoms.nr, index, conect,
- outftp == efPQR);
+ write_pdbfile_indexed(out, name, &atoms, x, pbcType, box, ' ', -1, atoms.nr, index,
+ conect, outftp == efPQR);
sfree(index);
if (bLegend)
{
}
else
{
- write_sto_conf(outfile, name, &atoms, x, bHaveV ? v : nullptr, ePBC, box);
+ write_sto_conf(outfile, name, &atoms, x, bHaveV ? v : nullptr, pbcType, box);
}
}
done_atom(&atoms);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
-static void low_mspeed(real tempi, gmx_mtop_t* mtop, rvec v[], gmx::ThreeFry2x64<>* rng)
+static void low_mspeed(real tempi, gmx_mtop_t* mtop, rvec v[], gmx::ThreeFry2x64<>* rng, const gmx::MDLogger& logger)
{
int nrdf;
real boltz;
}
}
}
- fprintf(stderr, "Velocities were taken from a Maxwell distribution at %g K\n", tempi);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Velocities were taken from a Maxwell distribution at %g K", tempi);
if (debug)
{
fprintf(debug,
}
}
-void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[])
+void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[], const gmx::MDLogger& logger)
{
if (seed == 0)
{
seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Using random seed %u for generating velocities\n", seed);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Using random seed %u for generating velocities", seed);
}
gmx::ThreeFry2x64<> rng(seed, gmx::RandomDomain::MaxwellVelocities);
- low_mspeed(tempi, mtop, v, &rng);
+ low_mspeed(tempi, mtop, v, &rng, logger);
}
static real calc_cm(int natoms, const real mass[], rvec x[], rvec v[], rvec xcm, rvec vcm, rvec acm, matrix L)
return tm;
}
-void stop_cm(FILE gmx_unused* log, int natoms, real mass[], rvec x[], rvec v[])
+void stop_cm(const gmx::MDLogger gmx_unused& logger, int natoms, real mass[], rvec x[], rvec v[])
{
rvec xcm, vcm, acm;
tensor L;
int i, m;
#ifdef DEBUG
- fprintf(log, "stopping center of mass motion...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("stopping center of mass motion...");
#endif
(void)calc_cm(natoms, mass, x, v, xcm, vcm, acm, L);
v[i][m] -= vcm[m];
}
}
-
-#ifdef DEBUG
- (void)calc_cm(log, natoms, mass, x, v, xcm, vcm, acm, L);
-#endif
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct gmx_mtop_t;
+namespace gmx
+{
+class MDLogger;
+}
+
/*! \brief
* Generate Maxwellian velocities.
*
* \param[in] seed Random number generator seed
* \param[in] mtop Molecular Topology
* \param[out] v Velocities
+ * \param[in] logger Handle to logging interface.
*/
-void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[]);
+void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t* mtop, rvec v[], const gmx::MDLogger& logger);
/*! \brief
* Remove the center of mass motion in a set of coordinates.
*
- * \param[out] log File for printing debug information
+ * \param[in] logger Handle to logging interface.
* \param[in] natoms Number of atoms
* \param[in] mass Atomic masses
* \param[in] x Coordinates
* \param[out] v Velocities
*/
-void stop_cm(FILE* log, int natoms, real mass[], rvec x[], rvec v[]);
+void stop_cm(const gmx::MDLogger& logger, int natoms, real mass[], rvec x[], rvec v[]);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
rvec * x, *xx, *v; /* coordinates? */
real t;
vec4 * xrot, *vrot;
- int ePBC;
+ PbcType pbcType;
matrix box, boxx; /* box length matrix */
rvec shift;
int natoms; /* number of atoms in one molecule */
gmx_mtop_t mtop;
bool haveTop = false;
- readConfAndTopology(opt2fn("-f", NFILE, fnm), &haveTop, &mtop, &ePBC, &x, &v, box);
+ readConfAndTopology(opt2fn("-f", NFILE, fnm), &haveTop, &mtop, &pbcType, &x, &v, box);
t_atoms atoms = gmx_mtop_global_atoms(&mtop);
natoms = atoms.nr;
nres = atoms.nres; /* nr of residues in one element? */
v[ndx + l][m] = v[l][m];
}
}
- if (ePBC == epbcSCREW && i % 2 == 1)
+ if (pbcType == PbcType::Screw && i % 2 == 1)
{
/* Rotate around x axis */
for (m = YY; m <= ZZ; m++)
svmul(nx, box[XX], box[XX]);
svmul(ny, box[YY], box[YY]);
svmul(nz, box[ZZ], box[ZZ]);
- if (ePBC == epbcSCREW && nx % 2 == 0)
+ if (pbcType == PbcType::Screw && nx % 2 == 0)
{
/* With an even number of boxes in x we can forgot about the screw */
- ePBC = epbcXYZ;
+ pbcType = PbcType::Xyz;
}
/*depending on how you look at it, this is either a nasty hack or the way it should work*/
}
}
- write_sto_conf(opt2fn("-o", NFILE, fnm), *mtop.name, &atoms, x, v, ePBC, box);
+ write_sto_conf(opt2fn("-o", NFILE, fnm), *mtop.name, &atoms, x, v, pbcType, box);
sfree(x);
sfree(v);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
matrix box;
t_atoms atoms;
t_pbc pbc;
- int * repl, ePBC;
+ int* repl;
+ PbcType pbcType;
int nw, nsa, nsalt, iqtot;
gmx_output_env_t* oenv = nullptr;
t_filenm fnm[] = { { efTPR, nullptr, nullptr, ffREAD },
}
/* Read atom positions and charges */
- read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE);
+ read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &pbcType, &x, nullptr, box, FALSE);
atoms = top.atoms;
/* Compute total charge */
}
snew(repl, nw);
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
if (seed == 0)
sfree(atoms.pdbinfo);
atoms.pdbinfo = nullptr;
- write_sto_conf(ftp2fn(efSTO, NFILE, fnm), *top.name, &atoms, x, nullptr, ePBC, box);
+ write_sto_conf(ftp2fn(efSTO, NFILE, fnm), *top.name, &atoms, x, nullptr, pbcType, box);
sfree(pptr);
sfree(paptr);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
#endif
-static void nnb2excl(t_nextnb* nnb, t_blocka* excl)
+static void nnb2excl(t_nextnb* nnb, gmx::ListOfLists<int>* excls)
{
int i, j, j_index;
int nre, nrx, nrs, nr_of_sortables;
sortable* s;
- srenew(excl->index, nnb->nr + 1);
- excl->index[0] = 0;
+ excls->clear();
+
for (i = 0; (i < nnb->nr); i++)
{
/* calculate the total number of exclusions for atom i */
nr_of_sortables = j_index;
prints("after rm-double", j_index, s);
- /* make space for arrays */
- srenew(excl->a, excl->nra + nr_of_sortables);
-
/* put the sorted exclusions in the target list */
+ excls->pushBackListOfSize(nr_of_sortables);
+ gmx::ArrayRef<int> exclusionsForAtom = excls->back();
for (nrs = 0; (nrs < nr_of_sortables); nrs++)
{
- excl->a[excl->nra + nrs] = s[nrs].aj;
+ exclusionsForAtom[nrs] = s[nrs].aj;
}
- excl->nra += nr_of_sortables;
- excl->index[i + 1] = excl->nra;
/* cleanup temporary space */
sfree(s);
}
-void generate_excl(int nrexcl, int nratoms, gmx::ArrayRef<InteractionsOfType> plist, t_blocka* excl)
+void generate_excl(int nrexcl, int nratoms, gmx::ArrayRef<InteractionsOfType> plist, gmx::ListOfLists<int>* excls)
{
t_nextnb nnb;
if (nrexcl < 0)
}
init_nnb(&nnb, nratoms, nrexcl);
gen_nnb(&nnb, plist);
- excl->nr = nratoms;
sort_and_purge_nnb(&nnb);
- nnb2excl(&nnb, excl);
+ nnb2excl(&nnb, excls);
done_nnb(&nnb);
}
#include "gromacs/utility/arrayref.h"
-struct t_blocka;
struct InteractionsOfType;
+namespace gmx
+{
+template<typename>
+class ListOfLists;
+}
+
struct t_nextnb
{
int nr; /* nr atoms (0 <= i < nr) (atoms->nr) */
* initiated using init_nnb.
*/
-void generate_excl(int nrexcl, int nratoms, gmx::ArrayRef<InteractionsOfType> plist, t_blocka* excl);
+void generate_excl(int nrexcl, int nratoms, gmx::ArrayRef<InteractionsOfType> plist, gmx::ListOfLists<int>* excls);
/* Generate an exclusion block from bonds and constraints in
* plist.
*/
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/filestream.h"
#include "gromacs/utility/futil.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/keyvaluetreebuilder.h"
+#include "gromacs/utility/listoflists.h"
+#include "gromacs/utility/logger.h"
+#include "gromacs/utility/loggerbuilder.h"
#include "gromacs/utility/mdmodulenotification.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/snprintf.h"
void MoleculeInformation::initMolInfo()
{
init_block(&mols);
- init_blocka(&excls);
+ excls.clear();
init_t_atoms(&atoms, 0, FALSE);
}
return n;
}
-static int check_atom_names(const char* fn1, const char* fn2, gmx_mtop_t* mtop, const t_atoms* at)
+static int check_atom_names(const char* fn1,
+ const char* fn2,
+ gmx_mtop_t* mtop,
+ const t_atoms* at,
+ const gmx::MDLogger& logger)
{
int m, i, j, nmismatch;
t_atoms* tat;
-#define MAXMISMATCH 20
+
+ constexpr int c_maxNumberOfMismatches = 20;
if (mtop->natoms != at->nr)
{
{
if (strcmp(*(tat->atomname[j]), *(at->atomname[i])) != 0)
{
- if (nmismatch < MAXMISMATCH)
+ if (nmismatch < c_maxNumberOfMismatches)
{
- fprintf(stderr,
- "Warning: atom name %d in %s and %s does not match (%s - %s)\n",
- i + 1, fn1, fn2, *(tat->atomname[j]), *(at->atomname[i]));
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "atom name %d in %s and %s does not match (%s - %s)", i + 1,
+ fn1, fn2, *(tat->atomname[j]), *(at->atomname[i]));
}
- else if (nmismatch == MAXMISMATCH)
+ else if (nmismatch == c_maxNumberOfMismatches)
{
- fprintf(stderr, "(more than %d non-matching atom names)\n", MAXMISMATCH);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("(more than %d non-matching atom names)",
+ c_maxNumberOfMismatches);
}
nmismatch++;
}
int i, a1, a2, w_a1, w_a2, j;
real twopi2, limit2, fc, re, m1, m2, period2, w_period2;
bool bFound, bWater, bWarn;
- char warn_buf[STRLEN];
/* Get the interaction parameters */
gmx::ArrayRef<const t_iparams> ip = mtop->ffparams.iparams;
bWarn = (w_period2 < gmx::square(min_steps_warn * dt));
/* A check that would recognize most water models */
bWater = ((*w_moltype->atoms.atomname[0])[0] == 'O' && w_moltype->atoms.nr <= 5);
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"The bond in molecule-type %s between atoms %d %s and %d %s has an estimated "
"oscillational period of %.1e ps, which is less than %d times the time step of "
"%.1e ps.\n"
: "Maybe you forgot to change the constraints mdp option.");
if (bWarn)
{
- warning(wi, warn_buf);
+ warning(wi, warningMessage.c_str());
}
else
{
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage.c_str());
}
}
}
static void check_shells_inputrec(gmx_mtop_t* mtop, t_inputrec* ir, warninp* wi)
{
- int nshells = 0;
- char warn_buf[STRLEN];
+ int nshells = 0;
for (const AtomProxy atomP : AtomRange(*mtop))
{
if ((nshells > 0) && (ir->nstcalcenergy != 1))
{
set_warning_line(wi, "unknown", -1);
- snprintf(warn_buf, STRLEN, "There are %d shells, changing nstcalcenergy from %d to 1",
- nshells, ir->nstcalcenergy);
+ std::string warningMessage = gmx::formatString(
+ "There are %d shells, changing nstcalcenergy from %d to 1", nshells, ir->nstcalcenergy);
ir->nstcalcenergy = 1;
- warning(wi, warn_buf);
+ warning(wi, warningMessage.c_str());
}
}
double* reppow,
real* fudgeQQ,
gmx_bool bMorse,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
std::vector<gmx_molblock_t> molblock;
int i, nmismatch;
bool ffParametrizedWithHBondConstraints;
- char buf[STRLEN];
- char warn_buf[STRLEN];
/* TOPOLOGY processing */
sys->name = do_top(bVerbose, topfile, topppfile, opts, bZero, &(sys->symtab), interactions,
comb, reppow, fudgeQQ, atypes, mi, intermolecular_interactions, ir,
- &molblock, &ffParametrizedWithHBondConstraints, wi);
+ &molblock, &ffParametrizedWithHBondConstraints, wi, logger);
sys->molblock.clear();
if (i > 0)
{
set_warning_line(wi, "unknown", -1);
- sprintf(warn_buf, "disre = no, removed %d distance restraints", i);
- warning_note(wi, warn_buf);
+ std::string warningMessage =
+ gmx::formatString("disre = no, removed %d distance restraints", i);
+ warning_note(wi, warningMessage.c_str());
}
}
if (!opts->bOrire)
if (i > 0)
{
set_warning_line(wi, "unknown", -1);
- sprintf(warn_buf, "orire = no, removed %d orientation restraints", i);
- warning_note(wi, warn_buf);
+ std::string warningMessage =
+ gmx::formatString("orire = no, removed %d orientation restraints", i);
+ warning_note(wi, warningMessage.c_str());
}
}
/* COORDINATE file processing */
if (bVerbose)
{
- fprintf(stderr, "processing coordinates...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("processing coordinates...");
}
t_topology* conftop;
/* This call fixes the box shape for runs with pressure scaling */
set_box_rel(ir, state);
- nmismatch = check_atom_names(topfile, confin, sys, &conftop->atoms);
+ nmismatch = check_atom_names(topfile, confin, sys, &conftop->atoms, logger);
done_top(conftop);
sfree(conftop);
if (nmismatch)
{
- sprintf(buf,
+ std::string warningMessage = gmx::formatString(
"%d non-matching atom name%s\n"
"atom names from %s will be used\n"
"atom names from %s will be ignored\n",
nmismatch, (nmismatch == 1) ? "" : "s", topfile, confin);
- warning(wi, buf);
+ warning(wi, warningMessage.c_str());
}
/* Do more checks, mostly related to constraints */
if (bVerbose)
{
- fprintf(stderr, "double-checking input for internal consistency...\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("double-checking input for internal consistency...");
}
{
bool bHasNormalConstraints =
if (opts->seed == -1)
{
opts->seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Setting gen_seed to %d\n", opts->seed);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Setting gen_seed to %d", opts->seed);
}
state->flags |= (1 << estV);
- maxwell_speed(opts->tempi, opts->seed, sys, state->v.rvec_array());
+ maxwell_speed(opts->tempi, opts->seed, sys, state->v.rvec_array(), logger);
- stop_cm(stdout, state->natoms, mass, state->x.rvec_array(), state->v.rvec_array());
+ stop_cm(logger, state->natoms, mass, state->x.rvec_array(), state->v.rvec_array());
sfree(mass);
}
}
t_inputrec* ir,
t_state* state,
gmx_mtop_t* sys,
- const gmx_output_env_t* oenv)
+ const gmx_output_env_t* oenv,
+ const gmx::MDLogger& logger)
/* If fr_time == -1 read the last frame available which is complete */
{
bool bReadVel;
bReadVel = (bNeedVel && !bGenVel);
- fprintf(stderr, "Reading Coordinates%s and Box size from old trajectory\n",
- bReadVel ? ", Velocities" : "");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Reading Coordinates%s and Box size from old trajectory",
+ bReadVel ? ", Velocities" : "");
if (fr_time == -1)
{
- fprintf(stderr, "Will read whole trajectory\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Will read whole trajectory");
}
else
{
- fprintf(stderr, "Will read till time %g\n", fr_time);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Will read till time %g", fr_time);
}
if (!bReadVel)
{
if (bGenVel)
{
- fprintf(stderr,
- "Velocities generated: "
- "ignoring velocities in input trajectory\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Velocities generated: "
+ "ignoring velocities in input trajectory");
}
read_first_frame(oenv, &fp, slog, &fr, TRX_NEED_X);
}
if (!fr.bV)
{
- fprintf(stderr,
- "\n"
- "WARNING: Did not find a frame with velocities in file %s,\n"
- " all velocities will be set to zero!\n\n",
- slog);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "WARNING: Did not find a frame with velocities in file %s,\n"
+ " all velocities will be set to zero!",
+ slog);
for (auto& vi : makeArrayRef(state->v))
{
vi = { 0, 0, 0 };
*/
set_box_rel(ir, state);
- fprintf(stderr, "Using frame at t = %g ps\n", use_time);
- fprintf(stderr, "Starting time for run is %g ps\n", ir->init_t);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Using frame at t = %g ps", use_time);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Starting time for run is %g ps", ir->init_t);
if ((ir->epc != epcNO || ir->etc == etcNOSEHOOVER) && ener)
{
gmx_bool bTopB,
const char* fn,
int rc_scaling,
- int ePBC,
+ PbcType pbcType,
rvec com,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
gmx_bool* hadAtom;
rvec * x, *v;
t_topology* top;
matrix box, invbox;
int natoms, npbcdim = 0;
- char warn_buf[STRLEN];
int a, nat_molb;
t_atom* atom;
sfree(top);
if (natoms != mtop->natoms)
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"The number of atoms in %s (%d) does not match the number of atoms in the topology "
"(%d). Will assume that the first %d atoms in the topology and %s match.",
fn, natoms, mtop->natoms, std::min(mtop->natoms, natoms), fn);
- warning(wi, warn_buf);
+ warning(wi, warningMessage.c_str());
}
- npbcdim = ePBC2npbcdim(ePBC);
+ npbcdim = numPbcDimensions(pbcType);
GMX_RELEASE_ASSERT(npbcdim <= DIM, "Invalid npbcdim");
clear_rvec(com);
if (rc_scaling != erscNO)
{
com[j] = sum[j] / totmass;
}
- fprintf(stderr,
- "The center of mass of the position restraint coord's is %6.3f %6.3f %6.3f\n",
- com[XX], com[YY], com[ZZ]);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "The center of mass of the position restraint coord's is %6.3f %6.3f %6.3f",
+ com[XX], com[YY], com[ZZ]);
}
if (rc_scaling != erscNO)
const char* fnA,
const char* fnB,
int rc_scaling,
- int ePBC,
+ PbcType pbcType,
rvec com,
rvec comB,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
- read_posres(mtop, mi, FALSE, fnA, rc_scaling, ePBC, com, wi);
+ read_posres(mtop, mi, FALSE, fnA, rc_scaling, pbcType, com, wi, logger);
/* It is safer to simply read the b-state posres rather than trying
* to be smart and copy the positions.
*/
- read_posres(mtop, mi, TRUE, fnB, rc_scaling, ePBC, comB, wi);
+ read_posres(mtop, mi, TRUE, fnB, rc_scaling, pbcType, comB, wi, logger);
}
-static void set_wall_atomtype(PreprocessingAtomTypes* at, t_gromppopts* opts, t_inputrec* ir, warninp* wi)
+static void set_wall_atomtype(PreprocessingAtomTypes* at,
+ t_gromppopts* opts,
+ t_inputrec* ir,
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
- int i;
- char warn_buf[STRLEN];
+ int i;
if (ir->nwall > 0)
{
- fprintf(stderr, "Searching the wall atom type(s)\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Searching the wall atom type(s)");
}
for (i = 0; i < ir->nwall; i++)
{
ir->wall_atomtype[i] = at->atomTypeFromName(opts->wall_atomtype[i]);
if (ir->wall_atomtype[i] == NOTSET)
{
- sprintf(warn_buf, "Specified wall atom type %s is not defined", opts->wall_atomtype[i]);
- warning_error(wi, warn_buf);
+ std::string warningMessage = gmx::formatString(
+ "Specified wall atom type %s is not defined", opts->wall_atomtype[i]);
+ warning_error(wi, warningMessage.c_str());
}
}
}
static int count_constraints(const gmx_mtop_t* mtop, gmx::ArrayRef<const MoleculeInformation> mi, warninp* wi)
{
- int count, count_mol;
- char buf[STRLEN];
+ int count, count_mol;
count = 0;
for (const gmx_molblock_t& molb : mtop->molblock)
if (count_mol > nrdf_internal(&mi[molb.type].atoms))
{
- sprintf(buf,
+ std::string warningMessage = gmx::formatString(
"Molecule type '%s' has %d constraints.\n"
"For stability and efficiency there should not be more constraints than "
"internal number of degrees of freedom: %d.\n",
*mi[molb.type].name, count_mol, nrdf_internal(&mi[molb.type].atoms));
- warning(wi, buf);
+ warning(wi, warningMessage.c_str());
}
count += molb.nmol * count_mol;
}
if (bNoCoupl)
{
- char buf[STRLEN];
-
- sprintf(buf,
+ std::string warningMessage = gmx::formatString(
"Some temperature coupling groups do not use temperature coupling. We will assume "
"their temperature is not more than %.3f K. If their temperature is higher, the "
"energy error and the Verlet buffer might be underestimated.",
ref_t);
- warning(wi, buf);
+ warning(wi, warningMessage.c_str());
}
return ref_t;
/* Checks if there are unbound atoms in moleculetype molt.
* Prints a note for each unbound atoms and a warning if any is present.
*/
-static void checkForUnboundAtoms(const gmx_moltype_t* molt, gmx_bool bVerbose, warninp* wi)
+static void checkForUnboundAtoms(const gmx_moltype_t* molt, gmx_bool bVerbose, warninp* wi, const gmx::MDLogger& logger)
{
const t_atoms* atoms = &molt->atoms;
{
if (bVerbose)
{
- fprintf(stderr,
- "\nAtom %d '%s' in moleculetype '%s' is not bound by a potential or "
- "constraint to any other atom in the same moleculetype.\n",
- a + 1, *atoms->atomname[a], *molt->name);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Atom %d '%s' in moleculetype '%s' is not bound by a potential or "
+ "constraint to any other atom in the same moleculetype.",
+ a + 1, *atoms->atomname[a], *molt->name);
}
numDanglingAtoms++;
}
if (numDanglingAtoms > 0)
{
- char buf[STRLEN];
- sprintf(buf,
+ std::string warningMessage = gmx::formatString(
"In moleculetype '%s' %d atoms are not bound by a potential or constraint to any "
"other atom in the same moleculetype. Although technically this might not cause "
"issues in a simulation, this often means that the user forgot to add a "
"bond/potential/constraint or put multiple molecules in the same moleculetype "
"definition by mistake. Run with -v to get information for each atom.",
*molt->name, numDanglingAtoms);
- warning_note(wi, buf);
+ warning_note(wi, warningMessage.c_str());
}
}
/* Checks all moleculetypes for unbound atoms */
-static void checkForUnboundAtoms(const gmx_mtop_t* mtop, gmx_bool bVerbose, warninp* wi)
+static void checkForUnboundAtoms(const gmx_mtop_t* mtop, gmx_bool bVerbose, warninp* wi, const gmx::MDLogger& logger)
{
for (const gmx_moltype_t& molt : mtop->moltype)
{
- checkForUnboundAtoms(&molt, bVerbose, wi);
+ checkForUnboundAtoms(&molt, bVerbose, wi, logger);
}
}
const t_atom* atom = molt.atoms.atom;
- t_blocka atomToConstraints =
+ const auto atomToConstraints =
gmx::make_at2con(molt, iparams, gmx::FlexibleConstraintTreatment::Exclude);
bool haveDecoupledMode = false;
int a1 = il.iatoms[1 + i + 1];
int a2 = il.iatoms[1 + i + 2];
if ((atom[a0].m > atom[a2].m * massFactorThreshold || atom[a2].m > atom[a0].m * massFactorThreshold)
- && atomToConstraints.index[a0 + 1] - atomToConstraints.index[a0] == 1
- && atomToConstraints.index[a2 + 1] - atomToConstraints.index[a2] == 1
- && atomToConstraints.index[a1 + 1] - atomToConstraints.index[a1] >= 3)
+ && atomToConstraints[a0].ssize() == 1 && atomToConstraints[a2].ssize() == 1
+ && atomToConstraints[a1].ssize() >= 3)
{
- int constraint0 = atomToConstraints.a[atomToConstraints.index[a0]];
- int constraint2 = atomToConstraints.a[atomToConstraints.index[a2]];
+ int constraint0 = atomToConstraints[a0][0];
+ int constraint2 = atomToConstraints[a2][0];
bool foundAtom0 = false;
bool foundAtom2 = false;
- for (int conIndex = atomToConstraints.index[a1];
- conIndex < atomToConstraints.index[a1 + 1]; conIndex++)
+ for (const int constraint : atomToConstraints[a1])
{
- if (atomToConstraints.a[conIndex] == constraint0)
+ if (constraint == constraint0)
{
foundAtom0 = true;
}
- if (atomToConstraints.a[conIndex] == constraint2)
+ if (constraint == constraint2)
{
foundAtom2 = true;
}
}
}
- done_blocka(&atomToConstraints);
-
return haveDecoupledMode;
}
}
}
-static void set_verlet_buffer(const gmx_mtop_t* mtop, t_inputrec* ir, real buffer_temp, matrix box, warninp* wi)
+static void set_verlet_buffer(const gmx_mtop_t* mtop,
+ t_inputrec* ir,
+ real buffer_temp,
+ matrix box,
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
- char warn_buf[STRLEN];
-
- printf("Determining Verlet buffer for a tolerance of %g kJ/mol/ps at %g K\n", ir->verletbuf_tol,
- buffer_temp);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Determining Verlet buffer for a tolerance of %g kJ/mol/ps at %g K",
+ ir->verletbuf_tol, buffer_temp);
/* Calculate the buffer size for simple atom vs atoms list */
VerletbufListSetup listSetup1x1;
const int n_nonlin_vsite = countNonlinearVsites(*mtop);
if (n_nonlin_vsite > 0)
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"There are %d non-linear virtual site constructions. Their contribution to the "
"energy error is approximated. In most cases this does not affect the error "
"significantly.",
n_nonlin_vsite);
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage);
}
- printf("Calculated rlist for %dx%d atom pair-list as %.3f nm, buffer size %.3f nm\n", 1, 1,
- rlist_1x1, rlist_1x1 - std::max(ir->rvdw, ir->rcoulomb));
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Calculated rlist for %dx%d atom pair-list as %.3f nm, buffer size %.3f nm", 1,
+ 1, rlist_1x1, rlist_1x1 - std::max(ir->rvdw, ir->rcoulomb));
- printf("Set rlist, assuming %dx%d atom pair-list, to %.3f nm, buffer size %.3f nm\n",
- listSetup4x4.cluster_size_i, listSetup4x4.cluster_size_j, ir->rlist,
- ir->rlist - std::max(ir->rvdw, ir->rcoulomb));
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Set rlist, assuming %dx%d atom pair-list, to %.3f nm, buffer size %.3f nm",
+ listSetup4x4.cluster_size_i, listSetup4x4.cluster_size_j, ir->rlist,
+ ir->rlist - std::max(ir->rvdw, ir->rcoulomb));
- printf("Note that mdrun will redetermine rlist based on the actual pair-list setup\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Note that mdrun will redetermine rlist based on the actual pair-list setup");
- if (gmx::square(ir->rlist) >= max_cutoff2(ir->ePBC, box))
+ if (gmx::square(ir->rlist) >= max_cutoff2(ir->pbcType, box))
{
gmx_fatal(FARGS,
"The pair-list cut-off (%g nm) is longer than half the shortest box vector or "
"longer than the smallest box diagonal element (%g nm). Increase the box size or "
"decrease nstlist or increase verlet-buffer-tolerance.",
- ir->rlist, std::sqrt(max_cutoff2(ir->ePBC, box)));
+ ir->rlist, std::sqrt(max_cutoff2(ir->pbcType, box)));
}
}
gmx_output_env_t* oenv;
gmx_bool bVerbose = FALSE;
warninp* wi;
- char warn_buf[STRLEN];
t_filenm fnm[] = { { efMDP, nullptr, nullptr, ffREAD },
{ efMDP, "-po", "mdout", ffWRITE },
snew(opts->include, STRLEN);
snew(opts->define, STRLEN);
+ gmx::LoggerBuilder builder;
+ builder.addTargetStream(gmx::MDLogger::LogLevel::Info, &gmx::TextOutputFile::standardOutput());
+ builder.addTargetStream(gmx::MDLogger::LogLevel::Warning, &gmx::TextOutputFile::standardError());
+ gmx::LoggerOwner logOwner(builder.build());
+ const gmx::MDLogger logger(logOwner.logger());
+
+
wi = init_warning(TRUE, maxwarn);
/* PARAMETER file processing */
if (bVerbose)
{
- fprintf(stderr, "checking input for internal consistency...\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("checking input for internal consistency...");
}
check_ir(mdparin, mdModules.notifier(), ir, opts, wi);
if (ir->ld_seed == -1)
{
ir->ld_seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Setting the LD random seed to %" PRId64 "\n", ir->ld_seed);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Setting the LD random seed to %" PRId64 "", ir->ld_seed);
}
if (ir->expandedvals->lmc_seed == -1)
{
ir->expandedvals->lmc_seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Setting the lambda MC random seed to %d\n", ir->expandedvals->lmc_seed);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Setting the lambda MC random seed to %d", ir->expandedvals->lmc_seed);
}
bNeedVel = EI_STATE_VELOCITY(ir->eI);
bGenVel = (bNeedVel && opts->bGenVel);
if (bGenVel && ir->bContinuation)
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"Generating velocities is inconsistent with attempting "
"to continue a previous run. Choose only one of "
"gen-vel = yes and continuation = yes.");
- warning_error(wi, warn_buf);
+ warning_error(wi, warningMessage);
}
std::array<InteractionsOfType, F_NRE> interactions;
t_state state;
new_status(fn, opt2fn_null("-pp", NFILE, fnm), opt2fn("-c", NFILE, fnm), opts, ir, bZero,
bGenVel, bVerbose, &state, &atypes, &sys, &mi, &intermolecular_interactions,
- interactions, &comb, &reppow, &fudgeQQ, opts->bMorse, wi);
+ interactions, &comb, &reppow, &fudgeQQ, opts->bMorse, wi, logger);
if (debug)
{
/* set parameters for virtual site construction (not for vsiten) */
for (size_t mt = 0; mt < sys.moltype.size(); mt++)
{
- nvsite += set_vsites(bVerbose, &sys.moltype[mt].atoms, &atypes, mi[mt].interactions);
+ nvsite += set_vsites(bVerbose, &sys.moltype[mt].atoms, &atypes, mi[mt].interactions, logger);
}
/* now throw away all obsolete bonds, angles and dihedrals: */
/* note: constraints are ALWAYS removed */
{
for (size_t mt = 0; mt < sys.moltype.size(); mt++)
{
- clean_vsite_bondeds(mi[mt].interactions, sys.moltype[mt].atoms.nr, bRmVSBds);
+ clean_vsite_bondeds(mi[mt].interactions, sys.moltype[mt].atoms.nr, bRmVSBds, logger);
}
}
{
if (ir->eI == eiCG || ir->eI == eiLBFGS)
{
- sprintf(warn_buf, "Can not do %s with %s, use %s", EI(ir->eI),
- econstr_names[econtSHAKE], econstr_names[econtLINCS]);
- warning_error(wi, warn_buf);
+ std::string warningMessage =
+ gmx::formatString("Can not do %s with %s, use %s", EI(ir->eI),
+ econstr_names[econtSHAKE], econstr_names[econtLINCS]);
+ warning_error(wi, warningMessage);
}
if (ir->bPeriodicMols)
{
- sprintf(warn_buf, "Can not do periodic molecules with %s, use %s",
- econstr_names[econtSHAKE], econstr_names[econtLINCS]);
- warning_error(wi, warn_buf);
+ std::string warningMessage =
+ gmx::formatString("Can not do periodic molecules with %s, use %s",
+ econstr_names[econtSHAKE], econstr_names[econtLINCS]);
+ warning_error(wi, warningMessage);
}
}
{
if (ir->epc == epcPARRINELLORAHMAN || ir->epc == epcMTTK)
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"You are combining position restraints with %s pressure coupling, which can "
"lead to instabilities. If you really want to combine position restraints with "
"pressure coupling, we suggest to use %s pressure coupling instead.",
EPCOUPLTYPE(ir->epc), EPCOUPLTYPE(epcBERENDSEN));
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage);
}
const char* fn = opt2fn("-r", NFILE, fnm);
if (bVerbose)
{
- fprintf(stderr, "Reading position restraint coords from %s", fn);
- if (strcmp(fn, fnB) == 0)
- {
- fprintf(stderr, "\n");
- }
- else
+ std::string message = gmx::formatString("Reading position restraint coords from %s", fn);
+ if (strcmp(fn, fnB) != 0)
{
- fprintf(stderr, " and %s\n", fnB);
+ message += gmx::formatString(" and %s", fnB);
}
+ GMX_LOG(logger.info).asParagraph().appendText(message);
}
- gen_posres(&sys, mi, fn, fnB, ir->refcoord_scaling, ir->ePBC, ir->posres_com, ir->posres_comB, wi);
+ gen_posres(&sys, mi, fn, fnB, ir->refcoord_scaling, ir->pbcType, ir->posres_com,
+ ir->posres_comB, wi, logger);
}
/* If we are using CMAP, setup the pre-interpolation grid */
interactions[F_CMAP].cmap, &sys.ffparams.cmap_grid);
}
- set_wall_atomtype(&atypes, opts, ir, wi);
+ set_wall_atomtype(&atypes, opts, ir, wi, logger);
if (bRenum)
{
atypes.renumberTypes(interactions, &sys, ir->wall_atomtype, bVerbose);
if (bVerbose)
{
- fprintf(stderr, "converting bonded parameters...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("converting bonded parameters...");
}
const int ntype = atypes.size();
/* set ptype to VSite for virtual sites */
for (gmx_moltype_t& moltype : sys.moltype)
{
- set_vsites_ptype(FALSE, &moltype);
+ set_vsites_ptype(FALSE, &moltype, logger);
}
if (debug)
{
/* check masses */
check_mol(&sys, wi);
- checkForUnboundAtoms(&sys, bVerbose, wi);
+ checkForUnboundAtoms(&sys, bVerbose, wi, logger);
if (EI_DYNAMICS(ir->eI) && ir->eI != eiBD)
{
if (bVerbose)
{
- fprintf(stderr, "initialising group options...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("initialising group options...");
}
do_index(mdparin, ftp2fn_null(efNDX, NFILE, fnm), &sys, bVerbose, mdModules.notifier(), ir, wi);
}
if (buffer_temp > 0)
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"NVE simulation: will use the initial temperature of %.3f K for "
"determining the Verlet buffer size",
buffer_temp);
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage);
}
else
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"NVE simulation with an initial temperature of zero: will use a Verlet "
"buffer of %d%%. Check your energy drift!",
gmx::roundToInt(verlet_buffer_ratio_NVE_T0 * 100));
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage);
}
}
else
if (ir->verletbuf_tol > 1.1 * driftTolerance * totalEnergyDriftPerAtomPerPicosecond)
{
- sprintf(warn_buf,
+ std::string warningMessage = gmx::formatString(
"You are using a Verlet buffer tolerance of %g kJ/mol/ps for an "
"NVE simulation of length %g ps, which can give a final drift of "
"%d%%. For conserving energy to %d%% when using constraints, you "
gmx::roundToInt(ir->verletbuf_tol / totalEnergyDriftPerAtomPerPicosecond * 100),
gmx::roundToInt(100 * driftTolerance),
driftTolerance * totalEnergyDriftPerAtomPerPicosecond);
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage);
}
}
- set_verlet_buffer(&sys, ir, buffer_temp, state.box, wi);
+ set_verlet_buffer(&sys, ir, buffer_temp, state.box, wi, logger);
}
}
}
/* make exclusions between QM atoms and remove charges if needed */
if (ir->bQMMM)
{
- generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_ORIGINAL);
+ generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_ORIGINAL, logger);
if (ir->QMMMscheme != eQMMMschemeoniom)
{
std::vector<int> qmmmAtoms = qmmmAtomIndices(*ir, sys);
if (ir->eI == eiMimic)
{
- generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_MIMIC);
+ generate_qmexcl(&sys, ir, wi, GmxQmmmMode::GMX_QMMM_MIMIC, logger);
}
if (ftp2bSet(efTRN, NFILE, fnm))
{
if (bVerbose)
{
- fprintf(stderr, "getting data from old trajectory ...\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("getting data from old trajectory ...");
}
cont_status(ftp2fn(efTRN, NFILE, fnm), ftp2fn_null(efEDR, NFILE, fnm), bNeedVel, bGenVel,
- fr_time, ir, &state, &sys, oenv);
+ fr_time, ir, &state, &sys, oenv, logger);
}
- if (ir->ePBC == epbcXY && ir->nwall != 2)
+ if (ir->pbcType == PbcType::XY && ir->nwall != 2)
{
clear_rvec(state.box[ZZ]);
}
{
copy_mat(ir->compress, compressibility);
}
- setStateDependentAwhParams(ir->awhParams, ir->pull, pull, state.box, ir->ePBC,
+ setStateDependentAwhParams(ir->awhParams, ir->pull, pull, state.box, ir->pbcType,
compressibility, &ir->opts, wi);
}
if (EEL_PME(ir->coulombtype))
{
float ratio = pme_load_estimate(sys, *ir, state.box);
- fprintf(stderr, "Estimate for the relative computational load of the PME mesh part: %.2f\n", ratio);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Estimate for the relative computational load of the PME mesh part: %.2f", ratio);
/* With free energy we might need to do PME both for the A and B state
* charges. This will double the cost, but the optimal performance will
* then probably be at a slightly larger cut-off and grid spacing.
}
{
- char warn_buf[STRLEN];
- double cio = compute_io(ir, sys.natoms, sys.groups, F_NRE, 1);
- sprintf(warn_buf, "This run will generate roughly %.0f Mb of data", cio);
+ double cio = compute_io(ir, sys.natoms, sys.groups, F_NRE, 1);
+ std::string warningMessage =
+ gmx::formatString("This run will generate roughly %.0f Mb of data", cio);
if (cio > 2000)
{
set_warning_line(wi, mdparin, -1);
- warning_note(wi, warn_buf);
+ warning_note(wi, warningMessage);
}
else
{
- printf("%s\n", warn_buf);
+ GMX_LOG(logger.info).asParagraph().appendText(warningMessage);
}
}
{
gmx::KeyValueTreeBuilder internalParameterBuilder;
- mdModules.notifier().notifier_.notify(internalParameterBuilder.rootObject());
+ mdModules.notifier().preProcessingNotifications_.notify(internalParameterBuilder.rootObject());
ir->internalParameters =
std::make_unique<gmx::KeyValueTreeObject>(internalParameterBuilder.build());
}
if (bVerbose)
{
- fprintf(stderr, "writing run input file...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("writing run input file...");
}
done_warning(wi, FARGS);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/real.h"
/*! \libinternal \brief
//! Molecules separated in datastructure.
t_block mols;
//! Exclusions in the molecule.
- t_blocka excls;
+ gmx::ListOfLists<int> excls;
//! Interactions of a defined type.
std::array<InteractionsOfType, F_NRE> interactions;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const std::set<int>& removableAtoms,
const t_atoms& atoms_insrt,
gmx::ArrayRef<RVec> x_insrt,
- int ePBC,
+ PbcType pbcType,
matrix box,
const std::string& posfn,
const rvec deltaR,
gmx::DefaultRandomEngine rng(seed);
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
/* With -ip, take nmol_insrt from file posfn */
double** rpos = nullptr;
gmx_mtop_t top_;
std::vector<RVec> x_;
matrix box_;
- int ePBC_;
+ PbcType pbcType_;
};
void InsertMolecules::initOptions(IOptionsContainer* options, ICommandLineOptionsModuleSettings* settings)
bool bTprFileWasRead;
rvec* temporaryX = nullptr;
fprintf(stderr, "Reading solute configuration\n");
- readConfAndTopology(inputConfFile_.c_str(), &bTprFileWasRead, &top_, &ePBC_, &temporaryX,
+ readConfAndTopology(inputConfFile_.c_str(), &bTprFileWasRead, &top_, &pbcType_, &temporaryX,
nullptr, box_);
x_.assign(temporaryX, temporaryX + top_.natoms);
sfree(temporaryX);
if (replaceSel_.isValid())
{
t_pbc pbc;
- set_pbc(&pbc, ePBC_, box_);
+ set_pbc(&pbc, pbcType_, box_);
t_trxframe* fr;
snew(fr, 1);
fr->natoms = x_.size();
// individual atoms.
}
- int ePBCForOutput = ePBC_;
+ PbcType pbcTypeForOutput = pbcType_;
if (bBox_)
{
- ePBCForOutput = epbcXYZ;
+ pbcTypeForOutput = PbcType::Xyz;
clear_mat(box_);
box_[XX][XX] = newBox_[XX];
box_[YY][YY] = newBox_[YY];
t_atoms atomsInserted;
std::vector<RVec> xInserted;
{
- bool bTprFileWasRead;
- int ePBC_dummy;
- matrix box_dummy;
- rvec* temporaryX;
- readConfAndTopology(insertConfFile_.c_str(), &bTprFileWasRead, &topInserted, &ePBC_dummy,
+ bool bTprFileWasRead;
+ PbcType pbcType_dummy;
+ matrix box_dummy;
+ rvec* temporaryX;
+ readConfAndTopology(insertConfFile_.c_str(), &bTprFileWasRead, &topInserted, &pbcType_dummy,
&temporaryX, nullptr, box_dummy);
xInserted.assign(temporaryX, temporaryX + topInserted.natoms);
sfree(temporaryX);
/* add nmol_ins molecules of atoms_ins
in random orientation at random place */
insert_mols(nmolIns_, nmolTry_, seed_, defaultDistance_, scaleFactor_, &atoms, &top_.symtab,
- &x_, removableAtoms, atomsInserted, xInserted, ePBCForOutput, box_, positionFile_,
- deltaR_, enumRot_);
+ &x_, removableAtoms, atomsInserted, xInserted, pbcTypeForOutput, box_,
+ positionFile_, deltaR_, enumRot_);
/* write new configuration to file confout */
fprintf(stderr, "Writing generated configuration to %s\n", outputConfFile_.c_str());
write_sto_conf(outputConfFile_.c_str(), *top_.name, &atoms, as_rvec_array(x_.data()), nullptr,
- ePBCForOutput, box_);
+ pbcTypeForOutput, box_);
/* print size of generated configuration */
fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n", atoms.nr, atoms.nres);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/dir_separator.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/filestream.h"
+#include "gromacs/utility/loggerbuilder.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/strdb.h"
gmx::ArrayRef<const int> r_end,
gmx::ArrayRef<const RtpRename> rr,
t_symtab* symtab,
- bool bVerbose)
+ bool bVerbose,
+ const gmx::MDLogger& logger)
{
bool bFFRTPTERRNM = (getenv("GMX_NO_FFRTP_TER_RENAME") == nullptr);
{
if (bVerbose)
{
- printf("Changing rtp entry of residue %d %s to '%s'\n", pdba->resinfo[r].nr,
- *pdba->resinfo[r].name, newName.c_str());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Changing rtp entry of residue %d %s to '%s'",
+ pdba->resinfo[r].nr, *pdba->resinfo[r].name,
+ newName.c_str());
}
pdba->resinfo[r].rtp = put_symtab(symtab, newName.c_str());
}
}
}
-static void check_occupancy(t_atoms* atoms, const char* filename, bool bVerbose)
+static void check_occupancy(t_atoms* atoms, const char* filename, bool bVerbose, const gmx::MDLogger& logger)
{
int i, ftp;
int nzero = 0;
ftp = fn2ftp(filename);
if (!atoms->pdbinfo || ((ftp != efPDB) && (ftp != efBRK) && (ftp != efENT)))
{
- fprintf(stderr, "No occupancies in %s\n", filename);
+ GMX_LOG(logger.warning).asParagraph().appendTextFormatted("No occupancies in %s", filename);
}
else
{
{
if (bVerbose)
{
- fprintf(stderr, "Occupancy for atom %s%d-%s is %f rather than 1\n",
- *atoms->resinfo[atoms->atom[i].resind].name,
- atoms->resinfo[atoms->atom[i].resind].nr, *atoms->atomname[i],
- atoms->pdbinfo[i].occup);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("Occupancy for atom %s%d-%s is %f rather than 1",
+ *atoms->resinfo[atoms->atom[i].resind].name,
+ atoms->resinfo[atoms->atom[i].resind].nr,
+ *atoms->atomname[i], atoms->pdbinfo[i].occup);
}
if (atoms->pdbinfo[i].occup == 0)
{
}
if (nzero == atoms->nr)
{
- fprintf(stderr, "All occupancy fields zero. This is probably not an X-Ray structure\n");
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "All occupancy fields zero. This is probably not an X-Ray structure");
}
else if ((nzero > 0) || (nnotone > 0))
{
- fprintf(stderr,
- "\n"
- "WARNING: there were %d atoms with zero occupancy and %d atoms with\n"
- " occupancy unequal to one (out of %d atoms). Check your pdb file.\n"
- "\n",
- nzero, nnotone, atoms->nr);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "there were %d atoms with zero occupancy and %d atoms with "
+ " occupancy unequal to one (out of %d atoms). Check your pdb "
+ "file.",
+ nzero, nnotone, atoms->nr);
}
else
{
- fprintf(stderr, "All occupancies are one\n");
+ GMX_LOG(logger.warning).asParagraph().appendTextFormatted("All occupancies are one");
}
}
}
char** title,
t_atoms* atoms,
rvec** x,
- int* ePBC,
+ PbcType* pbcType,
matrix box,
bool bRemoveH,
t_symtab* symtab,
/* READ IT */
printf("Reading %s...\n", inf);
- readConfAndAtoms(inf, symtab, title, atoms, ePBC, x, nullptr, box);
+ readConfAndAtoms(inf, symtab, title, atoms, pbcType, x, nullptr, box);
natom = atoms->nr;
if (atoms->pdbinfo == nullptr)
{
}
if (bOutput)
{
- write_sto_conf(outf, *title, atoms, *x, nullptr, *ePBC, box);
+ write_sto_conf(outf, *title, atoms, *x, nullptr, *pbcType, box);
}
return natom;
[&atomnm](char** it) { return gmx::equalCaseInsensitive(atomnm, *it); });
if (found == localPpResidue->atomname.end())
{
- char buf[STRLEN];
-
- sprintf(buf,
+ std::string buf = gmx::formatString(
"Atom %s in residue %s %d was not found in rtp entry %s with %d atoms\n"
"while sorting atoms.\n%s",
atomnm, *pdba->resinfo[pdba->atom[i].resind].name,
"solve it.\n"
"Option -ignh will ignore all hydrogens in the input."
: ".");
- gmx_fatal(FARGS, "%s", buf);
+ gmx_fatal(FARGS, "%s", buf.c_str());
}
/* make shadow array to be sorted into indexgroup */
pdbi[i].resnr = pdba->atom[i].resind;
sfree(pdbi);
}
-static int remove_duplicate_atoms(t_atoms* pdba, gmx::ArrayRef<gmx::RVec> x, bool bVerbose)
+static int remove_duplicate_atoms(t_atoms* pdba, gmx::ArrayRef<gmx::RVec> x, bool bVerbose, const gmx::MDLogger& logger)
{
int i, j, oldnatoms, ndel;
t_resinfo* ri;
- printf("Checking for duplicate atoms....\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Checking for duplicate atoms....");
oldnatoms = pdba->nr;
ndel = 0;
/* NOTE: pdba->nr is modified inside the loop */
if (bVerbose)
{
ri = &pdba->resinfo[pdba->atom[i].resind];
- printf("deleting duplicate atom %4s %s%4d%c", *pdba->atomname[i], *ri->name,
- ri->nr, ri->ic);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("deleting duplicate atom %4s %s%4d%c",
+ *pdba->atomname[i], *ri->name, ri->nr, ri->ic);
if (ri->chainid && (ri->chainid != ' '))
{
printf(" ch %c", ri->chainid);
}
if (pdba->nr != oldnatoms)
{
- printf("Now there are %d atoms. Deleted %d duplicates.\n", pdba->nr, ndel);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Now there are %d atoms. Deleted %d duplicates.", pdba->nr, ndel);
}
return pdba->nr;
}
}
-static void find_nc_ter(t_atoms* pdba, int r0, int r1, int* r_start, int* r_end, ResidueType* rt)
+static void find_nc_ter(t_atoms* pdba, int r0, int r1, int* r_start, int* r_end, ResidueType* rt, const gmx::MDLogger& logger)
{
int i;
gmx::compat::optional<std::string> startrestype;
|| gmx::equalCaseInsensitive(*startrestype, "DNA")
|| gmx::equalCaseInsensitive(*startrestype, "RNA"))
{
- printf("Identified residue %s%d as a starting terminus.\n", *pdba->resinfo[i].name,
- pdba->resinfo[i].nr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Identified residue %s%d as a starting terminus.",
+ *pdba->resinfo[i].name, pdba->resinfo[i].nr);
*r_start = i;
}
else if (gmx::equalCaseInsensitive(*startrestype, "Ion"))
{
if (ionNotes < 5)
{
- printf("Residue %s%d has type 'Ion', assuming it is not linked into a chain.\n",
- *pdba->resinfo[i].name, pdba->resinfo[i].nr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Residue %s%d has type 'Ion', assuming it is not linked into a "
+ "chain.",
+ *pdba->resinfo[i].name, pdba->resinfo[i].nr);
}
if (ionNotes == 4)
{
- printf("Disabling further notes about ions.\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Disabling further notes about ions.");
}
ionNotes++;
}
{
if (chainID == ' ')
{
- printf("\nWarning: Starting residue %s%d in chain not identified as "
- "Protein/RNA/DNA.\n"
- "This chain lacks identifiers, which makes it impossible to do strict\n"
- "classification of the start/end residues. Here we need to guess this "
- "residue\n"
- "should not be part of the chain and instead introduce a break, but "
- "that will\n"
- "be catastrophic if they should in fact be linked. Please check your "
- "structure,\n"
- "and add %s to residuetypes.dat if this was not correct.\n\n",
- *pdba->resinfo[i].name, pdba->resinfo[i].nr, *pdba->resinfo[i].name);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Starting residue %s%d in chain not identified as "
+ "Protein/RNA/DNA. "
+ "This chain lacks identifiers, which makes it impossible to do "
+ "strict "
+ "classification of the start/end residues. Here we need to "
+ "guess this residue "
+ "should not be part of the chain and instead introduce a "
+ "break, but that will "
+ "be catastrophic if they should in fact be linked. Please "
+ "check your structure, "
+ "and add %s to residuetypes.dat if this was not correct.",
+ *pdba->resinfo[i].name, pdba->resinfo[i].nr, *pdba->resinfo[i].name);
}
else
{
- printf("\nWarning: No residues in chain starting at %s%d identified as "
- "Protein/RNA/DNA.\n"
- "This makes it impossible to link them into a molecule, which could "
- "either be\n"
- "correct or a catastrophic error. Please check your structure, and add "
- "all\n"
- "necessary residue names to residuetypes.dat if this was not "
- "correct.\n\n",
- *pdba->resinfo[i].name, pdba->resinfo[i].nr);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "No residues in chain starting at %s%d identified as "
+ "Protein/RNA/DNA. "
+ "This makes it impossible to link them into a molecule, which "
+ "could either be "
+ "correct or a catastrophic error. Please check your structure, "
+ "and add all "
+ "necessary residue names to residuetypes.dat if this was not "
+ "correct.",
+ *pdba->resinfo[i].name, pdba->resinfo[i].nr);
}
}
if (startWarnings == 4)
{
- printf("Disabling further warnings about unidentified residues at start of "
- "chain.\n");
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Disabling further warnings about unidentified residues at start "
+ "of chain.");
}
startWarnings++;
}
{
if (ionNotes < 5)
{
- printf("Residue %s%d has type 'Ion', assuming it is not linked into a chain.\n",
- *pdba->resinfo[i].name, pdba->resinfo[i].nr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Residue %s%d has type 'Ion', assuming it is not linked into a "
+ "chain.",
+ *pdba->resinfo[i].name, pdba->resinfo[i].nr);
}
if (ionNotes == 4)
{
- printf("Disabling further notes about ions.\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Disabling further notes about ions.");
}
ionNotes++;
}
// have caught the problem.
if (endWarnings < 5)
{
- printf("\nWarning: Residue %s%d in chain has different type ('%s') from\n"
- "residue %s%d ('%s'). This chain lacks identifiers, which makes\n"
- "it impossible to do strict classification of the start/end residues. "
- "Here we\n"
- "need to guess this residue should not be part of the chain and "
- "instead\n"
- "introduce a break, but that will be catastrophic if they should in "
- "fact be\n"
- "linked. Please check your structure, and add %s to residuetypes.dat\n"
- "if this was not correct.\n\n",
- *pdba->resinfo[i].name, pdba->resinfo[i].nr, restype->c_str(),
- *pdba->resinfo[*r_start].name, pdba->resinfo[*r_start].nr,
- startrestype->c_str(), *pdba->resinfo[i].name);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Residue %s%d in chain has different type ('%s') from "
+ "residue %s%d ('%s'). This chain lacks identifiers, which "
+ "makes "
+ "it impossible to do strict classification of the start/end "
+ "residues. Here we "
+ "need to guess this residue should not be part of the chain "
+ "and instead "
+ "introduce a break, but that will be catastrophic if they "
+ "should in fact be "
+ "linked. Please check your structure, and add %s to "
+ "residuetypes.dat "
+ "if this was not correct.",
+ *pdba->resinfo[i].name, pdba->resinfo[i].nr, restype->c_str(),
+ *pdba->resinfo[*r_start].name, pdba->resinfo[*r_start].nr,
+ startrestype->c_str(), *pdba->resinfo[i].name);
}
if (endWarnings == 4)
{
- printf("Disabling further warnings about unidentified residues at end of "
- "chain.\n");
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Disabling further warnings about unidentified residues at end "
+ "of chain.");
}
endWarnings++;
}
if (*r_end >= 0)
{
- printf("Identified residue %s%d as a ending terminus.\n", *pdba->resinfo[*r_end].name,
- pdba->resinfo[*r_end].nr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Identified residue %s%d as a ending terminus.",
+ *pdba->resinfo[*r_end].name, pdba->resinfo[*r_end].nr);
}
}
"Splitting chemical chains interactively.\n"
};
-static void modify_chain_numbers(t_atoms* pdba, ChainSepType enumChainSep)
+static void modify_chain_numbers(t_atoms* pdba, ChainSepType enumChainSep, const gmx::MDLogger& logger)
{
int i;
char old_prev_chainid;
{
if (i > 0)
{
- printf("Split the chain (and introduce termini) between residue %s%d (chain id '%c', atom %d %s)\
-\n"
- "and residue %s%d (chain id '%c', atom %d %s) ? [n/y]\n",
- prev_resname, prev_resnum, prev_chainid, prev_atomnum, prev_atomname,
- this_resname, this_resnum, this_chainid, this_atomnum, this_atomname);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Split the chain (and introduce termini) between residue %s%d (chain id '%c', atom %d %s)\
+"
+ "and residue %s%d (chain id '%c', atom %d %s) ? [n/y]",
+ prev_resname, prev_resnum, prev_chainid, prev_atomnum,
+ prev_atomname, this_resname, this_resnum, this_chainid,
+ this_atomnum, this_atomname);
if (nullptr == fgets(select, STRLEN - 1, stdin))
{
WaterType enumWater_;
MergeType enumMerge_;
- FILE* itp_file_;
- char forcefield_[STRLEN];
- char ffdir_[STRLEN];
- char* ffname_;
- char* watermodel_;
- std::vector<std::string> incls_;
- std::vector<t_mols> mols_;
- real mHmult_;
+ FILE* itp_file_;
+ char forcefield_[STRLEN];
+ char ffdir_[STRLEN];
+ char* ffname_;
+ char* watermodel_;
+ std::vector<std::string> incls_;
+ std::vector<t_mols> mols_;
+ real mHmult_;
+ std::unique_ptr<gmx::MDLogger> loggerPointer_;
};
void pdb2gmx::initOptions(IOptionsContainer* options, ICommandLineOptionsModuleSettings* settings)
/* Force field selection, interactive or direct */
choose_ff(strcmp(ff_.c_str(), "select") == 0 ? nullptr : ff_.c_str(), forcefield_,
- sizeof(forcefield_), ffdir_, sizeof(ffdir_));
+ sizeof(forcefield_), ffdir_, sizeof(ffdir_), *loggerPointer_);
if (strlen(forcefield_) > 0)
{
int this_chainstart;
int prev_chainstart;
- printf("\nUsing the %s force field in directory %s\n\n", ffname_, ffdir_);
+ gmx::LoggerBuilder builder;
+ builder.addTargetStream(gmx::MDLogger::LogLevel::Info, &gmx::TextOutputFile::standardOutput());
+ builder.addTargetStream(gmx::MDLogger::LogLevel::Warning, &gmx::TextOutputFile::standardError());
+ gmx::LoggerOwner logOwner(builder.build());
+ loggerPointer_ = std::make_unique<gmx::MDLogger>(logOwner.logger());
+ const gmx::MDLogger& logger = *loggerPointer_;
+
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Using the %s force field in directory %s", ffname_, ffdir_);
- choose_watermodel(WaterEnum[enumWater_], ffdir_, &watermodel_);
+ choose_watermodel(WaterEnum[enumWater_], ffdir_, &watermodel_, logger);
switch (enumVSites_)
{
std::vector<RtpRename> rtprename;
for (const auto& filename : rrn)
{
- printf("going to rename %s\n", filename.c_str());
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("going to rename %s", filename.c_str());
FILE* fp = fflib_open(filename);
read_rtprename(filename.c_str(), fp, &rtprename);
gmx_ffclose(fp);
AtomProperties aps;
char* title = nullptr;
- int ePBC;
+ PbcType pbcType;
t_atoms pdba_all;
rvec* pdbx;
int natom = read_pdball(inputConfFile_.c_str(), bOutputSet_, outFile_.c_str(), &title, &pdba_all,
- &pdbx, &ePBC, box, bRemoveH_, &symtab, &rt, watres, &aps, bVerbose_);
+ &pdbx, &pbcType, box, bRemoveH_, &symtab, &rt, watres, &aps, bVerbose_);
if (natom == 0)
{
GMX_THROW(InconsistentInputError(message));
}
- printf("Analyzing pdb file\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Analyzing pdb file");
int nwaterchain = 0;
- modify_chain_numbers(&pdba_all, enumChainSep_);
+ modify_chain_numbers(&pdba_all, enumChainSep_, logger);
int nchainmerges = 0;
{
if (!strncmp(MergeEnum[enumMerge_], "int", 3))
{
- printf("Merge chain ending with residue %s%d (chain id '%c', atom %d %s) and "
- "chain starting with\n"
- "residue %s%d (chain id '%c', atom %d %s) into a single moleculetype "
- "(keeping termini)? [n/y]\n",
- prev_resname, prev_resnum, prev_chainid, prev_atomnum, prev_atomname,
- this_resname, this_resnum, this_chainid, this_atomnum, this_atomname);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Merge chain ending with residue %s%d (chain id '%c', atom %d "
+ "%s) and chain starting with "
+ "residue %s%d (chain id '%c', atom %d %s) into a single "
+ "moleculetype (keeping termini)? [n/y]",
+ prev_resname, prev_resnum, prev_chainid, prev_atomnum,
+ prev_atomname, this_resname, this_resnum, this_chainid,
+ this_atomnum, this_atomname);
if (nullptr == fgets(select, STRLEN - 1, stdin))
{
{
if (pdb_ch[j].chainid != ' ' && pdb_ch[j].chainid == ri->chainid)
{
- printf("WARNING: Chain identifier '%c' is used in two non-sequential "
- "blocks.\n"
- "They will be treated as separate chains unless you reorder your "
- "file.\n",
- ri->chainid);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Chain identifier '%c' is used in two non-sequential "
+ "blocks. "
+ "They will be treated as separate chains unless you "
+ "reorder your file.",
+ ri->chainid);
}
}
t_pdbchain newChain;
}
if (nwaterchain > 1)
{
- printf("Moved all the water blocks to the end\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Moved all the water blocks to the end");
}
t_atoms* pdba;
if (nchainmerges > 0)
{
- printf("\nMerged chains into joint molecule definitions at %d places.\n\n", nchainmerges);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Merged chains into joint molecule definitions at %d places.",
+ nchainmerges);
}
- printf("There are %d chains and %d blocks of water and "
- "%d residues with %d atoms\n",
- numChains - nwaterchain, nwaterchain, pdba_all.nres, natom);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "There are %d chains and %d blocks of water and "
+ "%d residues with %d atoms",
+ numChains - nwaterchain, nwaterchain, pdba_all.nres, natom);
- printf("\n %5s %4s %6s\n", "chain", "#res", "#atoms");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(" %5s %4s %6s", "chain", "#res", "#atoms");
for (int i = 0; (i < numChains); i++)
{
- printf(" %d '%c' %5d %6d %s\n", i + 1, chains[i].chainid ? chains[i].chainid : '-',
- chains[i].pdba->nres, chains[i].pdba->nr, chains[i].bAllWat ? "(only water)" : "");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(" %d '%c' %5d %6d %s\n", i + 1,
+ chains[i].chainid ? chains[i].chainid : '-', chains[i].pdba->nres,
+ chains[i].pdba->nr, chains[i].bAllWat ? "(only water)" : "");
}
- printf("\n");
- check_occupancy(&pdba_all, inputConfFile_.c_str(), bVerbose_);
+ check_occupancy(&pdba_all, inputConfFile_.c_str(), bVerbose_, logger);
/* Read atomtypes... */
PreprocessingAtomTypes atype = read_atype(ffdir_, &symtab);
/* read residue database */
- printf("Reading residue database... (%s)\n", forcefield_);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Reading residue database... (%s)", forcefield_);
std::vector<std::string> rtpf = fflib_search_file_end(ffdir_, ".rtp", true);
std::vector<PreprocessResidue> rtpFFDB;
for (const auto& filename : rtpf)
{
- readResidueDatabase(filename, &rtpFFDB, &atype, &symtab, false);
+ readResidueDatabase(filename, &rtpFFDB, &atype, &symtab, logger, false);
}
if (bNewRTP_)
{
if (cc->chainid && (cc->chainid != ' '))
{
- printf("Processing chain %d '%c' (%d atoms, %d residues)\n", chain + 1, cc->chainid,
- natom, nres);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Processing chain %d '%c' (%d atoms, %d residues)",
+ chain + 1, cc->chainid, natom, nres);
}
else
{
- printf("Processing chain %d (%d atoms, %d residues)\n", chain + 1, natom, nres);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Processing chain %d (%d atoms, %d residues)", chain + 1,
+ natom, nres);
}
process_chain(pdba, x, bUnA_, bUnA_, bUnA_, bLysMan_, bAspMan_, bGluMan_, bHisMan_,
for (int i = 0; i < cc->nterpairs; i++)
{
find_nc_ter(pdba, cc->chainstart[i], cc->chainstart[i + 1], &(cc->r_start[j]),
- &(cc->r_end[j]), &rt);
+ &(cc->r_end[j]), &rt, logger);
if (cc->r_start[j] >= 0 && cc->r_end[j] >= 0)
{
cc->nterpairs = j;
if (cc->nterpairs == 0)
{
- printf("Problem with chain definition, or missing terminal residues.\n"
- "This chain does not appear to contain a recognized chain molecule.\n"
- "If this is incorrect, you can edit residuetypes.dat to modify the behavior.\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Problem with chain definition, or missing terminal residues. "
+ "This chain does not appear to contain a recognized chain molecule. "
+ "If this is incorrect, you can edit residuetypes.dat to modify the "
+ "behavior.");
}
/* Check for disulfides and other special bonds */
if (!rtprename.empty())
{
- rename_resrtp(pdba, cc->nterpairs, cc->r_start, cc->r_end, rtprename, &symtab, bVerbose_);
+ rename_resrtp(pdba, cc->nterpairs, cc->r_start, cc->r_end, rtprename, &symtab, bVerbose_, logger);
}
for (int i = 0; i < cc->nterpairs; i++)
tdblist = filter_ter(ntdb, *pdba->resinfo[cc->r_start[i]].name);
if (tdblist.empty())
{
- printf("No suitable end (N or 5') terminus found in database - assuming this "
- "residue\n"
- "is already in a terminus-specific form and skipping terminus "
- "selection.\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "No suitable end (N or 5') terminus found in database - "
+ "assuming this residue "
+ "is already in a terminus-specific form and skipping terminus "
+ "selection.");
cc->ntdb.push_back(nullptr);
}
else
tdblist = filter_ter(ctdb, *pdba->resinfo[cc->r_end[i]].name);
if (tdblist.empty())
{
- printf("No suitable end (C or 3') terminus found in database - assuming this "
- "residue\n"
- "is already in a terminus-specific form and skipping terminus "
- "selection.\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "No suitable end (C or 3') terminus found in database - "
+ "assuming this residue"
+ "is already in a terminus-specific form and skipping terminus "
+ "selection.");
cc->ctdb.push_back(nullptr);
}
else
/* lookup hackblocks and rtp for all residues */
std::vector<PreprocessResidue> restp_chain;
get_hackblocks_rtp(&hb_chain, &restp_chain, rtpFFDB, pdba->nres, pdba->resinfo, cc->nterpairs,
- &symtab, cc->ntdb, cc->ctdb, cc->r_start, cc->r_end, bAllowMissing_);
+ &symtab, cc->ntdb, cc->ctdb, cc->r_start, cc->r_end, bAllowMissing_, logger);
/* ideally, now we would not need the rtp itself anymore, but do
everything using the hb and restp arrays. Unfortunately, that
requires some re-thinking of code in gen_vsite.c, which I won't
rename_atoms(nullptr, ffdir_, pdba, &symtab, restp_chain, false, &rt, false, bVerbose_);
- match_atomnames_with_rtp(restp_chain, hb_chain, pdba, &symtab, x, bVerbose_);
+ match_atomnames_with_rtp(restp_chain, hb_chain, pdba, &symtab, x, bVerbose_, logger);
if (bSort_)
{
t_blocka* block = new_blocka();
snew(gnames, 1);
sort_pdbatoms(restp_chain, natom, &pdba, &sortAtoms[chain], &x, block, &gnames);
- remove_duplicate_atoms(pdba, x, bVerbose_);
+ remove_duplicate_atoms(pdba, x, bVerbose_, logger);
if (bIndexSet_)
{
if (bRemoveH_)
{
- fprintf(stderr,
- "WARNING: with the -remh option the generated "
- "index file (%s) might be useless\n"
- "(the index file is generated before hydrogens are added)",
- indexOutputFile_.c_str());
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "With the -remh option the generated "
+ "index file (%s) might be useless "
+ "(the index file is generated before hydrogens are added)",
+ indexOutputFile_.c_str());
}
write_index(indexOutputFile_.c_str(), block, gnames, false, 0);
}
}
else
{
- fprintf(stderr,
- "WARNING: "
- "without sorting no check for duplicate atoms can be done\n");
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Without sorting no check for duplicate atoms can be done");
}
/* Generate Hydrogen atoms (and termini) in the sequence */
- printf("Generating any missing hydrogen atoms and/or adding termini.\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Generating any missing hydrogen atoms and/or adding termini.");
add_h(&pdba, &localAtoms[chain], &x, ah, &symtab, cc->nterpairs, cc->ntdb, cc->ctdb,
cc->r_start, cc->r_end, bAllowMissing_);
- printf("Now there are %d residues with %d atoms\n", pdba->nres, pdba->nr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Now there are %d residues with %d atoms", pdba->nres, pdba->nr);
/* make up molecule name(s) */
pdb2top(top_file2, posre_fn.c_str(), molname.c_str(), pdba, &x, &atype, &symtab, rtpFFDB,
restp_chain, hb_chain, bAllowMissing_, bVsites_, bVsiteAromatics_, ffdir_, mHmult_,
ssbonds, long_bond_dist_, short_bond_dist_, bDeuterate_, bChargeGroups_, bCmap_,
- bRenumRes_, bRTPresname_);
+ bRenumRes_, bRTPresname_, logger);
if (!cc->bAllWat)
{
{
if (numChains > 1)
{
- printf("Including chain %d in system: %d atoms %d residues\n", i + 1,
- chains[i].pdba->nr, chains[i].pdba->nres);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Including chain %d in system: %d atoms %d residues",
+ i + 1, chains[i].pdba->nr, chains[i].pdba->nres);
}
for (int j = 0; (j < chains[i].pdba->nr); j++)
{
if (numChains > 1)
{
- fprintf(stderr, "Now there are %d atoms and %d residues\n", k, l);
- print_sums(atoms, true);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Now there are %d atoms and %d residues", k, l);
+ print_sums(atoms, true, logger);
}
rvec box_space;
- fprintf(stderr, "\nWriting coordinate file...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Writing coordinate file...");
clear_rvec(box_space);
if (box[0][0] == 0)
{
make_new_box(atoms->nr, gmx::as_rvec_array(x.data()), box, box_space, false);
}
- write_sto_conf(outputConfFile_.c_str(), title, atoms, gmx::as_rvec_array(x.data()), nullptr, ePBC, box);
+ write_sto_conf(outputConfFile_.c_str(), title, atoms, gmx::as_rvec_array(x.data()), nullptr,
+ pbcType, box);
done_symtab(&symtab);
done_atom(&pdba_all);
sfree(atoms);
sfree(title);
sfree(pdbx);
- printf("\t\t--------- PLEASE NOTE ------------\n");
- printf("You have successfully generated a topology from: %s.\n", inputConfFile_.c_str());
+
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("\t\t--------- PLEASE NOTE ------------");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("You have successfully generated a topology from: %s.",
+ inputConfFile_.c_str());
if (watermodel_ != nullptr)
{
- printf("The %s force field and the %s water model are used.\n", ffname_, watermodel_);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("The %s force field and the %s water model are used.", ffname_,
+ watermodel_);
sfree(watermodel_);
}
else
{
- printf("The %s force field is used.\n", ffname_);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("The %s force field is used.", ffname_);
}
- printf("\t\t--------- ETON ESAELP ------------\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("\t\t--------- ETON ESAELP ------------");
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/niceheader.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/programcontext.h"
/* this must correspond to enum in pdb2top.h */
const char* hh[ehisNR] = { "HISD", "HISE", "HISH", "HIS1" };
-static int missing_atoms(const PreprocessResidue* rp, int resind, t_atoms* at, int i0, int i)
+static int missing_atoms(const PreprocessResidue* rp, int resind, t_atoms* at, int i0, int i, const gmx::MDLogger& logger)
{
int nmiss = 0;
for (int j = 0; j < rp->natom(); j++)
if (!bFound)
{
nmiss++;
- fprintf(stderr,
- "\nWARNING: "
- "atom %s is missing in residue %s %d in the pdb file\n",
- name, *(at->resinfo[resind].name), at->resinfo[resind].nr);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("atom %s is missing in residue %s %d in the pdb file",
+ name, *(at->resinfo[resind].name), at->resinfo[resind].nr);
if (name[0] == 'H' || name[0] == 'h')
{
- fprintf(stderr,
- " You might need to add atom %s to the hydrogen database of "
- "building block %s\n"
- " in the file %s.hdb (see the manual)\n",
- name, *(at->resinfo[resind].rtp), rp->filebase.c_str());
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "You might need to add atom %s to the hydrogen database of "
+ "building block %s "
+ "in the file %s.hdb (see the manual)",
+ name, *(at->resinfo[resind].rtp), rp->filebase.c_str());
}
- fprintf(stderr, "\n");
}
}
return (fabs(x - ix) < tol);
}
-static void choose_ff_impl(const char* ffsel, char* forcefield, int ff_maxlen, char* ffdir, int ffdir_maxlen)
+static void choose_ff_impl(const char* ffsel,
+ char* forcefield,
+ int ff_maxlen,
+ char* ffdir,
+ int ffdir_maxlen,
+ const gmx::MDLogger& logger)
{
std::vector<gmx::DataFileInfo> ffdirs = fflib_enumerate_forcefields();
const int nff = ssize(ffdirs);
{
if (cwdsel != -1)
{
- fprintf(stderr,
- "Force field '%s' occurs in %d places. pdb2gmx is using the one in the\n"
- "current directory. Use interactive selection (not the -ff option) if\n"
- "you would prefer a different one.\n",
- ffsel, nfound);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Force field '%s' occurs in %d places. pdb2gmx is using the one in "
+ "the current directory. Use interactive selection "
+ "(not the -ff option) if you would prefer a different one.",
+ ffsel, nfound);
}
else
{
}
}
- printf("\nSelect the Force Field:\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Select the Force Field:");
for (int i = 0; i < nff; ++i)
{
if (i == 0 || ffdirs[i - 1].dir != ffdirs[i].dir)
{
if (ffdirs[i].dir == ".")
{
- printf("From current directory:\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("From current directory:");
}
else
{
- printf("From '%s':\n", ffdirs[i].dir.c_str());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("From '%s':", ffdirs[i].dir.c_str());
}
}
- printf("%2d: %s\n", i + 1, desc[i].c_str());
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("%2d: %s", i + 1, desc[i].c_str());
}
sel = -1;
strcpy(ffdir, ffpath.c_str());
}
-void choose_ff(const char* ffsel, char* forcefield, int ff_maxlen, char* ffdir, int ffdir_maxlen)
+void choose_ff(const char* ffsel, char* forcefield, int ff_maxlen, char* ffdir, int ffdir_maxlen, const gmx::MDLogger& logger)
{
try
{
- choose_ff_impl(ffsel, forcefield, ff_maxlen, ffdir, ffdir_maxlen);
+ choose_ff_impl(ffsel, forcefield, ff_maxlen, ffdir, ffdir_maxlen, logger);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
-void choose_watermodel(const char* wmsel, const char* ffdir, char** watermodel)
+void choose_watermodel(const char* wmsel, const char* ffdir, char** watermodel, const gmx::MDLogger& logger)
{
const char* fn_watermodels = "watermodels.dat";
FILE* fp;
std::string filename = gmx::Path::join(ffdir, fn_watermodels);
if (!fflib_fexist(filename))
{
- fprintf(stderr, "No file '%s' found, will not include a water model\n", fn_watermodels);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("No file '%s' found, will not include a water model", fn_watermodels);
*watermodel = nullptr;
return;
}
fp = fflib_open(filename);
- printf("\nSelect the Water Model:\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Select the Water Model:");
nwm = 0;
model = nullptr;
while (get_a_line(fp, buf, STRLEN))
if (i > 0)
{
ltrim(buf + i);
- fprintf(stderr, "%2d: %s\n", nwm + 1, buf + i);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("%2d: %s", nwm + 1, buf + i);
nwm++;
}
else
}
}
gmx_ffclose(fp);
- fprintf(stderr, "%2d: %s\n", nwm + 1, "None");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("%2d: %s", nwm + 1, "None");
sel = -1;
do
sfree(model);
}
-static int name2type(t_atoms* at, int** cgnr, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, ResidueType* rt)
+static int name2type(t_atoms* at,
+ int** cgnr,
+ gmx::ArrayRef<const PreprocessResidue> usedPpResidues,
+ ResidueType* rt,
+ const gmx::MDLogger& logger)
{
int i, j, prevresind, i0, prevcg, cg, curcg;
char* name;
bNterm = bProt && (resind == 0);
if (resind > 0)
{
- nmissat += missing_atoms(&usedPpResidues[prevresind], prevresind, at, i0, i);
+ nmissat += missing_atoms(&usedPpResidues[prevresind], prevresind, at, i0, i, logger);
}
i0 = i;
}
at->atom[i].qB = at->atom[i].q;
at->atom[i].mB = at->atom[i].m;
}
- nmissat += missing_atoms(&usedPpResidues[resind], resind, at, i0, i);
+ nmissat += missing_atoms(&usedPpResidues[resind], resind, at, i0, i, logger);
return nmissat;
}
t_atoms* atoms,
gmx::ArrayRef<const gmx::RVec> x,
real long_bond_dist,
- real short_bond_dist)
+ real short_bond_dist,
+ const gmx::MDLogger& logger)
{
real long_bond_dist2, short_bond_dist2;
const char* ptr;
ptr = "check";
}
- fprintf(stderr, "Making bonds...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Making bonds...");
int i = 0;
for (int resind = 0; (resind < atoms->nres) && (i < atoms->nr); resind++)
{
if (dist2 > long_bond_dist2)
{
- fprintf(stderr, "Warning: Long Bond (%d-%d = %g nm)\n", ai + 1, aj + 1,
- std::sqrt(dist2));
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("Long Bond (%d-%d = %g nm)", ai + 1, aj + 1,
+ std::sqrt(dist2));
}
else if (dist2 < short_bond_dist2)
{
- fprintf(stderr, "Warning: Short Bond (%d-%d = %g nm)\n", ai + 1, aj + 1,
- std::sqrt(dist2));
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("Short Bond (%d-%d = %g nm)", ai + 1, aj + 1,
+ std::sqrt(dist2));
}
add_param(psb, ai, aj, {}, patch.s.c_str());
}
}
}
-static void clean_bonds(InteractionsOfType* ps)
+static void clean_bonds(InteractionsOfType* ps, const gmx::MDLogger& logger)
{
if (ps->size() > 0)
{
++parm;
}
}
- fprintf(stderr, "Number of bonds was %d, now %zu\n", oldNumber, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Number of bonds was %d, now %zu", oldNumber, ps->size());
}
else
{
- fprintf(stderr, "No bonds\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("No bonds");
}
}
-void print_sums(const t_atoms* atoms, bool bSystem)
+void print_sums(const t_atoms* atoms, bool bSystem, const gmx::MDLogger& logger)
{
double m, qtot;
int i;
qtot += atoms->atom[i].q;
}
- fprintf(stderr, "Total mass%s %.3f a.m.u.\n", where, m);
- fprintf(stderr, "Total charge%s %.3f e\n", where, qtot);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Total mass%s %.3f a.m.u.", where, m);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Total charge%s %.3f e", where, qtot);
}
static void check_restp_type(const char* name, int t1, int t2)
gmx::ArrayRef<MoleculePatchDatabase*> ctdb,
gmx::ArrayRef<const int> rn,
gmx::ArrayRef<const int> rc,
- bool bAllowMissing)
+ bool bAllowMissing,
+ const gmx::MDLogger& logger)
{
char* key;
bool bRM;
*/
key = *resinfo[i].rtp;
- resinfo[i].rtp = put_symtab(symtab, searchResidueDatabase(key, rtpFFDB).c_str());
+ resinfo[i].rtp = put_symtab(symtab, searchResidueDatabase(key, rtpFFDB, logger).c_str());
auto res = getDatabaseEntry(*resinfo[i].rtp, rtpFFDB);
usedPpResidues->push_back(PreprocessResidue());
PreprocessResidue* newentry = &usedPpResidues->back();
"terminal database entries (.tdb).";
if (bAllowMissing)
{
- fprintf(stderr, "%s\n", errString);
+ GMX_LOG(logger.warning).asParagraph().appendTextFormatted("%s", errString);
}
else
{
"proper existing terminal entry.";
if (bAllowMissing)
{
- fprintf(stderr, "%s\n", errString);
+ GMX_LOG(logger.warning).asParagraph().appendTextFormatted("%s", errString);
}
else
{
int atind,
PreprocessResidue* localPpResidue,
const MoleculePatchDatabase& singlePatch,
- bool bVerbose)
+ bool bVerbose,
+ const gmx::MDLogger& logger)
{
int resnr;
char* oldnm;
if (bVerbose)
{
- printf("Renaming atom '%s' in residue '%s' %d to '%s'\n", oldnm,
- localPpResidue->resname.c_str(), resnr, newnm.c_str());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Renaming atom '%s' in residue '%s' %d to '%s'", oldnm,
+ localPpResidue->resname.c_str(), resnr, newnm.c_str());
}
/* Rename the atom in pdba */
pdba->atomname[atind] = put_symtab(symtab, newnm.c_str());
*/
if (bVerbose)
{
- printf("Deleting atom '%s' in residue '%s' %d\n", oldnm,
- localPpResidue->resname.c_str(), resnr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Deleting atom '%s' in residue '%s' %d", oldnm,
+ localPpResidue->resname.c_str(), resnr);
}
/* We should free the atom name,
* but it might be used multiple times in the symtab.
t_atoms* pdba,
t_symtab* symtab,
gmx::ArrayRef<gmx::RVec> x,
- bool bVerbose)
+ bool bVerbose,
+ const gmx::MDLogger& logger)
{
for (int i = 0; i < pdba->nr; i++)
{
{
/* Not found yet, check if we have to rename this atom */
if (match_atomnames_with_rtp_atom(pdba, x, symtab, i, localPpResidue,
- globalPatches[pdba->atom[i].resind], bVerbose))
+ globalPatches[pdba->atom[i].resind], bVerbose, logger))
{
/* We deleted this atom, decrease the atom counter by 1. */
i--;
}
#define NUM_CMAP_ATOMS 5
-static void gen_cmap(InteractionsOfType* psb, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, t_atoms* atoms)
+static void gen_cmap(InteractionsOfType* psb,
+ gmx::ArrayRef<const PreprocessResidue> usedPpResidues,
+ t_atoms* atoms,
+ const gmx::MDLogger& logger)
{
int residx;
const char* ptr;
ptr = "check";
}
- fprintf(stderr, "Making cmap torsions...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Making cmap torsions...");
int i = 0;
/* Most cmap entries use the N atom from the next residue, so the last
* residue should not have its CMAP entry in that case, but for things like
bool bChargeGroups,
bool bCmap,
bool bRenumRes,
- bool bRTPresname)
+ bool bRTPresname,
+ const gmx::MDLogger& logger)
{
std::array<InteractionsOfType, F_NRE> plist;
t_excls* excls;
ResidueType rt;
/* Make bonds */
- at2bonds(&(plist[F_BONDS]), globalPatches, atoms, *x, long_bond_dist, short_bond_dist);
+ at2bonds(&(plist[F_BONDS]), globalPatches, atoms, *x, long_bond_dist, short_bond_dist, logger);
/* specbonds: disulphide bonds & heme-his */
do_ssbonds(&(plist[F_BONDS]), atoms, ssbonds, bAllowMissing);
- nmissat = name2type(atoms, &cgnr, usedPpResidues, &rt);
+ nmissat = name2type(atoms, &cgnr, usedPpResidues, &rt, logger);
if (nmissat)
{
if (bAllowMissing)
{
- fprintf(stderr, "There were %d missing atoms in molecule %s\n", nmissat, molname);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("There were %d missing atoms in molecule %s", nmissat, molname);
}
else
{
}
/* Cleanup bonds (sort and rm doubles) */
- clean_bonds(&(plist[F_BONDS]));
+ clean_bonds(&(plist[F_BONDS]), logger);
snew(vsite_type, atoms->nr);
for (i = 0; i < atoms->nr; i++)
{
if (bVsiteAromatics)
{
- fprintf(stdout,
- "The conversion of aromatic rings into virtual sites is deprecated "
- "and may be removed in a future version of GROMACS");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "The conversion of aromatic rings into virtual sites is deprecated "
+ "and may be removed in a future version of GROMACS");
}
/* determine which atoms will be vsites and add dummy masses
also renumber atom numbers in plist[0..F_NRE]! */
}
/* Make Angles and Dihedrals */
- fprintf(stderr, "Generating angles, dihedrals and pairs...\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Generating angles, dihedrals and pairs...");
snew(excls, atoms->nr);
gen_pad(atoms, usedPpResidues, plist, excls, globalPatches, bAllowMissing);
/* Make CMAP */
if (bCmap)
{
- gen_cmap(&(plist[F_CMAP]), usedPpResidues, atoms);
+ gen_cmap(&(plist[F_CMAP]), usedPpResidues, atoms, logger);
if (plist[F_CMAP].size() > 0)
{
- fprintf(stderr, "There are %4zu cmap torsion pairs\n", plist[F_CMAP].size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("There are %4zu cmap torsion pairs", plist[F_CMAP].size());
}
}
/* Cleanup bonds (sort and rm doubles) */
/* clean_bonds(&(plist[F_BONDS]));*/
- fprintf(stderr,
- "There are %4zu dihedrals, %4zu impropers, %4zu angles\n"
- " %4zu pairs, %4zu bonds and %4zu virtual sites\n",
- plist[F_PDIHS].size(), plist[F_IDIHS].size(), plist[F_ANGLES].size(),
- plist[F_LJ14].size(), plist[F_BONDS].size(),
- plist[F_VSITE2].size() + plist[F_VSITE3].size() + plist[F_VSITE3FD].size()
- + plist[F_VSITE3FAD].size() + plist[F_VSITE3OUT].size()
- + plist[F_VSITE4FD].size() + plist[F_VSITE4FDN].size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "There are %4zu dihedrals, %4zu impropers, %4zu angles\n"
+ " %4zu pairs, %4zu bonds and %4zu virtual sites",
+ plist[F_PDIHS].size(), plist[F_IDIHS].size(), plist[F_ANGLES].size(),
+ plist[F_LJ14].size(), plist[F_BONDS].size(),
+ plist[F_VSITE2].size() + plist[F_VSITE3].size() + plist[F_VSITE3FD].size()
+ + plist[F_VSITE3FAD].size() + plist[F_VSITE3OUT].size()
+ + plist[F_VSITE4FD].size() + plist[F_VSITE4FDN].size());
- print_sums(atoms, FALSE);
+ print_sums(atoms, FALSE, logger);
if (!bChargeGroups)
{
if (top_file)
{
- fprintf(stderr, "Writing topology\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Writing topology");
/* We can copy the bonded types from the first restp,
* since the types have to be identical for all residues in one molecule.
*/
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/arrayref.h"
class PreprocessingAtomTypes;
+
+namespace gmx
+{
+class MDLogger;
+}
+
struct t_atoms;
struct t_excls;
struct MoleculePatchDatabase;
};
extern const char* hh[ehisNR];
-void choose_ff(const char* ffsel, char* forcefield, int ff_maxlen, char* ffdir, int ffdir_maxlen);
+void choose_ff(const char* ffsel,
+ char* forcefield,
+ int ff_maxlen,
+ char* ffdir,
+ int ffdir_maxlen,
+ const gmx::MDLogger& logger);
/* Find force fields in the current and libdirs and choose an ff.
* If ffsel!=NULL: search for ffsel.
* If ffsel==NULL: interactive selection.
*/
-void choose_watermodel(const char* wmsel, const char* ffdir, char** watermodel);
+void choose_watermodel(const char* wmsel, const char* ffdir, char** watermodel, const gmx::MDLogger& logger);
/* Choose, possibly interactively, which water model to include,
* based on the wmsel command line option choice and watermodels.dat
* in ffdir.
gmx::ArrayRef<MoleculePatchDatabase*> ctdb,
gmx::ArrayRef<const int> rn,
gmx::ArrayRef<const int> rc,
- bool bAllowMissing);
+ bool bAllowMissing,
+ const gmx::MDLogger& logger);
/* Get the database entries for the nres residues in resinfo
* and store them in restp and hb.
*/
t_atoms* pdba,
t_symtab* symtab,
gmx::ArrayRef<gmx::RVec> x,
- bool bVerbose);
+ bool bVerbose,
+ const gmx::MDLogger& logger);
/* Check if atom in pdba need to be deleted of renamed due to tdb or hdb.
* If renaming involves atoms added wrt to the rtp database,
* add these atoms to restp.
bool bChargeGroups,
bool bCmap,
bool bRenumRes,
- bool bRTPresname);
+ bool bRTPresname,
+ const gmx::MDLogger& logger);
/* Create a topology ! */
-void print_sums(const t_atoms* atoms, bool bSystem);
+void print_sums(const t_atoms* atoms, bool bSystem, const gmx::MDLogger& logger);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017, The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// Inquire all MdModules, if their parameters match with the energy
// calculation frequency
gmx::EnergyCalculationFrequencyErrors energyCalculationFrequencyErrors(ir->nstcalcenergy);
- mdModulesNotifier.notifier_.notify(&energyCalculationFrequencyErrors);
+ mdModulesNotifier.preProcessingNotifications_.notify(&energyCalculationFrequencyErrors);
// Emit all errors from the energy calculation frequency checks
for (const std::string& energyFrequencyErrorMessage :
/* TPI STUFF */
if (EI_TPI(ir->eI))
{
- sprintf(err_buf, "TPI only works with pbc = %s", epbc_names[epbcXYZ]);
- CHECK(ir->ePBC != epbcXYZ);
+ sprintf(err_buf, "TPI only works with pbc = %s", c_pbcTypeNames[PbcType::Xyz].c_str());
+ CHECK(ir->pbcType != PbcType::Xyz);
sprintf(err_buf, "with TPI nstlist should be larger than zero");
CHECK(ir->nstlist <= 0);
sprintf(err_buf, "TPI does not work with full electrostatics other than PME");
sprintf(err_buf, "The soft-core power is %d and can only be 1 or 2", fep->sc_power);
CHECK(fep->sc_alpha != 0 && fep->sc_power != 1 && fep->sc_power != 2);
- sprintf(err_buf, "The soft-core sc-r-power is %d and can only be 6 or 48",
+ sprintf(err_buf,
+ "The soft-core sc-r-power is %d and can only be 6. (sc-r-power 48 is no longer "
+ "supported.)",
static_cast<int>(fep->sc_r_power));
- CHECK(fep->sc_alpha != 0 && fep->sc_r_power != 6.0 && fep->sc_r_power != 48.0);
+ CHECK(fep->sc_alpha != 0 && fep->sc_r_power != 6.0);
sprintf(err_buf,
"Can't use positive delta-lambda (%g) if initial state/lambda does not start at "
}
/* PBC/WALLS */
- sprintf(err_buf, "walls only work with pbc=%s", epbc_names[epbcXY]);
- CHECK(ir->nwall && ir->ePBC != epbcXY);
+ sprintf(err_buf, "walls only work with pbc=%s", c_pbcTypeNames[PbcType::XY].c_str());
+ CHECK(ir->nwall && ir->pbcType != PbcType::XY);
/* VACUUM STUFF */
- if (ir->ePBC != epbcXYZ && ir->nwall != 2)
+ if (ir->pbcType != PbcType::Xyz && ir->nwall != 2)
{
- if (ir->ePBC == epbcNONE)
+ if (ir->pbcType == PbcType::No)
{
if (ir->epc != epcNO)
{
}
else
{
- sprintf(err_buf, "Can not have pressure coupling with pbc=%s", epbc_names[ir->ePBC]);
+ sprintf(err_buf, "Can not have pressure coupling with pbc=%s",
+ c_pbcTypeNames[ir->pbcType].c_str());
CHECK(ir->epc != epcNO);
}
- sprintf(err_buf, "Can not have Ewald with pbc=%s", epbc_names[ir->ePBC]);
+ sprintf(err_buf, "Can not have Ewald with pbc=%s", c_pbcTypeNames[ir->pbcType].c_str());
CHECK(EEL_FULL(ir->coulombtype));
- sprintf(err_buf, "Can not have dispersion correction with pbc=%s", epbc_names[ir->ePBC]);
+ sprintf(err_buf, "Can not have dispersion correction with pbc=%s",
+ c_pbcTypeNames[ir->pbcType].c_str());
CHECK(ir->eDispCorr != edispcNO);
}
"with coulombtype = %s or coulombtype = %s\n"
"without periodic boundary conditions (pbc = %s) and\n"
"rcoulomb and rvdw set to zero",
- eel_names[eelCUT], eel_names[eelUSER], epbc_names[epbcNONE]);
+ eel_names[eelCUT], eel_names[eelUSER], c_pbcTypeNames[PbcType::No].c_str());
CHECK(((ir->coulombtype != eelCUT) && (ir->coulombtype != eelUSER))
- || (ir->ePBC != epbcNONE) || (ir->rcoulomb != 0.0) || (ir->rvdw != 0.0));
+ || (ir->pbcType != PbcType::No) || (ir->rcoulomb != 0.0) || (ir->rvdw != 0.0));
if (ir->nstlist > 0)
{
"Can not remove the rotation around the center of mass with periodic "
"molecules");
CHECK(ir->bPeriodicMols);
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
warning(wi,
"Removing the rotation around the center of mass in a periodic system, "
}
}
- if (EI_STATE_VELOCITY(ir->eI) && !EI_SD(ir->eI) && ir->ePBC == epbcNONE && ir->comm_mode != ecmANGULAR)
+ if (EI_STATE_VELOCITY(ir->eI) && !EI_SD(ir->eI) && ir->pbcType == PbcType::No && ir->comm_mode != ecmANGULAR)
{
sprintf(warn_buf,
"Tumbling and flying ice-cubes: We are not removing rotation around center of mass "
{
if (ir->ewald_geometry == eewg3D)
{
- sprintf(warn_buf, "With pbc=%s you should use ewald-geometry=%s", epbc_names[ir->ePBC],
- eewg_names[eewg3DC]);
+ sprintf(warn_buf, "With pbc=%s you should use ewald-geometry=%s",
+ c_pbcTypeNames[ir->pbcType].c_str(), eewg_names[eewg3DC]);
warning(wi, warn_buf);
}
/* This check avoids extra pbc coding for exclusion corrections */
sprintf(err_buf, "wall-ewald-zfac should be >= 2");
CHECK(ir->wall_ewald_zfac < 2);
}
- if ((ir->ewald_geometry == eewg3DC) && (ir->ePBC != epbcXY) && EEL_FULL(ir->coulombtype))
+ if ((ir->ewald_geometry == eewg3DC) && (ir->pbcType != PbcType::XY) && EEL_FULL(ir->coulombtype))
{
sprintf(warn_buf, "With %s and ewald_geometry = %s you should use pbc = %s",
- eel_names[ir->coulombtype], eewg_names[eewg3DC], epbc_names[epbcXY]);
+ eel_names[ir->coulombtype], eewg_names[eewg3DC], c_pbcTypeNames[PbcType::XY].c_str());
warning(wi, warn_buf);
}
if ((ir->epsilon_surface != 0) && EEL_FULL(ir->coulombtype))
}
- /* make it easier if sc_r_power = 48 by increasing it to the 4th power, to be in the right scale. */
- if (fep->sc_r_power == 48)
- {
- if (fep->sc_alpha > 0.1)
- {
- gmx_fatal(FARGS,
- "sc_alpha (%f) for sc_r_power = 48 should usually be between 0.001 and 0.004",
- fep->sc_alpha);
- }
- }
-
/* now read in the weights */
parse_n_real(weights, &nweights, &(expand->init_lambda_weights), wi);
if (nweights == 0)
printStringNoNewline(&inp, "nblist update frequency");
ir->nstlist = get_eint(&inp, "nstlist", 10, wi);
printStringNoNewline(&inp, "Periodic boundary conditions: xyz, no, xy");
- ir->ePBC = get_eeenum(&inp, "pbc", epbc_names, wi);
+ // TODO This conversion should be removed when proper std:string handling will be added to get_eeenum(...), etc.
+ std::vector<const char*> pbcTypesNamesChar;
+ for (const auto& pbcTypeName : c_pbcTypeNames)
+ {
+ pbcTypesNamesChar.push_back(pbcTypeName.c_str());
+ }
+ ir->pbcType = static_cast<PbcType>(get_eeenum(&inp, "pbc", pbcTypesNamesChar.data(), wi));
ir->bPeriodicMols = get_eeenum(&inp, "periodic-molecules", yesno_names, wi) != 0;
printStringNoNewline(&inp,
"Allowed energy error due to the Verlet buffer in kJ/mol/ps per atom,");
gmx::IndexGroupsAndNames defaultIndexGroupsAndNames(
*defaultIndexGroups, gmx::arrayRefFromArray(gnames, defaultIndexGroups->nr));
- notifier.notifier_.notify(defaultIndexGroupsAndNames);
+ notifier.preProcessingNotifications_.notify(defaultIndexGroupsAndNames);
auto accelerations = gmx::splitString(is->acc);
auto accelerationGroupNames = gmx::splitString(is->accgrps);
char warn_buf[STRLEN];
const char* ptr;
- ptr = check_box(ir->ePBC, box);
+ ptr = check_box(ir->pbcType, box);
if (ptr)
{
warning_error(wi, ptr);
ir->LincsWarnAngle = 90.0;
}
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
if (ir->nstlist == 0)
{
"With nstlist=0 atoms are only put into the box at step 0, therefore drifting "
"atoms might cause the simulation to crash.");
}
- if (gmx::square(ir->rlist) >= max_cutoff2(ir->ePBC, box))
+ if (gmx::square(ir->rlist) >= max_cutoff2(ir->pbcType, box))
{
sprintf(warn_buf,
"ERROR: The cut-off length is longer than half the shortest box vector or "
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/pull_params.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pulling/pull.h"
update_mdatoms(md, lambda);
}
- set_pbc(&pbc, ir->ePBC, box);
+ set_pbc(&pbc, ir->pbcType, box);
t_start = ir->init_t + ir->init_step * ir->delta_t;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/strdb.h"
{
a->m = m;
at.addType(tab, *a, name, InteractionOfType({}, {}), 0, 0);
- fflush(stderr);
}
else
{
}
}
-static void check_rtp(gmx::ArrayRef<const PreprocessResidue> rtpDBEntry, const std::string& libfn)
+static void check_rtp(gmx::ArrayRef<const PreprocessResidue> rtpDBEntry,
+ const std::string& libfn,
+ const gmx::MDLogger& logger)
{
/* check for double entries, assuming list is already sorted */
for (auto it = rtpDBEntry.begin() + 1; it != rtpDBEntry.end(); it++)
auto prev = it - 1;
if (gmx::equalCaseInsensitive(prev->resname, it->resname))
{
- fprintf(stderr, "WARNING double entry %s in file %s\n", it->resname.c_str(), libfn.c_str());
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("Double entry %s in file %s", it->resname.c_str(), libfn.c_str());
}
}
}
static_cast<int>(rtpDBEntry[0].bRemoveDihedralIfWithImproper));
}
+
+static void print_resall_log(const gmx::MDLogger& logger, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry)
+{
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("[ bondedtypes ]");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "; bonds angles dihedrals impropers all_dihedrals nr_exclusions HH14 "
+ "remove_dih");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ " %5d %6d %9d %9d %14d %14d %14d %14d", rtpDBEntry[0].rb[0].type,
+ rtpDBEntry[0].rb[1].type, rtpDBEntry[0].rb[2].type, rtpDBEntry[0].rb[3].type,
+ static_cast<int>(rtpDBEntry[0].bKeepAllGeneratedDihedrals),
+ rtpDBEntry[0].nrexcl, static_cast<int>(rtpDBEntry[0].bGenerateHH14Interactions),
+ static_cast<int>(rtpDBEntry[0].bRemoveDihedralIfWithImproper));
+}
+
+
void print_resall(FILE* out, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry, const PreprocessingAtomTypes& atype)
{
if (rtpDBEntry.empty())
std::vector<PreprocessResidue>* rtpDBEntry,
PreprocessingAtomTypes* atype,
t_symtab* tab,
+ const gmx::MDLogger& logger,
bool bAllowOverrideRTP)
{
FILE* in;
get_a_line(in, line, STRLEN);
if (nparam < 5)
{
- fprintf(stderr, "Using default: not generating all possible dihedrals\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Using default: not generating all possible dihedrals");
header_settings.bKeepAllGeneratedDihedrals = FALSE;
}
if (nparam < 6)
{
- fprintf(stderr, "Using default: excluding 3 bonded neighbors\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Using default: excluding 3 bonded neighbors");
header_settings.nrexcl = 3;
}
if (nparam < 7)
{
- fprintf(stderr, "Using default: generating 1,4 H--H interactions\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Using default: generating 1,4 H--H interactions");
header_settings.bGenerateHH14Interactions = TRUE;
}
if (nparam < 8)
{
- fprintf(stderr,
- "Using default: removing proper dihedrals found on the same bond as a proper "
- "dihedral\n");
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Using default: removing proper dihedrals found on the same bond as a "
+ "proper dihedral");
header_settings.bRemoveDihedralIfWithImproper = TRUE;
}
}
else
{
- fprintf(stderr,
- "Reading .rtp file without '[ bondedtypes ]' directive,\n"
- "Will proceed as if the entry was:\n");
- print_resall_header(stderr, gmx::arrayRefFromArray(&header_settings, 1));
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Reading .rtp file without '[ bondedtypes ]' directive, "
+ "Will proceed as if the entry was:");
+ print_resall_log(logger, gmx::arrayRefFromArray(&header_settings, 1));
}
/* We don't know the current size of rrtp, but simply realloc immediately */
auto oldArrayEnd = rtpDBEntry->end();
}
if (bAllowOverrideRTP)
{
- fprintf(stderr,
- "Found another rtp entry for '%s' in '%s', ignoring this entry and keeping "
- "the one from '%s.rtp'\n",
- res->resname.c_str(), rrdb.c_str(), found->filebase.c_str());
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Found another rtp entry for '%s' in '%s',"
+ " ignoring this entry and keeping the one from '%s.rtp'",
+ res->resname.c_str(), rrdb.c_str(), found->filebase.c_str());
/* We should free all the data for this entry.
* The current code gives a lot of dangling pointers.
*/
[](const char& c1, const char& c2) { return std::toupper(c1) < std::toupper(c2); });
});
- check_rtp(*rtpDBEntry, rrdb);
+ check_rtp(*rtpDBEntry, rrdb, logger);
}
/************************************************************
}
}
-std::string searchResidueDatabase(const std::string& key, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry)
+std::string searchResidueDatabase(const std::string& key,
+ gmx::ArrayRef<const PreprocessResidue> rtpDBEntry,
+ const gmx::MDLogger& logger)
{
int nbest, best, besti;
std::string bestbuf;
}
if (!gmx::equalCaseInsensitive(rtpDBEntry[besti].resname, key))
{
- fprintf(stderr,
- "\nWARNING: '%s' not found in residue topology database, "
- "trying to use '%s'\n\n",
- key.c_str(), rtpDBEntry[besti].resname.c_str());
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "'%s' not found in residue topology database, "
+ "trying to use '%s'",
+ key.c_str(), rtpDBEntry[besti].resname.c_str());
}
return rtpDBEntry[besti].resname;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/arrayref.h"
class PreprocessingAtomTypes;
+
+namespace gmx
+{
+class MDLogger;
+}
struct PreprocessResidue;
struct t_symtab;
*
* \param[in] key The atomname to search for.
* \param[in] rtpDBEntry Database with residue information.
+ * \param[in] logger Logging object.
* \returns The rtp residue name.
*/
-std::string searchResidueDatabase(const std::string& key, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry);
+std::string searchResidueDatabase(const std::string& key,
+ gmx::ArrayRef<const PreprocessResidue> rtpDBEntry,
+ const gmx::MDLogger& logger);
/*! \brief
* Returns matching entry in database.
* \param[inout] rtpDBEntry Database to populate.
* \param[inout] atype Atomtype information.
* \param[inout] tab Symbol table for names.
+ * \param[in] logger MDLogger interface.
* \param[in] bAllowOverrideRTP If entries can be overwritten in the database.
*/
void readResidueDatabase(const std::string& resdb,
std::vector<PreprocessResidue>* rtpDBEntry,
PreprocessingAtomTypes* atype,
t_symtab* tab,
+ const gmx::MDLogger& logger,
bool bAllowOverrideRTP);
/*! \brief
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_symtab* symtab,
std::vector<RVec>* x,
std::vector<RVec>* v,
- int ePBC,
+ PbcType pbcType,
matrix box,
AtomProperties* aps,
real defaultDistance,
gmx_mtop_t topSolvent;
std::vector<RVec> xSolvent, vSolvent;
matrix boxSolvent = { { 0 } };
- int ePBCSolvent;
+ PbcType pbcTypeSolvent;
fprintf(stderr, "Reading solvent configuration\n");
bool bTprFileWasRead;
rvec *temporaryX = nullptr, *temporaryV = nullptr;
readConfAndTopology(gmx::findLibraryFile(filename).c_str(), &bTprFileWasRead, &topSolvent,
- &ePBCSolvent, &temporaryX, &temporaryV, boxSolvent);
+ &pbcTypeSolvent, &temporaryX, &temporaryV, boxSolvent);
t_atoms* atomsSolvent;
snew(atomsSolvent, 1);
*atomsSolvent = gmx_mtop_global_atoms(&topSolvent);
/* generate a new solvent configuration */
fprintf(stderr, "Generating solvent configuration\n");
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
if (!gmx::boxesAreEqual(boxSolvent, box))
{
if (TRICLINIC(boxSolvent))
/* apply pbc for solvent configuration for whole molecules */
rm_res_pbc(atomsSolvent, &xSolvent, boxSolvent);
replicateSolventBox(atomsSolvent, &xSolvent, &vSolvent, &exclusionDistances_solvt, boxSolvent, box);
- if (ePBC != epbcNONE)
+ if (pbcType != PbcType::No)
{
removeSolventBoxOverlap(atomsSolvent, &xSolvent, &vSolvent, &exclusionDistances_solvt, pbc);
}
/* solute configuration data */
gmx_mtop_t top;
std::vector<RVec> x, v;
- matrix box = { { 0 } };
- int ePBC = -1;
+ matrix box = { { 0 } };
+ PbcType pbcType = PbcType::Unset;
t_atoms* atoms;
snew(atoms, 1);
if (bProt)
fprintf(stderr, "Reading solute configuration%s\n", bReadV ? " and velocities" : "");
bool bTprFileWasRead;
rvec *temporaryX = nullptr, *temporaryV = nullptr;
- readConfAndTopology(conf_prot, &bTprFileWasRead, &top, &ePBC, &temporaryX,
+ readConfAndTopology(conf_prot, &bTprFileWasRead, &top, &pbcType, &temporaryX,
bReadV ? &temporaryV : nullptr, box);
*atoms = gmx_mtop_global_atoms(&top);
x.assign(temporaryX, temporaryX + top.natoms);
firstSolventResidueIndex = atoms->nres;
}
}
- int ePBCForOutput = ePBC;
+ PbcType pbcTypeForOutput = pbcType;
if (bBox)
{
- ePBCForOutput = epbcXYZ;
+ pbcTypeForOutput = PbcType::Xyz;
clear_mat(box);
box[XX][XX] = new_box[XX];
box[YY][YY] = new_box[YY];
"or give explicit -box command line option");
}
- add_solv(solventFileName, atoms, &top.symtab, &x, &v, ePBCForOutput, box, &aps, defaultDistance,
- scaleFactor, r_shell, max_sol);
+ add_solv(solventFileName, atoms, &top.symtab, &x, &v, pbcTypeForOutput, box, &aps,
+ defaultDistance, scaleFactor, r_shell, max_sol);
/* write new configuration 1 to file confout */
confout = ftp2fn(efSTO, NFILE, fnm);
fprintf(stderr, "Writing generated configuration to %s\n", confout);
const char* outputTitle = (bProt ? *top.name : "Generated by gmx solvate");
write_sto_conf(confout, outputTitle, atoms, as_rvec_array(x.data()),
- !v.empty() ? as_rvec_array(v.data()) : nullptr, ePBCForOutput, box);
+ !v.empty() ? as_rvec_array(v.data()) : nullptr, pbcTypeForOutput, box);
/* print size of generated configuration */
fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n", atoms->nr, atoms->nres);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/pleasecite.h"
#include "gromacs/utility/smalloc.h"
bool bFEP,
bool bZero,
bool usingFullRangeElectrostatics,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
FILE* out;
int sl, nb_funct;
generate_nbparams(*combination_rule, nb_funct,
&(interactions[nb_funct]), atypes, wi);
ncopy = copy_nbparams(nbparam, nb_funct, &(interactions[nb_funct]), ntype);
- fprintf(stderr,
- "Generated %d of the %d non-bonded parameter "
- "combinations\n",
- ncombs - ncopy, ncombs);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Generated %d of the %d non-bonded parameter "
+ "combinations",
+ ncombs - ncopy, ncombs);
free_nbparam(nbparam, ntype);
if (bGenPairs)
{
gen_pairs((interactions[nb_funct]), &(interactions[F_LJ14]),
fudgeLJ, *combination_rule);
ncopy = copy_nbparams(pair, nb_funct, &(interactions[F_LJ14]), ntype);
- fprintf(stderr,
- "Generated %d of the %d 1-4 parameter combinations\n",
- ncombs - ncopy, ncombs);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Generated %d of the %d 1-4 parameter "
+ "combinations",
+ ncombs - ncopy, ncombs);
free_nbparam(pair, ntype);
}
/* Copy GBSA parameters to atomtype array? */
{
gmx_fatal(FARGS, "Molecule type '%s' contains no atoms", *mi0->name);
}
- fprintf(stderr, "Excluding %d bonded neighbours molecule type '%s'\n",
- mi0->nrexcl, *mi0->name);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Excluding %d bonded neighbours molecule type '%s'",
+ mi0->nrexcl, *mi0->name);
sum_q(&mi0->atoms, nrcopies, &qt, &qBt);
if (!mi0->bProcessed)
{
generate_excl(mi0->nrexcl, mi0->atoms.nr, mi0->interactions, &(mi0->excls));
gmx::mergeExclusions(&(mi0->excls), exclusionBlocks[whichmol]);
- make_shake(mi0->interactions, &mi0->atoms, opts->nshake);
+ make_shake(mi0->interactions, &mi0->atoms, opts->nshake, logger);
if (bCouple)
{
break;
}
default:
- fprintf(stderr, "case: %d\n", static_cast<int>(d));
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted("case: %d", static_cast<int>(d));
gmx_incons("unknown directive");
}
}
{
gmx_fatal(FARGS, "Did not find any molecules of type '%s' for coupling", opts->couple_moltype);
}
- fprintf(stderr, "Coupling %d copies of molecule type '%s'\n", nmol_couple, opts->couple_moltype);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Coupling %d copies of molecule type '%s'", nmol_couple,
+ opts->couple_moltype);
}
/* this is not very clean, but fixes core dump on empty system name */
const t_inputrec* ir,
std::vector<gmx_molblock_t>* molblock,
bool* ffParametrizedWithHBondConstraints,
- warninp* wi)
+ warninp* wi,
+ const gmx::MDLogger& logger)
{
/* Tmpfile might contain a long path */
const char* tmpfile;
if (bVerbose)
{
- printf("processing topology...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("processing topology...");
}
title = read_topol(topfile, tmpfile, opts->define, opts->include, symtab, atypes, molinfo,
intermolecular_interactions, interactions, combination_rule, repulsion_power,
opts, fudgeQQ, molblock, ffParametrizedWithHBondConstraints,
- ir->efep != efepNO, bZero, EEL_FULL(ir->coulombtype), wi);
+ ir->efep != efepNO, bZero, EEL_FULL(ir->coulombtype), wi, logger);
if ((*combination_rule != eCOMB_GEOMETRIC) && (ir->vdwtype == evdwUSER))
{
* CONNBOND and, when MiMiC is not used, removes bonded interactions between QM and link atoms.
* Finally, in case if MiMiC QM/MM is used - charges of QM atoms are set to 0
*
- * @param molt molecule type with QM atoms
- * @param grpnr group informatio
- * @param ir input record
- * @param qmmmMode QM/MM mode switch: original/MiMiC
+ * \param[in,out] molt molecule type with QM atoms
+ * \param[in] grpnr group informatio
+ * \param[in,out] ir input record
+ * \param[in,out] qmmmMode QM/MM mode switch: original/MiMiC
+ * \param[in] logger Handle to logging interface.
*/
-static void generate_qmexcl_moltype(gmx_moltype_t* molt, const unsigned char* grpnr, t_inputrec* ir, GmxQmmmMode qmmmMode)
+static void generate_qmexcl_moltype(gmx_moltype_t* molt,
+ const unsigned char* grpnr,
+ t_inputrec* ir,
+ GmxQmmmMode qmmmMode,
+ const gmx::MDLogger& logger)
{
/* This routine expects molt->ilist to be of size F_NRE and ordered. */
int ind_connbond = 0;
if (molt->ilist[F_CONNBONDS].size() != 0)
{
- fprintf(stderr, "nr. of CONNBONDS present already: %d\n", molt->ilist[F_CONNBONDS].size() / 3);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("nr. of CONNBONDS present already: %d",
+ molt->ilist[F_CONNBONDS].size() / 3);
ftype_connbond = molt->ilist[F_CONNBONDS].iatoms[0];
ind_connbond = molt->ilist[F_CONNBONDS].size();
}
free(blink);
} /* generate_qmexcl */
-void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp* wi, GmxQmmmMode qmmmMode)
+void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp* wi, GmxQmmmMode qmmmMode, const gmx::MDLogger& logger)
{
/* This routine expects molt->molt[m].ilist to be of size F_NRE and ordered.
*/
/* Copy the exclusions to a new array, since this is the only
* thing that needs to be modified for QMMM.
*/
- copy_blocka(&sys->moltype[molb->type].excls, &sys->moltype.back().excls);
+ sys->moltype.back().excls = sys->moltype[molb->type].excls;
/* Set the molecule type for the QMMM molblock */
molb->type = sys->moltype.size() - 1;
}
- generate_qmexcl_moltype(&sys->moltype[molb->type], grpnr, ir, qmmmMode);
+ generate_qmexcl_moltype(&sys->moltype[molb->type], grpnr, ir, qmmmMode, logger);
}
if (grpnr)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
enum struct GmxQmmmMode;
typedef warninp* warninp_t;
+namespace gmx
+{
+class MDLogger;
+}
+
double check_mol(const gmx_mtop_t* mtop, warninp_t wi);
/* Check mass and charge */
const t_inputrec* ir,
std::vector<gmx_molblock_t>* molblock,
bool* ffParametrizedWithHBondConstraints,
- warninp_t wi);
+ warninp_t wi,
+ const gmx::MDLogger& logger);
/* This routine expects sys->molt[m].ilist to be of size F_NRE and ordered. */
-void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp_t wi, GmxQmmmMode qmmmMode);
+void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, warninp_t wi, GmxQmmmMode qmmmMode, const gmx::MDLogger& logger);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static void generate_LJCpairsNB(MoleculeInformation* mol, int nb_funct, InteractionsOfType* nbp, warninp* wi)
{
- int n, ntype;
- t_atom* atom;
- t_blocka* excl;
- bool bExcl;
+ int n, ntype;
+ t_atom* atom;
n = mol->atoms.nr;
atom = mol->atoms.atom;
"Number of pairs of generated non-bonded parameters should be a perfect square");
/* Add a pair interaction for all non-excluded atom pairs */
- excl = &mol->excls;
+ const auto& excls = mol->excls;
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
- bExcl = FALSE;
- for (int k = excl->index[i]; k < excl->index[i + 1]; k++)
+ bool pairIsExcluded = false;
+ for (const int atomK : excls[i])
{
- if (excl->a[k] == j)
+ if (atomK == j)
{
- bExcl = TRUE;
+ pairIsExcluded = true;
}
}
- if (!bExcl)
+ if (!pairIsExcluded)
{
if (nb_funct != F_LJ)
{
}
}
-static void set_excl_all(t_blocka* excl)
+static void set_excl_all(gmx::ListOfLists<int>* excl)
{
- int nat, i, j, k;
-
/* Get rid of the current exclusions and exclude all atom pairs */
- nat = excl->nr;
- excl->nra = nat * nat;
- srenew(excl->a, excl->nra);
- k = 0;
- for (i = 0; i < nat; i++)
+ const int numAtoms = excl->ssize();
+ std::vector<int> exclusionsForAtom(numAtoms);
+ for (int i = 0; i < numAtoms; i++)
{
- excl->index[i] = k;
- for (j = 0; j < nat; j++)
- {
- excl->a[k++] = j;
- }
+ exclusionsForAtom[i] = i;
+ }
+ excl->clear();
+ for (int i = 0; i < numAtoms; i++)
+ {
+ excl->pushBack(exclusionsForAtom);
}
- excl->index[nat] = k;
}
static void decouple_atoms(t_atoms* atoms,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/units.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
static int count_hydrogens(char*** atomname, int nra, gmx::ArrayRef<const int> a)
return nh;
}
-void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake)
+void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake, const gmx::MDLogger& logger)
{
char*** info = atoms->atomname;
real b_ij, b_jk;
{
switch (nshake)
{
- case eshHBONDS: printf("turning H bonds into constraints...\n"); break;
- case eshALLBONDS: printf("turning all bonds into constraints...\n"); break;
- case eshHANGLES: printf("turning all bonds and H angles into constraints...\n"); break;
- case eshALLANGLES: printf("turning all bonds and angles into constraints...\n"); break;
+ case eshHBONDS:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning H bonds into constraints...");
+ break;
+ case eshALLBONDS:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning all bonds into constraints...");
+ break;
+ case eshHANGLES:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning all bonds and H angles into constraints...");
+ break;
+ case eshALLANGLES:
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("turning all bonds and angles into constraints...");
+ break;
default: gmx_fatal(FARGS, "Invalid option for make_shake (%d)", nshake);
}
{
const InteractionOfType* ang = &(*parm);
#ifdef DEBUG
- printf("Angle: %d-%d-%d\n", ang->ai(), ang->aj(), ang->ak());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Angle: %d-%d-%d", ang->ai(),
+ ang->aj(), ang->ak());
#endif
int numhydrogens = count_hydrogens(info, 3, ang->atoms());
if ((nshake == eshALLANGLES) || (numhydrogens > 1)
}
/* apply law of cosines */
#ifdef DEBUG
- printf("p: %d, q: %d, dist: %12.5e\n", atomNumbers[0],
- atomNumbers[1], forceParm[0]);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("p: %d, q: %d, dist: %12.5e",
+ atomNumbers[0], atomNumbers[1],
+ forceParm[0]);
#endif
add_param_to_list(&(plist[F_CONSTR]),
InteractionOfType(atomNumbers, forceParm));
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_atoms;
struct InteractionsOfType;
-void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake);
+namespace gmx
+{
+class MDLogger;
+}
+
+void make_shake(gmx::ArrayRef<InteractionsOfType> plist, t_atoms* atoms, int nshake, const gmx::MDLogger& logger);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/strconvert.h"
static bool calc_vsite4fd_param(InteractionOfType* vsite,
gmx::ArrayRef<const VsiteBondedInteraction> bonds,
- gmx::ArrayRef<const VsiteBondedInteraction> angles)
+ gmx::ArrayRef<const VsiteBondedInteraction> angles,
+ const gmx::MDLogger& logger)
{
/* i = virtual site | ,k
* j = 1st bonded heavy atom | i-j-m
cosakm = (std::cos(akjm) - std::cos(aijk) * std::cos(aijm)) / (std::sin(aijk) * std::sin(aijm));
if (cosakl < -1 || cosakl > 1 || cosakm < -1 || cosakm > 1)
{
- fprintf(stderr, "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f\n",
- vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f",
+ vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
gmx_fatal(FARGS,
"invalid construction in calc_vsite4fd for atom %d: "
"cosakl=%f, cosakm=%f\n",
static bool calc_vsite4fdn_param(InteractionOfType* vsite,
gmx::ArrayRef<const VsiteBondedInteraction> bonds,
- gmx::ArrayRef<const VsiteBondedInteraction> angles)
+ gmx::ArrayRef<const VsiteBondedInteraction> angles,
+ const gmx::MDLogger& logger)
{
/* i = virtual site | ,k
* j = 1st bonded heavy atom | i-j-m
if (fabs(pl) < 1000 * GMX_REAL_MIN || fabs(pm) < 1000 * GMX_REAL_MIN)
{
- fprintf(stderr, "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f\n",
- vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "virtual site %d: angle ijk = %f, angle ijl = %f, angle ijm = %f",
+ vsite->ai() + 1, RAD2DEG * aijk, RAD2DEG * aijl, RAD2DEG * aijm);
gmx_fatal(FARGS,
"invalid construction in calc_vsite4fdn for atom %d: "
"pl=%f, pm=%f\n",
}
-int set_vsites(bool bVerbose, t_atoms* atoms, PreprocessingAtomTypes* atypes, gmx::ArrayRef<InteractionsOfType> plist)
+int set_vsites(bool bVerbose,
+ t_atoms* atoms,
+ PreprocessingAtomTypes* atypes,
+ gmx::ArrayRef<InteractionsOfType> plist,
+ const gmx::MDLogger& logger)
{
int ftype;
int nvsite, nrset;
{
if (bVerbose && bFirst)
{
- fprintf(stderr, "Calculating parameters for virtual sites\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Calculating parameters for virtual sites");
bFirst = FALSE;
}
break;
case F_VSITE4FD:
bERROR = calc_vsite4fd_param(¶m, allVsiteBondeds.bonds,
- allVsiteBondeds.angles);
+ allVsiteBondeds.angles, logger);
break;
case F_VSITE4FDN:
bERROR = calc_vsite4fdn_param(¶m, allVsiteBondeds.bonds,
- allVsiteBondeds.angles);
+ allVsiteBondeds.angles, logger);
break;
default:
gmx_fatal(FARGS,
return nvsite;
}
-void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt)
+void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt, const gmx::MDLogger& logger)
{
int ftype, i;
if (bVerbose)
{
- fprintf(stderr, "Setting particle type to V for virtual sites\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Setting particle type to V for virtual sites");
}
for (ftype = 0; ftype < F_NRE; ftype++)
{
if (debug && nrd)
{
- fprintf(stderr, "doing %d %s virtual sites\n", (nrd / (nra + 1)),
- interaction_function[ftype].longname);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("doing %d %s virtual sites", (nrd / (nra + 1)),
+ interaction_function[ftype].longname);
}
for (i = 0; (i < nrd);)
int interactionIndex_;
};
-static void check_vsite_constraints(gmx::ArrayRef<InteractionsOfType> plist, int cftype, const int vsite_type[])
+static void check_vsite_constraints(gmx::ArrayRef<InteractionsOfType> plist,
+ int cftype,
+ const int vsite_type[],
+ const gmx::MDLogger& logger)
{
int n = 0;
for (const auto& param : plist[cftype].interactionTypes)
int atom = atoms[k];
if (vsite_type[atom] != NOTSET)
{
- fprintf(stderr, "ERROR: Cannot have constraint (%d-%d) with virtual site (%d)\n",
- param.ai() + 1, param.aj() + 1, atom + 1);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "ERROR: Cannot have constraint (%d-%d) with virtual site (%d)",
+ param.ai() + 1, param.aj() + 1, atom + 1);
n++;
}
}
static void clean_vsite_bonds(gmx::ArrayRef<InteractionsOfType> plist,
gmx::ArrayRef<const VsiteAtomMapping> pindex,
int cftype,
- const int vsite_type[])
+ const int vsite_type[],
+ const gmx::MDLogger& logger)
{
int ftype, nOut;
int nconverted, nremoved;
if (nremoved)
{
- fprintf(stderr, "Removed %4d %15ss with virtual sites, %zu left\n", nremoved,
- interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Removed %4d %15ss with virtual sites, %zu left", nremoved,
+ interaction_function[cftype].longname, ps->size());
}
if (nconverted)
{
- fprintf(stderr, "Converted %4d %15ss with virtual sites to connections, %zu left\n",
- nconverted, interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Converted %4d %15ss with virtual sites to connections, %zu left",
+ nconverted, interaction_function[cftype].longname, ps->size());
}
if (nOut)
{
- fprintf(stderr,
- "Warning: removed %d %ss with vsite with %s construction\n"
- " This vsite construction does not guarantee constant "
- "bond-length\n"
- " If the constructions were generated by pdb2gmx ignore "
- "this warning\n",
- nOut, interaction_function[cftype].longname, interaction_function[F_VSITE3OUT].longname);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "Warning: removed %d %ss with vsite with %s construction\n"
+ " This vsite construction does not guarantee constant "
+ "bond-length\n"
+ " If the constructions were generated by pdb2gmx ignore "
+ "this warning",
+ nOut, interaction_function[cftype].longname,
+ interaction_function[F_VSITE3OUT].longname);
}
}
gmx::ArrayRef<VsiteAtomMapping> pindex,
int cftype,
const int vsite_type[],
- gmx::ArrayRef<const Atom2VsiteConnection> at2vc)
+ gmx::ArrayRef<const Atom2VsiteConnection> at2vc,
+ const gmx::MDLogger& logger)
{
int atom, at1, at2;
InteractionsOfType* ps;
if (oldSize != gmx::ssize(*ps))
{
- fprintf(stderr, "Removed %4zu %15ss with virtual sites, %zu left\n", oldSize - ps->size(),
- interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Removed %4zu %15ss with virtual sites, %zu left",
+ oldSize - ps->size(), interaction_function[cftype].longname,
+ ps->size());
}
}
static void clean_vsite_dihs(gmx::ArrayRef<InteractionsOfType> plist,
gmx::ArrayRef<const VsiteAtomMapping> pindex,
int cftype,
- const int vsite_type[])
+ const int vsite_type[],
+ const gmx::MDLogger& logger)
{
InteractionsOfType* ps;
if (oldSize != gmx::ssize(*ps))
{
- fprintf(stderr, "Removed %4zu %15ss with virtual sites, %zu left\n", oldSize - ps->size(),
- interaction_function[cftype].longname, ps->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Removed %4zu %15ss with virtual sites, %zu left",
+ oldSize - ps->size(), interaction_function[cftype].longname,
+ ps->size());
}
}
// TODO use gmx::compat::optional for pindex.
-void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> plist, int natoms, bool bRmVSiteBds)
+void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> plist,
+ int natoms,
+ bool bRmVSiteBds,
+ const gmx::MDLogger& logger)
{
int nvsite, vsite;
int* vsite_type;
/* the rest only if we have virtual sites: */
if (nvsite)
{
- fprintf(stderr, "Cleaning up constraints %swith virtual sites\n",
- bRmVSiteBds ? "and constant bonded interactions " : "");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Cleaning up constraints %swith virtual sites",
+ bRmVSiteBds ? "and constant bonded interactions " : "");
/* Make a reverse list to avoid ninteractions^2 operations */
at2vc = make_at2vsitecon(natoms, plist);
{
if (interaction_function[ftype].flags & (IF_BTYPE | IF_CONSTRAINT))
{
- clean_vsite_bonds(plist, pindex, ftype, vsite_type);
+ clean_vsite_bonds(plist, pindex, ftype, vsite_type, logger);
}
else if (interaction_function[ftype].flags & IF_ATYPE)
{
- clean_vsite_angles(plist, pindex, ftype, vsite_type, at2vc);
+ clean_vsite_angles(plist, pindex, ftype, vsite_type, at2vc, logger);
}
else if ((ftype == F_PDIHS) || (ftype == F_IDIHS))
{
- clean_vsite_dihs(plist, pindex, ftype, vsite_type);
+ clean_vsite_dihs(plist, pindex, ftype, vsite_type, logger);
}
}
}
{
if (interaction_function[ftype].flags & IF_CONSTRAINT)
{
- check_vsite_constraints(plist, ftype, vsite_type);
+ check_vsite_constraints(plist, ftype, vsite_type, logger);
}
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_atoms;
struct InteractionsOfType;
+namespace gmx
+{
+class MDLogger;
+}
+
int set_vsites(bool bVerbose,
t_atoms* atoms,
PreprocessingAtomTypes* atype,
- gmx::ArrayRef<InteractionsOfType> plist);
+ gmx::ArrayRef<InteractionsOfType> plist,
+ const gmx::MDLogger& logger);
/* set parameters for virtual sites, return number of virtual sites */
-void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt);
+void set_vsites_ptype(bool bVerbose, gmx_moltype_t* molt, const gmx::MDLogger& logger);
/* set ptype to VSite for virtual sites */
/*! \brief Clean up the bonded interactions
*
* Throw away all obsolete bonds, angles and dihedrals.
* Throw away all constraints. */
-void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> ps, int natoms, bool bRmVSiteBds);
+void clean_vsite_bondeds(gmx::ArrayRef<InteractionsOfType> ps,
+ int natoms,
+ bool bRmVSiteBds,
+ const gmx::MDLogger& logger);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/arraysize.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/filestream.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/logger.h"
+#include "gromacs/utility/loggerbuilder.h"
#include "gromacs/utility/smalloc.h"
#include "hackblock.h"
std::array<real, MAXFORCEPARAM> forceParam = { 0.0 };
if (bPBC)
{
- set_pbc(&pbc, -1, box);
+ set_pbc(&pbc, PbcType::Unset, box);
}
for (i = 0; (i < atoms->nr); i++)
{
- if ((i % 10) == 0)
- {
- fprintf(stderr, "\ratom %d", i);
- fflush(stderr);
- }
for (j = i + 1; (j < atoms->nr); j++)
{
if (bPBC)
}
}
}
- fprintf(stderr, "\ratom %d\n", i);
- fflush(stderr);
}
static int* set_cgnr(t_atoms* atoms, bool bUsePDBcharge, real* qtot, real* mtot)
InteractionsOfType* bonds,
int* nbonds,
int nnm,
- t_nm2type nm2t[])
+ t_nm2type nm2t[],
+ const gmx::MDLogger& logger)
{
int nresolved;
gmx_fatal(FARGS, "Could only find a forcefield type for %d out of %d atoms", nresolved, atoms->nr);
}
- fprintf(stderr, "There are %zu different atom types in your sample\n", atypes->size());
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("There are %zu different atom types in your sample", atypes->size());
}
static void lo_set_force_const(InteractionsOfType* plist, real c[], int nrfp, bool bRound, bool bDih, bool bParam)
if (bPBC)
{
- set_pbc(&pbc, epbcXYZ, box);
+ set_pbc(&pbc, PbcType::Xyz, box);
}
for (auto& angle : ang->interactionTypes)
{
int bts[] = { 1, 1, 1, 2 };
matrix box; /* box length matrix */
int natoms; /* number of atoms in one molecule */
- int epbc;
+ PbcType pbcType;
bool bRTP, bTOP, bOPLS;
t_symtab symtab;
real qtot, mtot;
gmx_fatal(FARGS, "Specify at least one output file");
}
+ gmx::LoggerBuilder builder;
+ builder.addTargetStream(gmx::MDLogger::LogLevel::Info, &gmx::TextOutputFile::standardOutput());
+ builder.addTargetStream(gmx::MDLogger::LogLevel::Warning, &gmx::TextOutputFile::standardError());
+ gmx::LoggerOwner logOwner(builder.build());
+ gmx::MDLogger logger(logOwner.logger());
+
+
/* Force field selection, interactive or direct */
choose_ff(strcmp(ff, "select") == 0 ? nullptr : ff, forcefield, sizeof(forcefield), ffdir,
- sizeof(ffdir));
+ sizeof(ffdir), logger);
bOPLS = (strcmp(forcefield, "oplsaa") == 0);
/* Read coordinates */
t_topology* top;
snew(top, 1);
- read_tps_conf(opt2fn("-f", NFILE, fnm), top, &epbc, &x, nullptr, box, FALSE);
+ read_tps_conf(opt2fn("-f", NFILE, fnm), top, &pbcType, &x, nullptr, box, FALSE);
t_atoms* atoms = &top->atoms;
natoms = atoms->nr;
if (atoms->pdbinfo == nullptr)
}
else
{
- printf("There are %d name to type translations in file %s\n", nnm, n2t);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("There are %d name to type translations in file %s", nnm, n2t);
}
if (debug)
{
dump_nm2type(debug, nnm, nm2t);
}
- printf("Generating bonds from distances...\n");
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Generating bonds from distances...");
snew(nbonds, atoms->nr);
mk_bonds(nnm, nm2t, atoms, x, &(plist[F_BONDS]), nbonds, bPBC, box);
open_symtab(&symtab);
PreprocessingAtomTypes atypes;
- set_atom_type(&atypes, &symtab, atoms, &(plist[F_BONDS]), nbonds, nnm, nm2t);
+ set_atom_type(&atypes, &symtab, atoms, &(plist[F_BONDS]), nbonds, nnm, nm2t, logger);
/* Make Angles and Dihedrals */
snew(excls, atoms->nr);
- printf("Generating angles and dihedrals from bonds...\n");
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted("Generating angles and dihedrals from bonds...");
gen_pad(atoms, gmx::arrayRefFromArray(&rtp_header_settings, 1), plist, excls, {}, TRUE);
if (!bPairs)
{
plist[F_LJ14].interactionTypes.clear();
}
- fprintf(stderr,
- "There are %4zu %s dihedrals, %4zu impropers, %4zu angles\n"
- " %4zu pairs, %4zu bonds and %4d atoms\n",
- plist[F_PDIHS].size(), bOPLS ? "Ryckaert-Bellemans" : "proper", plist[F_IDIHS].size(),
- plist[F_ANGLES].size(), plist[F_LJ14].size(), plist[F_BONDS].size(), atoms->nr);
+ GMX_LOG(logger.info)
+ .asParagraph()
+ .appendTextFormatted(
+ "There are %4zu %s dihedrals, %4zu impropers, %4zu angles\n"
+ " %4zu pairs, %4zu bonds and %4d atoms\n",
+ plist[F_PDIHS].size(), bOPLS ? "Ryckaert-Bellemans" : "proper", plist[F_IDIHS].size(),
+ plist[F_ANGLES].size(), plist[F_LJ14].size(), plist[F_BONDS].size(), atoms->nr);
calc_angles_dihs(&plist[F_ANGLES], &plist[F_PDIHS], x, bPBC, box);
set_force_const(plist, kb, kt, kp, bRound, bParam);
cgnr = set_cgnr(atoms, bUsePDBcharge, &qtot, &mtot);
- printf("Total charge is %g, total mass is %g\n", qtot, mtot);
+ GMX_LOG(logger.info).asParagraph().appendTextFormatted("Total charge is %g, total mass is %g", qtot, mtot);
if (bOPLS)
{
bts[2] = 3;
}
close_symtab(&symtab);
- printf("\nWARNING: topologies generated by %s can not be trusted at face value.\n",
- output_env_get_program_display_name(oenv));
- printf(" Please verify atomtypes and charges by comparison to other\n");
- printf(" topologies.\n");
+ GMX_LOG(logger.warning)
+ .asParagraph()
+ .appendTextFormatted(
+ "Topologies generated by %s can not be trusted at face value. "
+ "Please verify atomtypes and charges by comparison to other topologies.",
+ output_env_get_program_display_name(oenv));
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#endif /* CHECK_CUDA_ERRORS */
-/*! \brief CUDA device information.
- *
- * The CUDA device information is queried and set at detection and contains
- * both information about the device/hardware returned by the runtime as well
- * as additional data like support status.
- */
-struct gmx_device_info_t
-{
- int id; /* id of the CUDA device */
- cudaDeviceProp prop; /* CUDA device properties */
- int stat; /* result of the device check */
-};
-
/*! Launches synchronous or asynchronous device to host memory copy.
*
* The copy is launched in stream s or if not specified, in stream 0.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief
* Clears the device buffer asynchronously.
*
- * \tparam ValueType Raw value type of the \p buffer.
- * \param[in,out] buffer Pointer to the device-side buffer
- * \param[in] startingOffset Offset (in values) at the device-side buffer to start clearing
- * at. \param[in] numValues Number of values to clear. \param[in] stream GPU stream.
+ * \tparam ValueType Raw value type of the \p buffer.
+ * \param[in,out] buffer Pointer to the device-side buffer
+ * \param[in] startingOffset Offset (in values) at the device-side buffer to start clearing at.
+ * \param[in] numValues Number of values to clear.
+ * \param[in] stream GPU stream.
*/
template<typename ValueType>
void clearDeviceBufferAsync(DeviceBuffer<ValueType>* buffer, size_t startingOffset, size_t numValues, CommandStream stream)
GMX_RELEASE_ASSERT(stat == cudaSuccess, "Couldn't clear the device buffer");
}
+/*! \brief Check the validity of the device buffer.
+ *
+ * Checks if the buffer is not nullptr.
+ *
+ * \todo Add checks on the buffer size when it will be possible.
+ *
+ * \param[in] buffer Device buffer to be checked.
+ * \param[in] requiredSize Number of elements that the buffer will have to accommodate.
+ *
+ * \returns Whether the device buffer can be set.
+ */
+template<typename T>
+static bool checkDeviceBuffer(DeviceBuffer<T> buffer, gmx_unused int requiredSize)
+{
+ GMX_ASSERT(buffer != nullptr, "The device pointer is nullptr");
+ return buffer != nullptr;
+}
+
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief
* Clears the device buffer asynchronously.
*
- * \tparam ValueType Raw value type of the \p buffer.
- * \param[in,out] buffer Pointer to the device-side buffer
- * \param[in] startingOffset Offset (in values) at the device-side buffer to start clearing
- * at. \param[in] numValues Number of values to clear. \param[in] stream GPU stream.
+ * \tparam ValueType Raw value type of the \p buffer.
+ * \param[in,out] buffer Pointer to the device-side buffer
+ * \param[in] startingOffset Offset (in values) at the device-side buffer to start clearing at.
+ * \param[in] numValues Number of values to clear.
+ * \param[in] stream GPU stream.
*/
template<typename ValueType>
void clearDeviceBufferAsync(DeviceBuffer<ValueType>* buffer, size_t startingOffset, size_t numValues, CommandStream stream)
GMX_ASSERT(buffer, "needs a buffer pointer");
const size_t offset = startingOffset * sizeof(ValueType);
const size_t bytes = numValues * sizeof(ValueType);
- const ValueType pattern = 0;
+ const int pattern = 0;
const cl_uint numWaitEvents = 0;
const cl_event* waitEvents = nullptr;
cl_event commandEvent;
.c_str());
}
+/*! \brief Check the validity of the device buffer.
+ *
+ * Checks if the buffer is not nullptr and if its allocation is big enough.
+ *
+ * \param[in] buffer Device buffer to be checked.
+ * \param[in] requiredSize Number of elements that the buffer will have to accommodate.
+ *
+ * \returns Whether the device buffer can be set.
+ */
+template<typename T>
+static bool checkDeviceBuffer(DeviceBuffer<T> buffer, int requiredSize)
+{
+ size_t size;
+ int retval = clGetMemObjectInfo(buffer, CL_MEM_SIZE, sizeof(size), &size, nullptr);
+ GMX_ASSERT(retval == CL_SUCCESS,
+ gmx::formatString("clGetMemObjectInfo failed with error code #%d", retval).c_str());
+ GMX_ASSERT(static_cast<int>(size) >= requiredSize,
+ "Number of atoms in device buffer is smaller then required size.");
+ return retval == CL_SUCCESS && static_cast<int>(size) >= requiredSize;
+}
+
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void free_gpu_info(const gmx_gpu_info_t* gpu_info)
{
- sfree(static_cast<void*>(gpu_info->gpu_dev)); // circumvent is_pod check in sfree
+ sfree(static_cast<void*>(gpu_info->deviceInfo)); // circumvent is_pod check in sfree
}
std::vector<int> getCompatibleGpus(const gmx_gpu_info_t& gpu_info)
compatibleGpus.reserve(gpu_info.n_dev);
for (int i = 0; i < gpu_info.n_dev; i++)
{
- assert(gpu_info.gpu_dev);
+ assert(gpu_info.deviceInfo);
if (gpu_info_get_stat(gpu_info, i) == egpuCompatible)
{
compatibleGpus.push_back(i);
return 0;
}
-void init_gpu(const gmx_device_info_t* deviceInfo)
+void init_gpu(const DeviceInformation* deviceInfo)
{
cudaError_t stat;
}
}
-void free_gpu(const gmx_device_info_t* deviceInfo)
+void free_gpu(const DeviceInformation* deviceInfo)
{
// One should only attempt to clear the device context when
// it has been used, but currently the only way to know that a GPU
}
}
-gmx_device_info_t* getDeviceInfo(const gmx_gpu_info_t& gpu_info, int deviceId)
+DeviceInformation* getDeviceInfo(const gmx_gpu_info_t& gpu_info, int deviceId)
{
if (deviceId < 0 || deviceId >= gpu_info.n_dev)
{
gmx_incons("Invalid GPU deviceId requested");
}
- return &gpu_info.gpu_dev[deviceId];
+ return &gpu_info.deviceInfo[deviceId];
}
/*! \brief Returns true if the gpu characterized by the device properties is
// We expect to start device support/sanity checks with a clean runtime error state
gmx::ensureNoPendingCudaError("");
- gmx_device_info_t* devs;
+ DeviceInformation* devs;
snew(devs, ndev);
for (int i = 0; i < ndev; i++)
{
cudaGetErrorName(stat), cudaGetErrorString(stat))
.c_str());
- gpu_info->n_dev = ndev;
- gpu_info->gpu_dev = devs;
+ gpu_info->n_dev = ndev;
+ gpu_info->deviceInfo = devs;
}
void get_gpu_device_info_string(char* s, const gmx_gpu_info_t& gpu_info, int index)
return;
}
- gmx_device_info_t* dinfo = &gpu_info.gpu_dev[index];
+ DeviceInformation* dinfo = &gpu_info.deviceInfo[index];
bool bGpuExists = (dinfo->stat != egpuNonexistent && dinfo->stat != egpuInsane);
size_t sizeof_gpu_dev_info(void)
{
- return sizeof(gmx_device_info_t);
+ return sizeof(DeviceInformation);
}
void startGpuProfiler(void)
int gpu_info_get_stat(const gmx_gpu_info_t& info, int index)
{
- return info.gpu_dev[index].stat;
+ return info.deviceInfo[index].stat;
}
/*! \brief Check status returned from peer access CUDA call, and error out or warn appropriately
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2010, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/gpu_macros.h"
#include "gromacs/utility/basedefinitions.h"
-struct gmx_device_info_t;
+struct DeviceInformation;
struct gmx_gpu_info_t;
namespace gmx
* Will detect every GPU supported by the device driver in use.
* Must only be called if canPerformGpuDetection() has returned true.
* This routine also checks for the compatibility of each and fill the
- * gpu_info->gpu_dev array with the required information on each the
+ * gpu_info->deviceInfo array with the required information on each the
* device: ID, device properties, status.
*
* Note that this function leaves the GPU runtime API error state clean;
* initialization.
*/
GPU_FUNC_QUALIFIER
-void init_gpu(const gmx_device_info_t* GPU_FUNC_ARGUMENT(deviceInfo)) GPU_FUNC_TERM;
+void init_gpu(const DeviceInformation* GPU_FUNC_ARGUMENT(deviceInfo)) GPU_FUNC_TERM;
/*! \brief Frees up the CUDA GPU used by the active context at the time of calling.
*
* \returns true if no error occurs during the freeing.
*/
CUDA_FUNC_QUALIFIER
-void free_gpu(const gmx_device_info_t* CUDA_FUNC_ARGUMENT(deviceInfo)) CUDA_FUNC_TERM;
+void free_gpu(const DeviceInformation* CUDA_FUNC_ARGUMENT(deviceInfo)) CUDA_FUNC_TERM;
/*! \brief Return a pointer to the device info for \c deviceId
*
* \returns Pointer to the device info for \c deviceId.
*/
GPU_FUNC_QUALIFIER
-gmx_device_info_t* getDeviceInfo(const gmx_gpu_info_t& GPU_FUNC_ARGUMENT(gpu_info),
+DeviceInformation* getDeviceInfo(const gmx_gpu_info_t& GPU_FUNC_ARGUMENT(gpu_info),
int GPU_FUNC_ARGUMENT(deviceId)) GPU_FUNC_TERM_WITH_RETURN(nullptr);
/*! \brief Returns the device ID of the CUDA GPU currently in use.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
/*!
- * \brief Checks that device \c devInfo is sane (ie can run a kernel).
+ * \brief Checks that device \c deviceInfo is sane (ie can run a kernel).
*
* Compiles and runs a dummy kernel to determine whether the given
* OpenCL device functions properly.
*
*
- * \param[in] devInfo The device info pointer.
+ * \param[in] deviceInfo The device info pointer.
* \param[out] errorMessage An error message related to a failing OpenCL API call.
* \throws std::bad_alloc When out of memory.
* \returns Whether the device passed sanity checks
*/
-static bool isDeviceSane(const gmx_device_info_t* devInfo, std::string* errorMessage)
+static bool isDeviceSane(const DeviceInformation* deviceInfo, std::string* errorMessage)
{
cl_context_properties properties[] = {
- CL_CONTEXT_PLATFORM, reinterpret_cast<cl_context_properties>(devInfo->ocl_gpu_id.ocl_platform_id), 0
+ CL_CONTEXT_PLATFORM, reinterpret_cast<cl_context_properties>(deviceInfo->oclPlatformId), 0
};
// uncrustify spacing
cl_int status;
- auto deviceId = devInfo->ocl_gpu_id.ocl_device_id;
+ auto deviceId = deviceInfo->oclDeviceId;
ClContext context(clCreateContext(properties, 1, &deviceId, nullptr, nullptr, &status));
if (status != CL_SUCCESS)
{
}
/*!
- * \brief Checks that device \c devInfo is compatible with GROMACS.
+ * \brief Checks that device \c deviceInfo is compatible with GROMACS.
*
* Vendor and OpenCL version support checks are executed an the result
* of these returned.
*
- * \param[in] devInfo The device info pointer.
- * \returns The result of the compatibility checks.
+ * \param[in] deviceInfo The device info pointer.
+ * \returns The result of the compatibility checks.
*/
-static int isDeviceSupported(const gmx_device_info_t* devInfo)
+static int isDeviceSupported(const DeviceInformation* deviceInfo)
{
if (getenv("GMX_OCL_DISABLE_COMPATIBILITY_CHECK") != nullptr)
{
// the device which has the following format:
// OpenCL<space><major_version.minor_version><space><vendor-specific information>
unsigned int deviceVersionMinor, deviceVersionMajor;
- const int valuesScanned = std::sscanf(devInfo->device_version, "OpenCL %u.%u",
+ const int valuesScanned = std::sscanf(deviceInfo->device_version, "OpenCL %u.%u",
&deviceVersionMajor, &deviceVersionMinor);
const bool versionLargeEnough =
((valuesScanned == 2)
}
/* Only AMD, Intel, and NVIDIA GPUs are supported for now */
- switch (devInfo->vendor_e)
+ switch (deviceInfo->deviceVendor)
{
- case OCL_VENDOR_NVIDIA: return egpuCompatible;
- case OCL_VENDOR_AMD:
+ case DeviceVendor::Nvidia: return egpuCompatible;
+ case DeviceVendor::Amd:
return runningOnCompatibleOSForAmd() ? egpuCompatible : egpuIncompatible;
- case OCL_VENDOR_INTEL:
+ case DeviceVendor::Intel:
return GMX_OPENCL_NB_CLUSTER_SIZE == 4 ? egpuCompatible : egpuIncompatibleClusterSize;
default: return egpuIncompatible;
}
* \returns An e_gpu_detect_res_t to indicate how the GPU coped with
* the sanity and compatibility check.
*/
-static int checkGpu(size_t deviceId, const gmx_device_info_t* deviceInfo)
+static int checkGpu(size_t deviceId, const DeviceInformation* deviceInfo)
{
int supportStatus = isDeviceSupported(deviceInfo);
} // namespace gmx
-/*! \brief Returns an ocl_vendor_id_t value corresponding to the input OpenCL vendor name.
+/*! \brief Returns an DeviceVendor value corresponding to the input OpenCL vendor name.
*
- * \param[in] vendor_name String with OpenCL vendor name.
- * \returns ocl_vendor_id_t value for the input vendor_name
+ * \param[in] vendorName String with OpenCL vendor name.
+ * \returns DeviceVendor value for the input vendor name
*/
-static ocl_vendor_id_t get_vendor_id(char* vendor_name)
+static DeviceVendor getDeviceVendor(const char* vendorName)
{
- if (vendor_name)
+ if (vendorName)
{
- if (strstr(vendor_name, "NVIDIA"))
+ if (strstr(vendorName, "NVIDIA"))
{
- return OCL_VENDOR_NVIDIA;
+ return DeviceVendor::Nvidia;
}
- else if (strstr(vendor_name, "AMD") || strstr(vendor_name, "Advanced Micro Devices"))
+ else if (strstr(vendorName, "AMD") || strstr(vendorName, "Advanced Micro Devices"))
{
- return OCL_VENDOR_AMD;
+ return DeviceVendor::Amd;
}
- else if (strstr(vendor_name, "Intel"))
+ else if (strstr(vendorName, "Intel"))
{
- return OCL_VENDOR_INTEL;
+ return DeviceVendor::Intel;
}
}
- return OCL_VENDOR_UNKNOWN;
+ return DeviceVendor::Unknown;
}
bool isGpuDetectionFunctional(std::string* errorMessage)
break;
}
- snew(gpu_info->gpu_dev, gpu_info->n_dev);
+ snew(gpu_info->deviceInfo, gpu_info->n_dev);
{
int device_index;
for (unsigned int j = 0; j < ocl_device_count; j++)
{
- gpu_info->gpu_dev[device_index].ocl_gpu_id.ocl_platform_id = ocl_platform_ids[i];
- gpu_info->gpu_dev[device_index].ocl_gpu_id.ocl_device_id = ocl_device_ids[j];
+ gpu_info->deviceInfo[device_index].oclPlatformId = ocl_platform_ids[i];
+ gpu_info->deviceInfo[device_index].oclDeviceId = ocl_device_ids[j];
- gpu_info->gpu_dev[device_index].device_name[0] = 0;
+ gpu_info->deviceInfo[device_index].device_name[0] = 0;
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_NAME,
- sizeof(gpu_info->gpu_dev[device_index].device_name),
- gpu_info->gpu_dev[device_index].device_name, nullptr);
+ sizeof(gpu_info->deviceInfo[device_index].device_name),
+ gpu_info->deviceInfo[device_index].device_name, nullptr);
- gpu_info->gpu_dev[device_index].device_version[0] = 0;
+ gpu_info->deviceInfo[device_index].device_version[0] = 0;
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_VERSION,
- sizeof(gpu_info->gpu_dev[device_index].device_version),
- gpu_info->gpu_dev[device_index].device_version, nullptr);
+ sizeof(gpu_info->deviceInfo[device_index].device_version),
+ gpu_info->deviceInfo[device_index].device_version, nullptr);
- gpu_info->gpu_dev[device_index].device_vendor[0] = 0;
+ gpu_info->deviceInfo[device_index].vendorName[0] = 0;
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_VENDOR,
- sizeof(gpu_info->gpu_dev[device_index].device_vendor),
- gpu_info->gpu_dev[device_index].device_vendor, nullptr);
+ sizeof(gpu_info->deviceInfo[device_index].vendorName),
+ gpu_info->deviceInfo[device_index].vendorName, nullptr);
- gpu_info->gpu_dev[device_index].compute_units = 0;
+ gpu_info->deviceInfo[device_index].compute_units = 0;
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_MAX_COMPUTE_UNITS,
- sizeof(gpu_info->gpu_dev[device_index].compute_units),
- &(gpu_info->gpu_dev[device_index].compute_units), nullptr);
+ sizeof(gpu_info->deviceInfo[device_index].compute_units),
+ &(gpu_info->deviceInfo[device_index].compute_units), nullptr);
- gpu_info->gpu_dev[device_index].adress_bits = 0;
+ gpu_info->deviceInfo[device_index].adress_bits = 0;
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_ADDRESS_BITS,
- sizeof(gpu_info->gpu_dev[device_index].adress_bits),
- &(gpu_info->gpu_dev[device_index].adress_bits), nullptr);
+ sizeof(gpu_info->deviceInfo[device_index].adress_bits),
+ &(gpu_info->deviceInfo[device_index].adress_bits), nullptr);
- gpu_info->gpu_dev[device_index].vendor_e =
- get_vendor_id(gpu_info->gpu_dev[device_index].device_vendor);
+ gpu_info->deviceInfo[device_index].deviceVendor =
+ getDeviceVendor(gpu_info->deviceInfo[device_index].vendorName);
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_MAX_WORK_ITEM_SIZES, 3 * sizeof(size_t),
- &gpu_info->gpu_dev[device_index].maxWorkItemSizes, nullptr);
+ &gpu_info->deviceInfo[device_index].maxWorkItemSizes, nullptr);
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t),
- &gpu_info->gpu_dev[device_index].maxWorkGroupSize, nullptr);
+ &gpu_info->deviceInfo[device_index].maxWorkGroupSize, nullptr);
- gpu_info->gpu_dev[device_index].stat =
- gmx::checkGpu(device_index, gpu_info->gpu_dev + device_index);
+ gpu_info->deviceInfo[device_index].stat =
+ gmx::checkGpu(device_index, gpu_info->deviceInfo + device_index);
- if (egpuCompatible == gpu_info->gpu_dev[device_index].stat)
+ if (egpuCompatible == gpu_info->deviceInfo[device_index].stat)
{
gpu_info->n_dev_compatible++;
}
int last = -1;
for (int i = 0; i < gpu_info->n_dev; i++)
{
- if (OCL_VENDOR_AMD == gpu_info->gpu_dev[i].vendor_e)
+ if (gpu_info->deviceInfo[i].deviceVendor == DeviceVendor::Amd)
{
last++;
if (last < i)
{
- gmx_device_info_t ocl_gpu_info;
- ocl_gpu_info = gpu_info->gpu_dev[i];
- gpu_info->gpu_dev[i] = gpu_info->gpu_dev[last];
- gpu_info->gpu_dev[last] = ocl_gpu_info;
+ std::swap(gpu_info->deviceInfo[i], gpu_info->deviceInfo[last]);
}
}
}
{
for (int i = 0; i < gpu_info->n_dev; i++)
{
- if (OCL_VENDOR_NVIDIA == gpu_info->gpu_dev[i].vendor_e)
+ if (gpu_info->deviceInfo[i].deviceVendor == DeviceVendor::Nvidia)
{
last++;
if (last < i)
{
- gmx_device_info_t ocl_gpu_info;
- ocl_gpu_info = gpu_info->gpu_dev[i];
- gpu_info->gpu_dev[i] = gpu_info->gpu_dev[last];
- gpu_info->gpu_dev[last] = ocl_gpu_info;
+ std::swap(gpu_info->deviceInfo[i], gpu_info->deviceInfo[last]);
}
}
}
return;
}
- gmx_device_info_t* dinfo = &gpu_info.gpu_dev[index];
+ DeviceInformation* dinfo = &gpu_info.deviceInfo[index];
bool bGpuExists = (dinfo->stat != egpuNonexistent && dinfo->stat != egpuInsane);
else
{
sprintf(s, "#%d: name: %s, vendor: %s, device version: %s, stat: %s", index, dinfo->device_name,
- dinfo->device_vendor, dinfo->device_version, gpu_detect_res_str[dinfo->stat]);
+ dinfo->vendorName, dinfo->device_version, gpu_detect_res_str[dinfo->stat]);
}
}
-void init_gpu(const gmx_device_info_t* deviceInfo)
+void init_gpu(const DeviceInformation* deviceInfo)
{
assert(deviceInfo);
// the cache does not always get regenerated when the source code changes,
// e.g. if the path to the kernel sources remains the same
- if (deviceInfo->vendor_e == OCL_VENDOR_NVIDIA)
+ if (deviceInfo->deviceVendor == DeviceVendor::Nvidia)
{
// Ignore return values, failing to set the variable does not mean
// that something will go wrong later.
}
}
-gmx_device_info_t* getDeviceInfo(const gmx_gpu_info_t& gpu_info, int deviceId)
+DeviceInformation* getDeviceInfo(const gmx_gpu_info_t& gpu_info, int deviceId)
{
if (deviceId < 0 || deviceId >= gpu_info.n_dev)
{
gmx_incons("Invalid GPU deviceId requested");
}
- return &gpu_info.gpu_dev[deviceId];
+ return &gpu_info.deviceInfo[deviceId];
}
size_t sizeof_gpu_dev_info()
{
- return sizeof(gmx_device_info_t);
+ return sizeof(DeviceInformation);
}
int gpu_info_get_stat(const gmx_gpu_info_t& info, int index)
{
- return info.gpu_dev[index].stat;
+ return info.deviceInfo[index].stat;
}
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
- * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
- * and including many others, as listed in the AUTHORS file in the
- * top-level source directory and at http://www.gromacs.org.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-#ifndef GMX_GPU_UTILS_GPU_VEC_CUH
-#define GMX_GPU_UTILS_GPU_VEC_CUH
-
-/* Note that because of the duplicate of ivec, this header (or an
- * OpenCL port of it) cannot be included in a translation unit that
- * also includes the normal vectypes.h */
-#define XX 0 /* Defines for indexing in */
-#define YY 1 /* vectors */
-#define ZZ 2
-#define DIM 3 /* Dimension of vectors */
-typedef int ivec[DIM];
-typedef float fvec[DIM];
-
-/* maths operations */
-/* imported from cpu versions in math/vec.h */
-__forceinline__ __device__ void svmul_gpu(float a, const fvec v1, fvec v2)
-{
- v2[XX] = a * v1[XX];
- v2[YY] = a * v1[YY];
- v2[ZZ] = a * v1[ZZ];
-}
-
-
-__forceinline__ __device__ void fvec_add_gpu(const fvec a, const fvec b, fvec c)
-{
- float x, y, z;
-
- x = a[XX] + b[XX];
- y = a[YY] + b[YY];
- z = a[ZZ] + b[ZZ];
-
- c[XX] = x;
- c[YY] = y;
- c[ZZ] = z;
-}
-
-__forceinline__ __device__ void ivec_add_gpu(const ivec a, const ivec b, ivec c)
-{
- int x, y, z;
-
- x = a[XX] + b[XX];
- y = a[YY] + b[YY];
- z = a[ZZ] + b[ZZ];
-
- c[XX] = x;
- c[YY] = y;
- c[ZZ] = z;
-}
-
-__forceinline__ __device__ void fvec_inc_atomic(fvec a, const fvec b)
-{
- atomicAdd(&a[XX], b[XX]);
- atomicAdd(&a[YY], b[YY]);
- atomicAdd(&a[ZZ], b[ZZ]);
-}
-
-__forceinline__ __device__ void fvec_inc_gpu(fvec a, const fvec b)
-{
- float x, y, z;
-
- x = a[XX] + b[XX];
- y = a[YY] + b[YY];
- z = a[ZZ] + b[ZZ];
-
- a[XX] = x;
- a[YY] = y;
- a[ZZ] = z;
-}
-
-__forceinline__ __device__ void fvec_dec_atomic(fvec a, const fvec b)
-{
- atomicAdd(&a[XX], -1.0f * b[XX]);
- atomicAdd(&a[YY], -1.0f * b[YY]);
- atomicAdd(&a[ZZ], -1.0f * b[ZZ]);
-}
-
-__forceinline__ __device__ void fvec_dec_gpu(fvec a, const fvec b)
-{
- float x, y, z;
-
- x = a[XX] - b[XX];
- y = a[YY] - b[YY];
- z = a[ZZ] - b[ZZ];
-
- a[XX] = x;
- a[YY] = y;
- a[ZZ] = z;
-}
-
-__forceinline__ __device__ void cprod_gpu(const fvec a, const fvec b, fvec c)
-{
- c[XX] = a[YY] * b[ZZ] - a[ZZ] * b[YY];
- c[YY] = a[ZZ] * b[XX] - a[XX] * b[ZZ];
- c[ZZ] = a[XX] * b[YY] - a[YY] * b[XX];
-}
-
-__forceinline__ __device__ float iprod_gpu(const fvec a, const fvec b)
-{
- return (a[XX] * b[XX] + a[YY] * b[YY] + a[ZZ] * b[ZZ]);
-}
-
-__forceinline__ __device__ float norm_gpu(const fvec a)
-{
- return sqrt(iprod_gpu(a, a));
-}
-
-__forceinline__ __device__ float gmx_angle_gpu(const fvec a, const fvec b)
-{
- fvec w;
- float wlen, s;
-
- cprod_gpu(a, b, w);
-
- wlen = norm_gpu(w);
- s = iprod_gpu(a, b);
-
- return atan2f(wlen, s); // requires float
-}
-
-__forceinline__ __device__ void clear_ivec_gpu(ivec a)
-{
- a[XX] = 0;
- a[YY] = 0;
- a[ZZ] = 0;
-}
-__forceinline__ __device__ void fvec_sub_gpu(const fvec a, const fvec b, fvec c)
-{
- float x, y, z;
-
- x = a[XX] - b[XX];
- y = a[YY] - b[YY];
- z = a[ZZ] - b[ZZ];
-
- c[XX] = x;
- c[YY] = y;
- c[ZZ] = z;
-}
-
-__forceinline__ __device__ float norm2_gpu(const fvec a)
-{
- return a[XX] * a[XX] + a[YY] * a[YY] + a[ZZ] * a[ZZ];
-}
-
-__forceinline__ __device__ void copy_fvec_gpu(const fvec a, fvec b)
-{
- b[XX] = a[XX];
- b[YY] = a[YY];
- b[ZZ] = a[ZZ];
-}
-
-__forceinline__ __device__ void copy_ivec_gpu(const ivec a, ivec b)
-{
- b[XX] = a[XX];
- b[YY] = a[YY];
- b[ZZ] = a[ZZ];
-}
-
-__forceinline__ __device__ float cos_angle_gpu(const fvec a, const fvec b)
-{
- /*
- * ax*bx + ay*by + az*bz
- * cos-vec (a,b) = ---------------------
- * ||a|| * ||b||
- */
- float cosval;
- int m;
- float aa, bb, ip, ipa, ipb, ipab;
-
- ip = ipa = ipb = 0.0f;
- for (m = 0; (m < DIM); m++)
- {
- aa = a[m];
- bb = b[m];
- ip += aa * bb;
- ipa += aa * aa;
- ipb += bb * bb;
- }
- ipab = ipa * ipb;
- if (ipab > 0.0f)
- {
- cosval = ip * rsqrt(ipab);
- }
- else
- {
- cosval = 1.0f;
- }
- if (cosval > 1.0f)
- {
- return 1.0f;
- }
- if (cosval < -1.0f)
- {
- return -1.0f;
- }
-
- return cosval;
-}
-
-
-__device__ static inline void unitv_gpu(const fvec src, fvec dest)
-{
- float linv;
-
- linv = rsqrt(norm2_gpu(src));
- dest[XX] = linv * src[XX];
- dest[YY] = linv * src[YY];
- dest[ZZ] = linv * src[ZZ];
-}
-
-#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \ingroup module_gpu_utils
*/
+/*! \brief CUDA device information.
+ *
+ * The CUDA device information is queried and set at detection and contains
+ * both information about the device/hardware returned by the runtime as well
+ * as additional data like support status.
+ */
+struct DeviceInformation
+{
+ //! ID of the CUDA device.
+ int id;
+ //! CUDA device properties.
+ cudaDeviceProp prop;
+ //! Result of the device check.
+ int stat;
+};
+
//! \brief GPU command stream
using CommandStream = cudaStream_t;
//! \brief Single GPU call timing event - meaningless in CUDA
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#else
+//! Stub for device information.
+struct DeviceInformation
+{
+ // No member needed
+};
+
//! \brief GPU command stream
using CommandStream = void*;
//! \brief Single GPU call timing event
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/gmxopencl.h"
+//! OpenCL device vendors
+enum class DeviceVendor : int
+{
+ Unknown = 0, //!< No data
+ Nvidia = 1, //!< NVIDIA
+ Amd = 2, //!< Advanced Micro Devices
+ Intel = 3, //!< Intel
+ Count = 4
+};
+
+/*! \internal
+ * \brief OpenCL device information.
+ *
+ * The OpenCL device information is queried and set at detection and contains
+ * both information about the device/hardware returned by the runtime as well
+ * as additional data like support status.
+ */
+struct DeviceInformation
+{
+ cl_platform_id oclPlatformId; //!< OpenCL Platform ID.
+ cl_device_id oclDeviceId; //!< OpenCL Device ID.
+ char device_name[256]; //!< Device name.
+ char device_version[256]; //!< Device version.
+ char vendorName[256]; //!< Device vendor name.
+ int compute_units; //!< Number of compute units.
+ int adress_bits; //!< Number of address bits the device is capable of.
+ int stat; //!< Device status takes values of e_gpu_detect_res_t.
+ DeviceVendor deviceVendor; //!< Device vendor.
+ size_t maxWorkItemSizes[3]; //!< Workgroup size limits (CL_DEVICE_MAX_WORK_ITEM_SIZES).
+ size_t maxWorkGroupSize; //!< Workgroup total size limit (CL_DEVICE_MAX_WORK_GROUP_SIZE).
+};
+
//! \brief GPU command stream
using CommandStream = cl_command_queue;
//! \brief Single GPU call timing event
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief Construct compiler options string
*
- * \param deviceVendorId Device vendor id. Used to
- * automatically enable some vendor-specific options
+ * \param deviceVendor Device vendor. Used to automatically enable some
+ * vendor-specific options.
* \return The string with the compiler options
*/
-static std::string selectCompilerOptions(ocl_vendor_id_t deviceVendorId)
+static std::string selectCompilerOptions(DeviceVendor deviceVendor)
{
std::string compilerOptions;
compilerOptions += " -cl-denorms-are-zero";
}
- if ((deviceVendorId == OCL_VENDOR_NVIDIA) && getenv("GMX_OCL_VERBOSE"))
+ if ((deviceVendor == DeviceVendor::Nvidia) && getenv("GMX_OCL_VERBOSE"))
{
compilerOptions += " -cl-nv-verbose";
}
- if ((deviceVendorId == OCL_VENDOR_AMD) && getenv("GMX_OCL_DUMP_INTERM_FILES"))
+ if ((deviceVendor == DeviceVendor::Amd) && getenv("GMX_OCL_DUMP_INTERM_FILES"))
{
/* To dump OpenCL build intermediate files, caching must be off */
if (!useBuildCache)
/*! \brief Select a compilation-line define for a vendor-specific kernel choice from vendor id
*
- * \param[in] vendorId Vendor id enumerator
+ * \param[in] deviceVendor Vendor id enumerator
*
* \return The appropriate compilation-line define
*/
-static const char* makeVendorFlavorChoice(ocl_vendor_id_t vendorId)
+static std::string makeVendorFlavorChoice(DeviceVendor deviceVendor)
{
- const char* choice;
- switch (vendorId)
+ switch (deviceVendor)
{
- case OCL_VENDOR_AMD: choice = "-D_AMD_SOURCE_"; break;
- case OCL_VENDOR_NVIDIA: choice = "-D_NVIDIA_SOURCE_"; break;
- case OCL_VENDOR_INTEL: choice = "-D_INTEL_SOURCE_"; break;
- default: choice = ""; break;
+ case DeviceVendor::Amd: return "-D_AMD_SOURCE_";
+ case DeviceVendor::Nvidia: return "-D_NVIDIA_SOURCE_";
+ case DeviceVendor::Intel: return "-D_INTEL_SOURCE_";
+ default: return "";
}
- return choice;
}
/*! \brief Create include paths for kernel sources.
static std::string makePreprocessorOptions(const std::string& kernelRootPath,
const std::string& includeRootPath,
size_t warpSize,
- ocl_vendor_id_t deviceVendorId,
+ DeviceVendor deviceVendor,
const std::string& extraDefines)
{
std::string preprocessorOptions;
/* Compose the complete build options */
preprocessorOptions = formatString("-DWARP_SIZE_TEST=%d", static_cast<int>(warpSize));
preprocessorOptions += ' ';
- preprocessorOptions += makeVendorFlavorChoice(deviceVendorId);
+ preprocessorOptions += makeVendorFlavorChoice(deviceVendor);
preprocessorOptions += ' ';
preprocessorOptions += extraDefines;
preprocessorOptions += ' ';
- preprocessorOptions += selectCompilerOptions(deviceVendorId);
+ preprocessorOptions += selectCompilerOptions(deviceVendor);
preprocessorOptions += ' ';
preprocessorOptions += makeKernelIncludePathOption(kernelRootPath);
preprocessorOptions += ' ';
const std::string& extraDefines,
cl_context context,
cl_device_id deviceId,
- ocl_vendor_id_t deviceVendorId)
+ DeviceVendor deviceVendor)
{
cl_int cl_error;
// Let the kernel find include files from its module.
/* Make the build options */
std::string preprocessorOptions = makePreprocessorOptions(
- kernelRootPath, rootPath, getDeviceWarpSize(context, deviceId), deviceVendorId, extraDefines);
+ kernelRootPath, rootPath, getDeviceWarpSize(context, deviceId), deviceVendor, extraDefines);
bool buildCacheWasRead = false;
}
}
}
- if ((OCL_VENDOR_NVIDIA == deviceVendorId) && getenv("GMX_OCL_DUMP_INTERM_FILES"))
+ if ((deviceVendor == DeviceVendor::Nvidia) && getenv("GMX_OCL_DUMP_INTERM_FILES"))
{
/* If dumping intermediate files has been requested and this is an NVIDIA card
=> write PTX to file */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param[in] kernelRelativePath Relative path to the kernel in the source tree,
* e.g. "src/gromacs/mdlib/nbnxn_ocl" for NB kernels.
* \param[in] kernelBaseFilename The name of the kernel source file to compile, e.g.
- * "nbnxn_ocl_kernels.cl" \param[in] extraDefines Preprocessor defines required by the
- * calling code, e.g. for configuring the kernels \param[in] context OpenCL context
- * on the device to compile for \param[in] deviceId OpenCL device id of the device to
- * compile for \param[in] deviceVendorId Enumerator of the device vendor to compile for
+ * "nbnxn_ocl_kernels.cl"
+ * \param[in] extraDefines Preprocessor defines required by the calling code,
+ * e.g. for configuring the kernels
+ * \param[in] context OpenCL context on the device to compile for
+ * \param[in] deviceId OpenCL device id of the device to compile for
+ * \param[in] deviceVendor Enumerator of the device vendor to compile for
*
* \returns The compiled OpenCL program
*
const std::string& extraDefines,
cl_context context,
cl_device_id deviceId,
- ocl_vendor_id_t deviceVendorId);
+ DeviceVendor deviceVendor);
} // namespace ocl
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
case GpuApiCallBehavior::Async:
cl_error = clEnqueueWriteBuffer(command_queue, d_dest, CL_FALSE, offset, bytes, h_src,
0, nullptr, copy_event);
- assert(cl_error == CL_SUCCESS);
- // TODO: handle errors
break;
case GpuApiCallBehavior::Sync:
cl_error = clEnqueueWriteBuffer(command_queue, d_dest, CL_TRUE, offset, bytes, h_src, 0,
nullptr, copy_event);
- assert(cl_error == CL_SUCCESS);
- // TODO: handle errors
break;
default: throw;
}
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clEnqueueWriteBuffer failed: " + ocl_get_error_string(cl_error)).c_str());
return 0;
}
case GpuApiCallBehavior::Async:
cl_error = clEnqueueReadBuffer(command_queue, d_src, CL_FALSE, offset, bytes, h_dest, 0,
nullptr, copy_event);
- assert(cl_error == CL_SUCCESS);
- // TODO: handle errors
break;
case GpuApiCallBehavior::Sync:
cl_error = clEnqueueReadBuffer(command_queue, d_src, CL_TRUE, offset, bytes, h_dest, 0,
nullptr, copy_event);
- assert(cl_error == CL_SUCCESS);
- // TODO: handle errors
break;
default: throw;
}
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clEnqueueWriteBuffer failed: " + ocl_get_error_string(cl_error)).c_str());
+
return 0;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
enum class GpuApiCallBehavior;
-/*! \brief OpenCL vendor IDs */
-typedef enum
-{
- OCL_VENDOR_NVIDIA = 0,
- OCL_VENDOR_AMD,
- OCL_VENDOR_INTEL,
- OCL_VENDOR_UNKNOWN
-} ocl_vendor_id_t;
-
-/*! \internal
- * \brief OpenCL GPU device identificator
- *
- * An OpenCL device is identified by its ID.
- * The platform ID is also included for caching reasons.
- */
-typedef struct
-{
- cl_platform_id ocl_platform_id; /**< Platform ID */
- cl_device_id ocl_device_id; /**< Device ID */
-} ocl_gpu_id_t;
-
-/*! \internal
- * \brief OpenCL device information.
- *
- * The OpenCL device information is queried and set at detection and contains
- * both information about the device/hardware returned by the runtime as well
- * as additional data like support status.
- */
-struct gmx_device_info_t
-{
- ocl_gpu_id_t ocl_gpu_id; /**< device ID assigned at detection */
- char device_name[256]; /**< device name */
- char device_version[256]; /**< device version */
- char device_vendor[256]; /**< device vendor */
- int compute_units; /**< number of compute units */
- int adress_bits; /**< number of adress bits the device is capable of */
- int stat; /**< device status takes values of e_gpu_detect_res_t */
- ocl_vendor_id_t vendor_e; /**< device vendor as defined by ocl_vendor_id_t */
- size_t maxWorkItemSizes[3]; /**< workgroup size limits (CL_DEVICE_MAX_WORK_ITEM_SIZES) */
- size_t maxWorkGroupSize; /**< workgroup total size limit (CL_DEVICE_MAX_WORK_GROUP_SIZE) */
-};
-
/*! \internal
* \brief OpenCL GPU runtime data
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# CUDA-only test
list(APPEND SOURCES_FROM_CXX
pinnedmemorychecker.cpp
+ typecasts.cpp
+ typecasts_runner.cpp
)
+ gmx_add_libgromacs_sources(typecasts_runner.cu)
# TODO Making a separate library is heavy handed, but nothing else
# seems to work. Also don't use a hyphen in its name, because nvcc
# can't cope with that.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const auto* device = getDeviceInfo(gpuInfo, compatibleGpus[0]);
cl_context_properties properties[] = {
- CL_CONTEXT_PLATFORM, reinterpret_cast<cl_context_properties>(device->ocl_gpu_id.ocl_platform_id), 0
+ CL_CONTEXT_PLATFORM, reinterpret_cast<cl_context_properties>(device->oclPlatformId), 0
};
// Give uncrustify more space
- auto deviceId = device->ocl_gpu_id.ocl_device_id;
+ auto deviceId = device->oclDeviceId;
auto context = clCreateContext(properties, 1, &deviceId, nullptr, nullptr, &status);
throwUponFailure(status, "creating context");
auto commandQueue = clCreateCommandQueue(context, deviceId, 0, &status);
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Tests for CUDA float3 type layout.
+ *
+ * \author Artem Zhmurov <zhmurov@gmail.com>
+ */
+#include "gmxpre.h"
+
+#include <vector>
+
+#include <gtest/gtest.h>
+
+#include "gromacs/gpu_utils/gpu_testutils.h"
+#include "gromacs/utility/exceptions.h"
+
+#include "testutils/testasserts.h"
+#include "testutils/testmatchers.h"
+
+#include "typecasts_runner.h"
+
+namespace gmx
+{
+
+namespace test
+{
+
+//! Test data in RVec format
+static const std::vector<RVec> rVecInput = { { 1.0, 2.0, 3.0 }, { 4.0, 5.0, 6.0 } };
+
+TEST(GpuDataTypesCompatibilityTest, RVecAndFloat3OnHost)
+{
+ std::vector<RVec> rVecOutput(rVecInput.size());
+ convertRVecToFloat3OnHost(rVecOutput, rVecInput);
+ EXPECT_THAT(rVecInput, testing::Pointwise(RVecEq(ulpTolerance(0)), rVecOutput));
+}
+
+TEST(GpuDataTypesCompatibilityTest, RVecAndFloat3OnDevice)
+{
+ if (canComputeOnGpu())
+ {
+ std::vector<RVec> rVecOutput(rVecInput.size());
+ convertRVecToFloat3OnDevice(rVecOutput, rVecInput);
+ EXPECT_THAT(rVecInput, testing::Pointwise(RVecEq(ulpTolerance(0)), rVecOutput));
+ }
+}
+
+} // namespace test
+} // namespace gmx
\ No newline at end of file
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Stub for runners for tests types compatibility.
+ *
+ * \author Artem Zhmurov <zhmurov@gmail.com>
+ */
+#include "gmxpre.h"
+
+#include "typecasts_runner.h"
+
+#include "config.h"
+
+#include <vector>
+
+#include "testutils/testasserts.h"
+
+#if GMX_GPU != GMX_GPU_CUDA
+
+namespace gmx
+{
+
+namespace test
+{
+
+void convertRVecToFloat3OnHost(std::vector<gmx::RVec>& /* rVecOutput */,
+ const std::vector<gmx::RVec>& /* rVecInput */)
+{
+ FAIL() << "Can't test float3 and RVec compatibility without CUDA.");
+}
+
+void convertRVecToFloat3OnDevice(std::vector<gmx::RVec>& /* rVecOutput */,
+ const std::vector<gmx::RVec>& /* rVecInput*/)
+{
+ FAIL() << "Can't test float3 and RVec compatibility without CUDA.");
+}
+
+} // namespace test
+} // namespace gmx
+
+#endif // GMX_GPU != GMX_GPU_CUDA
\ No newline at end of file
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Runners for tests of CUDA types compatibility.
+ *
+ * \author Artem Zhmurov <zhmurov@gmail.com>
+ */
+#include "gmxpre.h"
+
+#include "typecasts_runner.h"
+
+#include "config.h"
+
+#include <vector>
+
+#include "gromacs/gpu_utils/cudautils.cuh"
+#include "gromacs/gpu_utils/devicebuffer.h"
+#include "gromacs/gpu_utils/typecasts.cuh"
+#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/stringutil.h"
+
+#if GMX_GPU == GMX_GPU_CUDA
+
+namespace gmx
+{
+
+namespace test
+{
+
+/* \brief Perform a component-wise conversion of the float3 vector back to RVec format.
+ *
+ * This is needed to pass the data back to the CPU testing code for comparison with the initial input.
+ *
+ * \param[out] rVecOutput Output data in RVec format for the output.
+ * \param[in] float3Output Output data in float3 format.
+ * \param[in] numElements Size of the data buffers.
+ */
+void inline saveFloat3InRVecFormat(std::vector<gmx::RVec>& rVecOutput, const float3* float3Output, int numElements)
+{
+ for (int i = 0; i < numElements; i++)
+ {
+ rVecOutput[i][XX] = float3Output[i].x;
+ rVecOutput[i][YY] = float3Output[i].y;
+ rVecOutput[i][ZZ] = float3Output[i].z;
+ }
+}
+
+void convertRVecToFloat3OnHost(std::vector<gmx::RVec>& rVecOutput, const std::vector<gmx::RVec>& rVecInput)
+{
+ const int numElements = rVecInput.size();
+
+ float3* dataFloat3 = asFloat3(const_cast<RVec*>(rVecInput.data()));
+
+ saveFloat3InRVecFormat(rVecOutput, dataFloat3, numElements);
+}
+
+//! Number of CUDA threads in a block.
+constexpr static int c_threadsPerBlock = 256;
+
+/*! \brief GPU kernel to perform type conversion on the device.
+ *
+ * \param[out] gm_float3Output Buffer to write the output into.
+ * \param[in] gm_rVecInput Input data in RVec format.
+ * \param[in] size Size of the data buffers.
+ *
+ */
+static __global__ void convertRVecToFloat3OnDevice_kernel(DeviceBuffer<float3> gm_float3Output,
+ DeviceBuffer<RVec> gm_rVecInput,
+ const int size)
+{
+ int threadIndex = blockIdx.x * blockDim.x + threadIdx.x;
+ if (threadIndex < size)
+ {
+ gm_float3Output[threadIndex] = asFloat3(gm_rVecInput)[threadIndex];
+ }
+}
+
+void convertRVecToFloat3OnDevice(std::vector<gmx::RVec>& h_rVecOutput, const std::vector<gmx::RVec>& h_rVecInput)
+{
+ const int numElements = h_rVecInput.size();
+
+ DeviceBuffer<RVec> d_rVecInput;
+ allocateDeviceBuffer(&d_rVecInput, numElements, nullptr);
+ copyToDeviceBuffer(&d_rVecInput, h_rVecInput.data(), 0, numElements, nullptr,
+ GpuApiCallBehavior::Sync, nullptr);
+
+ DeviceBuffer<float3> d_float3Output;
+ allocateDeviceBuffer(&d_float3Output, numElements * DIM, nullptr);
+
+ std::vector<float3> h_float3Output(numElements);
+
+ KernelLaunchConfig kernelLaunchConfig;
+ kernelLaunchConfig.gridSize[0] = (numElements + c_threadsPerBlock - 1) / c_threadsPerBlock;
+ kernelLaunchConfig.blockSize[0] = c_threadsPerBlock;
+ kernelLaunchConfig.blockSize[1] = 1;
+ kernelLaunchConfig.blockSize[2] = 1;
+ kernelLaunchConfig.sharedMemorySize = 0;
+ kernelLaunchConfig.stream = nullptr;
+
+ auto kernelPtr = convertRVecToFloat3OnDevice_kernel;
+ const auto kernelArgs = prepareGpuKernelArguments(kernelPtr, kernelLaunchConfig,
+ &d_float3Output, &d_rVecInput, &numElements);
+ launchGpuKernel(kernelPtr, kernelLaunchConfig, nullptr, "convertRVecToFloat3OnDevice_kernel", kernelArgs);
+
+ copyFromDeviceBuffer(h_float3Output.data(), &d_float3Output, 0, numElements, nullptr,
+ GpuApiCallBehavior::Sync, nullptr);
+
+ saveFloat3InRVecFormat(h_rVecOutput, h_float3Output.data(), numElements);
+
+ freeDeviceBuffer(&d_rVecInput);
+ freeDeviceBuffer(&d_float3Output);
+}
+
+} // namespace test
+} // namespace gmx
+
+#endif // GMX_GPU == GMX_GPU_CUDA
\ No newline at end of file
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Header for runner for CUDA float3 type layout tests.
+ *
+ * \author Artem Zhmurov <zhmurov@gmail.com>
+ */
+#ifndef GMX_GPU_UTILS_TESTS_TYPECASTS_RUNNER_H
+#define GMX_GPU_UTILS_TESTS_TYPECASTS_RUNNER_H
+
+#include "gmxpre.h"
+
+#include <vector>
+
+#include "gromacs/math/vectypes.h"
+
+namespace gmx
+{
+
+namespace test
+{
+
+/*! \brief Tests the compatibility of RVec and float3 using the conversion on host.
+ *
+ * \param[out] rVecOutput Data in RVec format for the output.
+ * \param[in] rVecInput Data in RVec format with the input.
+ */
+void convertRVecToFloat3OnHost(std::vector<gmx::RVec>& rVecOutput, const std::vector<gmx::RVec>& rVecInput);
+
+/*! \brief Tests the compatibility of RVec and float3 using the conversion on device.
+ *
+ * \param[out] rVecOutput Data in RVec format for the output.
+ * \param[in] rVecInput Data in RVec format with the input.
+ */
+void convertRVecToFloat3OnDevice(std::vector<gmx::RVec>& rVecOutput, const std::vector<gmx::RVec>& rVecInput);
+
+} // namespace test
+} // namespace gmx
+
+#endif // GMX_GPU_UTILS_TESTS_TYPECASTS_RUNNER_H
\ No newline at end of file
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \libinternal \file
+ * \brief Declare functions to be used to cast CPU types to compatible GPU types.
+ *
+ * \author Artem Zhmurov <zhmurov@gmail.com>
+ *
+ * \inlibraryapi
+ */
+#ifndef GMX_GPU_UTILS_TYPECASTS_CUH
+#define GMX_GPU_UTILS_TYPECASTS_CUH
+
+#include "gmxpre.h"
+
+#include "gromacs/math/vectypes.h"
+
+/*! \brief Cast RVec buffer to float3 buffer.
+ *
+ * \param[in] in The RVec buffer to cast.
+ *
+ * \returns Buffer, casted to float3*.
+ */
+static inline __host__ __device__ float3* asFloat3(gmx::RVec* in)
+{
+ static_assert(sizeof(in[0]) == sizeof(float3),
+ "Size of the host-side data-type is different from the size of the device-side "
+ "counterpart.");
+ return reinterpret_cast<float3*>(in);
+}
+
+#endif // GMX_GPU_UTILS_TYPECASTS_CUH
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return norm(b - a);
}
+/* \brief Compute the scalar product of two vectors.
+ *
+ * \param[in] a First vector.
+ * \param[in] b Second vector.
+ * \returns Scalar product.
+ */
+__forceinline__ __device__ float iprod(const float3 a, const float3 b)
+{
+ return a.x * b.x + a.y * b.y + a.z * b.z;
+}
+
+/* \brief Compute the vector product of two vectors.
+ *
+ * \param[in] a First vector.
+ * \param[in] b Second vector.
+ * \returns Vector product.
+ */
+__forceinline__ __device__ float3 cprod(const float3 a, const float3 b)
+{
+ float3 c;
+ c.x = a.y * b.z - a.z * b.y;
+ c.y = a.z * b.x - a.x * b.z;
+ c.z = a.x * b.y - a.y * b.x;
+ return c;
+}
+
+/* \brief Cosine of an angle between two vectors.
+ *
+ * Computes cosine using the following formula:
+ *
+ * ax*bx + ay*by + az*bz
+ * cos-vec (a,b) = ---------------------
+ * ||a|| * ||b||
+ *
+ * This function also makes sure that the cosine does not leave the [-1, 1]
+ * interval, which can happen due to numerical errors.
+ *
+ * \param[in] a First vector.
+ * \param[in] b Second vector.
+ * \returns Cosine between a and b.
+ */
+__forceinline__ __device__ float cos_angle(const float3 a, const float3 b)
+{
+ float cosval;
+
+ float ipa = norm2(a);
+ float ipb = norm2(b);
+ float ip = iprod(a, b);
+ float ipab = ipa * ipb;
+ if (ipab > 0.0f)
+ {
+ cosval = ip * rsqrt(ipab);
+ }
+ else
+ {
+ cosval = 1.0f;
+ }
+ if (cosval > 1.0f)
+ {
+ return 1.0f;
+ }
+ if (cosval < -1.0f)
+ {
+ return -1.0f;
+ }
+
+ return cosval;
+}
+
+/* \brief Compute the angle between two vectors.
+ *
+ * Uses atan( |axb| / a.b ) formula.
+ *
+ * \param[in] a First vector.
+ * \param[in] b Second vector.
+ * \returns Angle between vectors in radians.
+ */
+__forceinline__ __device__ float gmx_angle(const float3 a, const float3 b)
+{
+ float3 w = cprod(a, b);
+
+ float wlen = norm(w);
+ float s = iprod(a, b);
+
+ return atan2f(wlen, s); // requires float
+}
+
+/* \brief Atomically add components of the vector.
+ *
+ * Executes atomicAdd one-by-one on all components of the float3 vector.
+ *
+ * \param[in] a First vector.
+ * \param[in] b Second vector.
+ * \returns Angle between vectors.
+ */
+__forceinline__ __device__ void atomicAdd(float3& a, const float3 b)
+{
+ atomicAdd(&a.x, b.x);
+ atomicAdd(&a.y, b.y);
+ atomicAdd(&a.z, b.z);
+}
+
#endif /* VECTYPE_OPS_CUH */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (!isMasterRankOfPhysicalNode)
{
- hardwareInfo->gpu_info.gpu_dev = (struct gmx_device_info_t*)malloc(dev_size);
+ hardwareInfo->gpu_info.deviceInfo = (struct DeviceInformation*)malloc(dev_size);
}
- MPI_Bcast(hardwareInfo->gpu_info.gpu_dev, dev_size, MPI_BYTE, 0, physicalNodeComm.comm_);
+ MPI_Bcast(hardwareInfo->gpu_info.deviceInfo, dev_size, MPI_BYTE, 0, physicalNodeComm.comm_);
MPI_Bcast(&hardwareInfo->gpu_info.n_dev_compatible, 1, MPI_INT, 0, physicalNodeComm.comm_);
}
}
// Detect GPUs
hardwareInfo->gpu_info.n_dev = 0;
hardwareInfo->gpu_info.n_dev_compatible = 0;
- hardwareInfo->gpu_info.gpu_dev = nullptr;
+ hardwareInfo->gpu_info.deviceInfo = nullptr;
gmx_detect_gpus(mdlog, physicalNodeComm, compat::make_not_null(hardwareInfo));
gmx_collect_hardware_mpi(*hardwareInfo->cpuInfo, physicalNodeComm, compat::make_not_null(hardwareInfo));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/basedefinitions.h"
-struct gmx_device_info_t;
+struct DeviceInformation;
/*! \brief Possible results of the GPU detection/check.
*
//! Total number of GPU devices detected on this physical node
int n_dev;
//! Information about each GPU device detected on this physical node
- gmx_device_info_t* gpu_dev;
+ DeviceInformation* deviceInfo;
//! Number of GPU devices detected on this physical node that are compatible.
int n_dev_compatible;
};
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (bIMD)
{
IMDatoms = gmx_mtop_global_atoms(sys);
- write_sto_conf_indexed(opt2fn("-imd", nfile, fnm), "IMDgroup", &IMDatoms, state->x.rvec_array(),
- state->v.rvec_array(), ir->ePBC, state->box, ir->imd->nat, ir->imd->ind);
+ write_sto_conf_indexed(opt2fn("-imd", nfile, fnm), "IMDgroup", &IMDatoms,
+ state->x.rvec_array(), state->v.rvec_array(), ir->pbcType,
+ state->box, ir->imd->nat, ir->imd->ind);
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2004 David van der Spoel, Erik Lindahl, University of Groningen.
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_LISTED_FORCES_GPUBONDED_H
#define GMX_LISTED_FORCES_GPUBONDED_H
+#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/topology/idef.h"
#include "gromacs/utility/arrayref.h"
void updateInteractionListsAndDeviceBuffers(ArrayRef<const int> nbnxnAtomOrder,
const t_idef& idef,
void* xqDevice,
- void* forceDevice,
- void* fshiftDevice);
+ DeviceBuffer<RVec> forceDevice,
+ DeviceBuffer<RVec> fshiftDevice);
/*! \brief Returns whether there are bonded interactions
* assigned to the GPU */
bool haveInteractions() const;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void GpuBonded::updateInteractionListsAndDeviceBuffers(ArrayRef<const int> /* nbnxnAtomOrder */,
const t_idef& /* idef */,
void* /* xqDevice */,
- void* /* forceDevice */,
- void* /* fshiftDevice */)
+ DeviceBuffer<RVec> /* forceDevice */,
+ DeviceBuffer<RVec> /* fshiftDevice */)
{
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/cuda_arch_utils.cuh"
#include "gromacs/gpu_utils/cudautils.cuh"
#include "gromacs/gpu_utils/devicebuffer.h"
+#include "gromacs/gpu_utils/typecasts.cuh"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/topology/forcefieldparameters.h"
const t_ilist& ilist = idef.il[fType];
- return (idef.ilsort != ilsortNO_FE && ilist.nr_nonperturbed != ilist.nr);
+ return (idef.ilsort != ilsortNO_FE && idef.numNonperturbedInteractions[fType] != ilist.nr);
}
//! Converts \p src with atom indices in state order to \p dest in nbnxn order
* types are assigned in blocks sized as <warp_size>. The beginning and end (thread index) of each
* interaction type are stored in kernelParams_. Pointers to the relevant data structures on the
* GPU are also stored in kernelParams_.
+ *
+ * \todo Use DeviceBuffer for the d_xqPtr.
*/
void GpuBonded::Impl::updateInteractionListsAndDeviceBuffers(ArrayRef<const int> nbnxnAtomOrder,
const t_idef& idef,
void* d_xqPtr,
- void* d_fPtr,
- void* d_fShiftPtr)
+ DeviceBuffer<RVec> d_fPtr,
+ DeviceBuffer<RVec> d_fShiftPtr)
{
// TODO wallcycle sub start
haveInteractions_ = false;
}
d_xq_ = static_cast<float4*>(d_xqPtr);
- d_f_ = static_cast<fvec*>(d_fPtr);
- d_fShift_ = static_cast<fvec*>(d_fShiftPtr);
+ d_f_ = asFloat3(d_fPtr);
+ d_fShift_ = asFloat3(d_fShiftPtr);
kernelParams_.d_xq = d_xq_;
kernelParams_.d_f = d_f_;
GMX_ASSERT(haveInteractions_,
"No GPU bonded interactions, so no energies will be computed, so transfer should "
"not be called");
-
wallcycle_sub_start_nocount(wcycle_, ewcsLAUNCH_GPU_BONDED);
// TODO add conditional on whether there has been any compute (and make sure host buffer doesn't contain garbage)
float* h_vTot = vTot_.data();
void GpuBonded::updateInteractionListsAndDeviceBuffers(ArrayRef<const int> nbnxnAtomOrder,
const t_idef& idef,
void* d_xq,
- void* d_f,
- void* d_fShift)
+ DeviceBuffer<RVec> d_f,
+ DeviceBuffer<RVec> d_fShift)
{
impl_->updateInteractionListsAndDeviceBuffers(nbnxnAtomOrder, idef, d_xq, d_f, d_fShift);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_LISTED_FORCES_GPUBONDED_IMPL_H
#define GMX_LISTED_FORCES_GPUBONDED_IMPL_H
-#include "gromacs/gpu_utils/gpu_vec.cuh"
#include "gromacs/gpu_utils/gputraits.cuh"
#include "gromacs/gpu_utils/hostallocator.h"
#include "gromacs/listed_forces/gpubonded.h"
//! Coordinates before the timestep (on GPU)
const float4* d_xq;
//! Forces on atoms (on GPU)
- fvec* d_f;
+ float3* d_f;
//! Force shifts on atoms (on GPU)
- fvec* d_fShift;
+ float3* d_fShift;
//! Total Energy (on GPU)
float* d_vTot;
//! Interaction list atoms (on GPU)
void updateInteractionListsAndDeviceBuffers(ArrayRef<const int> nbnxnAtomOrder,
const t_idef& idef,
void* xqDevice,
- void* forceDevice,
- void* fshiftDevice);
+ DeviceBuffer<RVec> forceDevice,
+ DeviceBuffer<RVec> fshiftDevice);
/*! \brief Launches bonded kernel on a GPU */
template<bool calcVir, bool calcEner>
//! Position-charge vector on the device.
const float4* d_xq_ = nullptr;
//! Force vector on the device.
- fvec* d_f_ = nullptr;
+ float3* d_f_ = nullptr;
//! Shift force vector on the device.
- fvec* d_fShift_ = nullptr;
+ float3* d_fShift_ = nullptr;
//! \brief Host-side virial buffer
HostVector<float> vTot_ = { {}, gmx::HostAllocationPolicy(gmx::PinningPolicy::PinnedIfSupported) };
//! \brief Device-side total virial
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <math_constants.h>
#include "gromacs/gpu_utils/cudautils.cuh"
-#include "gromacs/gpu_utils/gpu_vec.cuh"
+#include "gromacs/gpu_utils/typecasts.cuh"
+#include "gromacs/gpu_utils/vectype_ops.cuh"
#include "gromacs/listed_forces/gpubonded.h"
#include "gromacs/math/units.h"
#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pbcutil/pbc_aiuc_cuda.cuh"
const t_iatom d_forceatoms[],
const t_iparams d_forceparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc)
{
if (i < numBonds)
int aj = bondData.z;
/* dx = xi - xj, corrected for periodic boundary conditions. */
- fvec dx;
- int ki = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[ai], gm_xq[aj], dx);
+ float3 dx;
+ int ki = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[ai], gm_xq[aj], dx);
- float dr2 = iprod_gpu(dx, dx);
+ float dr2 = norm2(dx);
float dr = sqrt(dr2);
float vbond;
{
fbond *= rsqrtf(dr2);
-#pragma unroll
- for (int m = 0; m < DIM; m++)
+ float3 fij = fbond * dx;
+ atomicAdd(&gm_f[ai], fij);
+ atomicAdd(&gm_f[aj], -fij);
+ if (calcVir && ki != CENTRAL)
{
- float fij = fbond * dx[m];
- atomicAdd(&gm_f[ai][m], fij);
- atomicAdd(&gm_f[aj][m], -fij);
- if (calcVir && ki != CENTRAL)
- {
- atomicAdd(&sm_fShiftLoc[ki][m], fij);
- atomicAdd(&sm_fShiftLoc[CENTRAL][m], -fij);
- }
+ atomicAdd(&sm_fShiftLoc[ki], fij);
+ atomicAdd(&sm_fShiftLoc[CENTRAL], -fij);
}
}
}
const float4 xj,
const float4 xk,
const PbcAiuc& pbcAiuc,
- fvec r_ij,
- fvec r_kj,
+ float3* r_ij,
+ float3* r_kj,
float* costh,
int* t1,
int* t2)
/* Return value is the angle between the bonds i-j and j-k */
{
- *t1 = pbcDxAiuc<returnShift>(pbcAiuc, xi, xj, r_ij);
- *t2 = pbcDxAiuc<returnShift>(pbcAiuc, xk, xj, r_kj);
+ *t1 = pbcDxAiuc<returnShift>(pbcAiuc, xi, xj, *r_ij);
+ *t2 = pbcDxAiuc<returnShift>(pbcAiuc, xk, xj, *r_kj);
- *costh = cos_angle_gpu(r_ij, r_kj);
+ *costh = cos_angle(*r_ij, *r_kj);
float th = acosf(*costh);
return th;
const t_iatom d_forceatoms[],
const t_iparams d_forceparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc)
{
if (i < numBonds)
int aj = angleData.z;
int ak = angleData.w;
- fvec r_ij;
- fvec r_kj;
- float cos_theta;
- int t1;
- int t2;
- float theta = bond_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], pbcAiuc, r_ij, r_kj,
- &cos_theta, &t1, &t2);
+ float3 r_ij;
+ float3 r_kj;
+ float cos_theta;
+ int t1;
+ int t2;
+ float theta = bond_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], pbcAiuc, &r_ij,
+ &r_kj, &cos_theta, &t1, &t2);
float va;
float dVdt;
{
float st = dVdt * rsqrtf(1.0f - cos_theta2);
float sth = st * cos_theta;
- float nrij2 = iprod_gpu(r_ij, r_ij);
- float nrkj2 = iprod_gpu(r_kj, r_kj);
+ float nrij2 = norm2(r_ij);
+ float nrkj2 = norm2(r_kj);
float nrij_1 = rsqrtf(nrij2);
float nrkj_1 = rsqrtf(nrkj2);
float cii = sth * nrij_1 * nrij_1;
float ckk = sth * nrkj_1 * nrkj_1;
- fvec f_i;
- fvec f_k;
- fvec f_j;
-#pragma unroll
- for (int m = 0; m < DIM; m++)
+ float3 f_i = cii * r_ij - cik * r_kj;
+ float3 f_k = ckk * r_kj - cik * r_ij;
+ float3 f_j = -f_i - f_k;
+
+ atomicAdd(&gm_f[ai], f_i);
+ atomicAdd(&gm_f[aj], f_j);
+ atomicAdd(&gm_f[ak], f_k);
+
+ if (calcVir)
{
- f_i[m] = -(cik * r_kj[m] - cii * r_ij[m]);
- f_k[m] = -(cik * r_ij[m] - ckk * r_kj[m]);
- f_j[m] = -f_i[m] - f_k[m];
- atomicAdd(&gm_f[ai][m], f_i[m]);
- atomicAdd(&gm_f[aj][m], f_j[m]);
- atomicAdd(&gm_f[ak][m], f_k[m]);
- if (calcVir)
- {
- atomicAdd(&sm_fShiftLoc[t1][m], f_i[m]);
- atomicAdd(&sm_fShiftLoc[CENTRAL][m], f_j[m]);
- atomicAdd(&sm_fShiftLoc[t2][m], f_k[m]);
- }
+ atomicAdd(&sm_fShiftLoc[t1], f_i);
+ atomicAdd(&sm_fShiftLoc[CENTRAL], f_j);
+ atomicAdd(&sm_fShiftLoc[t2], f_k);
}
}
}
const t_iatom d_forceatoms[],
const t_iparams d_forceparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc)
{
if (i < numBonds)
float r13A = d_forceparams[type].u_b.r13A;
float kUBA = d_forceparams[type].u_b.kUBA;
- fvec r_ij;
- fvec r_kj;
- float cos_theta;
- int t1;
- int t2;
- float theta = bond_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], pbcAiuc, r_ij, r_kj,
- &cos_theta, &t1, &t2);
+ float3 r_ij;
+ float3 r_kj;
+ float cos_theta;
+ int t1;
+ int t2;
+ float theta = bond_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], pbcAiuc, &r_ij,
+ &r_kj, &cos_theta, &t1, &t2);
float va;
float dVdt;
*vtot_loc += va;
}
- fvec r_ik;
- int ki = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[ai], gm_xq[ak], r_ik);
+ float3 r_ik;
+ int ki = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[ai], gm_xq[ak], r_ik);
- float dr2 = iprod_gpu(r_ik, r_ik);
+ float dr2 = norm2(r_ik);
float dr = dr2 * rsqrtf(dr2);
float vbond;
float st = dVdt * rsqrtf(1.0f - cos_theta2);
float sth = st * cos_theta;
- float nrkj2 = iprod_gpu(r_kj, r_kj);
- float nrij2 = iprod_gpu(r_ij, r_ij);
+ float nrkj2 = norm2(r_kj);
+ float nrij2 = norm2(r_ij);
float cik = st * rsqrtf(nrkj2 * nrij2);
float cii = sth / nrij2;
float ckk = sth / nrkj2;
- fvec f_i;
- fvec f_j;
- fvec f_k;
-#pragma unroll
- for (int m = 0; m < DIM; m++)
+ float3 f_i = cii * r_ij - cik * r_kj;
+ float3 f_k = ckk * r_kj - cik * r_ij;
+ float3 f_j = -f_i - f_k;
+
+ atomicAdd(&gm_f[ai], f_i);
+ atomicAdd(&gm_f[aj], f_j);
+ atomicAdd(&gm_f[ak], f_k);
+
+ if (calcVir)
{
- f_i[m] = -(cik * r_kj[m] - cii * r_ij[m]);
- f_k[m] = -(cik * r_ij[m] - ckk * r_kj[m]);
- f_j[m] = -f_i[m] - f_k[m];
- atomicAdd(&gm_f[ai][m], f_i[m]);
- atomicAdd(&gm_f[aj][m], f_j[m]);
- atomicAdd(&gm_f[ak][m], f_k[m]);
- if (calcVir)
- {
- atomicAdd(&sm_fShiftLoc[t1][m], f_i[m]);
- atomicAdd(&sm_fShiftLoc[CENTRAL][m], f_j[m]);
- atomicAdd(&sm_fShiftLoc[t2][m], f_k[m]);
- }
+ atomicAdd(&sm_fShiftLoc[t1], f_i);
+ atomicAdd(&sm_fShiftLoc[CENTRAL], f_j);
+ atomicAdd(&sm_fShiftLoc[t2], f_k);
}
}
fbond *= rsqrtf(dr2);
-#pragma unroll
- for (int m = 0; m < DIM; m++)
+ float3 fik = fbond * r_ik;
+ atomicAdd(&gm_f[ai], fik);
+ atomicAdd(&gm_f[ak], -fik);
+
+ if (calcVir && ki != CENTRAL)
{
- float fik = fbond * r_ik[m];
- atomicAdd(&gm_f[ai][m], fik);
- atomicAdd(&gm_f[ak][m], -fik);
-
- if (calcVir && ki != CENTRAL)
- {
- atomicAdd(&sm_fShiftLoc[ki][m], fik);
- atomicAdd(&sm_fShiftLoc[CENTRAL][m], -fik);
- }
+ atomicAdd(&sm_fShiftLoc[ki], fik);
+ atomicAdd(&sm_fShiftLoc[CENTRAL], -fik);
}
}
}
const T xk,
const T xl,
const PbcAiuc& pbcAiuc,
- fvec r_ij,
- fvec r_kj,
- fvec r_kl,
- fvec m,
- fvec n,
+ float3* r_ij,
+ float3* r_kj,
+ float3* r_kl,
+ float3* m,
+ float3* n,
int* t1,
int* t2,
int* t3)
{
- *t1 = pbcDxAiuc<returnShift>(pbcAiuc, xi, xj, r_ij);
- *t2 = pbcDxAiuc<returnShift>(pbcAiuc, xk, xj, r_kj);
- *t3 = pbcDxAiuc<returnShift>(pbcAiuc, xk, xl, r_kl);
-
- cprod_gpu(r_ij, r_kj, m);
- cprod_gpu(r_kj, r_kl, n);
- float phi = gmx_angle_gpu(m, n);
- float ipr = iprod_gpu(r_ij, n);
+ *t1 = pbcDxAiuc<returnShift>(pbcAiuc, xi, xj, *r_ij);
+ *t2 = pbcDxAiuc<returnShift>(pbcAiuc, xk, xj, *r_kj);
+ *t3 = pbcDxAiuc<returnShift>(pbcAiuc, xk, xl, *r_kl);
+
+ *m = cprod(*r_ij, *r_kj);
+ *n = cprod(*r_kj, *r_kl);
+ float phi = gmx_angle(*m, *n);
+ float ipr = iprod(*r_ij, *n);
float sign = (ipr < 0.0f) ? -1.0f : 1.0f;
phi = sign * phi;
const int k,
const int l,
const float ddphi,
- const fvec r_ij,
- const fvec r_kj,
- const fvec r_kl,
- const fvec m,
- const fvec n,
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ const float3 r_ij,
+ const float3 r_kj,
+ const float3 r_kl,
+ const float3 m,
+ const float3 n,
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc& pbcAiuc,
const float4 gm_xq[],
const int t1,
const int t2,
const int gmx_unused t3)
{
- float iprm = iprod_gpu(m, m);
- float iprn = iprod_gpu(n, n);
- float nrkj2 = iprod_gpu(r_kj, r_kj);
+ float iprm = norm2(m);
+ float iprn = norm2(n);
+ float nrkj2 = norm2(r_kj);
float toler = nrkj2 * GMX_REAL_EPS;
if ((iprm > toler) && (iprn > toler))
{
- float nrkj_1 = rsqrtf(nrkj2); // replacing std::invsqrt call
- float nrkj_2 = nrkj_1 * nrkj_1;
- float nrkj = nrkj2 * nrkj_1;
- float a = -ddphi * nrkj / iprm;
- fvec f_i;
- svmul_gpu(a, m, f_i);
- float b = ddphi * nrkj / iprn;
- fvec f_l;
- svmul_gpu(b, n, f_l);
- float p = iprod_gpu(r_ij, r_kj);
+ float nrkj_1 = rsqrtf(nrkj2); // replacing std::invsqrt call
+ float nrkj_2 = nrkj_1 * nrkj_1;
+ float nrkj = nrkj2 * nrkj_1;
+ float a = -ddphi * nrkj / iprm;
+ float3 f_i = a * m;
+ float b = ddphi * nrkj / iprn;
+ float3 f_l = b * n;
+ float p = iprod(r_ij, r_kj);
p *= nrkj_2;
- float q = iprod_gpu(r_kl, r_kj);
+ float q = iprod(r_kl, r_kj);
q *= nrkj_2;
- fvec uvec;
- svmul_gpu(p, f_i, uvec);
- fvec vvec;
- svmul_gpu(q, f_l, vvec);
- fvec svec;
- fvec_sub_gpu(uvec, vvec, svec);
- fvec f_j;
- fvec_sub_gpu(f_i, svec, f_j);
- fvec f_k;
- fvec_add_gpu(f_l, svec, f_k);
-#pragma unroll
- for (int m = 0; (m < DIM); m++)
- {
- atomicAdd(&gm_f[i][m], f_i[m]);
- atomicAdd(&gm_f[j][m], -f_j[m]);
- atomicAdd(&gm_f[k][m], -f_k[m]);
- atomicAdd(&gm_f[l][m], f_l[m]);
- }
+ float3 uvec = p * f_i;
+ float3 vvec = q * f_l;
+ float3 svec = uvec - vvec;
+ float3 f_j = f_i - svec;
+ float3 f_k = f_l + svec;
+
+ atomicAdd(&gm_f[i], f_i);
+ atomicAdd(&gm_f[j], -f_j);
+ atomicAdd(&gm_f[k], -f_k);
+ atomicAdd(&gm_f[l], f_l);
if (calcVir)
{
- fvec dx_jl;
- int t3 = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[l], gm_xq[j], dx_jl);
+ float3 dx_jl;
+ int t3 = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[l], gm_xq[j], dx_jl);
-#pragma unroll
- for (int m = 0; (m < DIM); m++)
- {
- atomicAdd(&sm_fShiftLoc[t1][m], f_i[m]);
- atomicAdd(&sm_fShiftLoc[CENTRAL][m], -f_j[m]);
- atomicAdd(&sm_fShiftLoc[t2][m], -f_k[m]);
- atomicAdd(&sm_fShiftLoc[t3][m], f_l[m]);
- }
+ atomicAdd(&sm_fShiftLoc[t1], f_i);
+ atomicAdd(&sm_fShiftLoc[CENTRAL], -f_j);
+ atomicAdd(&sm_fShiftLoc[t2], -f_k);
+ atomicAdd(&sm_fShiftLoc[t3], f_l);
}
}
}
const t_iatom d_forceatoms[],
const t_iparams d_forceparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc)
{
if (i < numBonds)
int ak = d_forceatoms[5 * i + 3];
int al = d_forceatoms[5 * i + 4];
- fvec r_ij;
- fvec r_kj;
- fvec r_kl;
- fvec m;
- fvec n;
- int t1;
- int t2;
- int t3;
- float phi = dih_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], gm_xq[al], pbcAiuc,
- r_ij, r_kj, r_kl, m, n, &t1, &t2, &t3);
+ float3 r_ij;
+ float3 r_kj;
+ float3 r_kl;
+ float3 m;
+ float3 n;
+ int t1;
+ int t2;
+ int t3;
+ float phi = dih_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], gm_xq[al], pbcAiuc,
+ &r_ij, &r_kj, &r_kl, &m, &n, &t1, &t2, &t3);
float vpd;
float ddphi;
const t_iatom d_forceatoms[],
const t_iparams d_forceparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc)
{
constexpr float c0 = 0.0f, c1 = 1.0f, c2 = 2.0f, c3 = 3.0f, c4 = 4.0f, c5 = 5.0f;
int ak = d_forceatoms[5 * i + 3];
int al = d_forceatoms[5 * i + 4];
- fvec r_ij;
- fvec r_kj;
- fvec r_kl;
- fvec m;
- fvec n;
- int t1;
- int t2;
- int t3;
- float phi = dih_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], gm_xq[al], pbcAiuc,
- r_ij, r_kj, r_kl, m, n, &t1, &t2, &t3);
+ float3 r_ij;
+ float3 r_kj;
+ float3 r_kl;
+ float3 m;
+ float3 n;
+ int t1;
+ int t2;
+ int t3;
+ float phi = dih_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], gm_xq[al], pbcAiuc,
+ &r_ij, &r_kj, &r_kl, &m, &n, &t1, &t2, &t3);
/* Change to polymer convention */
if (phi < c0)
const t_iatom d_forceatoms[],
const t_iparams d_forceparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc)
{
if (i < numBonds)
int ak = d_forceatoms[5 * i + 3];
int al = d_forceatoms[5 * i + 4];
- fvec r_ij;
- fvec r_kj;
- fvec r_kl;
- fvec m;
- fvec n;
- int t1;
- int t2;
- int t3;
- float phi = dih_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], gm_xq[al], pbcAiuc,
- r_ij, r_kj, r_kl, m, n, &t1, &t2, &t3);
+ float3 r_ij;
+ float3 r_kj;
+ float3 r_kl;
+ float3 m;
+ float3 n;
+ int t1;
+ int t2;
+ int t3;
+ float phi = dih_angle_gpu<calcVir>(gm_xq[ai], gm_xq[aj], gm_xq[ak], gm_xq[al], pbcAiuc,
+ &r_ij, &r_kj, &r_kl, &m, &n, &t1, &t2, &t3);
/* phi can jump if phi0 is close to Pi/-Pi, which will cause huge
* force changes if we just apply a normal harmonic.
const t_iatom d_forceatoms[],
const t_iparams iparams[],
const float4 gm_xq[],
- fvec gm_f[],
- fvec sm_fShiftLoc[],
+ float3 gm_f[],
+ float3 sm_fShiftLoc[],
const PbcAiuc pbcAiuc,
const float scale_factor,
float* vtotVdw_loc,
{
if (i < numBonds)
{
+ // TODO this should be made into a separate type, the GPU and CPU sizes should be compared
int3 pairData = *(int3*)(d_forceatoms + 3 * i);
int type = pairData.x;
int ai = pairData.y;
float c12 = iparams[type].lj14.c12A;
/* Do we need to apply full periodic boundary conditions? */
- fvec dr;
- int fshift_index = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[ai], gm_xq[aj], dr);
+ float3 dr;
+ int fshift_index = pbcDxAiuc<calcVir>(pbcAiuc, gm_xq[ai], gm_xq[aj], dr);
- float r2 = norm2_gpu(dr);
+ float r2 = norm2(dr);
float rinv = rsqrtf(r2);
float rinv2 = rinv * rinv;
float rinv6 = rinv2 * rinv2 * rinv2;
/* Calculate the LJ force * r and add it to the Coulomb part */
float fr = (12.0f * c12 * rinv6 - 6.0f * c6) * rinv6 + velec;
- float finvr = fr * rinv2;
- fvec f;
- svmul_gpu(finvr, dr, f);
+ float finvr = fr * rinv2;
+ float3 f = finvr * dr;
/* Add the forces */
-#pragma unroll
- for (int m = 0; m < DIM; m++)
+ atomicAdd(&gm_f[ai], f);
+ atomicAdd(&gm_f[aj], -f);
+ if (calcVir && fshift_index != CENTRAL)
{
- atomicAdd(&gm_f[ai][m], f[m]);
- atomicAdd(&gm_f[aj][m], -f[m]);
- if (calcVir && fshift_index != CENTRAL)
- {
- atomicAdd(&sm_fShiftLoc[fshift_index][m], f[m]);
- atomicAdd(&sm_fShiftLoc[CENTRAL][m], -f[m]);
- }
+ atomicAdd(&sm_fShiftLoc[fshift_index], f);
+ atomicAdd(&sm_fShiftLoc[CENTRAL], -f);
}
if (calcEner)
float vtot_loc = 0;
float vtotVdw_loc = 0;
float vtotElec_loc = 0;
- __shared__ fvec sm_fShiftLoc[SHIFTS];
+ __shared__ float3 sm_fShiftLoc[SHIFTS];
if (calcVir)
{
if (threadIdx.x < SHIFTS)
{
- sm_fShiftLoc[threadIdx.x][XX] = 0.0f;
- sm_fShiftLoc[threadIdx.x][YY] = 0.0f;
- sm_fShiftLoc[threadIdx.x][ZZ] = 0.0f;
+ sm_fShiftLoc[threadIdx.x] = make_float3(0.0f, 0.0f, 0.0f);
}
__syncthreads();
}
__syncthreads();
if (threadIdx.x < SHIFTS)
{
- fvec_inc_atomic(kernelParams.d_fShift[threadIdx.x], sm_fShiftLoc[threadIdx.x]);
+ atomicAdd(kernelParams.d_fShift[threadIdx.x], sm_fShiftLoc[threadIdx.x]);
}
}
}
"TPB_BONDED must be >= SHIFTS for the virial kernel (calcVir=true)");
PbcAiuc pbcAiuc;
- setPbcAiuc(fr->bMolPBC ? ePBC2npbcdim(fr->ePBC) : 0, box, &pbcAiuc);
+ setPbcAiuc(fr->bMolPBC ? numPbcDimensions(fr->pbcType) : 0, box, &pbcAiuc);
int fTypeRangeEnd = kernelParams_.fTypeRangeEnd[numFTypesOnGpu - 1];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/force.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
namespace
{
+using gmx::ArrayRef;
+
/*! \brief Return true if ftype is an explicit pair-listed LJ or
* COULOMB interaction type: bonded LJ (usually 1-4), or special
* listed non-bonded for FEP. */
real calc_one_bond(int thread,
int ftype,
const t_idef* idef,
+ ArrayRef<const int> iatoms,
+ const int numNonperturbedInteractions,
const WorkDivision& workDivision,
const rvec x[],
rvec4 f[],
"The topology should be marked either as no FE or sorted on FE");
const bool havePerturbedInteractions =
- (idef->ilsort == ilsortFE_SORTED && idef->il[ftype].nr_nonperturbed < idef->il[ftype].nr);
+ (idef->ilsort == ilsortFE_SORTED && numNonperturbedInteractions < iatoms.ssize());
BondedKernelFlavor flavor =
selectBondedKernelFlavor(stepWork, fr->use_simd_kernels, havePerturbedInteractions);
int efptFTYPE;
efptFTYPE = efptBONDED;
}
- const int nat1 = interaction_function[ftype].nratoms + 1;
- const int nbonds = idef->il[ftype].nr / nat1;
- const t_iatom* iatoms = idef->il[ftype].iatoms;
+ const int nat1 = interaction_function[ftype].nratoms + 1;
+ const int nbonds = iatoms.ssize() / nat1;
- GMX_ASSERT(fr->gpuBonded != nullptr || workDivision.end(ftype) == idef->il[ftype].nr,
+ GMX_ASSERT(fr->gpuBonded != nullptr || workDivision.end(ftype) == iatoms.ssize(),
"The thread division should match the topology");
const int nb0 = workDivision.bound(ftype, thread);
nice to account to its own subtimer, but first
wallcycle needs to be extended to support calling from
multiple threads. */
- v = cmap_dihs(nbn, iatoms + nb0, idef->iparams, idef->cmap_grid, x, f, fshift, pbc, g,
- lambda[efptFTYPE], &(dvdl[efptFTYPE]), md, fcd, global_atom_index);
+ v = cmap_dihs(nbn, iatoms.data() + nb0, idef->iparams, idef->cmap_grid, x, f, fshift,
+ pbc, g, lambda[efptFTYPE], &(dvdl[efptFTYPE]), md, fcd, global_atom_index);
}
else
{
- v = calculateSimpleBond(ftype, nbn, iatoms + nb0, idef->iparams, x, f, fshift, pbc, g,
- lambda[efptFTYPE], &(dvdl[efptFTYPE]), md, fcd,
+ v = calculateSimpleBond(ftype, nbn, iatoms.data() + nb0, idef->iparams, x, f, fshift,
+ pbc, g, lambda[efptFTYPE], &(dvdl[efptFTYPE]), md, fcd,
global_atom_index, flavor);
}
}
/* TODO The execution time for pairs might be nice to account
to its own subtimer, but first wallcycle needs to be
extended to support calling from multiple threads. */
- do_pairs(ftype, nbn, iatoms + nb0, idef->iparams, x, f, fshift, pbc, g, lambda, dvdl, md,
- fr, havePerturbedInteractions, stepWork, grpp, global_atom_index);
+ do_pairs(ftype, nbn, iatoms.data() + nb0, idef->iparams, x, f, fshift, pbc, g, lambda, dvdl,
+ md, fr, havePerturbedInteractions, stepWork, grpp, global_atom_index);
}
if (thread == 0)
/* Loop over all bonded force types to calculate the bonded forces */
for (ftype = 0; (ftype < F_NRE); ftype++)
{
- if (idef->il[ftype].nr > 0 && ftype_is_bonded_potential(ftype))
+ const t_ilist& ilist = idef->il[ftype];
+ if (ilist.nr > 0 && ftype_is_bonded_potential(ftype))
{
- v = calc_one_bond(thread, ftype, idef, fr->bondedThreading->workDivision, x, ft,
- fshift, fr, pbc_null, g, grpp, nrnb, lambda, dvdlt, md, fcd,
- stepWork, global_atom_index);
+ ArrayRef<const int> iatoms = gmx::constArrayRefFromArray(ilist.iatoms, ilist.nr);
+ v = calc_one_bond(
+ thread, ftype, idef, iatoms, idef->numNonperturbedInteractions[ftype],
+ fr->bondedThreading->workDivision, x, ft, fshift, fr, pbc_null, g, grpp,
+ nrnb, lambda, dvdlt, md, fcd, stepWork, global_atom_index);
epot[ftype] += v;
}
}
* do with checking graph!=nullptr, which should tell us if we made
* molecules whole before calling the current function.
*/
- GMX_RELEASE_ASSERT(fr->ePBC == epbcNONE || g != nullptr,
+ GMX_RELEASE_ASSERT(fr->pbcType == PbcType::No || g != nullptr,
"With orientation restraints molecules should be whole");
enerd->term[F_ORIRESDEV] = calc_orires_dev(ms, idef->il[F_ORIRES].nr, idef->il[F_ORIRES].iatoms,
idef->iparams, md, x, pbc_null, fcd, hist);
const struct t_graph* g,
gmx_grppairener_t* grpp,
real* epot,
+ gmx::ArrayRef<real> dvdl,
t_nrnb* nrnb,
const real* lambda,
const t_mdatoms* md,
int* global_atom_index)
{
real v;
- real dvdl_dum[efptNR] = { 0 };
rvec4* f;
rvec* fshift;
const t_pbc* pbc_null;
if (ftype_is_bonded_potential(ftype))
{
const t_ilist& ilist = idef->il[ftype];
- /* Create a temporary t_ilist with only perturbed interactions */
- t_ilist& ilist_fe = idef_fe.il[ftype];
- ilist_fe.iatoms = ilist.iatoms + ilist.nr_nonperturbed;
- ilist_fe.nr_nonperturbed = 0;
- ilist_fe.nr = ilist.nr - ilist.nr_nonperturbed;
+ /* Create a temporary iatom list with only perturbed interactions */
+ const int numNonperturbed = idef->numNonperturbedInteractions[ftype];
+ ArrayRef<const int> iatoms = gmx::constArrayRefFromArray(ilist.iatoms + numNonperturbed,
+ ilist.nr - numNonperturbed);
+ t_ilist& ilist_fe = idef_fe.il[ftype];
/* Set the work range of thread 0 to the perturbed bondeds */
workDivision.setBound(ftype, 0, 0);
- workDivision.setBound(ftype, 1, ilist_fe.nr);
+ workDivision.setBound(ftype, 1, iatoms.ssize());
if (ilist_fe.nr > 0)
{
gmx::StepWorkload tempFlags;
tempFlags.computeEnergy = true;
- v = calc_one_bond(0, ftype, &idef_fe, workDivision, x, f, fshift, fr, pbc_null, g,
- grpp, nrnb, lambda, dvdl_dum, md, fcd, tempFlags, global_atom_index);
+ v = calc_one_bond(0, ftype, idef, iatoms, iatoms.ssize(), workDivision, x, f,
+ fshift, fr, pbc_null, g, grpp, nrnb, lambda, dvdl.data(), md, fcd,
+ tempFlags, global_atom_index);
epot[ftype] += v;
}
}
if ((idef->il[F_POSRES].nr > 0) || (idef->il[F_FBPOSRES].nr > 0))
{
/* Not enough flops to bother counting */
- set_pbc(&pbc_full, fr->ePBC, box);
+ set_pbc(&pbc_full, fr->pbcType, box);
}
calc_listed(cr, ms, wcycle, idef, x, hist, forceOutputs, fr, pbc, &pbc_full, graph, enerd, nrnb,
lambda, md, fcd, global_atom_index, stepWork);
*/
if (fepvals->n_lambda > 0 && stepWork.computeDhdl)
{
+ real dvdl[efptNR] = { 0 };
posres_wrapper_lambda(wcycle, fepvals, idef, &pbc_full, x, enerd, lambda, fr);
if (idef->ilsort != ilsortNO_FE)
lam_i[j] = (i == 0 ? lambda[j] : fepvals->all_lambda[j][i - 1]);
}
calc_listed_lambda(idef, x, fr, pbc, graph, &(enerd->foreign_grpp),
- enerd->foreign_term, nrnb, lam_i, md, fcd, global_atom_index);
+ enerd->foreign_term, dvdl, nrnb, lam_i, md, fcd, global_atom_index);
sum_epot(&(enerd->foreign_grpp), enerd->foreign_term);
enerd->enerpart_lambda[i] += enerd->foreign_term[F_EPOT];
+ for (int j = 0; j < efptNR; j++)
+ {
+ enerd->dhdlLambda[i] += dvdl[j];
+ dvdl[j] = 0;
+ }
}
wallcycle_sub_stop(wcycle, ewcsLISTED_FEP);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
class ForceOutputs;
class StepWorkload;
+template<typename>
+class ArrayRef;
} // namespace gmx
//! Type of CPU function to compute a bonded interaction.
const struct t_graph* g,
gmx_grppairener_t* grpp,
real* epot,
+ gmx::ArrayRef<real> dvdl,
t_nrnb* nrnb,
const real* lambda,
const t_mdatoms* md,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const t_ilist& ilist = idef.il[ftype];
- return (idef.ilsort != ilsortNO_FE && ilist.nr_nonperturbed != ilist.nr);
+ return (idef.ilsort != ilsortNO_FE && idef.numNonperturbedInteractions[ftype] != ilist.nr);
}
//! Divides bonded interactions over threads and GPU
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/listed_forces/bonded.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/vec.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/group.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/pbcutil/ishift.h"
real fscal_vdw[2], fscal_elec[2];
real velec[2], vvdw[2];
int i, ntab;
- const real half = 0.5;
- const real minusOne = -1.0;
- const real one = 1.0;
- const real two = 2.0;
- const real six = 6.0;
- const real fourtyeight = 48.0;
+ const real half = 0.5;
+ const real minusOne = -1.0;
+ const real one = 1.0;
+ const real two = 2.0;
+ const real six = 6.0;
qq[0] = qqA;
qq[1] = qqB;
rpm2 = r2 * r2; /* r4 */
rp = rpm2 * r2; /* r6 */
}
- else if (sc_r_power == fourtyeight)
- {
- rp = r2 * r2 * r2; /* r6 */
- rp = rp * rp; /* r12 */
- rp = rp * rp; /* r24 */
- rp = rp * rp; /* r48 */
- rpm2 = rp / r2; /* r46 */
- }
else
{
rp = std::pow(r2, half * sc_r_power); /* not currently supported as input, but can handle it */
{
sigma_pow[i] = sigma6[i];
}
- else if (sc_r_power == fourtyeight)
- {
- sigma_pow[i] = sigma6[i] * sigma6[i]; /* sigma^12 */
- sigma_pow[i] = sigma_pow[i] * sigma_pow[i]; /* sigma^24 */
- sigma_pow[i] = sigma_pow[i] * sigma_pow[i]; /* sigma^48 */
- }
else
{ /* not really supported as input, but in here for testing the general case*/
sigma_pow[i] = std::pow(sigma2[i], sc_r_power / 2);
}
else
{
- set_pbc(&pbc_no, epbcNONE, nullptr);
+ set_pbc(&pbc_no, PbcType::No, nullptr);
pbc_nonnull = &pbc_no;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#define GMX_LISTED_FORCES_PAIRS_H
#include "gromacs/math/vec.h"
-#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx::ForceWithVirial* forceWithVirial,
const t_pbc* pbc,
int refcoord_scaling,
- int ePBC,
+ PbcType pbcType,
const rvec com)
/* compute flat-bottomed positions restraints */
{
rvec com_sc, rdist, dx, dpdl, fm;
gmx_bool bInvert;
- npbcdim = ePBC2npbcdim(ePBC);
- GMX_ASSERT((ePBC == epbcNONE) == (npbcdim == 0), "");
+ npbcdim = numPbcDimensions(pbcType);
+ GMX_ASSERT((pbcType == PbcType::No) == (npbcdim == 0), "");
if (refcoord_scaling == erscCOM)
{
clear_rvec(com_sc);
real lambda,
real* dvdlambda,
int refcoord_scaling,
- int ePBC,
+ PbcType pbcType,
const rvec comA,
const rvec comB)
{
real kk, fm;
rvec comA_sc, comB_sc, rdist, dpdl, dx;
- npbcdim = ePBC2npbcdim(ePBC);
- GMX_ASSERT((ePBC == epbcNONE) == (npbcdim == 0), "");
+ npbcdim = numPbcDimensions(pbcType);
+ GMX_ASSERT((pbcType == PbcType::No) == (npbcdim == 0), "");
if (refcoord_scaling == erscCOM)
{
clear_rvec(comA_sc);
dvdl = 0;
v = posres<true>(idef->il[F_POSRES].nr, idef->il[F_POSRES].iatoms, idef->iparams_posres, x,
- forceWithVirial, fr->ePBC == epbcNONE ? nullptr : pbc, lambda[efptRESTRAINT],
- &dvdl, fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB);
+ forceWithVirial, fr->pbcType == PbcType::No ? nullptr : pbc, lambda[efptRESTRAINT],
+ &dvdl, fr->rc_scaling, fr->pbcType, fr->posres_com, fr->posres_comB);
enerd->term[F_POSRES] += v;
/* If just the force constant changes, the FEP term is linear,
* but if k changes, it is not.
wallcycle_sub_start_nocount(wcycle, ewcsRESTRAINTS);
for (size_t i = 0; i < enerd->enerpart_lambda.size(); i++)
{
- real dvdl_dum = 0, lambda_dum;
+ real dvdl = 0;
- lambda_dum = (i == 0 ? lambda[efptRESTRAINT] : fepvals->all_lambda[efptRESTRAINT][i - 1]);
+ const real lambda_dum =
+ (i == 0 ? lambda[efptRESTRAINT] : fepvals->all_lambda[efptRESTRAINT][i - 1]);
v = posres<false>(idef->il[F_POSRES].nr, idef->il[F_POSRES].iatoms, idef->iparams_posres, x,
- nullptr, fr->ePBC == epbcNONE ? nullptr : pbc, lambda_dum, &dvdl_dum,
- fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB);
+ nullptr, fr->pbcType == PbcType::No ? nullptr : pbc, lambda_dum, &dvdl,
+ fr->rc_scaling, fr->pbcType, fr->posres_com, fr->posres_comB);
enerd->enerpart_lambda[i] += v;
+ enerd->dhdlLambda[i] += dvdl;
}
wallcycle_sub_stop(wcycle, ewcsRESTRAINTS);
}
real v;
v = fbposres(idef->il[F_FBPOSRES].nr, idef->il[F_FBPOSRES].iatoms, idef->iparams_fbposres, x,
- forceWithVirial, fr->ePBC == epbcNONE ? nullptr : pbc, fr->rc_scaling, fr->ePBC,
- fr->posres_com);
+ forceWithVirial, fr->pbcType == PbcType::No ? nullptr : pbc, fr->rc_scaling,
+ fr->pbcType, fr->posres_com);
enerd->term[F_FBPOSRES] += v;
inc_nrnb(nrnb, eNR_FBPOSRES, gmx::exactDiv(idef->il[F_FBPOSRES].nr, 2));
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
class ListedForcesTest :
- public ::testing::TestWithParam<std::tuple<iListInput, std::vector<gmx::RVec>, int>>
+ public ::testing::TestWithParam<std::tuple<iListInput, std::vector<gmx::RVec>, PbcType>>
{
protected:
matrix box_;
t_pbc pbc_;
std::vector<gmx::RVec> x_;
- int epbc_;
+ PbcType pbcType_;
iListInput input_;
test::TestReferenceData refData_;
test::TestReferenceChecker checker_;
ListedForcesTest() : checker_(refData_.rootChecker())
{
- input_ = std::get<0>(GetParam());
- x_ = std::get<1>(GetParam());
- epbc_ = std::get<2>(GetParam());
+ input_ = std::get<0>(GetParam());
+ x_ = std::get<1>(GetParam());
+ pbcType_ = std::get<2>(GetParam());
clear_mat(box_);
box_[0][0] = box_[1][1] = box_[2][2] = 1.5;
- set_pbc(&pbc_, epbc_, box_);
+ set_pbc(&pbc_, pbcType_, box_);
// We need quite specific tolerances here since angle functions
// etc. are not very precise and reproducible.
test::FloatingPointTolerance tolerance(test::FloatingPointTolerance(
}
void testOneIfunc(test::TestReferenceChecker* checker, const std::vector<t_iatom>& iatoms, const real lambda)
{
- SCOPED_TRACE(std::string("Testing PBC ") + epbc_names[epbc_]);
+ SCOPED_TRACE(std::string("Testing PBC ") + c_pbcTypeNames[pbcType_]);
std::vector<int> ddgatindex = { 0, 1, 2, 3 };
std::vector<real> chargeA = { 1.5, -2.0, 1.5, -1.0 };
t_mdatoms mdatoms = { 0 };
};
//! PBC values for testing
-std::vector<int> c_pbcForTests = { epbcNONE, epbcXY, epbcXYZ };
+std::vector<PbcType> c_pbcForTests = { PbcType::No, PbcType::XY, PbcType::Xyz };
// Those tests give errors with the intel compiler and nothing else, so we disable them only there.
#ifndef __INTEL_COMPILER
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
EXPECT_LE(v.paddedSize(), vReserved.paddedSize());
}
+TYPED_TEST(PaddedVectorTest, ArrayRefConversionsAreIdentical)
+{
+ using VectorType = PaddedVector<typename TypeParam::value_type, TypeParam>;
+
+ VectorType v;
+ fillInput(&v, 1);
+
+ SCOPED_TRACE("Comparing different paths to create identical unpadded views");
+ compareViews(makeArrayRef(v), v.arrayRefWithPadding().unpaddedArrayRef());
+ compareViews(makeConstArrayRef(v), v.constArrayRefWithPadding().unpaddedConstArrayRef());
+ compareViews(makeConstArrayRef(v), v.constArrayRefWithPadding().unpaddedArrayRef());
+ compareViews(makeConstArrayRef(v), v.arrayRefWithPadding().unpaddedConstArrayRef());
+
+ SCOPED_TRACE("Comparing const to non-const unpadded views");
+ compareViewsIgnoreConst(makeArrayRef(v), makeConstArrayRef(v));
+}
+
TYPED_TEST(PaddedVectorTest, CanCopyAssign)
{
using VectorType = PaddedVector<typename TypeParam::value_type, TypeParam>;
w = v;
compareViews(v.arrayRefWithPadding().unpaddedArrayRef(), w.arrayRefWithPadding().unpaddedArrayRef());
- compareViews(makeArrayRef(v), makeArrayRef(v));
+ compareViews(makeArrayRef(v), makeArrayRef(w));
}
TYPED_TEST(PaddedVectorTest, CanMoveAssign)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
}
+//! Comparison for non-BasicVector ignoring const qualifiers
+template<typename T, typename U>
+typename std::enable_if<std::is_same<typename std::remove_const<T>::type, typename std::remove_const<U>::type>::value, void>::type
+compareViewsIgnoreConst(ArrayRef<T> input, ArrayRef<U> output)
+{
+ ASSERT_EQ(input.size(), output.size());
+ for (index i = 0; i != input.ssize(); ++i)
+ {
+ EXPECT_EQ(input[i], output[i]) << "for index " << i;
+ }
+}
+
//! Comparison overload for BasicVector<T>
template<typename T>
void compareViews(ArrayRef<BasicVector<T>> input, ArrayRef<BasicVector<T>> output)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
endif()
if(GMX_USE_CUDA)
gmx_add_libgromacs_sources(
- lincs_cuda.cu
- settle_cuda.cu
- leapfrog_cuda.cu
- update_constrain_cuda_impl.cu
+ leapfrog_gpu.cu
+ lincs_gpu.cu
+ settle_gpu.cu
+ update_constrain_gpu_impl.cu
)
endif()
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pulling/pull.h"
#include "gromacs/timing/wallcycle.h"
-#include "gromacs/topology/block.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/mtop_lookup.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/pleasecite.h"
-#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/txtdump.h"
namespace gmx
int numSettles);
~Impl();
void setConstraints(const gmx_localtop_t& top, const t_mdatoms& md);
- bool apply(bool bLog,
- bool bEner,
- int64_t step,
- int delta_step,
- real step_scaling,
- rvec* x,
- rvec* xprime,
- rvec* min_proj,
- const matrix box,
- real lambda,
- real* dvdlambda,
- rvec* v,
- tensor* vir,
- ConstraintVariable econq);
+ bool apply(bool bLog,
+ bool bEner,
+ int64_t step,
+ int delta_step,
+ real step_scaling,
+ ArrayRefWithPadding<RVec> x,
+ ArrayRefWithPadding<RVec> xprime,
+ ArrayRef<RVec> min_proj,
+ const matrix box,
+ real lambda,
+ real* dvdlambda,
+ ArrayRefWithPadding<RVec> v,
+ tensor* vir,
+ ConstraintVariable econq);
//! The total number of constraints.
int ncon_tot = 0;
//! The number of flexible constraints.
int nflexcon = 0;
//! A list of atoms to constraints for each moleculetype.
- std::vector<t_blocka> at2con_mt;
+ std::vector<ListOfLists<int>> at2con_mt;
//! A list of atoms to settles for each moleculetype
std::vector<std::vector<int>> at2settle_mt;
//! LINCS data.
}
//! Clears constraint quantities for atoms in nonlocal region.
-static void clear_constraint_quantity_nonlocal(gmx_domdec_t* dd, rvec* q)
+static void clear_constraint_quantity_nonlocal(gmx_domdec_t* dd, ArrayRef<RVec> q)
{
int nonlocal_at_start, nonlocal_at_end, at;
}
//! Writes out coordinates.
-static void write_constr_pdb(const char* fn,
- const char* title,
- const gmx_mtop_t& mtop,
- int start,
- int homenr,
- const t_commrec* cr,
- const rvec x[],
- const matrix box)
+static void write_constr_pdb(const char* fn,
+ const char* title,
+ const gmx_mtop_t& mtop,
+ int start,
+ int homenr,
+ const t_commrec* cr,
+ ArrayRef<const RVec> x,
+ const matrix box)
{
char fname[STRLEN];
FILE* out;
out = gmx_fio_fopen(fname, "w");
fprintf(out, "TITLE %s\n", title);
- gmx_write_pdb_box(out, -1, box);
+ gmx_write_pdb_box(out, PbcType::Unset, box);
int molb = 0;
for (i = start; i < start + homenr; i++)
{
}
//! Writes out domain contents to help diagnose crashes.
-static void dump_confs(FILE* log,
- int64_t step,
- const gmx_mtop_t& mtop,
- int start,
- int homenr,
- const t_commrec* cr,
- const rvec x[],
- rvec xprime[],
- const matrix box)
+static void dump_confs(FILE* log,
+ int64_t step,
+ const gmx_mtop_t& mtop,
+ int start,
+ int homenr,
+ const t_commrec* cr,
+ ArrayRef<const RVec> x,
+ ArrayRef<const RVec> xprime,
+ const matrix box)
{
char buf[STRLEN], buf2[22];
fprintf(stderr, "Wrote pdb files with previous and current coordinates\n");
}
-bool Constraints::apply(bool bLog,
- bool bEner,
- int64_t step,
- int delta_step,
- real step_scaling,
- rvec* x,
- rvec* xprime,
- rvec* min_proj,
- const matrix box,
- real lambda,
- real* dvdlambda,
- rvec* v,
- tensor* vir,
- ConstraintVariable econq)
+bool Constraints::apply(bool bLog,
+ bool bEner,
+ int64_t step,
+ int delta_step,
+ real step_scaling,
+ ArrayRefWithPadding<RVec> x,
+ ArrayRefWithPadding<RVec> xprime,
+ ArrayRef<RVec> min_proj,
+ const matrix box,
+ real lambda,
+ real* dvdlambda,
+ ArrayRefWithPadding<RVec> v,
+ tensor* vir,
+ ConstraintVariable econq)
{
- return impl_->apply(bLog, bEner, step, delta_step, step_scaling, x, xprime, min_proj, box,
- lambda, dvdlambda, v, vir, econq);
+ return impl_->apply(bLog, bEner, step, delta_step, step_scaling, std::move(x), std::move(xprime),
+ min_proj, box, lambda, dvdlambda, std::move(v), vir, econq);
}
-bool Constraints::Impl::apply(bool bLog,
- bool bEner,
- int64_t step,
- int delta_step,
- real step_scaling,
- rvec* x,
- rvec* xprime,
- rvec* min_proj,
- const matrix box,
- real lambda,
- real* dvdlambda,
- rvec* v,
- tensor* vir,
- ConstraintVariable econq)
+bool Constraints::Impl::apply(bool bLog,
+ bool bEner,
+ int64_t step,
+ int delta_step,
+ real step_scaling,
+ ArrayRefWithPadding<RVec> x,
+ ArrayRefWithPadding<RVec> xprime,
+ ArrayRef<RVec> min_proj,
+ const matrix box,
+ real lambda,
+ real* dvdlambda,
+ ArrayRefWithPadding<RVec> v,
+ tensor* vir,
+ ConstraintVariable econq)
{
bool bOK, bDump;
int start, homenr;
* Note that PBC for constraints is different from PBC for bondeds.
* For constraints there is both forward and backward communication.
*/
- if (ir.ePBC != epbcNONE && (cr->dd || pbcHandlingRequired_)
+ if (ir.pbcType != PbcType::No && (cr->dd || pbcHandlingRequired_)
&& !(cr->dd && cr->dd->constraint_comm == nullptr))
{
/* With pbc=screw the screw has been changed to a shift
* by the constraint coordinate communication routine,
* so that here we can use normal pbc.
*/
- pbc_null = set_pbc_dd(&pbc, ir.ePBC, DOMAINDECOMP(cr) ? cr->dd->nc : nullptr, FALSE, box);
+ pbc_null = set_pbc_dd(&pbc, ir.pbcType, DOMAINDECOMP(cr) ? cr->dd->numCells : nullptr, FALSE, box);
}
else
{
*/
if (cr->dd)
{
- dd_move_x_constraints(cr->dd, box, x, xprime, econq == ConstraintVariable::Positions);
+ dd_move_x_constraints(cr->dd, box, x.unpaddedArrayRef(), xprime.unpaddedArrayRef(),
+ econq == ConstraintVariable::Positions);
- if (v != nullptr)
+ if (!v.empty())
{
/* We need to initialize the non-local components of v.
* We never actually use these values, but we do increment them,
* so we should avoid uninitialized variables and overflows.
*/
- clear_constraint_quantity_nonlocal(cr->dd, v);
+ clear_constraint_quantity_nonlocal(cr->dd, v.unpaddedArrayRef());
}
}
if (lincsd != nullptr)
{
bOK = constrain_lincs(bLog || bEner, ir, step, lincsd, md, cr, ms, x, xprime, min_proj, box,
- pbc_null, lambda, dvdlambda, invdt, v, vir != nullptr, vir_r_m_dr,
- econq, nrnb, maxwarn, &warncount_lincs);
+ pbc_null, lambda, dvdlambda, invdt, v.unpaddedArrayRef(),
+ vir != nullptr, vir_r_m_dr, econq, nrnb, maxwarn, &warncount_lincs);
if (!bOK && maxwarn < INT_MAX)
{
if (log != nullptr)
if (shaked != nullptr)
{
- bOK = constrain_shake(log, shaked, md.invmass, *idef, ir, x, xprime, min_proj, nrnb, lambda,
- dvdlambda, invdt, v, vir != nullptr, vir_r_m_dr, maxwarn < INT_MAX, econq);
+ bOK = constrain_shake(
+ log, shaked, md.invmass, *idef, ir, as_rvec_array(x.unpaddedArrayRef().data()),
+ as_rvec_array(xprime.unpaddedArrayRef().data()), as_rvec_array(min_proj.data()),
+ nrnb, lambda, dvdlambda, invdt, as_rvec_array(v.unpaddedArrayRef().data()),
+ vir != nullptr, vir_r_m_dr, maxwarn < INT_MAX, econq);
if (!bOK && maxwarn < INT_MAX)
{
clear_mat(vir_r_m_dr_th[th]);
}
- csettle(settled, nth, th, pbc_null, x[0], xprime[0], invdt, v ? v[0] : nullptr,
- vir != nullptr, th == 0 ? vir_r_m_dr : vir_r_m_dr_th[th],
+ csettle(settled, nth, th, pbc_null, x, xprime, invdt, v, vir != nullptr,
+ th == 0 ? vir_r_m_dr : vir_r_m_dr_th[th],
th == 0 ? &bSettleErrorHasOccurred0 : &bSettleErrorHasOccurred[th]);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
inc_nrnb(nrnb, eNR_SETTLE, nsettle);
- if (v != nullptr)
+ if (!v.empty())
{
inc_nrnb(nrnb, eNR_CONSTR_V, nsettle * 3);
}
{
settle_proj(settled, econq, end_th - start_th,
settle->iatoms + start_th * (1 + NRAL(F_SETTLE)), pbc_null,
- x, xprime, min_proj, calcvir_atom_end,
- th == 0 ? vir_r_m_dr : vir_r_m_dr_th[th]);
+ x.unpaddedArrayRef(), xprime.unpaddedArrayRef(), min_proj,
+ calcvir_atom_end, th == 0 ? vir_r_m_dr : vir_r_m_dr_th[th]);
}
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
if (bDump)
{
- dump_confs(log, step, mtop, start, homenr, cr, x, xprime, box);
+ dump_confs(log, step, mtop, start, homenr, cr, x.unpaddedArrayRef(),
+ xprime.unpaddedArrayRef(), box);
}
if (econq == ConstraintVariable::Positions)
{
t = ir.init_t;
}
- set_pbc(&pbc, ir.ePBC, box);
- pull_constraint(pull_work, &md, &pbc, cr, ir.delta_t, t, x, xprime, v, *vir);
+ set_pbc(&pbc, ir.pbcType, box);
+ pull_constraint(pull_work, &md, &pbc, cr, ir.delta_t, t,
+ as_rvec_array(x.unpaddedArrayRef().data()),
+ as_rvec_array(xprime.unpaddedArrayRef().data()),
+ as_rvec_array(v.unpaddedArrayRef().data()), *vir);
}
if (ed && delta_step > 0)
{
/* apply the essential dynamics constraints here */
- do_edsam(&ir, step, cr, xprime, v, box, ed);
+ do_edsam(&ir, step, cr, as_rvec_array(xprime.unpaddedArrayRef().data()),
+ as_rvec_array(v.unpaddedArrayRef().data()), box, ed);
}
}
wallcycle_stop(wcycle, ewcCONSTR);
- if (v != nullptr && md.cFREEZE)
+ if (!v.empty() && md.cFREEZE)
{
/* Set the velocities of frozen dimensions to zero */
+ ArrayRef<RVec> vRef = v.unpaddedArrayRef();
int gmx_unused numThreads = gmx_omp_nthreads_get(emntUpdate);
{
if (ir.opts.nFreeze[freezeGroup][d])
{
- v[i][d] = 0;
+ vRef[i][d] = 0;
}
}
}
* \param[in] numAtoms The number of atoms to construct the list for
* \param[in] ilists The interaction lists, size F_NRE
* \param[in] iparams Interaction parameters, can be null when
- * flexibleConstraintTreatment=Include \param[in] flexibleConstraintTreatment The flexible
- * constraint treatment, see enum above \returns a block struct with all constraints for each atom
+ * \p flexibleConstraintTreatment==Include
+ * \param[in] flexibleConstraintTreatment The flexible constraint treatment,
+ * see enum above
+ *
+ * \returns a block struct with all constraints for each atom
*/
template<typename T>
-static t_blocka makeAtomsToConstraintsList(int numAtoms,
- const T* ilists,
- const t_iparams* iparams,
- FlexibleConstraintTreatment flexibleConstraintTreatment)
+static ListOfLists<int> makeAtomsToConstraintsList(int numAtoms,
+ const T* ilists,
+ const t_iparams* iparams,
+ FlexibleConstraintTreatment flexibleConstraintTreatment)
{
GMX_ASSERT(flexibleConstraintTreatment == FlexibleConstraintTreatment::Include || iparams != nullptr,
"With flexible constraint detection we need valid iparams");
}
}
- t_blocka at2con;
- at2con.nr = numAtoms;
- at2con.nalloc_index = at2con.nr + 1;
- snew(at2con.index, at2con.nalloc_index);
- at2con.index[0] = 0;
+ std::vector<int> listRanges(numAtoms + 1);
for (int a = 0; a < numAtoms; a++)
{
- at2con.index[a + 1] = at2con.index[a] + count[a];
- count[a] = 0;
+ listRanges[a + 1] = listRanges[a] + count[a];
+ count[a] = 0;
}
- at2con.nra = at2con.index[at2con.nr];
- at2con.nalloc_a = at2con.nra;
- snew(at2con.a, at2con.nalloc_a);
+ std::vector<int> elements(listRanges[numAtoms]);
/* The F_CONSTRNC constraints have constraint numbers
* that continue after the last F_CONSTR constraint.
{
for (int j = 1; j < 3; j++)
{
- int a = ilist.iatoms[i + j];
- at2con.a[at2con.index[a] + count[a]++] = numConstraints;
+ const int a = ilist.iatoms[i + j];
+ elements[listRanges[a] + count[a]++] = numConstraints;
}
}
numConstraints++;
}
}
- return at2con;
+ return ListOfLists<int>(std::move(listRanges), std::move(elements));
}
-t_blocka make_at2con(int numAtoms,
- const t_ilist* ilist,
- const t_iparams* iparams,
- FlexibleConstraintTreatment flexibleConstraintTreatment)
+ListOfLists<int> make_at2con(int numAtoms,
+ const t_ilist* ilist,
+ const t_iparams* iparams,
+ FlexibleConstraintTreatment flexibleConstraintTreatment)
{
return makeAtomsToConstraintsList(numAtoms, ilist, iparams, flexibleConstraintTreatment);
}
-t_blocka make_at2con(const gmx_moltype_t& moltype,
- gmx::ArrayRef<const t_iparams> iparams,
- FlexibleConstraintTreatment flexibleConstraintTreatment)
+ListOfLists<int> make_at2con(const gmx_moltype_t& moltype,
+ gmx::ArrayRef<const t_iparams> iparams,
+ FlexibleConstraintTreatment flexibleConstraintTreatment)
{
return makeAtomsToConstraintsList(moltype.atoms.nr, moltype.ilist.data(), iparams.data(),
flexibleConstraintTreatment);
* indices to constraint indices.
*
* Note that flexible constraints are only enabled with a dynamical integrator. */
-static std::vector<t_blocka> makeAtomToConstraintMappings(const gmx_mtop_t& mtop,
- FlexibleConstraintTreatment flexibleConstraintTreatment)
+static std::vector<ListOfLists<int>> makeAtomToConstraintMappings(const gmx_mtop_t& mtop,
+ FlexibleConstraintTreatment flexibleConstraintTreatment)
{
- std::vector<t_blocka> mapping;
+ std::vector<ListOfLists<int>> mapping;
mapping.reserve(mtop.moltype.size());
for (const gmx_moltype_t& moltype : mtop.moltype)
{
Constraints::Impl::~Impl()
{
- for (auto blocka : at2con_mt)
- {
- done_blocka(&blocka);
- }
if (bSettleErrorHasOccurred != nullptr)
{
sfree(bSettleErrorHasOccurred);
impl_->ed = ed;
}
-ArrayRef<const t_blocka> Constraints::atom2constraints_moltype() const
+ArrayRef<const ListOfLists<int>> Constraints::atom2constraints_moltype() const
{
return impl_->at2con_mt;
}
int64_t step;
real dt = ir->delta_t;
real dvdl_dum;
- rvec* savex;
- auto xRvec = as_rvec_array(x.paddedArrayRef().data());
- auto vRvec = as_rvec_array(v.paddedArrayRef().data());
-
- /* We need to allocate one element extra, since we might use
- * (unaligned) 4-wide SIMD loads to access rvec entries.
- */
- snew(savex, natoms + 1);
+ PaddedVector<RVec> savex(natoms);
start = 0;
end = md->homenr;
dvdl_dum = 0;
/* constrain the current position */
- constr->apply(TRUE, FALSE, step, 0, 1.0, xRvec, xRvec, nullptr, box, lambda, &dvdl_dum, nullptr,
- nullptr, gmx::ConstraintVariable::Positions);
+ constr->apply(TRUE, FALSE, step, 0, 1.0, x, x, {}, box, lambda, &dvdl_dum, {}, nullptr,
+ gmx::ConstraintVariable::Positions);
if (EI_VV(ir->eI))
{
/* constrain the inital velocity, and save it */
/* also may be useful if we need the ekin from the halfstep for velocity verlet */
- constr->apply(TRUE, FALSE, step, 0, 1.0, xRvec, vRvec, vRvec, box, lambda, &dvdl_dum,
- nullptr, nullptr, gmx::ConstraintVariable::Velocities);
+ constr->apply(TRUE, FALSE, step, 0, 1.0, x, v, v.unpaddedArrayRef(), box, lambda, &dvdl_dum,
+ {}, nullptr, gmx::ConstraintVariable::Velocities);
}
/* constrain the inital velocities at t-dt/2 */
if (EI_STATE_VELOCITY(ir->eI) && ir->eI != eiVV)
fprintf(fplog, "\nConstraining the coordinates at t0-dt (step %s)\n", gmx_step_str(step, buf));
}
dvdl_dum = 0;
- constr->apply(TRUE, FALSE, step, -1, 1.0, xRvec, savex, nullptr, box, lambda, &dvdl_dum,
- vRvec, nullptr, gmx::ConstraintVariable::Positions);
+ constr->apply(TRUE, FALSE, step, -1, 1.0, x, savex.arrayRefWithPadding(), {}, box, lambda,
+ &dvdl_dum, v, nullptr, gmx::ConstraintVariable::Positions);
for (i = start; i < end; i++)
{
}
}
}
- sfree(savex);
}
} // namespace gmx
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct gmx_multisim_t;
struct gmx_wallcycle;
struct pull_t;
-struct t_blocka;
struct t_commrec;
struct t_ilist;
struct t_inputrec;
{
template<typename T>
class ArrayRefWithPadding;
+template<typename>
+class ListOfLists;
//! Describes supported flavours of constrained updates.
enum class ConstraintVariable : int
/*! \brief Applies constraints to coordinates.
*
* When econq=ConstraintVariable::Positions constrains
- * coordinates xprime using th directions in x, min_proj is
+ * coordinates xprime using the directions in x, min_proj is
* not used.
*
* When econq=ConstraintVariable::Derivative, calculates the
* If vir!=NULL calculate the constraint virial.
*
* Return whether the application of constraints succeeded without error.
+ *
+ * /note x is non-const, because non-local atoms need to be communicated.
*/
- bool apply(bool bLog,
- bool bEner,
- int64_t step,
- int delta_step,
- real step_scaling,
- rvec* x,
- rvec* xprime,
- rvec* min_proj,
- const matrix box,
- real lambda,
- real* dvdlambda,
- rvec* v,
- tensor* vir,
- ConstraintVariable econq);
+ bool apply(bool bLog,
+ bool bEner,
+ int64_t step,
+ int delta_step,
+ real step_scaling,
+ ArrayRefWithPadding<RVec> x,
+ ArrayRefWithPadding<RVec> xprime,
+ ArrayRef<RVec> min_proj,
+ const matrix box,
+ real lambda,
+ real* dvdlambda,
+ ArrayRefWithPadding<RVec> v,
+ tensor* vir,
+ ConstraintVariable econq);
//! Links the essentialdynamics and constraint code.
void saveEdsamPointer(gmx_edsam* ed);
//! Getter for use by domain decomposition.
- ArrayRef<const t_blocka> atom2constraints_moltype() const;
+ ArrayRef<const ListOfLists<int>> atom2constraints_moltype() const;
//! Getter for use by domain decomposition.
ArrayRef<const std::vector<int>> atom2settle_moltype() const;
/*! \brief Returns the flexible constraint treatment depending on whether the integrator is dynamic */
FlexibleConstraintTreatment flexibleConstraintTreatment(bool haveDynamicsIntegrator);
-/*! \brief Returns a block struct to go from atoms to constraints
+/*! \brief Returns a ListOfLists object to go from atoms to constraints
*
- * The block struct will contain constraint indices with lower indices
+ * The object will contain constraint indices with lower indices
* directly matching the order in F_CONSTR and higher indices matching
* the order in F_CONSTRNC offset by the number of constraints in F_CONSTR.
*
* \param[in] moltype The molecule data
* \param[in] iparams Interaction parameters, can be null when
- * flexibleConstraintTreatment=Include \param[in] flexibleConstraintTreatment The flexible
- * constraint treatment, see enum above \returns a block struct with all constraints for each atom
+ * \p flexibleConstraintTreatment==Include
+ * \param[in] flexibleConstraintTreatment The flexible constraint treatment,
+ * see enum above
+ *
+ * \returns a ListOfLists object with all constraints for each atom
*/
-t_blocka make_at2con(const gmx_moltype_t& moltype,
- gmx::ArrayRef<const t_iparams> iparams,
- FlexibleConstraintTreatment flexibleConstraintTreatment);
+ListOfLists<int> make_at2con(const gmx_moltype_t& moltype,
+ gmx::ArrayRef<const t_iparams> iparams,
+ FlexibleConstraintTreatment flexibleConstraintTreatment);
-/*! \brief Returns a block struct to go from atoms to constraints
+/*! \brief Returns a ListOfLists object to go from atoms to constraints
*
- * The block struct will contain constraint indices with lower indices
+ * The object will contain constraint indices with lower indices
* directly matching the order in F_CONSTR and higher indices matching
* the order in F_CONSTRNC offset by the number of constraints in F_CONSTR.
*
* \param[in] numAtoms The number of atoms to construct the list for
* \param[in] ilist Interaction list, size F_NRE
* \param[in] iparams Interaction parameters, can be null when
- * flexibleConstraintTreatment=Include \param[in] flexibleConstraintTreatment The flexible
- * constraint treatment, see enum above \returns a block struct with all constraints for each atom
+ * \p flexibleConstraintTreatment==Include
+ * \param[in] flexibleConstraintTreatment The flexible constraint treatment,
+ * see enum above
+ *
+ * \returns a ListOfLists object with all constraints for each atom
*/
-t_blocka make_at2con(int numAtoms,
- const t_ilist* ilist,
- const t_iparams* iparams,
- FlexibleConstraintTreatment flexibleConstraintTreatment);
-
-/*! \brief Returns an array of atom to constraints lists for the moltypes */
-const t_blocka* atom2constraints_moltype(const Constraints* constr);
+ListOfLists<int> make_at2con(int numAtoms,
+ const t_ilist* ilist,
+ const t_iparams* iparams,
+ FlexibleConstraintTreatment flexibleConstraintTreatment);
//! Return the number of flexible constraints in the \c ilist and \c iparams.
int countFlexibleConstraints(const t_ilist* ilist, const t_iparams* iparams);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdtypes/inputrec.h"
-#include "gromacs/topology/block.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/real.h"
-#include "gromacs/utility/smalloc.h"
namespace gmx
{
//! Recursing function to help find all adjacent constraints.
-static void constr_recur(const t_blocka* at2con,
+static void constr_recur(const ListOfLists<int>& at2con,
const InteractionLists& ilist,
gmx::ArrayRef<const t_iparams> iparams,
gmx_bool bTopB,
int at,
int depth,
int nc,
- int* path,
+ ArrayRef<int> path,
real r0,
real r1,
real* r2max,
int* count)
{
- int c, con, a1;
gmx_bool bUse;
real len, rn0, rn1;
gmx::ArrayRef<const int> ia2 = ilist[F_CONSTRNC].iatoms;
/* Loop over all constraints connected to this atom */
- for (c = at2con->index[at]; c < at2con->index[at + 1]; c++)
+ for (const int con : at2con[at])
{
- con = at2con->a[c];
/* Do not walk over already used constraints */
bUse = TRUE;
- for (a1 = 0; a1 < depth; a1++)
+ for (int a1 = 0; a1 < depth; a1++)
{
if (con == path[a1])
{
fprintf(debug,
"Found longer constraint distance: r0 %5.3f r1 %5.3f rmax %5.3f\n", rn0,
rn1, sqrt(*r2max));
- for (a1 = 0; a1 < depth; a1++)
+ for (int a1 = 0; a1 < depth; a1++)
{
fprintf(debug, " %d %5.3f", path[a1],
iparams[constr_iatomptr(ia1, ia2, con)[0]].constr.dA);
*/
if (depth + 1 < nc && *count < 1000 * nc)
{
+ int a1;
if (ia[1] == at)
{
a1 = ia[2];
gmx::ArrayRef<const t_iparams> iparams,
const t_inputrec* ir)
{
- int natoms, *path, at, count;
+ int natoms, at, count;
- t_blocka at2con;
- real r0, r1, r2maxA, r2maxB, rmax, lam0, lam1;
+ real r0, r1, r2maxA, r2maxB, rmax, lam0, lam1;
if (molt->ilist[F_CONSTR].size() == 0 && molt->ilist[F_CONSTRNC].size() == 0)
{
natoms = molt->atoms.nr;
- at2con = make_at2con(*molt, iparams, flexibleConstraintTreatment(EI_DYNAMICS(ir->eI)));
- snew(path, 1 + ir->nProjOrder);
+ const ListOfLists<int> at2con =
+ make_at2con(*molt, iparams, flexibleConstraintTreatment(EI_DYNAMICS(ir->eI)));
+ std::vector<int> path(1 + ir->nProjOrder);
for (at = 0; at < 1 + ir->nProjOrder; at++)
{
path[at] = -1;
r1 = 0;
count = 0;
- constr_recur(&at2con, molt->ilist, iparams, FALSE, at, 0, 1 + ir->nProjOrder, path, r0, r1,
+ constr_recur(at2con, molt->ilist, iparams, FALSE, at, 0, 1 + ir->nProjOrder, path, r0, r1,
&r2maxA, &count);
}
if (ir->efep == efepNO)
r0 = 0;
r1 = 0;
count = 0;
- constr_recur(&at2con, molt->ilist, iparams, TRUE, at, 0, 1 + ir->nProjOrder, path, r0,
+ constr_recur(at2con, molt->ilist, iparams, TRUE, at, 0, 1 + ir->nProjOrder, path, r0,
r1, &r2maxB, &count);
}
lam0 = ir->fepvals->init_lambda;
}
}
- done_blocka(&at2con);
- sfree(path);
-
return rmax;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* for now, we use Elr = 0, because if you want to get it right, you
really should be using PME. Maybe print a warning? */
- pscal = calc_pres(ir->ePBC, nwall, box, ekinmod, vir, localpres) + pcorr;
+ pscal = calc_pres(ir->pbcType, nwall, box, ekinmod, vir, localpres) + pcorr;
vol = det(box);
GW = (vol * (MassQ->Winv / PRESFAC)) * (DIM * pscal - trace(ir->ref_p)); /* W is in ps^2 * bar * nm^3 */
*
*/
-real calc_pres(int ePBC, int nwall, const matrix box, const tensor ekin, const tensor vir, tensor pres)
+real calc_pres(PbcType pbcType, int nwall, const matrix box, const tensor ekin, const tensor vir, tensor pres)
{
int n, m;
real fac;
- if (ePBC == epbcNONE || (ePBC == epbcXY && nwall != 2))
+ if (pbcType == PbcType::No || (pbcType == PbcType::XY && nwall != 2))
{
clear_mat(pres);
}
#include "gromacs/math/vec.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/tables/forcetable.h"
*/
for (const gmx_molblock_t& molb : mtop.molblock)
{
- const int nmol = molb.nmol;
- const t_atoms* atoms = &mtop.moltype[molb.type].atoms;
- const t_blocka* excl = &mtop.moltype[molb.type].excls;
+ const int nmol = molb.nmol;
+ const t_atoms* atoms = &mtop.moltype[molb.type].atoms;
+ const auto& excl = mtop.moltype[molb.type].excls;
for (int i = 0; (i < atoms->nr); i++)
{
const int tpi = atomtypeAOrB(atoms->atom[i], q);
- const int j1 = excl->index[i];
- const int j2 = excl->index[i + 1];
- for (int j = j1; j < j2; j++)
+ for (const int k : excl[i])
{
- const int k = excl->a[j];
if (k > i)
{
const int tpj = atomtypeAOrB(atoms->atom[k], q);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_enerdata_t::gmx_enerdata_t(int numEnergyGroups, int numFepLambdas) :
grpp(numEnergyGroups),
enerpart_lambda(numFepLambdas == 0 ? 0 : numFepLambdas + 1),
+ dhdlLambda(numFepLambdas == 0 ? 0 : numFepLambdas + 1),
foreign_grpp(numEnergyGroups)
{
}
int index;
enerd->dvdl_lin[efptVDW] += enerd->term[F_DVDL_VDW]; /* include dispersion correction */
+
+ for (size_t i = 0; i < enerd->enerpart_lambda.size(); i++)
+ {
+ enerd->dhdlLambda[i] += enerd->term[F_DVDL_VDW];
+ }
+
enerd->term[F_DVDL] = 0.0;
for (int i = 0; i < efptNR; i++)
{
}
}
+void reset_dvdl_enerdata(gmx_enerdata_t* enerd)
+{
+ for (int i = 0; i < efptNR; i++)
+ {
+ enerd->dvdl_lin[i] = 0.0;
+ enerd->dvdl_nonlin[i] = 0.0;
+ }
+}
+
void reset_enerdata(gmx_enerdata_t* enerd)
{
int i, j;
enerd->grpp.ener[i][j] = 0.0;
}
}
- for (i = 0; i < efptNR; i++)
- {
- enerd->dvdl_lin[i] = 0.0;
- enerd->dvdl_nonlin[i] = 0.0;
- }
/* Normal potential energy components */
for (i = 0; (i <= F_EPOT); i++)
enerd->term[F_DVDL_RESTRAINT] = 0.0;
enerd->term[F_DKDL] = 0.0;
std::fill(enerd->enerpart_lambda.begin(), enerd->enerpart_lambda.end(), 0);
- /* reset foreign energy data - separate function since we also call it elsewhere */
+ std::fill(enerd->dhdlLambda.begin(), enerd->dhdlLambda.end(), 0);
+ /* reset foreign energy data and dvdl - separate functions since they are also called elsewhere */
reset_foreign_enerdata(enerd);
+ reset_dvdl_enerdata(enerd);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void reset_foreign_enerdata(gmx_enerdata_t* enerd);
/* Resets only the foreign energy data */
+void reset_dvdl_enerdata(gmx_enerdata_t* enerd);
+/* Resets only the dvdl energy data */
+
void reset_enerdata(gmx_enerdata_t* enerd);
/* Resets the energy data */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
bEner_[F_COM_PULL] = ((ir->bPull && pull_have_potential(pull_work)) || ir->bRot);
MdModulesEnergyOutputToDensityFittingRequestChecker mdModulesAddOutputToDensityFittingFieldRequest;
- mdModulesNotifier.notifier_.notify(&mdModulesAddOutputToDensityFittingFieldRequest);
+ mdModulesNotifier.simulationSetupNotifications_.notify(&mdModulesAddOutputToDensityFittingFieldRequest);
bEner_[F_DENSITYFITTING] = mdModulesAddOutputToDensityFittingFieldRequest.energyOutputToDensityFitting_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/simulation_workload.h"
/* do QMMM first if requested */
if (fr->bQMMM)
{
- enerd->term[F_EQM] = calculate_QMMM(cr, &forceOutputs->forceWithShiftForces(), fr);
+ enerd->term[F_EQM] = calculate_QMMM(cr, &forceOutputs->forceWithShiftForces(), fr->qr);
}
/* Call the short range functions all in one go. */
real dvdl_walls = do_walls(*ir, *fr, box, *md, x, &forceWithVirial, lambda[efptVDW],
enerd->grpp.ener[egLJSR].data(), nrnb);
enerd->dvdl_lin[efptVDW] += dvdl_walls;
+
+ for (auto& dhdl : enerd->dhdlLambda)
+ {
+ dhdl += dvdl_walls;
+ }
}
/* Shift the coordinates. Must be done before listed forces and PPPM,
/* Since all atoms are in the rectangular or triclinic unit-cell,
* only single box vector shifts (2 in x) are required.
*/
- set_pbc_dd(&pbc, fr->ePBC, DOMAINDECOMP(cr) ? cr->dd->nc : nullptr, TRUE, box);
+ set_pbc_dd(&pbc, fr->pbcType, DOMAINDECOMP(cr) ? cr->dd->numCells : nullptr, TRUE, box);
}
do_force_listed(wcycle, box, ir->fepvals, cr, ms, idef, x, hist, forceOutputs, fr, &pbc,
enerd->term[F_COUL_RECIP] = Vlr_q + ewaldOutput.Vcorr_q;
enerd->term[F_LJ_RECIP] = Vlr_lj + ewaldOutput.Vcorr_lj;
+ for (auto& dhdl : enerd->dhdlLambda)
+ {
+ dhdl += ewaldOutput.dvdl[efptVDW] + ewaldOutput.dvdl[efptCOUL];
+ }
+
if (debug)
{
fprintf(debug, "Vlr_q = %g, Vcorr_q = %g, Vlr_corr_q = %g\n", Vlr_q,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/arrayrefwithpadding.h"
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/utility/arrayref.h"
class DDBalanceRegionHandler;
namespace gmx
{
class Awh;
+class ForceOutputs;
class ForceWithVirial;
class ImdSession;
class MdrunScheduleWorkload;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2020, by the GROMACS development team, led by
+ * Copyright (c) 2013-2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "forcerec.h"
-#include "config.h"
-
#include <cassert>
#include <cmath>
#include <cstdlib>
#include "gromacs/mdlib/wall.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/iforceprovider.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/strconvert.h"
-/*! \brief environment variable to enable GPU P2P communication */
-static const bool c_enableGpuPmePpComms =
- (getenv("GMX_GPU_PME_PP_COMMS") != nullptr) && GMX_THREAD_MPI && (GMX_GPU == GMX_GPU_CUDA);
-
-static real* mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM)
+static std::vector<real> mk_nbfp(const gmx_ffparams_t* idef, gmx_bool bBHAM)
{
- real* nbfp;
- int i, j, k, atnr;
+ std::vector<real> nbfp;
+ int atnr;
atnr = idef->atnr;
if (bBHAM)
{
- snew(nbfp, 3 * atnr * atnr);
- for (i = k = 0; (i < atnr); i++)
+ nbfp.resize(3 * atnr * atnr);
+ int k = 0;
+ for (int i = 0; (i < atnr); i++)
{
- for (j = 0; (j < atnr); j++, k++)
+ for (int j = 0; (j < atnr); j++, k++)
{
BHAMA(nbfp, atnr, i, j) = idef->iparams[k].bham.a;
BHAMB(nbfp, atnr, i, j) = idef->iparams[k].bham.b;
}
else
{
- snew(nbfp, 2 * atnr * atnr);
- for (i = k = 0; (i < atnr); i++)
+ nbfp.resize(2 * atnr * atnr);
+ int k = 0;
+ for (int i = 0; (i < atnr); i++)
{
- for (j = 0; (j < atnr); j++, k++)
+ for (int j = 0; (j < atnr); j++, k++)
{
/* nbfp now includes the 6.0/12.0 derivative prefactors */
C6(nbfp, atnr, i, j) = idef->iparams[k].lj.c6 * 6.0;
acSETTLE
};
-static cginfo_mb_t* init_cginfo_mb(const gmx_mtop_t* mtop, const t_forcerec* fr, gmx_bool* bFEP_NonBonded)
+static std::vector<cginfo_mb_t> init_cginfo_mb(const gmx_mtop_t* mtop, const t_forcerec* fr)
{
- cginfo_mb_t* cginfo_mb;
- gmx_bool* type_VDW;
- int* cginfo;
- int* a_con;
-
- snew(cginfo_mb, mtop->molblock.size());
+ gmx_bool* type_VDW;
+ int* a_con;
snew(type_VDW, fr->ntype);
for (int ai = 0; ai < fr->ntype; ai++)
}
}
- *bFEP_NonBonded = FALSE;
-
- int a_offset = 0;
+ std::vector<cginfo_mb_t> cginfoPerMolblock;
+ int a_offset = 0;
for (size_t mb = 0; mb < mtop->molblock.size(); mb++)
{
const gmx_molblock_t& molb = mtop->molblock[mb];
const gmx_moltype_t& molt = mtop->moltype[molb.type];
- const t_blocka& excl = molt.excls;
+ const auto& excl = molt.excls;
/* Check if the cginfo is identical for all molecules in this block.
* If so, we only need an array of the size of one molecule.
}
}
- cginfo_mb[mb].cg_start = a_offset;
- cginfo_mb[mb].cg_end = a_offset + molb.nmol * molt.atoms.nr;
- cginfo_mb[mb].cg_mod = (bId ? 1 : molb.nmol) * molt.atoms.nr;
- snew(cginfo_mb[mb].cginfo, cginfo_mb[mb].cg_mod);
- cginfo = cginfo_mb[mb].cginfo;
+ cginfo_mb_t cginfo_mb;
+ cginfo_mb.cg_start = a_offset;
+ cginfo_mb.cg_end = a_offset + molb.nmol * molt.atoms.nr;
+ cginfo_mb.cg_mod = (bId ? 1 : molb.nmol) * molt.atoms.nr;
+ cginfo_mb.cginfo.resize(cginfo_mb.cg_mod);
+ gmx::ArrayRef<int> cginfo = cginfo_mb.cginfo;
/* Set constraints flags for constrained atoms */
snew(a_con, molt.atoms.nr);
bool haveExclusions = false;
/* Loop over all the exclusions of atom ai */
- for (int j = excl.index[a]; j < excl.index[a + 1]; j++)
+ for (const int j : excl[a])
{
- if (excl.a[j] != a)
+ if (j != a)
{
haveExclusions = true;
break;
if (fr->efep != efepNO && PERTURBED(atom))
{
SET_CGINFO_FEP(atomInfo);
- *bFEP_NonBonded = TRUE;
}
}
}
sfree(a_con);
+ cginfoPerMolblock.push_back(cginfo_mb);
+
a_offset += molb.nmol * molt.atoms.nr;
}
sfree(type_VDW);
- return cginfo_mb;
+ return cginfoPerMolblock;
}
-static std::vector<int> cginfo_expand(const int nmb, const cginfo_mb_t* cgi_mb)
+static std::vector<int> cginfo_expand(const int nmb, gmx::ArrayRef<const cginfo_mb_t> cgi_mb)
{
const int ncg = cgi_mb[nmb - 1].cg_end;
return cginfo;
}
-static void done_cginfo_mb(cginfo_mb_t* cginfo_mb, int numMolBlocks)
-{
- if (cginfo_mb == nullptr)
- {
- return;
- }
- for (int mb = 0; mb < numMolBlocks; ++mb)
- {
- sfree(cginfo_mb[mb].cginfo);
- }
- sfree(cginfo_mb);
-}
-
/* Sets the sum of charges (squared) and C6 in the system in fr.
* Returns whether the system has a net charge.
*/
const char* tabfn,
const char* tabpfn,
gmx::ArrayRef<const std::string> tabbfnm,
- const gmx_hw_info_t& hardwareInfo,
- const gmx_device_info_t* deviceInfo,
- const bool useGpuForBonded,
- const bool pmeOnlyRankUsesGpu,
- real print_force,
- gmx_wallcycle* wcycle)
+ real print_force)
{
- real rtab;
- char* env;
- double dbl;
- gmx_bool bFEP_NonBonded;
-
/* By default we turn SIMD kernels on, but it might be turned off further down... */
fr->use_simd_kernels = TRUE;
- if (check_box(ir->ePBC, box))
+ if (check_box(ir->pbcType, box))
{
- gmx_fatal(FARGS, "%s", check_box(ir->ePBC, box));
+ gmx_fatal(FARGS, "%s", check_box(ir->pbcType, box));
}
/* Test particle insertion ? */
fr->sc_r_power = ir->fepvals->sc_r_power;
fr->sc_sigma6_def = gmx::power6(ir->fepvals->sc_sigma);
- env = getenv("GMX_SCSIGMA_MIN");
+ char* env = getenv("GMX_SCSIGMA_MIN");
if (env != nullptr)
{
- dbl = 0;
+ double dbl = 0;
sscanf(env, "%20lf", &dbl);
fr->sc_sigma6_min = gmx::power6(dbl);
if (fp)
/* Neighbour searching stuff */
fr->cutoff_scheme = ir->cutoff_scheme;
- fr->ePBC = ir->ePBC;
+ fr->pbcType = ir->pbcType;
/* Determine if we will do PBC for distances in bonded interactions */
- if (fr->ePBC == epbcNONE)
+ if (fr->pbcType == PbcType::No)
{
fr->bMolPBC = FALSE;
}
}
else
{
- fr->bMolPBC = dd_bonded_molpbc(cr->dd, fr->ePBC);
+ fr->bMolPBC = dd_bonded_molpbc(cr->dd, fr->pbcType);
if (useEwaldSurfaceCorrection && !dd_moleculesAreAlwaysWhole(*cr->dd))
{
fr->shiftForces.resize(SHIFTS);
- if (fr->nbfp == nullptr)
+ if (fr->nbfp.empty())
{
fr->ntype = mtop->ffparams.atnr;
fr->nbfp = mk_nbfp(&mtop->ffparams, fr->bBHAM);
* in that case grompp should already have checked that we do not need
* normal tables and we only generate tables for 1-4 interactions.
*/
- rtab = ir->rlist + ir->tabext;
+ real rtab = ir->rlist + ir->tabext;
/* We want to use unmodified tables for 1-4 coulombic
* interactions, so we must in general have an extra set of
}
/* Set all the static charge group info */
- fr->cginfo_mb = init_cginfo_mb(mtop, fr, &bFEP_NonBonded);
+ fr->cginfo_mb = init_cginfo_mb(mtop, fr);
if (!DOMAINDECOMP(cr))
{
fr->cginfo = cginfo_expand(mtop->molblock.size(), fr->cginfo_mb);
fr->nthread_ewc = gmx_omp_nthreads_get(emntBonded);
snew(fr->ewc_t, fr->nthread_ewc);
- if (fr->cutoff_scheme == ecutsVERLET)
- {
- // We checked the cut-offs in grompp, but double-check here.
- // We have PME+LJcutoff kernels for rcoulomb>rvdw.
- if (EEL_PME_EWALD(ir->coulombtype) && ir->vdwtype == eelCUT)
- {
- GMX_RELEASE_ASSERT(ir->rcoulomb >= ir->rvdw,
- "With Verlet lists and PME we should have rcoulomb>=rvdw");
- }
- else
- {
- GMX_RELEASE_ASSERT(
- ir->rcoulomb == ir->rvdw,
- "With Verlet lists and no PME rcoulomb and rvdw should be identical");
- }
-
- fr->nbv = Nbnxm::init_nb_verlet(mdlog, bFEP_NonBonded, ir, fr, cr, hardwareInfo, deviceInfo,
- mtop, box, wcycle);
-
- if (useGpuForBonded)
- {
- auto stream = havePPDomainDecomposition(cr)
- ? Nbnxm::gpu_get_command_stream(
- fr->nbv->gpu_nbv, gmx::InteractionLocality::NonLocal)
- : Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv,
- gmx::InteractionLocality::Local);
- // TODO the heap allocation is only needed while
- // t_forcerec lacks a constructor.
- fr->gpuBonded = new gmx::GpuBonded(mtop->ffparams, stream, wcycle);
- }
- }
-
if (ir->eDispCorr != edispcNO)
{
fr->dispersionCorrection = std::make_unique<DispersionCorrection>(
- *mtop, *ir, fr->bBHAM, fr->ntype,
- gmx::arrayRefFromArray(fr->nbfp, fr->ntype * fr->ntype * 2), *fr->ic, tabfn);
+ *mtop, *ir, fr->bBHAM, fr->ntype, fr->nbfp, *fr->ic, tabfn);
fr->dispersionCorrection->print(mdlog);
}
*/
fprintf(fp, "\n");
}
-
- if (pmeOnlyRankUsesGpu && c_enableGpuPmePpComms)
- {
- fr->pmePpCommGpu = std::make_unique<gmx::PmePpCommGpu>(cr->mpi_comm_mysim, cr->dd->pme_nodeid);
- }
}
t_forcerec::t_forcerec() = default;
-t_forcerec::~t_forcerec() = default;
-
-/* Frees GPU memory and sets a tMPI node barrier.
- *
- * Note that this function needs to be called even if GPUs are not used
- * in this run because the PME ranks have no knowledge of whether GPUs
- * are used or not, but all ranks need to enter the barrier below.
- * \todo Remove physical node barrier from this function after making sure
- * that it's not needed anymore (with a shared GPU run).
- */
-void free_gpu_resources(t_forcerec* fr,
- const gmx::PhysicalNodeCommunicator& physicalNodeCommunicator,
- const gmx_gpu_info_t& gpu_info)
+t_forcerec::~t_forcerec()
{
- bool isPPrankUsingGPU = (fr != nullptr) && (fr->nbv != nullptr) && fr->nbv->useGpu();
-
- /* stop the GPU profiler (only CUDA) */
- if (gpu_info.n_dev > 0)
- {
- stopGpuProfiler();
- }
-
- if (isPPrankUsingGPU)
- {
- /* Free data in GPU memory and pinned memory before destroying the GPU context */
- fr->nbv.reset();
-
- delete fr->gpuBonded;
- fr->gpuBonded = nullptr;
- }
-
- /* With tMPI we need to wait for all ranks to finish deallocation before
- * destroying the CUDA context in free_gpu() as some tMPI ranks may be sharing
- * GPU and context.
- *
- * This is not a concern in OpenCL where we use one context per rank which
- * is freed in nbnxn_gpu_free().
- *
- * Note: it is safe to not call the barrier on the ranks which do not use GPU,
- * but it is easier and more futureproof to call it on the whole node.
- */
- if (GMX_THREAD_MPI)
- {
- physicalNodeCommunicator.barrier();
- }
-}
-
-void done_forcerec(t_forcerec* fr, int numMolBlocks)
-{
- if (fr == nullptr)
- {
- // PME-only ranks don't have a forcerec
- return;
- }
- done_cginfo_mb(fr->cginfo_mb, numMolBlocks);
- sfree(fr->nbfp);
- delete fr->ic;
- sfree(fr->shift_vec);
- sfree(fr->ewc_t);
- tear_down_bonded_threading(fr->bondedThreading);
- GMX_RELEASE_ASSERT(fr->gpuBonded == nullptr, "Should have been deleted earlier, when used");
- fr->bondedThreading = nullptr;
- delete fr;
+ /* Note: This code will disappear when types are converted to C++ */
+ sfree(shift_vec);
+ sfree(ewc_t);
+ tear_down_bonded_threading(bondedThreading);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_MDLIB_FORCEREC_H
#define GMX_MDLIB_FORCEREC_H
-#include "gromacs/mdlib/force_flags.h"
-#include "gromacs/mdlib/tgroup.h"
-#include "gromacs/mdlib/vsite.h"
-#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/math/vec.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/utility/arrayref.h"
-struct gmx_device_info_t;
+struct DeviceInformation;
struct gmx_hw_info_t;
struct t_commrec;
struct t_fcdata;
+struct t_forcerec;
struct t_filenm;
struct t_inputrec;
struct gmx_gpu_info_t;
+struct gmx_localtop_t;
+struct gmx_mtop_t;
struct gmx_wallcycle;
+struct interaction_const_t;
namespace gmx
{
class PhysicalNodeCommunicator;
} // namespace gmx
-//! Destroy a forcerec.
-void done_forcerec(t_forcerec* fr, int numMolBlocks);
-
/*! \brief Print the contents of the forcerec to a file
*
* \param[in] fplog The log file to print to
* \param[in] tabfn Table potential file for non-bonded interactions
* \param[in] tabpfn Table potential file for pair interactions
* \param[in] tabbfnm Table potential files for bonded interactions
- * \param[in] hardwareInfo Information about hardware
- * \param[in] deviceInfo Info about GPU device to use for short-ranged work
- * \param[in] useGpuForBonded Whether bonded interactions will run on a GPU
- * \param[in] pmeOnlyRankUsesGpu Whether there is a PME task on a GPU on a PME-only rank
* \param[in] print_force Print forces for atoms with force >= print_force
- * \param[out] wcycle Pointer to cycle counter object
*/
void init_forcerec(FILE* fplog,
const gmx::MDLogger& mdlog,
const char* tabfn,
const char* tabpfn,
gmx::ArrayRef<const std::string> tabbfnm,
- const gmx_hw_info_t& hardwareInfo,
- const gmx_device_info_t* deviceInfo,
- bool useGpuForBonded,
- bool pmeOnlyRankUsesGpu,
- real print_force,
- gmx_wallcycle* wcycle);
+ real print_force);
/*! \brief Check whether molecules are ever distributed over PBC boundaries
*
*/
void forcerec_set_excl_load(t_forcerec* fr, const gmx_localtop_t* top);
-void free_gpu_resources(t_forcerec* fr,
- const gmx::PhysicalNodeCommunicator& physicalNodeCommunicator,
- const gmx_gpu_info_t& gpu_info);
-
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* using CUDA, including class initialization, data-structures management
* and GPU kernel.
*
- * \todo Reconsider naming towards using "gpu" suffix instead of "cuda".
- *
* \author Artem Zhmurov <zhmurov@gmail.com>
*
* \ingroup module_mdlib
*/
#include "gmxpre.h"
-#include "leapfrog_cuda.cuh"
+#include "leapfrog_gpu.cuh"
#include <assert.h>
#include <stdio.h>
return kernelPtr;
}
-void LeapFrogCuda::integrate(const float3* d_x,
- float3* d_xp,
- float3* d_v,
- const float3* d_f,
- const real dt,
- const bool doTemperatureScaling,
- gmx::ArrayRef<const t_grp_tcstat> tcstat,
- const bool doParrinelloRahman,
- const float dtPressureCouple,
- const matrix prVelocityScalingMatrix)
+void LeapFrogGpu::integrate(const float3* d_x,
+ float3* d_xp,
+ float3* d_v,
+ const float3* d_f,
+ const real dt,
+ const bool doTemperatureScaling,
+ gmx::ArrayRef<const t_grp_tcstat> tcstat,
+ const bool doParrinelloRahman,
+ const float dtPressureCouple,
+ const matrix prVelocityScalingMatrix)
{
ensureNoPendingCudaError("In CUDA version of Leap-Frog integrator");
return;
}
-LeapFrogCuda::LeapFrogCuda(CommandStream commandStream) : commandStream_(commandStream)
+LeapFrogGpu::LeapFrogGpu(CommandStream commandStream) : commandStream_(commandStream)
{
numAtoms_ = 0;
kernelLaunchConfig_.stream = commandStream_;
}
-LeapFrogCuda::~LeapFrogCuda()
+LeapFrogGpu::~LeapFrogGpu()
{
freeDeviceBuffer(&d_inverseMasses_);
}
-void LeapFrogCuda::setPbc(const t_pbc* pbc)
-{
- setPbcAiuc(pbc->ndim_ePBC, pbc->box, &pbcAiuc_);
-}
-
-void LeapFrogCuda::set(const t_mdatoms& md, const int numTempScaleValues, const unsigned short* tempScaleGroups)
+void LeapFrogGpu::set(const t_mdatoms& md, const int numTempScaleValues, const unsigned short* tempScaleGroups)
{
numAtoms_ = md.nr;
kernelLaunchConfig_.gridSize[0] = (numAtoms_ + c_threadsPerBlock - 1) / c_threadsPerBlock;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
/*! \libinternal \file
*
- * \brief Declarations for CUDA implementation of Leap-Frog.
- *
- * \todo Reconsider naming towards using "gpu" suffix instead of "cuda".
+ * \brief Declarations for GPU implementation of Leap-Frog.
*
* \author Artem Zhmurov <zhmurov@gmail.com>
*
* \ingroup module_mdlib
* \inlibraryapi
*/
-#ifndef GMX_MDLIB_LEAPFROG_CUDA_CUH
-#define GMX_MDLIB_LEAPFROG_CUDA_CUH
+#ifndef GMX_MDLIB_LEAPFROG_GPU_CUH
+#define GMX_MDLIB_LEAPFROG_GPU_CUH
#include "gromacs/gpu_utils/gputraits.cuh"
#include "gromacs/gpu_utils/hostallocator.h"
namespace gmx
{
-class LeapFrogCuda
+class LeapFrogGpu
{
public:
*
* \param[in] commandStream Device command stream to use.
*/
- LeapFrogCuda(CommandStream commandStream);
- ~LeapFrogCuda();
-
- /*! \brief
- * Update PBC data.
- *
- * Converts PBC data from t_pbc into the PbcAiuc format and stores the latter.
- *
- * \param[in] pbc The PBC data in t_pbc format.
- */
- void setPbc(const t_pbc* pbc);
+ LeapFrogGpu(CommandStream commandStream);
+ ~LeapFrogGpu();
/*! \brief Integrate
*
class Impl;
private:
- //! CUDA stream
+ //! GPU stream
CommandStream commandStream_;
- //! CUDA kernel launch config
+ //! GPU kernel launch config
KernelLaunchConfig kernelLaunchConfig_;
- //! Periodic boundary data
- PbcAiuc pbcAiuc_;
//! Number of atoms
int numAtoms_;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/simd/simd.h"
#include "gromacs/simd/simd_math.h"
#include "gromacs/simd/vector_operations.h"
-#include "gromacs/topology/block.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/utility/alignedallocator.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxomp.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/pleasecite.h"
using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
#endif // GMX_SIMD_HAVE_REAL
/*! \brief LINCS projection, works on derivatives of the coordinates. */
-static void do_lincsp(const rvec* x,
- rvec* f,
- rvec* fp,
- t_pbc* pbc,
- Lincs* lincsd,
- int th,
- real* invmass,
- ConstraintVariable econq,
- bool bCalcDHDL,
- bool bCalcVir,
- tensor rmdf)
+static void do_lincsp(ArrayRefWithPadding<const RVec> xPadded,
+ ArrayRefWithPadding<RVec> fPadded,
+ ArrayRef<RVec> fp,
+ t_pbc* pbc,
+ Lincs* lincsd,
+ int th,
+ real* invmass,
+ ConstraintVariable econq,
+ bool bCalcDHDL,
+ bool bCalcVir,
+ tensor rmdf)
{
const int b0 = lincsd->task[th].b0;
const int b1 = lincsd->task[th].b1;
gmx::ArrayRef<real> rhs2 = lincsd->tmp2;
gmx::ArrayRef<real> sol = lincsd->tmp3;
+ const rvec* x = as_rvec_array(xPadded.paddedArrayRef().data());
+ rvec* f = as_rvec_array(fPadded.paddedArrayRef().data());
+
#if GMX_SIMD_HAVE_REAL
/* This SIMD code does the same as the plain-C code after the #else.
* The only difference is that we always call pbc code, as with SIMD
/* When constraining forces, we should not use mass weighting,
* so we pass invmass=NULL, which results in the use of 1 for all atoms.
*/
- lincs_update_atoms(lincsd, th, 1.0, sol, r,
- (econq != ConstraintVariable::Force) ? invmass : nullptr, fp);
+ lincs_update_atoms(lincsd, th, 1.0, sol, r, (econq != ConstraintVariable::Force) ? invmass : nullptr,
+ as_rvec_array(fp.data()));
if (bCalcDHDL)
{
#endif // GMX_SIMD_HAVE_REAL
//! Implements LINCS constraining.
-static void do_lincs(const rvec* x,
- rvec* xp,
- const matrix box,
- t_pbc* pbc,
- Lincs* lincsd,
- int th,
- const real* invmass,
- const t_commrec* cr,
- bool bCalcDHDL,
- real wangle,
- bool* bWarn,
- real invdt,
- rvec* gmx_restrict v,
- bool bCalcVir,
- tensor vir_r_m_dr)
+static void do_lincs(ArrayRefWithPadding<const RVec> xPadded,
+ ArrayRefWithPadding<RVec> xpPadded,
+ const matrix box,
+ t_pbc* pbc,
+ Lincs* lincsd,
+ int th,
+ const real* invmass,
+ const t_commrec* cr,
+ bool bCalcDHDL,
+ real wangle,
+ bool* bWarn,
+ real invdt,
+ ArrayRef<RVec> vRef,
+ bool bCalcVir,
+ tensor vir_r_m_dr)
{
+ const rvec* x = as_rvec_array(xPadded.paddedArrayRef().data());
+ rvec* xp = as_rvec_array(xpPadded.paddedArrayRef().data());
+ rvec* gmx_restrict v = as_rvec_array(vRef.data());
+
const int b0 = lincsd->task[th].b0;
const int b1 = lincsd->task[th].b1;
/* Communicate the corrected non-local coordinates */
if (DOMAINDECOMP(cr))
{
- dd_move_x_constraints(cr->dd, box, xp, nullptr, FALSE);
+ dd_move_x_constraints(cr->dd, box, xpPadded.unpaddedArrayRef(), ArrayRef<RVec>(), FALSE);
}
}
#pragma omp barrier
}
//! Finds all triangles of atoms that share constraints to a central atom.
-static int count_triangle_constraints(const InteractionLists& ilist, const t_blocka& at2con)
+static int count_triangle_constraints(const InteractionLists& ilist, const ListOfLists<int>& at2con)
{
- int ncon1, ncon_tot;
- int c0, n1, c1, ac1, n2, c2;
- int ncon_triangle;
-
- ncon1 = ilist[F_CONSTR].size() / 3;
- ncon_tot = ncon1 + ilist[F_CONSTRNC].size() / 3;
+ const int ncon1 = ilist[F_CONSTR].size() / 3;
+ const int ncon_tot = ncon1 + ilist[F_CONSTRNC].size() / 3;
gmx::ArrayRef<const int> ia1 = ilist[F_CONSTR].iatoms;
gmx::ArrayRef<const int> ia2 = ilist[F_CONSTRNC].iatoms;
- ncon_triangle = 0;
- for (c0 = 0; c0 < ncon_tot; c0++)
+ int ncon_triangle = 0;
+ for (int c0 = 0; c0 < ncon_tot; c0++)
{
bool bTriangle = FALSE;
const int* iap = constr_iatomptr(ia1, ia2, c0);
const int a00 = iap[1];
const int a01 = iap[2];
- for (n1 = at2con.index[a01]; n1 < at2con.index[a01 + 1]; n1++)
+ for (const int c1 : at2con[a01])
{
- c1 = at2con.a[n1];
if (c1 != c0)
{
const int* iap = constr_iatomptr(ia1, ia2, c1);
const int a10 = iap[1];
const int a11 = iap[2];
+ int ac1;
if (a10 == a01)
{
ac1 = a11;
{
ac1 = a10;
}
- for (n2 = at2con.index[ac1]; n2 < at2con.index[ac1 + 1]; n2++)
+ for (const int c2 : at2con[ac1])
{
- c2 = at2con.a[n2];
if (c2 != c0 && c2 != c1)
{
const int* iap = constr_iatomptr(ia1, ia2, c2);
}
//! Finds sequences of sequential constraints.
-static bool more_than_two_sequential_constraints(const InteractionLists& ilist, const t_blocka& at2con)
+static bool more_than_two_sequential_constraints(const InteractionLists& ilist, const ListOfLists<int>& at2con)
{
- int ncon1, ncon_tot, c;
- bool bMoreThanTwoSequentialConstraints;
-
- ncon1 = ilist[F_CONSTR].size() / 3;
- ncon_tot = ncon1 + ilist[F_CONSTRNC].size() / 3;
+ const int ncon1 = ilist[F_CONSTR].size() / 3;
+ const int ncon_tot = ncon1 + ilist[F_CONSTRNC].size() / 3;
gmx::ArrayRef<const int> ia1 = ilist[F_CONSTR].iatoms;
gmx::ArrayRef<const int> ia2 = ilist[F_CONSTRNC].iatoms;
- bMoreThanTwoSequentialConstraints = FALSE;
- for (c = 0; c < ncon_tot && !bMoreThanTwoSequentialConstraints; c++)
+ for (int c = 0; c < ncon_tot; c++)
{
const int* iap = constr_iatomptr(ia1, ia2, c);
const int a1 = iap[1];
const int a2 = iap[2];
/* Check if this constraint has constraints connected at both atoms */
- if (at2con.index[a1 + 1] - at2con.index[a1] > 1 && at2con.index[a2 + 1] - at2con.index[a2] > 1)
+ if (at2con[a1].ssize() > 1 && at2con[a2].ssize() > 1)
{
- bMoreThanTwoSequentialConstraints = TRUE;
+ return true;
}
}
- return bMoreThanTwoSequentialConstraints;
+ return false;
}
-Lincs* init_lincs(FILE* fplog,
- const gmx_mtop_t& mtop,
- int nflexcon_global,
- ArrayRef<const t_blocka> at2con,
- bool bPLINCS,
- int nIter,
- int nProjOrder)
+Lincs* init_lincs(FILE* fplog,
+ const gmx_mtop_t& mtop,
+ int nflexcon_global,
+ ArrayRef<const ListOfLists<int>> atomToConstraintsPerMolType,
+ bool bPLINCS,
+ int nIter,
+ int nProjOrder)
{
// TODO this should become a unique_ptr
Lincs* li;
li->max_connect = 0;
for (size_t mt = 0; mt < mtop.moltype.size(); mt++)
{
+ const auto& at2con = atomToConstraintsPerMolType[mt];
for (int a = 0; a < mtop.moltype[mt].atoms.nr; a++)
{
- li->max_connect = std::max(li->max_connect, at2con[mt].index[a + 1] - at2con[mt].index[a]);
+ li->max_connect = std::max(li->max_connect, int(at2con[a].ssize()));
}
}
bMoreThanTwoSeq = FALSE;
for (const gmx_molblock_t& molb : mtop.molblock)
{
- const gmx_moltype_t& molt = mtop.moltype[molb.type];
+ const gmx_moltype_t& molt = mtop.moltype[molb.type];
+ const auto& at2con = atomToConstraintsPerMolType[molb.type];
- li->ncg_triangle += molb.nmol * count_triangle_constraints(molt.ilist, at2con[molb.type]);
+ li->ncg_triangle += molb.nmol * count_triangle_constraints(molt.ilist, at2con);
- if (!bMoreThanTwoSeq && more_than_two_sequential_constraints(molt.ilist, at2con[molb.type]))
+ if (!bMoreThanTwoSeq && more_than_two_sequential_constraints(molt.ilist, at2con))
{
bMoreThanTwoSeq = TRUE;
}
}
//! Assign a constraint.
-static void assign_constraint(Lincs* li, int constraint_index, int a1, int a2, real lenA, real lenB, const t_blocka* at2con)
+static void assign_constraint(Lincs* li,
+ int constraint_index,
+ int a1,
+ int a2,
+ real lenA,
+ real lenB,
+ const ListOfLists<int>& at2con)
{
int con;
/* Make space in the constraint connection matrix for constraints
* connected to both end of the current constraint.
*/
- li->ncc += at2con->index[a1 + 1] - at2con->index[a1] - 1 + at2con->index[a2 + 1]
- - at2con->index[a2] - 1;
+ li->ncc += at2con[a1].ssize() - 1 + at2con[a2].ssize() - 1;
li->blnr[con + 1] = li->ncc;
/*! \brief Check if constraint with topology index constraint_index is connected
* to other constraints, and if so add those connected constraints to our task. */
-static void check_assign_connected(Lincs* li,
- const t_iatom* iatom,
- const t_idef& idef,
- bool bDynamics,
- int a1,
- int a2,
- const t_blocka* at2con)
+static void check_assign_connected(Lincs* li,
+ const t_iatom* iatom,
+ const t_idef& idef,
+ bool bDynamics,
+ int a1,
+ int a2,
+ const ListOfLists<int>& at2con)
{
/* Currently this function only supports constraint groups
* in which all constraints share at least one atom
* connected constraints. We need to assign those
* to the same task.
*/
- int end;
-
- for (end = 0; end < 2; end++)
+ for (int end = 0; end < 2; end++)
{
- int a, k;
-
- a = (end == 0 ? a1 : a2);
+ const int a = (end == 0 ? a1 : a2);
- for (k = at2con->index[a]; k < at2con->index[a + 1]; k++)
+ for (const int cc : at2con[a])
{
- int cc;
-
- cc = at2con->a[k];
/* Check if constraint cc has not yet been assigned */
if (li->con_index[cc] == -1)
{
- int type;
- real lenA, lenB;
-
- type = iatom[cc * 3];
- lenA = idef.iparams[type].constr.dA;
- lenB = idef.iparams[type].constr.dB;
+ const int type = iatom[cc * 3];
+ const real lenA = idef.iparams[type].constr.dA;
+ const real lenB = idef.iparams[type].constr.dB;
if (bDynamics || lenA != 0 || lenB != 0)
{
/*! \brief Check if constraint with topology index constraint_index is involved
* in a constraint triangle, and if so add the other two constraints
* in the triangle to our task. */
-static void check_assign_triangle(Lincs* li,
- const t_iatom* iatom,
- const t_idef& idef,
- bool bDynamics,
- int constraint_index,
- int a1,
- int a2,
- const t_blocka* at2con)
+static void check_assign_triangle(Lincs* li,
+ const t_iatom* iatom,
+ const t_idef& idef,
+ bool bDynamics,
+ int constraint_index,
+ int a1,
+ int a2,
+ const ListOfLists<int>& at2con)
{
- int nca, cc[32], ca[32], k;
+ int nca, cc[32], ca[32];
int c_triangle[2] = { -1, -1 };
nca = 0;
- for (k = at2con->index[a1]; k < at2con->index[a1 + 1]; k++)
+ for (const int c : at2con[a1])
{
- int c;
-
- c = at2con->a[k];
if (c != constraint_index)
{
int aa1, aa2;
}
}
- for (k = at2con->index[a2]; k < at2con->index[a2 + 1]; k++)
+ for (const int c : at2con[a2])
{
- int c;
-
- c = at2con->a[k];
if (c != constraint_index)
{
int aa1, aa2, i;
}
//! Sets matrix indices.
-static void set_matrix_indices(Lincs* li, const Task& li_task, const t_blocka* at2con, bool bSortMatrix)
+static void set_matrix_indices(Lincs* li, const Task& li_task, const ListOfLists<int>& at2con, bool bSortMatrix)
{
for (int b = li_task.b0; b < li_task.b1; b++)
{
const int a2 = li->atoms[b].index2;
int i = li->blnr[b];
- for (int k = at2con->index[a1]; k < at2con->index[a1 + 1]; k++)
+ for (const int constraint : at2con[a1])
{
- int concon = li->con_index[at2con->a[k]];
+ const int concon = li->con_index[constraint];
if (concon != b)
{
li->blbnb[i++] = concon;
}
}
- for (int k = at2con->index[a2]; k < at2con->index[a2 + 1]; k++)
+ for (const int constraint : at2con[a2])
{
- int concon = li->con_index[at2con->a[k]];
+ const int concon = li->con_index[constraint];
if (concon != b)
{
li->blbnb[i++] = concon;
void set_lincs(const t_idef& idef, const t_mdatoms& md, bool bDynamics, const t_commrec* cr, Lincs* li)
{
int natoms;
- t_blocka at2con;
t_iatom* iatom;
li->nc_real = 0;
natoms = md.homenr;
}
- at2con = make_at2con(natoms, idef.il, idef.iparams, flexibleConstraintTreatment(bDynamics));
+ const ListOfLists<int> at2con =
+ make_at2con(natoms, idef.il, idef.iparams, flexibleConstraintTreatment(bDynamics));
const int ncon_tot = idef.il[F_CONSTR].nr / 3;
/* Skip the flexible constraints when not doing dynamics */
if (bDynamics || lenA != 0 || lenB != 0)
{
- assign_constraint(li, con, a1, a2, lenA, lenB, &at2con);
+ assign_constraint(li, con, a1, a2, lenA, lenB, at2con);
if (li->ntask > 1 && !li->bTaskDep)
{
/* We can generate independent tasks. Check if we
* need to assign connected constraints to our task.
*/
- check_assign_connected(li, iatom, idef, bDynamics, a1, a2, &at2con);
+ check_assign_connected(li, iatom, idef, bDynamics, a1, a2, at2con);
}
if (li->ntask > 1 && li->ncg_triangle > 0)
{
/* Ensure constraints in one triangle are assigned
* to the same task.
*/
- check_assign_triangle(li, iatom, idef, bDynamics, con, a1, a2, &at2con);
+ check_assign_triangle(li, iatom, idef, bDynamics, con, a1, a2, at2con);
}
}
}
li_task.tri_bits.resize(li_task.b1 - li_task.b0);
}
- set_matrix_indices(li, li_task, &at2con, bSortMatrix);
+ set_matrix_indices(li, li_task, at2con, bSortMatrix);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
- done_blocka(&at2con);
-
if (cr->dd == nullptr)
{
/* Since the matrix is static, we should free some memory */
//! Issues a warning when LINCS constraints cannot be satisfied.
static void lincs_warning(gmx_domdec_t* dd,
- const rvec* x,
- rvec* xprime,
+ ArrayRef<const RVec> x,
+ ArrayRef<const RVec> xprime,
t_pbc* pbc,
int ncons,
gmx::ArrayRef<const AtomPair> atoms,
};
//! Determine how well the constraints have been satisfied.
-static LincsDeviations makeLincsDeviations(const Lincs& lincsd, const rvec* x, const t_pbc* pbc)
+static LincsDeviations makeLincsDeviations(const Lincs& lincsd, ArrayRef<const RVec> x, const t_pbc* pbc)
{
LincsDeviations result;
const ArrayRef<const AtomPair> atoms = lincsd.atoms;
return result;
}
-bool constrain_lincs(bool computeRmsd,
- const t_inputrec& ir,
- int64_t step,
- Lincs* lincsd,
- const t_mdatoms& md,
- const t_commrec* cr,
- const gmx_multisim_t* ms,
- const rvec* x,
- rvec* xprime,
- rvec* min_proj,
- const matrix box,
- t_pbc* pbc,
- real lambda,
- real* dvdlambda,
- real invdt,
- rvec* v,
- bool bCalcVir,
- tensor vir_r_m_dr,
- ConstraintVariable econq,
- t_nrnb* nrnb,
- int maxwarn,
- int* warncount)
+bool constrain_lincs(bool computeRmsd,
+ const t_inputrec& ir,
+ int64_t step,
+ Lincs* lincsd,
+ const t_mdatoms& md,
+ const t_commrec* cr,
+ const gmx_multisim_t* ms,
+ ArrayRefWithPadding<const RVec> xPadded,
+ ArrayRefWithPadding<RVec> xprimePadded,
+ ArrayRef<RVec> min_proj,
+ const matrix box,
+ t_pbc* pbc,
+ real lambda,
+ real* dvdlambda,
+ real invdt,
+ ArrayRef<RVec> v,
+ bool bCalcVir,
+ tensor vir_r_m_dr,
+ ConstraintVariable econq,
+ t_nrnb* nrnb,
+ int maxwarn,
+ int* warncount)
{
bool bOK = TRUE;
return bOK;
}
+ ArrayRef<const RVec> x = xPadded.unpaddedArrayRef();
+ ArrayRef<RVec> xprime = xprimePadded.unpaddedArrayRef();
+
if (econq == ConstraintVariable::Positions)
{
/* We can't use bCalcDHDL here, since NULL can be passed for dvdlambda
clear_mat(lincsd->task[th].vir_r_m_dr);
- do_lincs(x, xprime, box, pbc, lincsd, th, md.invmass, cr, bCalcDHDL, ir.LincsWarnAngle,
- &bWarn, invdt, v, bCalcVir, th == 0 ? vir_r_m_dr : lincsd->task[th].vir_r_m_dr);
+ do_lincs(xPadded, xprimePadded, box, pbc, lincsd, th, md.invmass, cr, bCalcDHDL,
+ ir.LincsWarnAngle, &bWarn, invdt, v, bCalcVir,
+ th == 0 ? vir_r_m_dr : lincsd->task[th].vir_r_m_dr);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
{
int th = gmx_omp_get_thread_num();
- do_lincsp(x, xprime, min_proj, pbc, lincsd, th, md.invmass, econq, bCalcDHDL,
- bCalcVir, th == 0 ? vir_r_m_dr : lincsd->task[th].vir_r_m_dr);
+ do_lincsp(xPadded, xprimePadded, min_proj, pbc, lincsd, th, md.invmass, econq,
+ bCalcDHDL, bCalcVir, th == 0 ? vir_r_m_dr : lincsd->task[th].vir_r_m_dr);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
{
inc_nrnb(nrnb, eNR_LINCSMAT, lincsd->nOrder * lincsd->ncc_triangle);
}
- if (v)
+ if (!v.empty())
{
inc_nrnb(nrnb, eNR_CONSTR_V, lincsd->nc_real * 2);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct gmx_mtop_t;
struct gmx_multisim_t;
-struct t_blocka;
struct t_commrec;
struct t_idef;
struct t_inputrec;
namespace gmx
{
+template<typename>
+class ArrayRefWithPadding;
enum class ConstraintVariable : int;
-
-/* Abstract type for LINCS that is defined only in the file that uses it */
class Lincs;
+template<typename>
+class ListOfLists;
+
/*! \brief Return the data for determining constraint RMS relative deviations. */
ArrayRef<real> lincs_rmsdData(Lincs* lincsd);
real lincs_rmsd(const Lincs* lincsd);
/*! \brief Initializes and returns the lincs data struct. */
-Lincs* init_lincs(FILE* fplog,
- const gmx_mtop_t& mtop,
- int nflexcon_global,
- ArrayRef<const t_blocka> at2con,
- bool bPLINCS,
- int nIter,
- int nProjOrder);
+Lincs* init_lincs(FILE* fplog,
+ const gmx_mtop_t& mtop,
+ int nflexcon_global,
+ ArrayRef<const ListOfLists<int>> atomsToConstraintsPerMolType,
+ bool bPLINCS,
+ int nIter,
+ int nProjOrder);
/*! \brief Destructs the lincs object when it is not nullptr. */
void done_lincs(Lincs* li);
/*! \brief Applies LINCS constraints.
*
* \returns true if the constraining succeeded. */
-bool constrain_lincs(bool computeRmsd,
- const t_inputrec& ir,
- int64_t step,
- Lincs* lincsd,
- const t_mdatoms& md,
- const t_commrec* cr,
- const gmx_multisim_t* ms,
- const rvec* x,
- rvec* xprime,
- rvec* min_proj,
- const matrix box,
- t_pbc* pbc,
- real lambda,
- real* dvdlambda,
- real invdt,
- rvec* v,
- bool bCalcVir,
- tensor vir_r_m_dr,
- ConstraintVariable econq,
- t_nrnb* nrnb,
- int maxwarn,
- int* warncount);
+bool constrain_lincs(bool computeRmsd,
+ const t_inputrec& ir,
+ int64_t step,
+ Lincs* lincsd,
+ const t_mdatoms& md,
+ const t_commrec* cr,
+ const gmx_multisim_t* ms,
+ ArrayRefWithPadding<const RVec> x,
+ ArrayRefWithPadding<RVec> xprime,
+ ArrayRef<RVec> min_proj,
+ const matrix box,
+ t_pbc* pbc,
+ real lambda,
+ real* dvdlambda,
+ real invdt,
+ ArrayRef<RVec> v,
+ bool bCalcVir,
+ tensor vir_r_m_dr,
+ ConstraintVariable econq,
+ t_nrnb* nrnb,
+ int maxwarn,
+ int* warncount);
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* using CUDA, including class initialization, data-structures management
* and GPU kernel.
*
- * \note Management of periodic boundary should be unified with SETTLE and
- * removed from here.
- * \todo Reconsider naming, i.e. "cuda" suffics should be changed to "gpu".
- *
* \author Artem Zhmurov <zhmurov@gmail.com>
* \author Alan Gray <alang@nvidia.com>
*
*/
#include "gmxpre.h"
-#include "lincs_cuda.cuh"
+#include "lincs_gpu.cuh"
#include <assert.h>
#include <stdio.h>
*/
template<bool updateVelocities, bool computeVirial>
__launch_bounds__(c_maxThreadsPerBlock) __global__
- void lincs_kernel(LincsCudaKernelParameters kernelParams,
+ void lincs_kernel(LincsGpuKernelParameters kernelParams,
const float3* __restrict__ gm_x,
float3* gm_xp,
float3* gm_v,
return kernelPtr;
}
-void LincsCuda::apply(const float3* d_x,
- float3* d_xp,
- const bool updateVelocities,
- float3* d_v,
- const real invdt,
- const bool computeVirial,
- tensor virialScaled)
+void LincsGpu::apply(const float3* d_x,
+ float3* d_xp,
+ const bool updateVelocities,
+ float3* d_v,
+ const real invdt,
+ const bool computeVirial,
+ tensor virialScaled,
+ const PbcAiuc pbcAiuc)
{
ensureNoPendingCudaError("In CUDA version of LINCS");
}
config.stream = commandStream_;
+ kernelParams_.pbcAiuc = pbcAiuc;
+
const auto kernelArgs =
prepareGpuKernelArguments(kernelPtr, config, &kernelParams_, &d_x, &d_xp, &d_v, &invdt);
return;
}
-LincsCuda::LincsCuda(int numIterations, int expansionOrder, CommandStream commandStream) :
+LincsGpu::LincsGpu(int numIterations, int expansionOrder, CommandStream commandStream) :
commandStream_(commandStream)
{
kernelParams_.numIterations = numIterations;
numAtomsAlloc_ = 0;
}
-LincsCuda::~LincsCuda()
+LincsGpu::~LincsGpu()
{
freeDeviceBuffer(&kernelParams_.d_virialScaled);
return numCoupledConstraints;
}
-bool LincsCuda::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
+bool LincsGpu::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
{
for (const gmx_moltype_t& molType : mtop.moltype)
{
return true;
}
-void LincsCuda::set(const t_idef& idef, const t_mdatoms& md)
+void LincsGpu::set(const t_idef& idef, const t_mdatoms& md)
{
int numAtoms = md.nr;
// List of constrained atoms (CPU memory)
GpuApiCallBehavior::Sync, nullptr);
}
-void LincsCuda::setPbc(const t_pbc* pbc)
-{
- setPbcAiuc(pbc->ndim_ePBC, pbc->box, &kernelParams_.pbcAiuc);
-}
-
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
/*! \libinternal \file
*
- * \brief Declares the class for CUDA implementation of LINCS.
+ * \brief Declares the class for GPU implementation of LINCS.
*
* \author Artem Zhmurov <zhmurov@gmail.com>
*
* \ingroup module_mdlib
* \inlibraryapi
*/
-#ifndef GMX_MDLIB_LINCS_CUDA_CUH
-#define GMX_MDLIB_LINCS_CUDA_CUH
+#ifndef GMX_MDLIB_LINCS_GPU_CUH
+#define GMX_MDLIB_LINCS_GPU_CUH
#include "gromacs/gpu_utils/gputraits.cuh"
#include "gromacs/mdlib/constr.h"
* to the GPU as a single structure.
*
*/
-struct LincsCudaKernelParameters
+struct LincsGpuKernelParameters
{
//! Periodic boundary data
PbcAiuc pbcAiuc;
float* d_massFactors;
};
-/*! \internal \brief Class with interfaces and data for CUDA version of LINCS. */
-class LincsCuda
+/*! \internal \brief Class with interfaces and data for GPU version of LINCS. */
+class LincsGpu
{
public:
* \param[in] expansionOrder Order of the matrix inversion algorithm.
* \param[in] commandStream Device command stream.
*/
- LincsCuda(int numIterations, int expansionOrder, CommandStream commandStream);
+ LincsGpu(int numIterations, int expansionOrder, CommandStream commandStream);
/*! \brief Destructor.*/
- ~LincsCuda();
+ ~LincsGpu();
/*! \brief Apply LINCS.
*
* Applies LINCS to coordinates and velocities, stored on GPU.
* The results are not automatically copied back to the CPU memory.
* Method uses this class data structures which should be updated
- * when needed using set() and setPbc() method.
+ * when needed using set() method.
*
* \param[in] d_x Coordinates before timestep (in GPU memory)
* \param[in,out] d_xp Coordinates after timestep (in GPU memory). The
* multipliers when velocities are updated)
* \param[in] computeVirial If virial should be updated.
* \param[in,out] virialScaled Scaled virial tensor to be updated.
+ * \param[in] pbcAiuc PBC data.
*/
void apply(const float3* d_x,
float3* d_xp,
float3* d_v,
const real invdt,
const bool computeVirial,
- tensor virialScaled);
+ tensor virialScaled,
+ const PbcAiuc pbcAiuc);
/*! \brief
* Update data-structures (e.g. after NB search step).
*/
void set(const t_idef& idef, const t_mdatoms& md);
- /*! \brief
- * Update PBC data.
- *
- * Converts pbc data from t_pbc into the PbcAiuc format and stores the latter.
- *
- * \todo Remove this method. LINCS should not manage PBC.
- *
- * \param[in] pbc The PBC data in t_pbc format.
- */
- void setPbc(const t_pbc* pbc);
-
/*! \brief
* Returns whether the maximum number of coupled constraints is supported
- * by the CUDA LINCS code.
+ * by the GPU LINCS code.
*
* \param[in] mtop The molecular topology
*/
static bool isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop);
private:
- //! CUDA stream
+ //! GPU stream
CommandStream commandStream_;
- //! Parameters and pointers, passed to the CUDA kernel
- LincsCudaKernelParameters kernelParams_;
+ //! Parameters and pointers, passed to the GPU kernel
+ LincsGpuKernelParameters kernelParams_;
//! Scaled virial tensor (6 floats: [XX, XY, XZ, YY, YZ, ZZ])
std::vector<float> h_virialScaled_;
} // namespace gmx
-#endif // GMX_MDLIB_LINCS_CUDA_CUH
+#endif // GMX_MDLIB_LINCS_GPU_CUH
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pulling/pull.h"
/* TODO Specialize this routine into init-time and loop-time versions?
e.g. bReadEkin is only true when restoring from checkpoint */
-void compute_globals(gmx_global_stat* gstat,
- t_commrec* cr,
- const t_inputrec* ir,
- t_forcerec* fr,
- gmx_ekindata_t* ekind,
- const rvec* x,
- const rvec* v,
- const matrix box,
- real vdwLambda,
- const t_mdatoms* mdatoms,
- t_nrnb* nrnb,
- t_vcm* vcm,
- gmx_wallcycle_t wcycle,
- gmx_enerdata_t* enerd,
- tensor force_vir,
- tensor shake_vir,
- tensor total_vir,
- tensor pres,
- rvec mu_tot,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* signalCoordinator,
- const matrix lastbox,
- int* totalNumberOfBondedInteractions,
- gmx_bool* bSumEkinhOld,
- const int flags)
+void compute_globals(gmx_global_stat* gstat,
+ t_commrec* cr,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ gmx_ekindata_t* ekind,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ const matrix box,
+ real vdwLambda,
+ const t_mdatoms* mdatoms,
+ t_nrnb* nrnb,
+ t_vcm* vcm,
+ gmx_wallcycle_t wcycle,
+ gmx_enerdata_t* enerd,
+ tensor force_vir,
+ tensor shake_vir,
+ tensor total_vir,
+ tensor pres,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* signalCoordinator,
+ const matrix lastbox,
+ int* totalNumberOfBondedInteractions,
+ gmx_bool* bSumEkinhOld,
+ const int flags)
{
gmx_bool bEner, bPres, bTemp;
gmx_bool bStopCM, bGStat, bReadEkin, bEkinAveVel, bScaleEkin, bConstrain;
if (PAR(cr))
{
wallcycle_start(wcycle, ewcMoveE);
- global_stat(gstat, cr, enerd, force_vir, shake_vir, mu_tot, ir, ekind, constr,
+ global_stat(gstat, cr, enerd, force_vir, shake_vir, ir, ekind, constr,
bStopCM ? vcm : nullptr, signalBuffer.size(), signalBuffer.data(),
totalNumberOfBondedInteractions, *bSumEkinhOld, flags);
wallcycle_stop(wcycle, ewcMoveE);
enerd->dvdl_lin[efptMASS] = static_cast<double>(dvdl_ekin);
enerd->term[F_EKIN] = trace(ekind->ekin);
+
+ for (auto& dhdl : enerd->dhdlLambda)
+ {
+ dhdl += enerd->dvdl_lin[efptMASS];
+ }
}
/* ########## Now pressure ############## */
* Use the box from last timestep since we already called update().
*/
- enerd->term[F_PRES] = calc_pres(fr->ePBC, ir->nwall, lastbox, ekind->ekin, total_vir, pres);
+ enerd->term[F_PRES] = calc_pres(fr->pbcType, ir->nwall, lastbox, ekind->ekin, total_vir, pres);
}
/* ########## Long range energy information ###### */
}
state->nnhpres = 0;
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
state->flags |= (1 << estBOX);
if (inputrecPreserveShape(ir))
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* and for COM removal with rotational and acceleration correction modes.
* Velocities v are needed for kinetic energy calculation and for COM removal.
*/
-void compute_globals(gmx_global_stat* gstat,
- t_commrec* cr,
- const t_inputrec* ir,
- t_forcerec* fr,
- gmx_ekindata_t* ekind,
- const rvec* x,
- const rvec* v,
- const matrix box,
- real vdwLambda,
- const t_mdatoms* mdatoms,
- t_nrnb* nrnb,
- t_vcm* vcm,
- gmx_wallcycle_t wcycle,
- gmx_enerdata_t* enerd,
- tensor force_vir,
- tensor shake_vir,
- tensor total_vir,
- tensor pres,
- rvec mu_tot,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* signalCoordinator,
- const matrix lastbox,
- int* totalNumberOfBondedInteractions,
- gmx_bool* bSumEkinhOld,
- int flags);
+void compute_globals(gmx_global_stat* gstat,
+ t_commrec* cr,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ gmx_ekindata_t* ekind,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ const matrix box,
+ real vdwLambda,
+ const t_mdatoms* mdatoms,
+ t_nrnb* nrnb,
+ t_vcm* vcm,
+ gmx_wallcycle_t wcycle,
+ gmx_enerdata_t* enerd,
+ tensor force_vir,
+ tensor shake_vir,
+ tensor total_vir,
+ tensor pres,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* signalCoordinator,
+ const matrix lastbox,
+ int* totalNumberOfBondedInteractions,
+ gmx_bool* bSumEkinhOld,
+ int flags);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/qmmm.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/topology/mtop_lookup.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
#include "gromacs/gpu_utils/hostallocator.h"
-#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
#include "gromacs/utility/unique_cptr.h"
struct gmx_mtop_t;
struct t_inputrec;
+struct t_mdatoms;
namespace gmx
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
ivec one_ivec = { 1, 1, 1 };
write_checkpoint(of->fn_cpt, of->bKeepAndNumCPT, fplog, cr,
- DOMAINDECOMP(cr) ? cr->dd->nc : one_ivec,
+ DOMAINDECOMP(cr) ? cr->dd->numCells : one_ivec,
DOMAINDECOMP(cr) ? cr->dd->nnodes : cr->nnodes, of->eIntegrator,
of->simulation_part, of->bExpanded, of->elamstats, step, t,
state_global, observablesHistory, *(of->mdModulesNotifier),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* remove overlapping lipids and water from the membrane box*/
/*mark molecules to be removed*/
snew(pbc, 1);
- set_pbc(pbc, inputrec->ePBC, state->box);
+ set_pbc(pbc, inputrec->pbcType, state->box);
snew(rm_p, 1);
lip_rm = gen_rm_list(rm_p, ins_at, rest_at, pbc, mtop, state->x.rvec_array(), mem_p,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
bdens0 = (*gr0)[d];
}
/* Check for a DD cell not at a higher edge */
- if (dd != nullptr && gr1 != nullptr && dd->ci[d] < dd->nc[d] - 1)
+ if (dd != nullptr && gr1 != nullptr && dd->ci[d] < dd->numCells[d] - 1)
{
grid_x1[d] = (*gr1)[d];
bdens1 = (*gr1)[d];
grid->cell_offset[i] = izones_x0[i];
size = izones_size[i];
- bDD = (dd != nullptr) && (dd->nc[i] > 1);
+ bDD = (dd != nullptr) && (dd->numCells[i] > 1);
if (!bDD)
{
bDDRect = FALSE;
snew(grid, 1);
- grid->npbcdim = ePBC2npbcdim(fr->ePBC);
+ grid->npbcdim = numPbcDimensions(fr->pbcType);
- if (fr->ePBC == epbcXY && fr->nwall == 2)
+ if (fr->pbcType == PbcType::XY && fr->nwall == 2)
{
grid->nboundeddim = 3;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
if (bExcl)
{
- ndtot_c += molb.nmol * (molt->excls.nra - molt->atoms.nr) / 2.;
+ ndtot_c += molb.nmol * (molt->excls.numElements() - molt->atoms.nr) / 2.;
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/force.h"
-#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/qmmm.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/utility/cstringutil.h"
}
-static void write_gaussian_SH_input(int step, gmx_bool swap, const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm)
+static void write_gaussian_SH_input(int step, gmx_bool swap, const t_QMMMrec* QMMMrec, t_QMrec* qm, t_MMrec* mm)
{
- int i;
- gmx_bool bSA;
- FILE* out;
- t_QMMMrec* QMMMrec;
- QMMMrec = fr->qr;
- bSA = (qm->SAstep > 0);
-
- out = fopen("input.com", "w");
+ int i;
+ bool bSA = (qm->SAstep > 0);
+ FILE* out = fopen("input.com", "w");
/* write the route */
fprintf(out, "%s", "%scr=input\n");
fprintf(out, "%s", "%rwf=input\n");
fclose(out);
} /* write_gaussian_SH_input */
-static void write_gaussian_input(int step, const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm)
+static void write_gaussian_input(int step, const t_QMMMrec* QMMMrec, t_QMrec* qm, t_MMrec* mm)
{
- int i;
- t_QMMMrec* QMMMrec;
- FILE* out;
+ int i;
- QMMMrec = fr->qr;
- out = fopen("input.com", "w");
+ FILE* out = fopen("input.com", "w");
/* write the route */
if (qm->QMmethod >= eQMmethodRHF)
}
}
-real call_gaussian(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[])
+real call_gaussian(const t_QMMMrec* qmmm, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[])
{
/* normal gaussian jobs */
static int step = 0;
snew(QMgrad, qm->nrQMatoms);
snew(MMgrad, mm->nrMMatoms);
- write_gaussian_input(step, fr, qm, mm);
+ write_gaussian_input(step, qmmm, qm, mm);
do_gaussian(step, exe);
QMener = read_gaussian_output(QMgrad, MMgrad, qm, mm);
/* put the QMMM forces in the force array and to the fshift
} /* call_gaussian */
-real call_gaussian_SH(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[])
+real call_gaussian_SH(const t_QMMMrec* qmmm, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[])
{
/* a gaussian call routine intended for doing diabatic surface
* "sliding". See the manual for the theoretical background of this
/* if(!step)
* qr->bSA=FALSE;*/
/* temporray set to step + 1, since there is a chk start */
- write_gaussian_SH_input(step, swapped, fr, qm, mm);
+ write_gaussian_SH_input(step, swapped, qmmm, qm, mm);
do_gaussian(step, exe);
QMener = read_gaussian_SH_output(QMgrad, MMgrad, step, qm, mm);
}
if (swap) /* change surface, so do another call */
{
- write_gaussian_SH_input(step, swapped, fr, qm, mm);
+ write_gaussian_SH_input(step, swapped, qmmm, qm, mm);
do_gaussian(step, exe);
QMener = read_gaussian_SH_output(QMgrad, MMgrad, step, qm, mm);
}
/*! \brief
* Call gaussian to do qm calculation.
*
- * \param[in] fr Global forcerec.
- * \param[in] qm QM part of forcerec.
- * \param[in] mm mm part of forcerec.
- * \param[in] f force vector.
+ * \param[in] qmmm QMMM part forcerec.
+ * \param[in] qm QM part of forcerec.
+ * \param[in] mm mm part of forcerec.
+ * \param[in] f force vector.
* \param[in] fshift shift of force vector.
*/
-real call_gaussian(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[]);
+real call_gaussian(const t_QMMMrec* qmmm, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[]);
/*! \brief
* Call gaussian SH(?) to do qm calculation.
*
- * \param[in] fr Global forcerec.
- * \param[in] qm QM part of forcerec.
- * \param[in] mm mm part of forcerec.
- * \param[in] f force vector.
+ * \param[in] qmmm QMMM part forcerec.
+ * \param[in] qm QM part of forcerec.
+ * \param[in] mm mm part of forcerec.
+ * \param[in] f force vector.
* \param[in] fshift shift of force vector.
*/
-real call_gaussian_SH(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[]);
+real call_gaussian_SH(const t_QMMMrec* qmmm, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[]);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/qmmm.h"
-#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
}
-static void write_orca_input(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm)
+static void write_orca_input(const t_QMMMrec* QMMMrec, t_QMrec* qm, t_MMrec* mm)
{
- int i;
- t_QMMMrec* QMMMrec;
- FILE * out, *pcFile, *addInputFile;
- char * buf, *orcaInput, *addInputFilename, *pcFilename;
-
- QMMMrec = fr->qr;
+ int i;
+ FILE *pcFile, *addInputFile;
+ char *buf, *orcaInput, *addInputFilename, *pcFilename;
/* write the first part of the input-file */
snew(orcaInput, 200);
sprintf(orcaInput, "%s.inp", qm->orca_basename);
- out = fopen(orcaInput, "w");
+ FILE* out = fopen(orcaInput, "w");
snew(addInputFilename, 200);
sprintf(addInputFilename, "%s.ORCAINFO", qm->orca_basename);
fclose(out);
} /* write_orca_input */
-static real read_orca_output(rvec QMgrad[], rvec MMgrad[], const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm)
+static real read_orca_output(rvec QMgrad[], rvec MMgrad[], const t_QMMMrec* QMMMrec, t_QMrec* qm, t_MMrec* mm)
{
- int i, j;
- char buf[300], orca_pcgradFilename[300], orca_engradFilename[300];
- real QMener;
- FILE * pcgrad, *engrad;
- int k;
- t_QMMMrec* QMMMrec;
- QMMMrec = fr->qr;
+ int i, j;
+ char buf[300], orca_pcgradFilename[300], orca_engradFilename[300];
+ real QMener;
+ FILE *pcgrad, *engrad;
+ int k;
/* the energy and gradients for the QM part are stored in the engrad file
* and the gradients for the point charges are stored in the pc file.
}
}
-real call_orca(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[])
+real call_orca(const t_QMMMrec* qmmm, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[])
{
/* normal orca jobs */
static int step = 0;
snew(QMgrad, qm->nrQMatoms);
snew(MMgrad, mm->nrMMatoms);
- write_orca_input(fr, qm, mm);
+ write_orca_input(qmmm, qm, mm);
do_orca(qm->orca_dir, qm->orca_basename);
- QMener = read_orca_output(QMgrad, MMgrad, fr, qm, mm);
+ QMener = read_orca_output(QMgrad, MMgrad, qmmm, qm, mm);
/* put the QMMM forces in the force array and to the fshift
*/
for (i = 0; i < qm->nrQMatoms; i++)
void init_orca(t_QMrec* qm);
-real call_orca(const t_forcerec* fr, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[]);
+real call_orca(const t_QMMMrec* qmmm, t_QMrec* qm, t_MMrec* mm, rvec f[], rvec fshift[]);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
static real call_QMroutine(const t_commrec gmx_unused* cr,
- const t_forcerec gmx_unused* fr,
+ const t_QMMMrec gmx_unused* qmmm,
t_QMrec gmx_unused* qm,
t_MMrec gmx_unused* mm,
rvec gmx_unused f[],
{
if (GMX_QMMM_GAUSSIAN)
{
- return call_gaussian_SH(fr, qm, mm, f, fshift);
+ return call_gaussian_SH(qmmm, qm, mm, f, fshift);
}
else
{
}
else if (GMX_QMMM_GAUSSIAN)
{
- return call_gaussian(fr, qm, mm, f, fshift);
+ return call_gaussian(qmmm, qm, mm, f, fshift);
}
else if (GMX_QMMM_ORCA)
{
- return call_orca(fr, qm, mm, f, fshift);
+ return call_orca(qmmm, qm, mm, f, fshift);
}
else
{
/* init_pbc(box); needs to be called first, see pbc.h */
ivec null_ivec;
clear_ivec(null_ivec);
- set_pbc_dd(&pbc, fr->ePBC, DOMAINDECOMP(cr) ? cr->dd->nc : null_ivec, FALSE, box);
+ set_pbc_dd(&pbc, fr->pbcType, DOMAINDECOMP(cr) ? cr->dd->numCells : null_ivec, FALSE, box);
/* only in standard (normal) QMMM we need the neighbouring MM
* particles to provide a electric field of point charges for the QM
* atoms.
}
} /* update_QMMM_rec */
-real calculate_QMMM(const t_commrec* cr, gmx::ForceWithShiftForces* forceWithShiftForces, const t_forcerec* fr)
+real calculate_QMMM(const t_commrec* cr, gmx::ForceWithShiftForces* forceWithShiftForces, const t_QMMMrec* qr)
{
real QMener = 0.0;
/* a selection for the QM package depending on which is requested
* (Gaussian, GAMESS-UK, MOPAC or ORCA) needs to be implemented here. Now
* it works through defines.... Not so nice yet
*/
- t_QMMMrec* qr;
- t_QMrec * qm, *qm2;
- t_MMrec* mm = nullptr;
- rvec * forces = nullptr, *fshift = nullptr, *forces2 = nullptr,
+ t_QMrec *qm, *qm2;
+ t_MMrec* mm = nullptr;
+ rvec * forces = nullptr, *fshift = nullptr, *forces2 = nullptr,
*fshift2 = nullptr; /* needed for multilayer ONIOM */
int i, j, k;
/* make a local copy the QMMMrec pointer
*/
- qr = fr->qr;
mm = qr->mm;
/* now different procedures are carried out for one layer ONION and
qm = qr->qm[0];
snew(forces, (qm->nrQMatoms + mm->nrMMatoms));
snew(fshift, (qm->nrQMatoms + mm->nrMMatoms));
- QMener = call_QMroutine(cr, fr, qm, mm, forces, fshift);
+ QMener = call_QMroutine(cr, qr, qm, mm, forces, fshift);
for (i = 0; i < qm->nrQMatoms; i++)
{
for (j = 0; j < DIM; j++)
srenew(fshift, qm->nrQMatoms);
/* we need to re-initialize the QMroutine every step... */
init_QMroutine(cr, qm, mm);
- QMener += call_QMroutine(cr, fr, qm, mm, forces, fshift);
+ QMener += call_QMroutine(cr, qr, qm, mm, forces, fshift);
/* this layer at the lower level of theory */
srenew(forces2, qm->nrQMatoms);
srenew(fshift2, qm->nrQMatoms);
init_QMroutine(cr, qm2, mm);
- QMener -= call_QMroutine(cr, fr, qm2, mm, forces2, fshift2);
+ QMener -= call_QMroutine(cr, qr, qm2, mm, forces2, fshift2);
/* E = E1high-E1low The next layer includes the current layer at
* the lower level of theory, which provides + E2low
* this is similar for gradients
init_QMroutine(cr, qm, mm);
srenew(forces, qm->nrQMatoms);
srenew(fshift, qm->nrQMatoms);
- QMener += call_QMroutine(cr, fr, qm, mm, forces, fshift);
+ QMener += call_QMroutine(cr, qr, qm, mm, forces, fshift);
for (i = 0; i < qm->nrQMatoms; i++)
{
for (j = 0; j < DIM; j++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* routine should be called at every step, since it updates the MM
* elements of the t_QMMMrec struct.
*/
-real calculate_QMMM(const t_commrec* cr, gmx::ForceWithShiftForces* forceWithShiftForces, const t_forcerec* fr);
+real calculate_QMMM(const t_commrec* cr, gmx::ForceWithShiftForces* forceWithShiftForces, const t_QMMMrec* qmmm);
/* QMMM computes the QM forces. This routine makes either function
* calls to gmx QM routines (derived from MOPAC7 (semi-emp.) and MPQC
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/domdec.h"
#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_load_balancing.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/mdrunutility/printtime.h"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <algorithm>
+#include "gromacs/math/arrayrefwithpadding.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/invertmatrix.h"
#include "gromacs/math/vec.h"
}
}
-void settle_proj(settledata* settled,
- ConstraintVariable econq,
- int nsettle,
- const t_iatom iatoms[],
- const t_pbc* pbc,
- const rvec x[],
- rvec* der,
- rvec* derp,
- int calcvir_atom_end,
- tensor vir_r_m_dder)
+void settle_proj(settledata* settled,
+ ConstraintVariable econq,
+ int nsettle,
+ const t_iatom iatoms[],
+ const t_pbc* pbc,
+ ArrayRef<const RVec> x,
+ ArrayRef<RVec> der,
+ ArrayRef<RVec> derp,
+ int calcvir_atom_end,
+ tensor vir_r_m_dder)
{
/* Settle for projection out constraint components
* of derivatives of the coordinates.
}
}
-void csettle(settledata* settled,
- int nthread,
- int thread,
- const t_pbc* pbc,
- const real x[],
- real xprime[],
- real invdt,
- real* v,
- bool bCalcVirial,
- tensor vir_r_m_dr,
- bool* bErrorHasOccurred)
+void csettle(settledata* settled,
+ int nthread,
+ int thread,
+ const t_pbc* pbc,
+ ArrayRefWithPadding<const RVec> x,
+ ArrayRefWithPadding<RVec> xprime,
+ real invdt,
+ ArrayRefWithPadding<RVec> v,
+ bool bCalcVirial,
+ tensor vir_r_m_dr,
+ bool* bErrorHasOccurred)
{
+ const real* xPtr = as_rvec_array(x.paddedArrayRef().data())[0];
+ real* xprimePtr = as_rvec_array(xprime.paddedArrayRef().data())[0];
+ real* vPtr = as_rvec_array(v.paddedArrayRef().data())[0];
+
#if GMX_SIMD_HAVE_REAL
if (settled->bUseSimd)
{
set_pbc_simd(pbc, pbcSimd);
settleTemplateWrapper<SimdReal, SimdBool, GMX_SIMD_REAL_WIDTH, const real*>(
- settled, nthread, thread, pbcSimd, x, xprime, invdt, v, bCalcVirial, vir_r_m_dr,
- bErrorHasOccurred);
+ settled, nthread, thread, pbcSimd, xPtr, xprimePtr, invdt, vPtr, bCalcVirial,
+ vir_r_m_dr, bErrorHasOccurred);
}
else
#endif
}
else
{
- set_pbc(&pbcNo, epbcNONE, nullptr);
+ set_pbc(&pbcNo, PbcType::No, nullptr);
pbcNonNull = &pbcNo;
}
- settleTemplateWrapper<real, bool, 1, const t_pbc*>(settled, nthread, thread, pbcNonNull, x,
- xprime, invdt, v, bCalcVirial,
- vir_r_m_dr, bErrorHasOccurred);
+ settleTemplateWrapper<real, bool, 1, const t_pbc*>(settled, nthread, thread, pbcNonNull,
+ &xPtr[0], &xprimePtr[0], invdt, &vPtr[0],
+ bCalcVirial, vir_r_m_dr, bErrorHasOccurred);
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
namespace gmx
{
+template<typename>
+class ArrayRef;
+template<typename>
+class ArrayRefWithPadding;
enum class ConstraintVariable : int;
/* Abstract type for SETTLE that is defined only in the file that uses it */
/*! \brief Constrain coordinates using SETTLE.
* Can be called on any number of threads.
*/
-void csettle(settledata* settled, /* The SETTLE structure */
- int nthread, /* The number of threads used */
- int thread, /* Our thread index */
- const t_pbc* pbc, /* PBC data pointer, can be NULL */
- const real x[], /* Reference coordinates */
- real xprime[], /* New coords, to be settled */
- real invdt, /* 1/delta_t */
- real* v, /* Also constrain v if v!=NULL */
- bool bCalcVirial, /* Calculate the virial contribution */
- tensor vir_r_m_dr, /* sum r x m delta_r */
- bool* bErrorHasOccurred /* True if a settle error occurred */
+void csettle(settledata* settled, /* The SETTLE structure */
+ int nthread, /* The number of threads used */
+ int thread, /* Our thread index */
+ const t_pbc* pbc, /* PBC data pointer, can be NULL */
+ ArrayRefWithPadding<const RVec> x, /* Reference coordinates */
+ ArrayRefWithPadding<RVec> xprime, /* New coords, to be settled */
+ real invdt, /* 1/delta_t */
+ ArrayRefWithPadding<RVec> v, /* Also constrain v if v!=NULL */
+ bool bCalcVirial, /* Calculate the virial contribution */
+ tensor vir_r_m_dr, /* sum r x m delta_r */
+ bool* bErrorHasOccurred /* True if a settle error occurred */
);
/*! \brief Analytical algorithm to subtract the components of derivatives
* of coordinates working on settle type constraint.
*/
-void settle_proj(settledata* settled,
- ConstraintVariable econq,
- int nsettle,
- const t_iatom iatoms[],
- const t_pbc* pbc, /* PBC data pointer, can be NULL */
- const rvec x[],
- rvec* der,
- rvec* derp,
- int CalcVirAtomEnd,
- tensor vir_r_m_dder);
+void settle_proj(settledata* settled,
+ ConstraintVariable econq,
+ int nsettle,
+ const t_iatom iatoms[],
+ const t_pbc* pbc, /* PBC data pointer, can be NULL */
+ ArrayRef<const RVec> x,
+ ArrayRef<RVec> der,
+ ArrayRef<RVec> derp,
+ int CalcVirAtomEnd,
+ tensor vir_r_m_dder);
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* using CUDA, including class initialization, data-structures management
* and GPU kernel.
*
- * \note Management of CUDA stream and periodic boundary should be unified with LINCS
- * and removed from here once constraints are fully integrated with update module.
- * \todo Reconsider naming to use "gpu" suffix instead of "cuda".
*
* \author Artem Zhmurov <zhmurov@gmail.com>
*
*/
#include "gmxpre.h"
-#include "settle_cuda.cuh"
+#include "settle_gpu.cuh"
#include <assert.h>
#include <stdio.h>
* \param [in] gm_x Coordinates of atoms before the timestep.
* \param [in,out] gm_x Coordinates of atoms after the timestep (constrained coordinates will be
* saved here).
- * \param [in] pbcAiuc Periodic boundary conditions data.
* \param [in] invdt Reciprocal timestep.
* \param [in] gm_v Velocities of the particles.
* \param [in] gm_virialScaled Virial tensor.
+ * \param [in] pbcAiuc Periodic boundary conditions data.
*/
template<bool updateVelocities, bool computeVirial>
__launch_bounds__(c_maxThreadsPerBlock) __global__
const SettleParameters pars,
const float3* __restrict__ gm_x,
float3* __restrict__ gm_xprime,
- const PbcAiuc pbcAiuc,
- float invdt,
+ float invdt,
float3* __restrict__ gm_v,
- float* __restrict__ gm_virialScaled)
+ float* __restrict__ gm_virialScaled,
+ const PbcAiuc pbcAiuc)
{
/* ******************************************************************* */
/* ** */
return kernelPtr;
}
-void SettleCuda::apply(const float3* d_x,
- float3* d_xp,
- const bool updateVelocities,
- float3* d_v,
- const real invdt,
- const bool computeVirial,
- tensor virialScaled)
+void SettleGpu::apply(const float3* d_x,
+ float3* d_xp,
+ const bool updateVelocities,
+ float3* d_v,
+ const real invdt,
+ const bool computeVirial,
+ tensor virialScaled,
+ const PbcAiuc pbcAiuc)
{
ensureNoPendingCudaError("In CUDA version SETTLE");
config.stream = commandStream_;
const auto kernelArgs = prepareGpuKernelArguments(kernelPtr, config, &numSettles_, &d_atomIds_,
- &settleParameters_, &d_x, &d_xp, &pbcAiuc_,
- &invdt, &d_v, &d_virialScaled_);
+ &settleParameters_, &d_x, &d_xp, &invdt, &d_v,
+ &d_virialScaled_, &pbcAiuc);
launchGpuKernel(kernelPtr, config, nullptr, "settle_kernel<updateVelocities, computeVirial>", kernelArgs);
return;
}
-SettleCuda::SettleCuda(const gmx_mtop_t& mtop, CommandStream commandStream) :
+SettleGpu::SettleGpu(const gmx_mtop_t& mtop, CommandStream commandStream) :
commandStream_(commandStream)
{
static_assert(sizeof(real) == sizeof(float),
h_virialScaled_.resize(6);
}
-SettleCuda::~SettleCuda()
+SettleGpu::~SettleGpu()
{
// Early exit if there is no settles
if (numSettles_ == 0)
}
}
-void SettleCuda::set(const t_idef& idef, const t_mdatoms gmx_unused& md)
+void SettleGpu::set(const t_idef& idef, const t_mdatoms gmx_unused& md)
{
const int nral1 = 1 + NRAL(F_SETTLE);
t_ilist il_settle = idef.il[F_SETTLE];
GpuApiCallBehavior::Sync, nullptr);
}
-void SettleCuda::setPbc(const t_pbc* pbc)
-{
- setPbcAiuc(pbc->ndim_ePBC, pbc->box, &pbcAiuc_);
-}
-
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
/*! \internal \file
*
- * \brief Declares class for CUDA implementation of SETTLE
+ * \brief Declares class for GPU implementation of SETTLE
*
* \author Artem Zhmurov <zhmurov@gmail.com>
*
* \ingroup module_mdlib
*/
-#ifndef GMX_MDLIB_SETTLE_CUDA_CUH
-#define GMX_MDLIB_SETTLE_CUDA_CUH
+#ifndef GMX_MDLIB_SETTLE_GPU_CUH
+#define GMX_MDLIB_SETTLE_GPU_CUH
#include "gmxpre.h"
initializeProjectionMatrix(invmO, invmH, dOH, dHH, p->invmat);
}
-/*! \internal \brief Class with interfaces and data for CUDA version of SETTLE. */
-class SettleCuda
+/*! \internal \brief Class with interfaces and data for GPU version of SETTLE. */
+class SettleGpu
{
public:
* consistency.
* \param[in] commandStream Device stream to use.
*/
- SettleCuda(const gmx_mtop_t& mtop, CommandStream commandStream);
+ SettleGpu(const gmx_mtop_t& mtop, CommandStream commandStream);
- ~SettleCuda();
+ ~SettleGpu();
/*! \brief Apply SETTLE.
*
* multipliers when velocities are updated)
* \param[in] computeVirial If virial should be updated.
* \param[in,out] virialScaled Scaled virial tensor to be updated.
+ * \param[in] pbcAiuc PBC data.
*/
void apply(const float3* d_x,
float3* d_xp,
float3* d_v,
const real invdt,
const bool computeVirial,
- tensor virialScaled);
+ tensor virialScaled,
+ const PbcAiuc pbcAiuc);
/*! \brief
* Update data-structures (e.g. after NB search step).
*/
void set(const t_idef& idef, const t_mdatoms& md);
- /*! \brief
- * Update PBC data.
- *
- * Converts pbc data from t_pbc into the PbcAiuc format and stores the latter.
- *
- * \todo PBC should not be handled by constraints.
- *
- * \param[in] pbc The PBC data in t_pbc format.
- */
- void setPbc(const t_pbc* pbc);
-
-
private:
- //! CUDA stream
+ //! GPU stream
CommandStream commandStream_;
- //! Periodic boundary data
- PbcAiuc pbcAiuc_;
//! Scaled virial tensor (9 reals, GPU)
std::vector<float> h_virialScaled_;
} // namespace gmx
-#endif
+#endif // GMX_MDLIB_SETTLE_GPU_CUH
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2020, by the GROMACS development team, led by
+ * Copyright (c) 2013-2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/partition.h"
#include "gromacs/essentialdynamics/edsam.h"
#include "gromacs/ewald/pme.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/ewald/pme_pp_comm_gpu.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nonbonded/nb_free_energy.h"
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/enerdata_utils.h"
#include "gromacs/mdlib/force.h"
+#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/qmmm.h"
#include "gromacs/mdlib/update.h"
+#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/forceoutput.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/iforceprovider.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/mdtypes/state_propagator_data_gpu.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/nbnxm/nbnxm.h"
+#include "gromacs/nbnxm/nbnxm_gpu.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/mshift.h"
#include "gromacs/pbcutil/pbc.h"
const matrix box,
t_nrnb* nrnb,
const t_forcerec* fr,
- int ePBC)
+ PbcType pbcType)
{
/* The short-range virial from surrounding boxes */
const rvec* fshift = as_rvec_array(forceWithShiftForces.shiftForces().data());
- calc_vir(SHIFTS, fr->shift_vec, fshift, vir_part, ePBC == epbcSCREW, box);
+ calc_vir(SHIFTS, fr->shift_vec, fshift, vir_part, pbcType == PbcType::Screw, box);
inc_nrnb(nrnb, eNR_VIRIAL, SHIFTS);
/* Calculate partial virial, for local atoms only, based on short range.
* which is why pull_potential is called close to other communication.
*/
wallcycle_start(wcycle, ewcPULLPOT);
- set_pbc(&pbc, ir->ePBC, box);
+ set_pbc(&pbc, ir->pbcType, box);
dvdl = 0;
enerd->term[F_COM_PULL] += pull_potential(pull_work, mdatoms, &pbc, cr, t, lambda[efptRESTRAINT],
as_rvec_array(x.data()), force, &dvdl);
enerd->dvdl_lin[efptRESTRAINT] += dvdl;
+ for (auto& dhdl : enerd->dhdlLambda)
+ {
+ dhdl += dvdl;
+ }
wallcycle_stop(wcycle, ewcPULLPOT);
}
enerd->dvdl_lin[efptCOUL] += dvdl_q;
enerd->dvdl_lin[efptVDW] += dvdl_lj;
+ for (auto& dhdl : enerd->dhdlLambda)
+ {
+ dhdl += dvdl_q + dvdl_lj;
+ }
+
if (wcycle)
{
dd_cycles_add(cr->dd, cycles_seppme, ddCyclPME);
*/
matrix virial = { { 0 } };
spread_vsite_f(vsite, x, fDirectVir, nullptr, stepWork.computeVirial, virial, nrnb,
- &top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr, wcycle);
+ &top->idef, fr->pbcType, fr->bMolPBC, graph, box, cr, wcycle);
forceWithVirial.addVirialContribution(virial);
}
if (awh)
{
enerd->term[F_COM_PULL] += awh->applyBiasForcesAndUpdateBias(
- inputrec->ePBC, *mdatoms, box, forceWithVirial, t, step, wcycle, fplog);
+ inputrec->pbcType, *mdatoms, box, forceWithVirial, t, step, wcycle, fplog);
}
}
static void launchPmeGpuFftAndGather(gmx_pme_t* pmedata, gmx_wallcycle_t wcycle)
{
pme_gpu_launch_complex_transforms(pmedata, wcycle);
- pme_gpu_launch_gather(pmedata, wcycle, PmeForceOutputHandling::Set);
+ pme_gpu_launch_gather(pmedata, wcycle);
}
/*! \brief
/* \brief Launch end-of-step GPU tasks: buffer clearing and rolling pruning.
*
- * TODO: eliminate the \p useGpuNonbonded and \p useGpuNonbonded when these are
+ * TODO: eliminate \p useGpuPmeOnThisRank when this is
* incorporated in DomainLifetimeWorkload.
*/
static void launchGpuEndOfStepTasks(nonbonded_verlet_t* nbv,
gmx_pme_t* pmedata,
gmx_enerdata_t* enerd,
const gmx::MdrunScheduleWorkload& runScheduleWork,
- bool useGpuNonbonded,
- bool useGpuPme,
+ bool useGpuPmeOnThisRank,
int64_t step,
gmx_wallcycle_t wcycle)
{
- if (useGpuNonbonded)
+ if (runScheduleWork.simulationWork.useGpuNonbonded)
{
/* Launch pruning before buffer clearing because the API overhead of the
* clear kernel launches can leave the GPU idle while it could be running
wallcycle_stop(wcycle, ewcLAUNCH_GPU);
}
- if (useGpuPme)
+ if (useGpuPmeOnThisRank)
{
pme_gpu_reinit_computation(pmedata, wcycle);
}
interaction_const_t* ic = fr->ic;
gmx::StatePropagatorDataGpu* stateGpu = fr->stateGpu;
- // TODO remove the code below when the legacy flags are not in use anymore
- /* modify force flag if not doing nonbonded */
- if (!fr->bNonbonded)
- {
- legacyFlags &= ~GMX_FORCE_NONBONDED;
- }
-
const SimulationWorkload& simulationWork = runScheduleWork->simulationWork;
const bool useGpuPmeOnThisRank = simulationWork.useGpuPme && thisRankHasDuty(cr, DUTY_PME);
const int pmeFlags = makePmeFlags(stepWork);
- // Switches on whether to use GPU for position and force buffer operations
- // TODO consider all possible combinations of triggers, and how to combine optimally in each case.
- const BufferOpsUseGpu useGpuXBufOps =
- stepWork.useGpuXBufferOps ? BufferOpsUseGpu::True : BufferOpsUseGpu::False;
- // GPU Force buffer ops are disabled on virial steps, because the virial calc is not yet ported to GPU
- const BufferOpsUseGpu useGpuFBufOps =
- stepWork.useGpuFBufferOps ? BufferOpsUseGpu::True : BufferOpsUseGpu::False;
-
/* At a search step we need to start the first balancing region
* somewhere early inside the step after communication during domain
* decomposition (and not during the previous step as usual).
clear_mat(vir_force);
- if (stepWork.stateChanged)
+ if (stepWork.stateChanged && simulationWork.computeMuTot)
{
- if (inputrecNeedMutot(inputrec))
- {
- /* Calculate total (local) dipole moment in a temporary common array.
- * This makes it possible to sum them over nodes faster.
- */
- calc_mu(start, homenr, x.unpaddedArrayRef(), mdatoms->chargeA, mdatoms->chargeB,
- mdatoms->nChargePerturbed, mu, mu + DIM);
- }
+ /* Calculate total (local) dipole moment in a temporary common array.
+ * This makes it possible to sum them over nodes faster.
+ */
+ calc_mu(start, homenr, x.unpaddedArrayRef(), mdatoms->chargeA, mdatoms->chargeB,
+ mdatoms->nChargePerturbed, mu, mu + DIM);
}
- if (fr->ePBC != epbcNONE)
+ if (fr->pbcType != PbcType::No)
{
/* Compute shift vectors every step,
* because of pressure coupling or box deformation!
const bool calcCGCM = (fillGrid && !DOMAINDECOMP(cr));
if (calcCGCM)
{
- put_atoms_in_box_omp(fr->ePBC, box, x.unpaddedArrayRef().subArray(0, homenr),
+ put_atoms_in_box_omp(fr->pbcType, box, x.unpaddedArrayRef().subArray(0, homenr),
gmx_omp_nthreads_get(emntDefault));
inc_nrnb(nrnb, eNR_SHIFTX, homenr);
}
// The local coordinates can be copied right away.
// NOTE: Consider moving this copy to right after they are updated and constrained,
// if the later is not offloaded.
- if (useGpuPmeOnThisRank || useGpuXBufOps == BufferOpsUseGpu::True)
+ if (useGpuPmeOnThisRank || stepWork.useGpuXBufferOps)
{
if (stepWork.doNeighborSearch)
{
+ // TODO refactor this to do_md, after partitioning.
stateGpu->reinit(mdatoms->homenr,
cr->dd != nullptr ? dd_numAtomsZones(*cr->dd) : mdatoms->homenr);
if (useGpuPmeOnThisRank)
// The conditions for gpuHaloExchange e.g. using GPU buffer
// operations were checked before construction, so here we can
// just use it and assert upon any conditions.
- gmx::GpuHaloExchange* gpuHaloExchange =
- (havePPDomainDecomposition(cr) ? cr->dd->gpuHaloExchange.get() : nullptr);
- const bool ddUsesGpuDirectCommunication = (gpuHaloExchange != nullptr);
- GMX_ASSERT(!ddUsesGpuDirectCommunication || (useGpuXBufOps == BufferOpsUseGpu::True),
+ const bool ddUsesGpuDirectCommunication =
+ ((cr->dd != nullptr) && (!cr->dd->gpuHaloExchange.empty()));
+ GMX_ASSERT(!ddUsesGpuDirectCommunication || stepWork.useGpuXBufferOps,
"Must use coordinate buffer ops with GPU halo exchange");
- const bool useGpuForcesHaloExchange =
- ddUsesGpuDirectCommunication && (useGpuFBufOps == BufferOpsUseGpu::True);
+ const bool useGpuForcesHaloExchange = ddUsesGpuDirectCommunication && stepWork.useGpuFBufferOps;
// Copy coordinate from the GPU if update is on the GPU and there
// are forces to be computed on the CPU, or for the computation of
if (graph && stepWork.stateChanged)
{
/* Calculate intramolecular shift vectors to make molecules whole */
- mk_mshift(fplog, graph, fr->ePBC, box, as_rvec_array(x.unpaddedArrayRef().data()));
+ mk_mshift(fplog, graph, fr->pbcType, box, as_rvec_array(x.unpaddedArrayRef().data()));
}
// TODO
}
wallcycle_stop(wcycle, ewcLAUNCH_GPU);
}
- }
- if (stepWork.doNeighborSearch)
- {
// Need to run after the GPU-offload bonded interaction lists
// are set up to be able to determine whether there is bonded work.
runScheduleWork->domainWork = setupDomainLifetimeWorkload(
wallcycle_start_nocount(wcycle, ewcNS);
wallcycle_sub_start(wcycle, ewcsNBS_SEARCH_LOCAL);
/* Note that with a GPU the launch overhead of the list transfer is not timed separately */
- nbv->constructPairlist(InteractionLocality::Local, &top->excls, step, nrnb);
+ nbv->constructPairlist(InteractionLocality::Local, top->excls, step, nrnb);
nbv->setupGpuShortRangeWork(fr->gpuBonded, InteractionLocality::Local);
wallcycle_sub_stop(wcycle, ewcsNBS_SEARCH_LOCAL);
wallcycle_stop(wcycle, ewcNS);
- if (useGpuXBufOps == BufferOpsUseGpu::True)
+ if (stepWork.useGpuXBufferOps)
{
nbv->atomdata_init_copy_x_to_nbat_x_gpu();
}
// For force buffer ops, we use the below conditon rather than
- // useGpuFBufOps to ensure that init is performed even if this
+ // useGpuFBufferOps to ensure that init is performed even if this
// NS step is also a virial step (on which f buf ops are deactivated).
if (simulationWork.useGpuBufferOps && simulationWork.useGpuNonbonded && (GMX_GPU == GMX_GPU_CUDA))
{
}
else if (!EI_TPI(inputrec->eI))
{
- if (useGpuXBufOps == BufferOpsUseGpu::True)
+ if (stepWork.useGpuXBufferOps)
{
GMX_ASSERT(stateGpu, "stateGpu should be valid when buffer ops are offloaded");
nbv->convertCoordinatesGpu(AtomLocality::Local, false, stateGpu->getCoordinates(),
wallcycle_sub_start(wcycle, ewcsLAUNCH_GPU_NONBONDED);
Nbnxm::gpu_upload_shiftvec(nbv->gpu_nbv, nbv->nbat.get());
- if (stepWork.doNeighborSearch || (useGpuXBufOps == BufferOpsUseGpu::False))
+ if (stepWork.doNeighborSearch || !stepWork.useGpuXBufferOps)
{
Nbnxm::gpu_copy_xq_to_gpu(nbv->gpu_nbv, nbv->nbat.get(), AtomLocality::Local);
}
wallcycle_start_nocount(wcycle, ewcNS);
wallcycle_sub_start(wcycle, ewcsNBS_SEARCH_NONLOCAL);
/* Note that with a GPU the launch overhead of the list transfer is not timed separately */
- nbv->constructPairlist(InteractionLocality::NonLocal, &top->excls, step, nrnb);
+ nbv->constructPairlist(InteractionLocality::NonLocal, top->excls, step, nrnb);
nbv->setupGpuShortRangeWork(fr->gpuBonded, InteractionLocality::NonLocal);
wallcycle_sub_stop(wcycle, ewcsNBS_SEARCH_NONLOCAL);
wallcycle_stop(wcycle, ewcNS);
+ // TODO refactor this GPU halo exchange re-initialisation
+ // to location in do_md where GPU halo exchange is
+ // constructed at partitioning, after above stateGpu
+ // re-initialization has similarly been refactored
if (ddUsesGpuDirectCommunication)
{
- gpuHaloExchange->reinitHalo(stateGpu->getCoordinates(), stateGpu->getForces());
+ reinitGpuHaloExchange(*cr, stateGpu->getCoordinates(), stateGpu->getForces());
}
}
else
{
// The following must be called after local setCoordinates (which records an event
// when the coordinate data has been copied to the device).
- gpuHaloExchange->communicateHaloCoordinates(box, localXReadyOnDevice);
+ communicateGpuHaloCoordinates(*cr, box, localXReadyOnDevice);
if (domainWork.haveCpuBondedWork || domainWork.haveFreeEnergyWork)
{
dd_move_x(cr->dd, box, x.unpaddedArrayRef(), wcycle);
}
- if (useGpuXBufOps == BufferOpsUseGpu::True)
+ if (stepWork.useGpuXBufferOps)
{
- // The condition here was (pme != nullptr && pme_gpu_get_device_x(fr->pmedata) != nullptr)
if (!useGpuPmeOnThisRank && !ddUsesGpuDirectCommunication)
{
stateGpu->copyCoordinatesToGpu(x.unpaddedArrayRef(), AtomLocality::NonLocal);
{
wallcycle_start(wcycle, ewcLAUNCH_GPU);
- if (stepWork.doNeighborSearch || (useGpuXBufOps == BufferOpsUseGpu::False))
+ if (stepWork.doNeighborSearch || !stepWork.useGpuXBufferOps)
{
wallcycle_sub_start(wcycle, ewcsLAUNCH_GPU_NONBONDED);
Nbnxm::gpu_copy_xq_to_gpu(nbv->gpu_nbv, nbv->nbat.get(), AtomLocality::NonLocal);
wallcycle_stop(wcycle, ewcLAUNCH_GPU);
}
- if (stepWork.stateChanged && inputrecNeedMutot(inputrec))
+ if (stepWork.stateChanged && simulationWork.computeMuTot)
{
if (PAR(cr))
{
wallcycle_stop(wcycle, ewcFORCE);
}
- if (useGpuFBufOps == BufferOpsUseGpu::True)
+ if (stepWork.useGpuFBufferOps)
{
gmx::FixedCapacityVector<GpuEventSynchronizer*, 1> dependencyList;
stateGpu->copyForcesToGpu(forceOut.forceWithShiftForces().force(),
AtomLocality::NonLocal);
dependencyList.push_back(stateGpu->getForcesReadyOnDeviceEvent(
- AtomLocality::NonLocal, useGpuFBufOps == BufferOpsUseGpu::True));
+ AtomLocality::NonLocal, stepWork.useGpuFBufferOps));
}
nbv->atomdata_add_nbat_f_to_f_gpu(AtomLocality::NonLocal, stateGpu->getForces(),
{
stateGpu->copyForcesToGpu(forceOut.forceWithShiftForces().force(), AtomLocality::Local);
}
- gpuHaloExchange->communicateHaloForces(domainWork.haveCpuLocalForceWork);
+ communicateGpuHaloForces(*cr, domainWork.haveCpuLocalForceWork);
}
else
{
- if (useGpuFBufOps == BufferOpsUseGpu::True)
+ if (stepWork.useGpuFBufferOps)
{
stateGpu->waitForcesReadyOnHost(AtomLocality::NonLocal);
}
// With both nonbonded and PME offloaded a GPU on the same rank, we use
// an alternating wait/reduction scheme.
bool alternateGpuWait = (!c_disableAlternatingWait && useGpuPmeOnThisRank && simulationWork.useGpuNonbonded
- && !DOMAINDECOMP(cr) && (useGpuFBufOps == BufferOpsUseGpu::False));
+ && !DOMAINDECOMP(cr) && !stepWork.useGpuFBufferOps);
if (alternateGpuWait)
{
alternatePmeNbGpuWaitReduce(fr->nbv.get(), fr->pmedata, &forceOut, enerd, stepWork, pmeFlags, wcycle);
gmx::ArrayRef<gmx::RVec> forceWithShift = forceOut.forceWithShiftForces().force();
- if (useGpuFBufOps == BufferOpsUseGpu::True)
+ if (stepWork.useGpuFBufferOps)
{
// Flag to specify whether the CPU force buffer has contributions to
// local atoms. This depends on whether there are CPU-based force tasks
auto locality = havePPDomainDecomposition(cr) ? AtomLocality::Local : AtomLocality::All;
stateGpu->copyForcesToGpu(forceWithShift, locality);
- dependencyList.push_back(stateGpu->getForcesReadyOnDeviceEvent(
- locality, useGpuFBufOps == BufferOpsUseGpu::True));
+ dependencyList.push_back(
+ stateGpu->getForcesReadyOnDeviceEvent(locality, stepWork.useGpuFBufferOps));
}
if (useGpuForcesHaloExchange)
{
- dependencyList.push_back(gpuHaloExchange->getForcesReadyOnDeviceEvent());
+ dependencyList.push_back(cr->dd->gpuHaloExchange[0]->getForcesReadyOnDeviceEvent());
}
nbv->atomdata_add_nbat_f_to_f_gpu(AtomLocality::Local, stateGpu->getForces(), pmeForcePtr,
dependencyList, stepWork.useGpuPmeFReduction,
}
launchGpuEndOfStepTasks(nbv, fr->gpuBonded, fr->pmedata, enerd, *runScheduleWork,
- simulationWork.useGpuNonbonded, useGpuPmeOnThisRank, step, wcycle);
+ useGpuPmeOnThisRank, step, wcycle);
if (DOMAINDECOMP(cr))
{
if (vsite && !(fr->haveDirectVirialContributions && !stepWork.computeVirial))
{
rvec* fshift = as_rvec_array(forceOut.forceWithShiftForces().shiftForces().data());
- spread_vsite_f(vsite, as_rvec_array(x.unpaddedArrayRef().data()), f, fshift, FALSE,
- nullptr, nrnb, &top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr, wcycle);
+ spread_vsite_f(vsite, as_rvec_array(x.unpaddedArrayRef().data()), f, fshift, FALSE, nullptr,
+ nrnb, &top->idef, fr->pbcType, fr->bMolPBC, graph, box, cr, wcycle);
}
if (stepWork.computeVirial)
{
/* Calculation of the virial must be done after vsites! */
calc_virial(0, mdatoms->homenr, as_rvec_array(x.unpaddedArrayRef().data()),
- forceOut.forceWithShiftForces(), vir_force, graph, box, nrnb, fr, inputrec->ePBC);
+ forceOut.forceWithShiftForces(), vir_force, graph, box, nrnb, fr,
+ inputrec->pbcType);
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_enerdata_t* enerd,
tensor fvir,
tensor svir,
- rvec mu_tot,
const t_inputrec* inputrec,
gmx_ekindata_t* ekind,
const gmx::Constraints* constr,
{
t_bin* rb;
int * itc0, *itc1;
- int ie = 0, ifv = 0, isv = 0, irmsd = 0, imu = 0;
+ int ie = 0, ifv = 0, isv = 0, irmsd = 0;
int idedl = 0, idedlo = 0, idvdll = 0, idvdlnl = 0, iepl = 0, icm = 0, imass = 0, ica = 0, inb = 0;
int isig = -1;
int icj = -1, ici = -1, icx = -1;
irmsd = add_binr(rb, 2, rmsdData.data());
}
}
- if (!inputrecNeedMutot(inputrec))
- {
- imu = add_binr(rb, DIM, mu_tot);
- }
for (j = 0; (j < egNR); j++)
{
{
extract_binr(rb, irmsd, rmsdData);
}
- if (!inputrecNeedMutot(inputrec))
- {
- extract_binr(rb, imu, DIM, mu_tot);
- }
for (j = 0; (j < egNR); j++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_enerdata_t* enerd,
tensor fvir,
tensor svir,
- rvec mu_tot,
const t_inputrec* inputrec,
gmx_ekindata_t* ekind,
const gmx::Constraints* constr,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
runnersNames.emplace_back("LINCS");
if (GMX_GPU == GMX_GPU_CUDA && canComputeOnGpu())
{
- runnersNames.emplace_back("LINCS_CUDA");
+ runnersNames.emplace_back("LINCS_GPU");
}
return runnersNames;
}
// Infinitely small box
matrix boxNone = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
- set_pbc(&pbc, epbcNONE, boxNone);
+ set_pbc(&pbc, PbcType::No, boxNone);
pbcs_["PBCNone"] = pbc;
// Rectangular box
matrix boxXyz = { { 10.0, 0.0, 0.0 }, { 0.0, 20.0, 0.0 }, { 0.0, 0.0, 15.0 } };
- set_pbc(&pbc, epbcXYZ, boxXyz);
+ set_pbc(&pbc, PbcType::Xyz, boxXyz);
pbcs_["PBCXYZ"] = pbc;
//
algorithms_["SHAKE"] = applyShake;
// LINCS
algorithms_["LINCS"] = applyLincs;
- // LINCS using CUDA (will only be called if CUDA is available)
- algorithms_["LINCS_CUDA"] = applyLincsCuda;
+ // LINCS using GPU (will only be called if GPU is available)
+ algorithms_["LINCS_GPU"] = applyLincsGpu;
}
/*! \brief
int j = testData.constraints_.at(3 * c + 2);
RVec xij0, xij1;
real d0, d1;
- if (pbc.ePBC == epbcXYZ)
+ if (pbc.pbcType == PbcType::Xyz)
{
pbc_dx_aiuc(&pbc, testData.x_[i], testData.x_[j], xij0);
pbc_dx_aiuc(&pbc, testData.xPrime_[i], testData.xPrime_[j], xij1);
int i = testData.constraints_.at(3 * c + 1);
int j = testData.constraints_.at(3 * c + 2);
RVec xij0, xij1;
- if (pbc.ePBC == epbcXYZ)
+ if (pbc.pbcType == PbcType::Xyz)
{
pbc_dx_aiuc(&pbc, testData.x_[i], testData.x_[j], xij0);
pbc_dx_aiuc(&pbc, testData.xPrime_[i], testData.xPrime_[j], xij1);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
-#include "gromacs/topology/block.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/topology.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/unique_cptr.h"
#include "testutils/testasserts.h"
gmx_omp_nthreads_set(emntLINCS, 1);
// Make blocka structure for faster LINCS setup
- std::vector<t_blocka> at2con_mt;
+ std::vector<ListOfLists<int>> at2con_mt;
at2con_mt.reserve(testData->mtop_.moltype.size());
for (const gmx_moltype_t& moltype : testData->mtop_.moltype)
{
// Evaluate constraints
bool success = constrain_lincs(
false, testData->ir_, 0, lincsd, testData->md_, &testData->cr_, &testData->ms_,
- as_rvec_array(testData->x_.data()), as_rvec_array(testData->xPrime_.data()),
- as_rvec_array(testData->xPrime2_.data()), pbc.box, &pbc, testData->md_.lambda,
- &testData->dHdLambda_, testData->invdt_, as_rvec_array(testData->v_.data()),
- testData->computeVirial_, testData->virialScaled_, gmx::ConstraintVariable::Positions,
- &testData->nrnb_, maxwarn, &warncount_lincs);
+ testData->x_.arrayRefWithPadding(), testData->xPrime_.arrayRefWithPadding(),
+ testData->xPrime2_.arrayRefWithPadding().unpaddedArrayRef(), pbc.box, &pbc,
+ testData->md_.lambda, &testData->dHdLambda_, testData->invdt_,
+ testData->v_.arrayRefWithPadding().unpaddedArrayRef(), testData->computeVirial_,
+ testData->virialScaled_, gmx::ConstraintVariable::Positions, &testData->nrnb_, maxwarn,
+ &warncount_lincs);
EXPECT_TRUE(success) << "Test failed with a false return value in LINCS.";
EXPECT_EQ(warncount_lincs, 0) << "There were warnings in LINCS.";
- for (auto& moltype : at2con_mt)
- {
- sfree(moltype.index);
- sfree(moltype.a);
- }
done_lincs(lincsd);
}
#if GMX_GPU != GMX_GPU_CUDA
/*! \brief
- * Stub for LINCS constraints on CUDA-enabled GPU to satisfy compiler.
+ * Stub for GPU version of LINCS constraints to satisfy compiler.
*
* \param[in] testData Test data structure.
* \param[in] pbc Periodic boundary data.
*/
-void applyLincsCuda(ConstraintsTestData gmx_unused* testData, t_pbc gmx_unused pbc)
+void applyLincsGpu(ConstraintsTestData gmx_unused* testData, t_pbc gmx_unused pbc)
{
FAIL() << "Dummy LINCS CUDA function was called instead of the real one.";
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/devicebuffer.cuh"
#include "gromacs/gpu_utils/gpu_utils.h"
-#include "gromacs/mdlib/lincs_cuda.cuh"
+#include "gromacs/mdlib/lincs_gpu.cuh"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/utility/unique_cptr.h"
{
/*! \brief
- * Initialize and apply LINCS constraints on CUDA-enabled GPU.
+ * Initialize and apply LINCS constraints on GPU.
*
* \param[in] testData Test data structure.
* \param[in] pbc Periodic boundary data.
*/
-void applyLincsCuda(ConstraintsTestData* testData, t_pbc pbc)
+void applyLincsGpu(ConstraintsTestData* testData, t_pbc pbc)
{
- auto lincsCuda =
- std::make_unique<LincsCuda>(testData->ir_.nLincsIter, testData->ir_.nProjOrder, nullptr);
+ auto lincsGpu =
+ std::make_unique<LincsGpu>(testData->ir_.nLincsIter, testData->ir_.nProjOrder, nullptr);
bool updateVelocities = true;
int numAtoms = testData->numAtoms_;
float3 *d_x, *d_xp, *d_v;
- lincsCuda->set(testData->idef_, testData->md_);
- lincsCuda->setPbc(&pbc);
+ lincsGpu->set(testData->idef_, testData->md_);
+ PbcAiuc pbcAiuc;
+ setPbcAiuc(pbc.ndim_ePBC, pbc.box, &pbcAiuc);
allocateDeviceBuffer(&d_x, numAtoms, nullptr);
allocateDeviceBuffer(&d_xp, numAtoms, nullptr);
copyToDeviceBuffer(&d_v, (float3*)(testData->v_.data()), 0, numAtoms, nullptr,
GpuApiCallBehavior::Sync, nullptr);
}
- lincsCuda->apply(d_x, d_xp, updateVelocities, d_v, testData->invdt_, testData->computeVirial_,
- testData->virialScaled_);
+ lincsGpu->apply(d_x, d_xp, updateVelocities, d_v, testData->invdt_, testData->computeVirial_,
+ testData->virialScaled_, pbcAiuc);
copyFromDeviceBuffer((float3*)(testData->xPrime_.data()), &d_xp, 0, numAtoms, nullptr,
GpuApiCallBehavior::Sync, nullptr);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief Apply LINCS constraints to the test data.
*/
void applyLincs(ConstraintsTestData* testData, t_pbc pbc);
-/*! \brief Apply CUDA version of LINCS constraints to the test data.
+/*! \brief Apply GPU version of LINCS constraints to the test data.
*
* All the data is copied to the GPU device, then LINCS is applied and
* the resulting coordinates are copied back.
*/
-void applyLincsCuda(ConstraintsTestData* testData, t_pbc pbc);
+void applyLincsGpu(ConstraintsTestData* testData, t_pbc pbc);
} // namespace test
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/devicebuffer.cuh"
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/math/vec.h"
-#include "gromacs/mdlib/leapfrog_cuda.cuh"
+#include "gromacs/mdlib/leapfrog_gpu.cuh"
#include "gromacs/mdlib/stat.h"
#include "gromacs/mdtypes/group.h"
copyToDeviceBuffer(&d_v, h_v, 0, numAtoms, nullptr, GpuApiCallBehavior::Sync, nullptr);
copyToDeviceBuffer(&d_f, h_f, 0, numAtoms, nullptr, GpuApiCallBehavior::Sync, nullptr);
- auto integrator = std::make_unique<LeapFrogCuda>(nullptr);
+ auto integrator = std::make_unique<LeapFrogGpu>(nullptr);
integrator->set(testData->mdAtoms_, testData->numTCoupleGroups_, testData->mdAtoms_.cTC);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
void integrateLeapFrogSimple(LeapFrogTestData* testData, int numSteps);
-/*! \brief Integrate using CUDA version of Leap-Frog
+/*! \brief Integrate using GPU version of Leap-Frog
*
* Copies data from CPU to GPU, integrates the equation of motion
* for requested number of steps using Leap-Frog algorithm, copies
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// Infinitely small box
matrix boxNone = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
- set_pbc(&pbc, epbcNONE, boxNone);
+ set_pbc(&pbc, PbcType::No, boxNone);
pbcs_["PBCNone"] = pbc;
// Rectangular box
matrix boxXyz = { { real(1.86206), 0, 0 }, { 0, real(1.86206), 0 }, { 0, 0, real(1.86206) } };
- set_pbc(&pbc, epbcXYZ, boxXyz);
+ set_pbc(&pbc, PbcType::Xyz, boxXyz);
pbcs_["PBCXYZ"] = pbc;
//
}
// Reshape some data so it can be directly used by the SETTLE constraints
- ilist_ = { mtop_.moltype[0].ilist[F_SETTLE].size(), 0,
- mtop_.moltype[0].ilist[F_SETTLE].iatoms.data(), 0 };
+ ilist_ = { mtop_.moltype[0].ilist[F_SETTLE].size(), mtop_.moltype[0].ilist[F_SETTLE].iatoms.data(), 0 };
idef_.il[F_SETTLE] = ilist_;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
bool errorOccured;
int numThreads = 1;
int threadIndex = 0;
- csettle(settled, numThreads, threadIndex, &pbc,
- reinterpret_cast<real*>(as_rvec_array(testData->x_.data())),
- reinterpret_cast<real*>(as_rvec_array(testData->xPrime_.data())), testData->reciprocalTimeStep_,
- updateVelocities ? reinterpret_cast<real*>(as_rvec_array(testData->v_.data())) : nullptr,
+ csettle(settled, numThreads, threadIndex, &pbc, testData->x_.arrayRefWithPadding(),
+ testData->xPrime_.arrayRefWithPadding(), testData->reciprocalTimeStep_,
+ updateVelocities ? testData->v_.arrayRefWithPadding() : ArrayRefWithPadding<RVec>(),
calcVirial, testData->virial_, &errorOccured);
settle_free(settled);
EXPECT_FALSE(errorOccured) << testDescription;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/devicebuffer.cuh"
#include "gromacs/gpu_utils/gpu_utils.h"
-#include "gromacs/mdlib/settle_cuda.cuh"
+#include "gromacs/mdlib/settle_gpu.cuh"
#include "gromacs/utility/unique_cptr.h"
namespace gmx
// TODO: Here we should check that at least 1 suitable GPU is available
GMX_RELEASE_ASSERT(canPerformGpuDetection(), "Can't detect CUDA-capable GPUs.");
- auto settleCuda = std::make_unique<SettleCuda>(testData->mtop_, nullptr);
- settleCuda->setPbc(&pbc);
- settleCuda->set(testData->idef_, testData->mdatoms_);
+ auto settleGpu = std::make_unique<SettleGpu>(testData->mtop_, nullptr);
+
+ settleGpu->set(testData->idef_, testData->mdatoms_);
+ PbcAiuc pbcAiuc;
+ setPbcAiuc(pbc.ndim_ePBC, pbc.box, &pbcAiuc);
int numAtoms = testData->mdatoms_.homenr;
{
copyToDeviceBuffer(&d_v, (float3*)h_v, 0, numAtoms, nullptr, GpuApiCallBehavior::Sync, nullptr);
}
- settleCuda->apply(d_x, d_xp, updateVelocities, d_v, testData->reciprocalTimeStep_, calcVirial,
- testData->virial_);
+ settleGpu->apply(d_x, d_xp, updateVelocities, d_v, testData->reciprocalTimeStep_, calcVirial,
+ testData->virial_, pbcAiuc);
copyFromDeviceBuffer((float3*)h_xp, &d_xp, 0, numAtoms, nullptr, GpuApiCallBehavior::Sync, nullptr);
if (updateVelocities)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
if (fr->bMolPBC && !ir->bPeriodicMols)
{
/* Make molecules whole only for confout writing */
- do_pbc_mtop(ir->ePBC, state->box, top_global, x_for_confout);
+ do_pbc_mtop(ir->pbcType, state->box, top_global, x_for_confout);
}
write_sto_conf_mtop(ftp2fn(efSTO, nfile, fnm), *top_global->name, top_global,
- x_for_confout, state_global->v.rvec_array(), ir->ePBC, state->box);
+ x_for_confout, state_global->v.rvec_array(), ir->pbcType, state->box);
if (fr->bMolPBC && state == state_global)
{
sfree(x_for_confout);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/boxutilities.h"
#include "gromacs/pbcutil/mshift.h"
}
}
-static void calc_ke_part_normal(const rvec v[],
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel)
+static void calc_ke_part_normal(ArrayRef<const RVec> v,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel)
{
int g;
gmx::ArrayRef<t_grp_tcstat> tcstat = ekind->tcstat;
inc_nrnb(nrnb, eNR_EKIN, md->homenr);
}
-static void calc_ke_part_visc(const matrix box,
- const rvec x[],
- const rvec v[],
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel)
+static void calc_ke_part_visc(const matrix box,
+ ArrayRef<const RVec> x,
+ ArrayRef<const RVec> v,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel)
{
int start = 0, homenr = md->homenr;
int g, d, n, m, gt = 0;
inc_nrnb(nrnb, eNR_EKIN, homenr);
}
-void calc_ke_part(const rvec* x,
- const rvec* v,
- const matrix box,
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel)
+void calc_ke_part(ArrayRef<const RVec> x,
+ ArrayRef<const RVec> v,
+ const matrix box,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel)
{
if (ekind->cosacc.cos_accel == 0)
{
clear_mat(vir_part);
/* Constrain the coordinates upd->xp */
- constr->apply(do_log, do_ene, step, 1, 1.0, state->x.rvec_array(), state->v.rvec_array(),
- state->v.rvec_array(), state->box, state->lambda[efptBONDED], dvdlambda,
- nullptr, bCalcVir ? &vir_con : nullptr, ConstraintVariable::Velocities);
+ constr->apply(do_log, do_ene, step, 1, 1.0, state->x.arrayRefWithPadding(),
+ state->v.arrayRefWithPadding(), state->v.arrayRefWithPadding().unpaddedArrayRef(),
+ state->box, state->lambda[efptBONDED], dvdlambda, ArrayRefWithPadding<RVec>(),
+ bCalcVir ? &vir_con : nullptr, ConstraintVariable::Velocities);
if (bCalcVir)
{
clear_mat(vir_part);
/* Constrain the coordinates upd->xp */
- constr->apply(do_log, do_ene, step, 1, 1.0, state->x.rvec_array(), upd->xp()->rvec_array(),
- nullptr, state->box, state->lambda[efptBONDED], dvdlambda,
- as_rvec_array(state->v.data()), bCalcVir ? &vir_con : nullptr,
- ConstraintVariable::Positions);
+ constr->apply(do_log, do_ene, step, 1, 1.0, state->x.arrayRefWithPadding(),
+ upd->xp()->arrayRefWithPadding(), ArrayRef<RVec>(), state->box,
+ state->lambda[efptBONDED], dvdlambda, state->v.arrayRefWithPadding(),
+ bCalcVir ? &vir_con : nullptr, ConstraintVariable::Positions);
if (bCalcVir)
{
wallcycle_stop(wcycle, ewcUPDATE);
/* Constrain the coordinates upd->xp for half a time step */
- constr->apply(do_log, do_ene, step, 1, 0.5, state->x.rvec_array(), upd->xp()->rvec_array(),
- nullptr, state->box, state->lambda[efptBONDED], dvdlambda,
- as_rvec_array(state->v.data()), nullptr, ConstraintVariable::Positions);
+ constr->apply(do_log, do_ene, step, 1, 0.5, state->x.arrayRefWithPadding(),
+ upd->xp()->arrayRefWithPadding(), ArrayRef<RVec>(), state->box,
+ state->lambda[efptBONDED], dvdlambda, state->v.arrayRefWithPadding(), nullptr,
+ ConstraintVariable::Positions);
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
class ekinstate_t;
struct gmx_ekindata_t;
struct gmx_enerdata_t;
+enum class PbcType;
struct t_extmass;
struct t_fcdata;
struct t_graph;
/* Return TRUE if OK, FALSE in case of Shake Error */
-void calc_ke_part(const rvec* x,
- const rvec* v,
- const matrix box,
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel);
+void calc_ke_part(gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ const matrix box,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel);
/*
* Compute the partial kinetic energy for home particles;
* will be accumulated in the calling routine.
real calc_temp(real ekin, real nrdf);
/* Calculate the temperature */
-real calc_pres(int ePBC, int nwall, const matrix box, const tensor ekin, const tensor vir, tensor pres);
+real calc_pres(PbcType pbcType, int nwall, const matrix box, const tensor ekin, const tensor vir, tensor pres);
/* Calculate the pressure tensor, returns the scalar pressure.
* The unit of pressure is bar.
*/
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
/*! \libinternal \file
*
- * \brief Declaration of high-level functions of CUDA implementation of update and constrain class.
- *
- * \todo Change "cuda" suffix to "gpu"
+ * \brief Declaration of high-level functions of GPU implementation of update and constrain class.
*
* \author Artem Zhmurov <zhmurov@gmail.com>
*
* \ingroup module_mdlib
* \inlibraryapi
*/
-#ifndef GMX_MDLIB_UPDATE_CONSTRAIN_CUDA_H
-#define GMX_MDLIB_UPDATE_CONSTRAIN_CUDA_H
+#ifndef GMX_MDLIB_UPDATE_CONSTRAIN_GPU_H
+#define GMX_MDLIB_UPDATE_CONSTRAIN_GPU_H
#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/mdtypes/group.h"
class GpuEventSynchronizer;
struct gmx_mtop_t;
+enum class PbcType : int;
struct t_idef;
struct t_inputrec;
struct t_mdatoms;
namespace gmx
{
-class UpdateConstrainCuda
+class UpdateConstrainGpu
{
public:
* \param[in] commandStream GPU stream to use. Can be nullptr.
* \param[in] xUpdatedOnDevice The event synchronizer to use to mark that update is done on the GPU.
*/
- UpdateConstrainCuda(const t_inputrec& ir,
- const gmx_mtop_t& mtop,
- const void* commandStream,
- GpuEventSynchronizer* xUpdatedOnDevice);
+ UpdateConstrainGpu(const t_inputrec& ir,
+ const gmx_mtop_t& mtop,
+ const void* commandStream,
+ GpuEventSynchronizer* xUpdatedOnDevice);
- ~UpdateConstrainCuda();
+ ~UpdateConstrainGpu();
/*! \brief Integrate
*
* \param[in] md Atoms data.
* \param[in] numTempScaleValues Number of temperature scaling groups. Zero for no temperature scaling.
*/
- void set(DeviceBuffer<float> d_x,
- DeviceBuffer<float> d_v,
- DeviceBuffer<float> d_f,
- const t_idef& idef,
- const t_mdatoms& md,
- int numTempScaleValues);
+ void set(DeviceBuffer<RVec> d_x,
+ DeviceBuffer<RVec> d_v,
+ DeviceBuffer<RVec> d_f,
+ const t_idef& idef,
+ const t_mdatoms& md,
+ int numTempScaleValues);
/*! \brief
* Update PBC data.
*
* Converts PBC data from t_pbc into the PbcAiuc format and stores the latter.
*
- * \param[in] pbc The PBC data in t_pbc format.
+ * \param[in] pbcType The type of the periodic boundary (Xyz, NO, XY or Screw).
+ * \param[in] box The periodic boundary box matrix.
*/
- void setPbc(const t_pbc* pbc);
+ void setPbc(PbcType pbcType, const matrix box);
/*! \brief Return the synchronizer associated with the event indicated that the coordinates are ready on the device.
*/
/*! \brief
* Returns whether the maximum number of coupled constraints is supported
- * by the CUDA LINCS code.
+ * by the GPU LINCS code.
*
* \param[in] mtop The molecular topology
*/
} // namespace gmx
-#endif
+#endif // GMX_MDLIB_UPDATE_CONSTRAIN_GPU_H
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "config.h"
-#include "gromacs/mdlib/update_constrain_cuda.h"
+#include "gromacs/mdlib/update_constrain_gpu.h"
#if GMX_GPU != GMX_GPU_CUDA
namespace gmx
{
-class UpdateConstrainCuda::Impl
+class UpdateConstrainGpu::Impl
{
};
-UpdateConstrainCuda::UpdateConstrainCuda(const t_inputrec& /* ir */,
- const gmx_mtop_t& /* mtop */,
- const void* /* commandStream */,
- GpuEventSynchronizer* /* xUpdatedOnDevice */) :
+UpdateConstrainGpu::UpdateConstrainGpu(const t_inputrec& /* ir */,
+ const gmx_mtop_t& /* mtop */,
+ const void* /* commandStream */,
+ GpuEventSynchronizer* /* xUpdatedOnDevice */) :
impl_(nullptr)
{
GMX_ASSERT(false,
"A CPU stub for UpdateConstrain was called instead of the correct implementation.");
}
-UpdateConstrainCuda::~UpdateConstrainCuda() = default;
+UpdateConstrainGpu::~UpdateConstrainGpu() = default;
-void UpdateConstrainCuda::integrate(GpuEventSynchronizer* /* fReadyOnDevice */,
- const real /* dt */,
- const bool /* updateVelocities */,
- const bool /* computeVirial */,
- tensor /* virialScaled */,
- const bool /* doTemperatureScaling */,
- gmx::ArrayRef<const t_grp_tcstat> /* tcstat */,
- const bool /* doParrinelloRahman */,
- const float /* dtPressureCouple */,
- const matrix /* prVelocityScalingMatrix*/)
+void UpdateConstrainGpu::integrate(GpuEventSynchronizer* /* fReadyOnDevice */,
+ const real /* dt */,
+ const bool /* updateVelocities */,
+ const bool /* computeVirial */,
+ tensor /* virialScaled */,
+ const bool /* doTemperatureScaling */,
+ gmx::ArrayRef<const t_grp_tcstat> /* tcstat */,
+ const bool /* doParrinelloRahman */,
+ const float /* dtPressureCouple */,
+ const matrix /* prVelocityScalingMatrix*/)
{
GMX_ASSERT(false,
"A CPU stub for UpdateConstrain was called instead of the correct implementation.");
}
-void UpdateConstrainCuda::scaleCoordinates(const matrix /* scalingMatrix */)
+void UpdateConstrainGpu::scaleCoordinates(const matrix /* scalingMatrix */)
{
GMX_ASSERT(false,
"A CPU stub for UpdateConstrain was called instead of the correct implementation.");
}
-void UpdateConstrainCuda::set(DeviceBuffer<float> /* d_x */,
- DeviceBuffer<float> /* d_v */,
- const DeviceBuffer<float> /* d_f */,
- const t_idef& /* idef */,
- const t_mdatoms& /* md */,
- const int /* numTempScaleValues */)
+void UpdateConstrainGpu::set(DeviceBuffer<RVec> /* d_x */,
+ DeviceBuffer<RVec> /* d_v */,
+ const DeviceBuffer<RVec> /* d_f */,
+ const t_idef& /* idef */,
+ const t_mdatoms& /* md */,
+ const int /* numTempScaleValues */)
{
GMX_ASSERT(false,
"A CPU stub for UpdateConstrain was called instead of the correct implementation.");
}
-void UpdateConstrainCuda::setPbc(const t_pbc* /* pbc */)
+void UpdateConstrainGpu::setPbc(const PbcType /* pbcType */, const matrix /* box */)
{
GMX_ASSERT(false,
"A CPU stub for UpdateConstrain was called instead of the correct implementation.");
}
-GpuEventSynchronizer* UpdateConstrainCuda::getCoordinatesReadySync()
+GpuEventSynchronizer* UpdateConstrainGpu::getCoordinatesReadySync()
{
GMX_ASSERT(false,
"A CPU stub for UpdateConstrain was called instead of the correct implementation.");
return nullptr;
}
-bool UpdateConstrainCuda::isNumCoupledConstraintsSupported(const gmx_mtop_t& /* mtop */)
+bool UpdateConstrainGpu::isNumCoupledConstraintsSupported(const gmx_mtop_t& /* mtop */)
{
return false;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
#include "gmxpre.h"
-#include "update_constrain_cuda_impl.h"
+#include "update_constrain_gpu_impl.h"
#include <assert.h>
#include <stdio.h>
#include "gromacs/gpu_utils/devicebuffer.h"
#include "gromacs/gpu_utils/gputraits.cuh"
#include "gromacs/gpu_utils/vectype_ops.cuh"
-#include "gromacs/mdlib/leapfrog_cuda.cuh"
-#include "gromacs/mdlib/lincs_cuda.cuh"
-#include "gromacs/mdlib/settle_cuda.cuh"
-#include "gromacs/mdlib/update_constrain_cuda.h"
+#include "gromacs/mdlib/leapfrog_gpu.cuh"
+#include "gromacs/mdlib/lincs_gpu.cuh"
+#include "gromacs/mdlib/settle_gpu.cuh"
+#include "gromacs/mdlib/update_constrain_gpu.h"
namespace gmx
{
}
}
-void UpdateConstrainCuda::Impl::integrate(GpuEventSynchronizer* fReadyOnDevice,
- const real dt,
- const bool updateVelocities,
- const bool computeVirial,
- tensor virial,
- const bool doTemperatureScaling,
- gmx::ArrayRef<const t_grp_tcstat> tcstat,
- const bool doParrinelloRahman,
- const float dtPressureCouple,
- const matrix prVelocityScalingMatrix)
+void UpdateConstrainGpu::Impl::integrate(GpuEventSynchronizer* fReadyOnDevice,
+ const real dt,
+ const bool updateVelocities,
+ const bool computeVirial,
+ tensor virial,
+ const bool doTemperatureScaling,
+ gmx::ArrayRef<const t_grp_tcstat> tcstat,
+ const bool doParrinelloRahman,
+ const float dtPressureCouple,
+ const matrix prVelocityScalingMatrix)
{
// Clearing virial matrix
// TODO There is no point in having separate virial matrix for constraints
// Constraints need both coordinates before (d_x_) and after (d_xp_) update. However, after constraints
// are applied, the d_x_ can be discarded. So we intentionally swap the d_x_ and d_xp_ here to avoid the
// d_xp_ -> d_x_ copy after constraints. Note that the integrate saves them in the wrong order as well.
- lincsCuda_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial);
- settleCuda_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial);
+ lincsGpu_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial, pbcAiuc_);
+ settleGpu_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial, pbcAiuc_);
// scaledVirial -> virial (methods above returns scaled values)
float scaleFactor = 0.5f / (dt * dt);
return;
}
-void UpdateConstrainCuda::Impl::scaleCoordinates(const matrix scalingMatrix)
+void UpdateConstrainGpu::Impl::scaleCoordinates(const matrix scalingMatrix)
{
ScalingMatrix mu;
mu.xx = scalingMatrix[XX][XX];
gpuStreamSynchronize(commandStream_);
}
-UpdateConstrainCuda::Impl::Impl(const t_inputrec& ir,
- const gmx_mtop_t& mtop,
- const void* commandStream,
- GpuEventSynchronizer* xUpdatedOnDevice) :
+UpdateConstrainGpu::Impl::Impl(const t_inputrec& ir,
+ const gmx_mtop_t& mtop,
+ const void* commandStream,
+ GpuEventSynchronizer* xUpdatedOnDevice) :
coordinatesReady_(xUpdatedOnDevice)
{
GMX_ASSERT(xUpdatedOnDevice != nullptr, "The event synchronizer can not be nullptr.");
: commandStream_ = nullptr;
- integrator_ = std::make_unique<LeapFrogCuda>(commandStream_);
- lincsCuda_ = std::make_unique<LincsCuda>(ir.nLincsIter, ir.nProjOrder, commandStream_);
- settleCuda_ = std::make_unique<SettleCuda>(mtop, commandStream_);
+ integrator_ = std::make_unique<LeapFrogGpu>(commandStream_);
+ lincsGpu_ = std::make_unique<LincsGpu>(ir.nLincsIter, ir.nProjOrder, commandStream_);
+ settleGpu_ = std::make_unique<SettleGpu>(mtop, commandStream_);
coordinateScalingKernelLaunchConfig_.blockSize[0] = c_threadsPerBlock;
coordinateScalingKernelLaunchConfig_.blockSize[1] = 1;
coordinateScalingKernelLaunchConfig_.stream = commandStream_;
}
-UpdateConstrainCuda::Impl::~Impl() {}
+UpdateConstrainGpu::Impl::~Impl() {}
-void UpdateConstrainCuda::Impl::set(DeviceBuffer<float> d_x,
- DeviceBuffer<float> d_v,
- const DeviceBuffer<float> d_f,
- const t_idef& idef,
- const t_mdatoms& md,
- const int numTempScaleValues)
+void UpdateConstrainGpu::Impl::set(DeviceBuffer<RVec> d_x,
+ DeviceBuffer<RVec> d_v,
+ const DeviceBuffer<RVec> d_f,
+ const t_idef& idef,
+ const t_mdatoms& md,
+ const int numTempScaleValues)
{
GMX_ASSERT(d_x != nullptr, "Coordinates device buffer should not be null.");
GMX_ASSERT(d_v != nullptr, "Velocities device buffer should not be null.");
// Integrator should also update something, but it does not even have a method yet
integrator_->set(md, numTempScaleValues, md.cTC);
- lincsCuda_->set(idef, md);
- settleCuda_->set(idef, md);
+ lincsGpu_->set(idef, md);
+ settleGpu_->set(idef, md);
coordinateScalingKernelLaunchConfig_.gridSize[0] =
(numAtoms_ + c_threadsPerBlock - 1) / c_threadsPerBlock;
}
-void UpdateConstrainCuda::Impl::setPbc(const t_pbc* pbc)
+void UpdateConstrainGpu::Impl::setPbc(const PbcType pbcType, const matrix box)
{
- setPbcAiuc(pbc->ndim_ePBC, pbc->box, &pbcAiuc_);
- integrator_->setPbc(pbc);
- lincsCuda_->setPbc(pbc);
- settleCuda_->setPbc(pbc);
+ setPbcAiuc(numPbcDimensions(pbcType), box, &pbcAiuc_);
}
-GpuEventSynchronizer* UpdateConstrainCuda::Impl::getCoordinatesReadySync()
+GpuEventSynchronizer* UpdateConstrainGpu::Impl::getCoordinatesReadySync()
{
return coordinatesReady_;
}
-UpdateConstrainCuda::UpdateConstrainCuda(const t_inputrec& ir,
- const gmx_mtop_t& mtop,
- const void* commandStream,
- GpuEventSynchronizer* xUpdatedOnDevice) :
+UpdateConstrainGpu::UpdateConstrainGpu(const t_inputrec& ir,
+ const gmx_mtop_t& mtop,
+ const void* commandStream,
+ GpuEventSynchronizer* xUpdatedOnDevice) :
impl_(new Impl(ir, mtop, commandStream, xUpdatedOnDevice))
{
}
-UpdateConstrainCuda::~UpdateConstrainCuda() = default;
-
-void UpdateConstrainCuda::integrate(GpuEventSynchronizer* fReadyOnDevice,
- const real dt,
- const bool updateVelocities,
- const bool computeVirial,
- tensor virialScaled,
- const bool doTemperatureScaling,
- gmx::ArrayRef<const t_grp_tcstat> tcstat,
- const bool doParrinelloRahman,
- const float dtPressureCouple,
- const matrix prVelocityScalingMatrix)
+UpdateConstrainGpu::~UpdateConstrainGpu() = default;
+
+void UpdateConstrainGpu::integrate(GpuEventSynchronizer* fReadyOnDevice,
+ const real dt,
+ const bool updateVelocities,
+ const bool computeVirial,
+ tensor virialScaled,
+ const bool doTemperatureScaling,
+ gmx::ArrayRef<const t_grp_tcstat> tcstat,
+ const bool doParrinelloRahman,
+ const float dtPressureCouple,
+ const matrix prVelocityScalingMatrix)
{
impl_->integrate(fReadyOnDevice, dt, updateVelocities, computeVirial, virialScaled, doTemperatureScaling,
tcstat, doParrinelloRahman, dtPressureCouple, prVelocityScalingMatrix);
}
-void UpdateConstrainCuda::scaleCoordinates(const matrix scalingMatrix)
+void UpdateConstrainGpu::scaleCoordinates(const matrix scalingMatrix)
{
impl_->scaleCoordinates(scalingMatrix);
}
-void UpdateConstrainCuda::set(DeviceBuffer<float> d_x,
- DeviceBuffer<float> d_v,
- const DeviceBuffer<float> d_f,
- const t_idef& idef,
- const t_mdatoms& md,
- const int numTempScaleValues)
+void UpdateConstrainGpu::set(DeviceBuffer<RVec> d_x,
+ DeviceBuffer<RVec> d_v,
+ const DeviceBuffer<RVec> d_f,
+ const t_idef& idef,
+ const t_mdatoms& md,
+ const int numTempScaleValues)
{
impl_->set(d_x, d_v, d_f, idef, md, numTempScaleValues);
}
-void UpdateConstrainCuda::setPbc(const t_pbc* pbc)
+void UpdateConstrainGpu::setPbc(const PbcType pbcType, const matrix box)
{
- impl_->setPbc(pbc);
+ impl_->setPbc(pbcType, box);
}
-GpuEventSynchronizer* UpdateConstrainCuda::getCoordinatesReadySync()
+GpuEventSynchronizer* UpdateConstrainGpu::getCoordinatesReadySync()
{
return impl_->getCoordinatesReadySync();
}
-bool UpdateConstrainCuda::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
+bool UpdateConstrainGpu::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
{
- return LincsCuda::isNumCoupledConstraintsSupported(mtop);
+ return LincsGpu::isNumCoupledConstraintsSupported(mtop);
}
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
/*! \internal \file
*
- * \brief Declares CUDA implementation class for update and constraints.
+ * \brief Declares GPU implementation class for update and constraints.
*
* This header file is needed to include from both the device-side
* kernels file, and the host-side management code.
*
* \ingroup module_mdlib
*/
-#ifndef GMX_MDLIB_UPDATE_CONSTRAIN_CUDA_IMPL_H
-#define GMX_MDLIB_UPDATE_CONSTRAIN_CUDA_IMPL_H
+#ifndef GMX_MDLIB_UPDATE_CONSTRAIN_GPU_IMPL_H
+#define GMX_MDLIB_UPDATE_CONSTRAIN_GPU_IMPL_H
#include "gmxpre.h"
#include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
-#include "gromacs/mdlib/leapfrog_cuda.cuh"
-#include "gromacs/mdlib/lincs_cuda.cuh"
-#include "gromacs/mdlib/settle_cuda.cuh"
-#include "gromacs/mdlib/update_constrain_cuda.h"
+#include "gromacs/mdlib/leapfrog_gpu.cuh"
+#include "gromacs/mdlib/lincs_gpu.cuh"
+#include "gromacs/mdlib/settle_gpu.cuh"
+#include "gromacs/mdlib/update_constrain_gpu.h"
#include "gromacs/mdtypes/inputrec.h"
namespace gmx
{
-/*! \internal \brief Class with interfaces and data for CUDA version of Update-Constraint. */
-class UpdateConstrainCuda::Impl
+/*! \internal \brief Class with interfaces and data for GPU version of Update-Constraint. */
+class UpdateConstrainGpu::Impl
{
public:
* \param[in] md Atoms data.
* \param[in] numTempScaleValues Number of temperature scaling groups. Set zero for no temperature coupling.
*/
- void set(DeviceBuffer<float> d_x,
- DeviceBuffer<float> d_v,
- const DeviceBuffer<float> d_f,
- const t_idef& idef,
- const t_mdatoms& md,
- const int numTempScaleValues);
+ void set(DeviceBuffer<RVec> d_x,
+ DeviceBuffer<RVec> d_v,
+ const DeviceBuffer<RVec> d_f,
+ const t_idef& idef,
+ const t_mdatoms& md,
+ const int numTempScaleValues);
/*! \brief
* Update PBC data.
*
* Converts PBC data from t_pbc into the PbcAiuc format and stores the latter.
*
- * \param[in] pbc The PBC data in t_pbc format.
+ * \param[in] pbcType The type of the periodic boundary.
+ * \param[in] box The periodic boundary box matrix.
*/
- void setPbc(const t_pbc* pbc);
+ void setPbc(PbcType pbcType, const matrix box);
/*! \brief Return the synchronizer associated with the event indicated that the coordinates are ready on the device.
*/
/*! \brief
* Returns whether the maximum number of coupled constraints is supported
- * by the CUDA LINCS code.
+ * by the GPU LINCS code.
*
* \param[in] mtop The molecular topology
*/
static bool isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop);
private:
- //! CUDA stream
+ //! GPU stream
CommandStream commandStream_ = nullptr;
- //! CUDA kernel launch config
+ //! GPU kernel launch config
KernelLaunchConfig coordinateScalingKernelLaunchConfig_;
//! Periodic boundary data
int numInverseMassesAlloc_ = -1;
//! Leap-Frog integrator
- std::unique_ptr<LeapFrogCuda> integrator_;
- //! LINCS CUDA object to use for non-water constraints
- std::unique_ptr<LincsCuda> lincsCuda_;
- //! SETTLE CUDA object for water constrains
- std::unique_ptr<SettleCuda> settleCuda_;
+ std::unique_ptr<LeapFrogGpu> integrator_;
+ //! LINCS GPU object to use for non-water constraints
+ std::unique_ptr<LincsGpu> lincsGpu_;
+ //! SETTLE GPU object for water constrains
+ std::unique_ptr<SettleGpu> settleGpu_;
//! An pointer to the event to indicate when the update of coordinates is complete
GpuEventSynchronizer* coordinatesReady_;
} // namespace gmx
-#endif
+#endif // GMX_MDLIB_UPDATE_CONSTRAIN_GPU_IMPL_H
#include "gromacs/math/units.h"
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdtypes/inputrec.h"
-#include "gromacs/topology/block.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/topology.h"
+#include "gromacs/utility/listoflists.h"
namespace gmx
{
}
/*! \brief Returns the range of atoms constrained to atom \p a (including \p a itself) */
-static AtomIndexExtremes constraintAtomRange(int a, const t_blocka& at2con, const InteractionList& ilistConstraints)
+static AtomIndexExtremes constraintAtomRange(int a,
+ const ListOfLists<int>& at2con,
+ const InteractionList& ilistConstraints)
{
AtomIndexExtremes extremes = { a, a };
- for (int i = at2con.index[a]; i < at2con.index[a + 1]; i++)
+ for (const int constraint : at2con[a])
{
for (int j = 0; j < 2; j++)
{
- int atomJ = ilistConstraints.iatoms[at2con.a[i] * 3 + 1 + j];
+ int atomJ = ilistConstraints.iatoms[constraint * 3 + 1 + j];
extremes.minAtom = std::min(extremes.minAtom, atomJ);
extremes.maxAtom = std::max(extremes.maxAtom, atomJ);
}
}
/*! \brief Returns the size of the update group starting at \p firstAtom or 0 when criteria (see updategroups.h) are not met */
-static int detectGroup(int firstAtom,
- const gmx_moltype_t& moltype,
- const t_blocka& at2con,
- const InteractionList& ilistConstraints)
+static int detectGroup(int firstAtom,
+ const gmx_moltype_t& moltype,
+ const ListOfLists<int>& at2con,
+ const InteractionList& ilistConstraints)
{
/* We should be using moltype.atoms.atom[].ptype for checking whether
* a particle is a vsite. But the test code can't fill t_atoms,
std::vector<bool> isParticleVsite = buildIsParticleVsite(moltype);
/* A non-vsite atom without constraints is an update group by itself */
- if (!isParticleVsite[firstAtom] && at2con.index[firstAtom + 1] - at2con.index[firstAtom] == 0)
+ if (!isParticleVsite[firstAtom] && at2con[firstAtom].empty())
{
return 1;
}
}
else
{
- int numConstraints = at2con.index[a + 1] - at2con.index[a];
+ const int numConstraints = at2con[a].ssize();
if (numConstraints == 0)
{
/* We can not have unconstrained atoms in an update group */
ilistsCombined[F_CONSTR].iatoms = constraintsCombined.iatoms.data();
ilistsCombined[F_CONSTRNC].nr = 0;
/* We "include" flexible constraints, but none are present (checked above) */
- t_blocka at2con = make_at2con(moltype.atoms.nr, ilistsCombined, iparams.data(),
- FlexibleConstraintTreatment::Include);
+ const ListOfLists<int> at2con = make_at2con(moltype.atoms.nr, ilistsCombined, iparams.data(),
+ FlexibleConstraintTreatment::Include);
bool satisfiesCriteria = true;
groups.clear();
}
- done_blocka(&at2con);
-
return groups;
}
static real constraintGroupRadius(const gmx_moltype_t& moltype,
gmx::ArrayRef<const t_iparams> iparams,
const int centralAtom,
- const t_blocka& at2con,
+ const ListOfLists<int>& at2con,
const std::unordered_multimap<int, int>& angleIndices,
const real constraintLength,
const real temperature)
{
- const int numConstraints = at2con.index[centralAtom + 1] - at2con.index[centralAtom];
+ const int numConstraints = at2con[centralAtom].ssize();
GMX_RELEASE_ASSERT(numConstraints == numPartnerAtoms,
"We expect as many constraints as partner atoms here");
std::array<int, numPartnerAtoms> partnerAtoms;
for (int i = 0; i < numPartnerAtoms; i++)
{
- const int ind = at2con.a[at2con.index[centralAtom] + i] * 3;
+ const int ind = at2con[centralAtom][i] * 3;
if (ind >= moltype.ilist[F_CONSTR].size())
{
/* This is a flexible constraint, we don't optimize for that */
const InteractionList& settles = moltype.ilist[F_SETTLE];
- t_blocka at2con = make_at2con(moltype, iparams, FlexibleConstraintTreatment::Include);
+ const ListOfLists<int> at2con = make_at2con(moltype, iparams, FlexibleConstraintTreatment::Include);
const auto angleIndices = getAngleIndices(moltype);
int maxAtom = -1;
for (int a : updateGroups.block(group))
{
- int numConstraints = at2con.index[a + 1] - at2con.index[a];
+ const int numConstraints = at2con[a].ssize();
if (numConstraints > maxNumConstraints)
{
maxNumConstraints = numConstraints;
int constraintType = -1;
real maxConstraintLength = 0;
real sumConstraintLengths = 0;
- for (int i = at2con.index[maxAtom]; i < at2con.index[maxAtom + 1]; i++)
+ bool isFirstConstraint = true;
+ for (const int constraint : at2con[maxAtom])
{
- int conIndex = at2con.a[i] * (1 + NRAL(F_CONSTR));
+ int conIndex = constraint * (1 + NRAL(F_CONSTR));
int iparamsIndex;
if (conIndex < moltype.ilist[F_CONSTR].size())
{
iparamsIndex =
moltype.ilist[F_CONSTRNC].iatoms[conIndex - moltype.ilist[F_CONSTR].size()];
}
- if (i == at2con.index[maxAtom])
+ if (isFirstConstraint)
{
- constraintType = iparamsIndex;
+ constraintType = iparamsIndex;
+ isFirstConstraint = false;
}
else if (iparamsIndex != constraintType)
{
sumConstraintLengths += constraintLength;
}
- int numConstraints = at2con.index[maxAtom + 1] - at2con.index[maxAtom];
+ int numConstraints = at2con[maxAtom].ssize();
real radius;
if (numConstraints == 1)
{
maxRadius = std::max(maxRadius, dCAny);
}
- done_blocka(&at2con);
-
return maxRadius;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "vcm.h"
-#include "gromacs/gmxlib/network.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/invertmatrix.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/fatalerror.h"
if (mode == ecmANGULAR && ndim < 3)
{
- gmx_fatal(FARGS, "Can not have angular comm removal with pbc=%s", epbc_names[ir.ePBC]);
+ gmx_fatal(FARGS, "Can not have angular comm removal with pbc=%s",
+ c_pbcTypeNames[ir.pbcType].c_str());
}
if (mode != ecmNO)
}
/* Center of mass code for groups */
-void calc_vcm_grp(const t_mdatoms& md, const rvec x[], const rvec v[], t_vcm* vcm)
+void calc_vcm_grp(const t_mdatoms& md,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ t_vcm* vcm)
{
+ if (vcm->mode == ecmNO)
+ {
+ return;
+ }
int nthreads = gmx_omp_nthreads_get(emntDefault);
- if (vcm->mode != ecmNO)
+
{
-#pragma omp parallel num_threads(nthreads)
+#pragma omp parallel num_threads(nthreads) default(none) shared(x, v, vcm, md)
{
int t = gmx_omp_get_thread_num();
for (int g = 0; g < vcm->size; g++)
* \param[in] vcm VCM data
*/
template<int numDimensions>
-static void doStopComMotionLinear(const t_mdatoms& mdatoms, rvec* v, const t_vcm& vcm)
+static void doStopComMotionLinear(const t_mdatoms& mdatoms, gmx::ArrayRef<gmx::RVec> v, const t_vcm& vcm)
{
const int homenr = mdatoms.homenr;
const unsigned short* group_id = mdatoms.cVCM;
* \param[in] vcm VCM data
*/
template<int numDimensions>
-static void doStopComMotionAccelerationCorrection(int homenr,
- const unsigned short* group_id,
- rvec* gmx_restrict x,
- rvec* gmx_restrict v,
- const t_vcm& vcm)
+static void doStopComMotionAccelerationCorrection(int homenr,
+ const unsigned short* group_id,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v,
+ const t_vcm& vcm)
{
const real xCorrectionFactor = 0.5 * vcm.timeStep;
}
}
-static void do_stopcm_grp(const t_mdatoms& mdatoms, rvec x[], rvec v[], const t_vcm& vcm)
+static void do_stopcm_grp(const t_mdatoms& mdatoms,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v,
+ const t_vcm& vcm)
{
- if (vcm.mode != ecmNO)
+ if (vcm.mode == ecmNO)
+ {
+ return;
+ }
{
const int homenr = mdatoms.homenr;
const unsigned short* group_id = mdatoms.cVCM;
int gmx_unused nth = gmx_omp_nthreads_get(emntDefault);
-#pragma omp parallel num_threads(nth)
+ // homenr could be shared, but gcc-8 & gcc-9 don't agree how to write that...
+ // https://www.gnu.org/software/gcc/gcc-9/porting_to.html -> OpenMP data sharing
+#pragma omp parallel num_threads(nth) default(none) shared(x, v, vcm, group_id, mdatoms) \
+ firstprivate(homenr)
{
if (vcm.mode == ecmLINEAR || vcm.mode == ecmANGULAR
- || (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION && x == nullptr))
+ || (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION && x.empty()))
{
/* Subtract linear momentum for v */
switch (vcm.ndim)
if (vcm.mode == ecmANGULAR)
{
/* Subtract angular momentum */
- GMX_ASSERT(x, "Need x to compute angular momentum correction");
+ GMX_ASSERT(!x.empty(), "Need x to compute angular momentum correction");
int g = 0;
#pragma omp for schedule(static)
}
}
-void process_and_stopcm_grp(FILE* fplog, t_vcm* vcm, const t_mdatoms& mdatoms, rvec x[], rvec v[])
+void process_and_stopcm_grp(FILE* fplog,
+ t_vcm* vcm,
+ const t_mdatoms& mdatoms,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v)
{
if (vcm->mode != ecmNO)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
struct t_inputrec;
struct t_mdatoms;
+namespace gmx
+{
+template<typename T>
+class ArrayRef;
+}
+
struct t_vcm_thread
{
//! Linear momentum
/* Do a per group center of mass things */
-void calc_vcm_grp(const t_mdatoms& md, const rvec x[], const rvec v[], t_vcm* vcm);
+void calc_vcm_grp(const t_mdatoms& md,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ t_vcm* vcm);
/* Set the COM velocity to zero and potentially correct the COM position.
*
* and a pointer to the coordinates at normal MD steps.
* When fplog != nullptr, a warning is printed to fplog with high COM velocity.
*/
-void process_and_stopcm_grp(FILE* fplog, t_vcm* vcm, const t_mdatoms& mdatoms, rvec x[], rvec v[]);
+void process_and_stopcm_grp(FILE* fplog,
+ t_vcm* vcm,
+ const t_mdatoms& mdatoms,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
rvec* v,
const t_iparams ip[],
const t_ilist ilist[],
- int ePBC,
+ PbcType pbcType,
gmx_bool bMolPBC,
const t_commrec* cr,
const matrix box)
GMX_ASSERT(!useDomdec || (cr != nullptr && DOMAINDECOMP(cr)),
"When vsites are set up with domain decomposition, we need a valid commrec");
// TODO: Remove this assertion when we remove charge groups
- GMX_ASSERT(vsite != nullptr || ePBC == epbcNONE,
+ GMX_ASSERT(vsite != nullptr || pbcType == PbcType::No,
"Without a vsite struct we can not do PBC (in case we have charge groups)");
t_pbc pbc, *pbc_null;
* when we have at least 3 domains along each dimension. Currently we
* do not optimize this case.
*/
- if (ePBC != epbcNONE && (useDomdec || bMolPBC)
+ if (pbcType != PbcType::No && (useDomdec || bMolPBC)
&& !(vsite != nullptr && vsite->numInterUpdategroupVsites == 0))
{
/* This is wasting some CPU time as we now do this multiple times
*/
ivec null_ivec;
clear_ivec(null_ivec);
- pbc_null = set_pbc_dd(&pbc, ePBC, useDomdec ? cr->dd->nc : null_ivec, FALSE, box);
+ pbc_null = set_pbc_dd(&pbc, pbcType, useDomdec ? cr->dd->numCells : null_ivec, FALSE, box);
}
else
{
}
construct_vsites(nullptr, as_rvec_array(x.data()) + atomOffset, 0.0, nullptr,
- mtop.ffparams.iparams.data(), ilist, epbcNONE, TRUE, nullptr, nullptr);
+ mtop.ffparams.iparams.data(), ilist, PbcType::No, TRUE, nullptr, nullptr);
atomOffset += molt.atoms.nr;
}
}
matrix vir,
t_nrnb* nrnb,
const t_idef* idef,
- int ePBC,
+ PbcType pbcType,
gmx_bool bMolPBC,
const t_graph* g,
const matrix box,
/* This is wasting some CPU time as we now do this multiple times
* per MD step.
*/
- pbc_null = set_pbc_dd(&pbc, ePBC, useDomdec ? cr->dd->nc : nullptr, FALSE, box);
+ pbc_null = set_pbc_dd(&pbc, pbcType, useDomdec ? cr->dd->numCells : nullptr, FALSE, box);
}
else
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_nrnb;
struct gmx_wallcycle;
struct VsiteThread;
+enum class PbcType : int;
namespace gmx
{
/*! \brief Create positions of vsite atoms based for the local system
*
* \param[in] vsite The vsite struct, when nullptr is passed, no MPI and no multi-threading
- * is used \param[in,out] x The coordinates \param[in] dt The time step \param[in,out]
- * v When != nullptr, velocities for vsites are set as displacement/dt \param[in] ip
- * Interaction parameters \param[in] ilist The interaction list \param[in] ePBC The
- * type of periodic boundary conditions \param[in] bMolPBC When true, molecules are broken over
- * PBC \param[in] cr The communication record \param[in] box The box
+ * is used
+ * \param[in,out] x The coordinates
+ * \param[in] dt The time step
+ * \param[in,out] v When != nullptr, velocities for vsites are set as displacement/dt
+ * \param[in] ip Interaction parameters
+ * \param[in] ilist The interaction list
+ * \param[in] pbcType The type of periodic boundary conditions
+ * \param[in] bMolPBC When true, molecules are broken over PBC
+ * \param[in] cr The communication record
+ * \param[in] box The box
*/
void construct_vsites(const gmx_vsite_t* vsite,
rvec x[],
rvec v[],
const t_iparams ip[],
const t_ilist ilist[],
- int ePBC,
+ PbcType pbcType,
gmx_bool bMolPBC,
const t_commrec* cr,
const matrix box);
matrix vir,
t_nrnb* nrnb,
const t_idef* idef,
- int ePBC,
+ PbcType pbcType,
gmx_bool bMolPBC,
const t_graph* g,
const matrix box,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdtypes/forceoutput.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/mdatom.h"
const int nwall = ir.nwall;
const int ngid = ir.opts.ngener;
const int ntype = fr.ntype;
- const real* nbfp = fr.nbfp;
+ const real* nbfp = fr.nbfp.data();
const int* egp_flags = fr.egp_flags;
for (int w = 0; w < nwall; w++)
#include "gromacs/domdec/domdec.h"
#include "gromacs/domdec/domdec_network.h"
#include "gromacs/domdec/domdec_struct.h"
+#include "gromacs/domdec/gpuhaloexchange.h"
#include "gromacs/domdec/mdsetup.h"
#include "gromacs/domdec/partition.h"
#include "gromacs/essentialdynamics/edsam.h"
-#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_load_balancing.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/mdlib/tgroup.h"
#include "gromacs/mdlib/trajectory_writing.h"
#include "gromacs/mdlib/update.h"
-#include "gromacs/mdlib/update_constrain_cuda.h"
+#include "gromacs/mdlib/update_constrain_gpu.h"
#include "gromacs/mdlib/vcm.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdrunutility/handlerestart.h"
auto mdatoms = mdAtoms->mdatoms();
- std::unique_ptr<UpdateConstrainCuda> integrator;
+ std::unique_ptr<UpdateConstrainGpu> integrator;
if (DOMAINDECOMP(cr))
{
"Constraints pulling is not supported with the GPU update.\n");
GMX_RELEASE_ASSERT(fcd->orires.nr == 0,
"Orientation restraints are not supported with the GPU update.\n");
- GMX_RELEASE_ASSERT(ir->efep == efepNO,
- "Free energy perturbations are not supported with the GPU update.");
+ GMX_RELEASE_ASSERT(
+ ir->efep == efepNO
+ || (!haveFreeEnergyType(*ir, efptBONDED) && !haveFreeEnergyType(*ir, efptMASS)),
+ "Free energy perturbation of masses and constraints are not supported with the GPU "
+ "update.");
GMX_RELEASE_ASSERT(graph == nullptr, "The graph is not supported with GPU update.");
if (constr != nullptr && constr->numConstraintsTotal() > 0)
{
GMX_LOG(mdlog.info).asParagraph().appendText("Updating coordinates on the GPU.");
}
- integrator = std::make_unique<UpdateConstrainCuda>(
+ integrator = std::make_unique<UpdateConstrainGpu>(
*ir, *top_global, stateGpu->getUpdateStream(), stateGpu->xUpdatedOnDevice());
- t_pbc pbc;
- set_pbc(&pbc, epbcXYZ, state->box);
- integrator->setPbc(&pbc);
+ integrator->setPbc(PbcType::Xyz, state->box);
}
if (useGpuForPme || (useGpuForNonbonded && useGpuForBufferOps) || useGpuForUpdate)
{
/* Construct the virtual sites for the initial configuration */
construct_vsites(vsite, state->x.rvec_array(), ir->delta_t, nullptr, top.idef.iparams,
- top.idef.il, fr->ePBC, fr->bMolPBC, cr, state->box);
+ top.idef.il, fr->pbcType, fr->bMolPBC, cr, state->box);
}
}
cglo_flags_iteration |= CGLO_STOPCM;
cglo_flags_iteration &= ~CGLO_TEMPERATURE;
}
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
cglo_flags_iteration
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
/* At initialization, do not pass x with acceleration-correction mode
* to avoid (incorrect) correction of the initial coordinates.
*/
- rvec* xPtr = nullptr;
- if (vcm.mode != ecmLINEAR_ACCELERATION_CORRECTION)
- {
- xPtr = state->x.rvec_array();
- }
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, xPtr, state->v.rvec_array());
+ auto x = (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION) ? ArrayRef<RVec>()
+ : makeArrayRef(state->x);
+ process_and_stopcm_grp(fplog, &vcm, *mdatoms, x, makeArrayRef(state->v));
inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
}
}
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global, &top,
- state->x.rvec_array(), state->box,
+ makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
if (ir->eI == eiVVAK)
{
kinetic energy calculation. This minimized excess variables, but
perhaps loses some logic?*/
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller,
- state->box, nullptr, &bSumEkinhOld, cglo_flags & ~CGLO_PRESSURE);
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &nullSignaller, state->box, nullptr, &bSumEkinhOld, cglo_flags & ~CGLO_PRESSURE);
}
/* Calculate the initial half step temperature, and save the ekinh_old */
// If update is offloaded, it should be informed about the box size change
if (useGpuForUpdate)
{
- t_pbc pbc;
- set_pbc(&pbc, epbcXYZ, state->box);
- integrator->setPbc(&pbc);
+ integrator->setPbc(PbcType::Xyz, state->box);
}
}
}
fr, vsite, constr, nrnb, wcycle, do_verbose && !bPMETunePrinting);
shouldCheckNumberOfBondedInteractions = true;
upd.setNumAtoms(state->natoms);
+
+ // Allocate or re-size GPU halo exchange object, if necessary
+ if (havePPDomainDecomposition(cr) && simulationWork.useGpuHaloExchange
+ && useGpuForNonbonded && is1D(*cr->dd))
+ {
+ // TODO remove need to pass local stream into GPU halo exchange - Redmine #3093
+ void* streamLocal =
+ Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv, InteractionLocality::Local);
+ void* streamNonLocal = Nbnxm::gpu_get_command_stream(
+ fr->nbv->gpu_nbv, InteractionLocality::NonLocal);
+ constructGpuHaloExchange(mdlog, *cr, streamLocal, streamNonLocal);
+ }
}
}
/* We need the kinetic energy at minus the half step for determining
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- nullptr, nullptr, nullptr, nullptr, mu_tot, constr, &nullSignaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, wcycle, enerd, nullptr, nullptr, nullptr, nullptr, constr,
+ &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_TEMPERATURE | CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS);
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
- &top, state->x.rvec_array(), state->box,
+ &top, makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
}
clear_mat(force_vir);
if (bGStat || do_per_step(step - 1, nstglobalcomm))
{
wallcycle_stop(wcycle, ewcUPDATE);
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
- (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
- | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
- | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
- | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
- : 0)
- | CGLO_SCALEEKIN);
+ compute_globals(
+ gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
+ | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
+ | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
+ | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
+ : 0)
+ | CGLO_SCALEEKIN);
/* explanation of above:
a) We compute Ekin at the full time step
if 1) we are using the AveVel Ekin, and it's not the
b) If we are using EkinAveEkin for the kinetic energy for the temperature control, we still feed in
EkinAveVel because it's needed for the pressure */
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions,
- top_global, &top, state->x.rvec_array(), state->box,
- &shouldCheckNumberOfBondedInteractions);
+ top_global, &top, makeConstArrayRef(state->x),
+ state->box, &shouldCheckNumberOfBondedInteractions);
if (bStopCM)
{
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, state->x.rvec_array(),
- state->v.rvec_array());
+ process_and_stopcm_grp(fplog, &vcm, *mdatoms, makeArrayRef(state->x),
+ makeArrayRef(state->v));
inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
}
wallcycle_start(wcycle, ewcUPDATE);
/* We need the kinetic energy at minus the half step for determining
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(),
- state->v.rvec_array(), state->box, state->lambda[efptVDW],
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW],
mdatoms, nrnb, &vcm, wcycle, enerd, nullptr, nullptr, nullptr,
- nullptr, mu_tot, constr, &nullSignaller, state->box, nullptr,
+ nullptr, constr, &nullSignaller, state->box, nullptr,
&bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE);
wallcycle_start(wcycle, ewcUPDATE);
}
{
/* erase F_EKIN and F_TEMP here? */
/* just compute the kinetic energy at the half step to perform a trotter step */
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller, lastbox,
- nullptr, &bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW],
+ mdatoms, nrnb, &vcm, wcycle, enerd, force_vir, shake_vir, total_vir,
+ pres, constr, &nullSignaller, lastbox, nullptr, &bSumEkinhOld,
+ (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
wallcycle_start(wcycle, ewcUPDATE);
trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ, trotter_seq, ettTSEQ4);
/* now we know the scaling, we can compute the positions again */
shift_self(graph, state->box, state->x.rvec_array());
}
construct_vsites(vsite, state->x.rvec_array(), ir->delta_t, state->v.rvec_array(),
- top.idef.iparams, top.idef.il, fr->ePBC, fr->bMolPBC, cr, state->box);
+ top.idef.iparams, top.idef.il, fr->pbcType, fr->bMolPBC, cr, state->box);
if (graph != nullptr)
{
SimulationSignaller signaller(&signals, cr, ms, doInterSimSignal, doIntraSimSignal);
compute_globals(
- gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &signaller, lastbox,
- &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &signaller, lastbox, &totalNumberOfBondedInteractions, &bSumEkinhOld,
(bGStat ? CGLO_GSTAT : 0) | (!EI_VV(ir->eI) && bCalcEner ? CGLO_ENERGY : 0)
| (!EI_VV(ir->eI) && bStopCM ? CGLO_STOPCM : 0)
| (!EI_VV(ir->eI) ? CGLO_TEMPERATURE : 0)
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions,
- top_global, &top, state->x.rvec_array(), state->box,
- &shouldCheckNumberOfBondedInteractions);
+ top_global, &top, makeConstArrayRef(state->x),
+ state->box, &shouldCheckNumberOfBondedInteractions);
if (!EI_VV(ir->eI) && bStopCM)
{
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, state->x.rvec_array(),
- state->v.rvec_array());
+ process_and_stopcm_grp(fplog, &vcm, *mdatoms, makeArrayRef(state->x),
+ makeArrayRef(state->v));
inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
// TODO: The special case of removing CM motion should be dealt more gracefully
if (useGpuForUpdate && (doBerendsenPressureCoupling || doParrinelloRahman))
{
integrator->scaleCoordinates(pressureCouplingMu);
- t_pbc pbc;
- set_pbc(&pbc, epbcXYZ, state->box);
- integrator->setPbc(&pbc);
+ integrator->setPbc(PbcType::Xyz, state->box);
}
/* ################# END UPDATE STEP 2 ################# */
#include "gromacs/domdec/mdsetup.h"
#include "gromacs/domdec/partition.h"
#include "gromacs/essentialdynamics/edsam.h"
-#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_load_balancing.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
bool bSumEkinhOld = false;
t_vcm* vcm = nullptr;
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms, nrnb,
+ vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags);
}
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global, &top,
- state->x.rvec_array(), state->box,
+ makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
if (MASTER(cr))
}
construct_vsites(vsite, as_rvec_array(state->x.data()), ir->delta_t,
as_rvec_array(state->v.data()), top.idef.iparams, top.idef.il,
- fr->ePBC, fr->bMolPBC, cr, state->box);
+ fr->pbcType, fr->bMolPBC, cr, state->box);
if (graph != nullptr)
{
t_vcm* vcm = nullptr;
SimulationSignaller signaller(&signals, cr, ms, doInterSimSignal, doIntraSimSignal);
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, wcycle, enerd,
- nullptr, nullptr, nullptr, nullptr, mu_tot, constr, &signaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, vcm, wcycle, enerd, nullptr, nullptr, nullptr, nullptr, constr,
+ &signaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_ENERGY
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
- &top, state->x.rvec_array(), state->box,
+ &top, makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/domdec_struct.h"
#include "gromacs/domdec/mdsetup.h"
#include "gromacs/domdec/partition.h"
-#include "gromacs/ewald/pme.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/mtxio.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/mdlib/enerdata_utils.h"
#include "gromacs/mdlib/energyoutput.h"
#include "gromacs/mdlib/force.h"
+#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/md_support.h"
#include "gromacs/mdrunutility/handlerestart.h"
#include "gromacs/mdrunutility/printtime.h"
#include "gromacs/mdtypes/commrec.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/mshift.h"
#include "legacysimulator.h"
#include "shellfc.h"
+using gmx::ArrayRef;
using gmx::MdrunScheduleWorkload;
+using gmx::RVec;
//! Utility structure for manipulating states during EM
typedef struct
{
/* Constrain the starting coordinates */
dvdl_constr = 0;
- constr->apply(TRUE, TRUE, -1, 0, 1.0, ems->s.x.rvec_array(), ems->s.x.rvec_array(),
- nullptr, ems->s.box, ems->s.lambda[efptFEP], &dvdl_constr, nullptr,
+ constr->apply(TRUE, TRUE, -1, 0, 1.0, ems->s.x.arrayRefWithPadding(),
+ ems->s.x.arrayRefWithPadding(), ArrayRef<RVec>(), ems->s.box,
+ ems->s.lambda[efptFEP], &dvdl_constr, gmx::ArrayRefWithPadding<RVec>(),
nullptr, gmx::ConstraintVariable::Positions);
}
}
if (MASTER(cr))
{
- if (ir->ePBC != epbcNONE && !ir->bPeriodicMols && DOMAINDECOMP(cr))
+ if (ir->pbcType != PbcType::No && !ir->bPeriodicMols && DOMAINDECOMP(cr))
{
/* Make molecules whole only for confout writing */
- do_pbc_mtop(ir->ePBC, state->s.box, top_global, state_global->x.rvec_array());
+ do_pbc_mtop(ir->pbcType, state->s.box, top_global, state_global->x.rvec_array());
}
write_sto_conf_mtop(confout, *top_global->name, top_global,
- state_global->x.rvec_array(), nullptr, ir->ePBC, state->s.box);
+ state_global->x.rvec_array(), nullptr, ir->pbcType, state->s.box);
}
}
}
if (constr)
{
dvdl_constr = 0;
- validStep = constr->apply(TRUE, TRUE, count, 0, 1.0, s1->x.rvec_array(), s2->x.rvec_array(),
- nullptr, s2->box, s2->lambda[efptBONDED], &dvdl_constr, nullptr,
- nullptr, gmx::ConstraintVariable::Positions);
+ validStep = constr->apply(
+ TRUE, TRUE, count, 0, 1.0, s1->x.arrayRefWithPadding(), s2->x.arrayRefWithPadding(),
+ ArrayRef<RVec>(), s2->box, s2->lambda[efptBONDED], &dvdl_constr,
+ gmx::ArrayRefWithPadding<RVec>(), nullptr, gmx::ConstraintVariable::Positions);
if (cr->nnodes > 1)
{
if (vsite)
{
construct_vsites(vsite, ems->s.x.rvec_array(), 1, nullptr, top->idef.iparams, top->idef.il,
- fr->ePBC, fr->bMolPBC, cr, ems->s.box);
+ fr->pbcType, fr->bMolPBC, cr, ems->s.box);
}
if (DOMAINDECOMP(cr) && bNS)
{
wallcycle_start(wcycle, ewcMoveE);
- global_stat(gstat, cr, enerd, force_vir, shake_vir, mu_tot, inputrec, nullptr, nullptr, nullptr,
- 1, &terminate, nullptr, FALSE, CGLO_ENERGY | CGLO_PRESSURE | CGLO_CONSTRAINT);
+ global_stat(gstat, cr, enerd, force_vir, shake_vir, inputrec, nullptr, nullptr, nullptr, 1,
+ &terminate, nullptr, FALSE, CGLO_ENERGY | CGLO_PRESSURE | CGLO_CONSTRAINT);
wallcycle_stop(wcycle, ewcMoveE);
}
if (constr)
{
/* Project out the constraint components of the force */
- dvdl_constr = 0;
- rvec* f_rvec = ems->f.rvec_array();
- constr->apply(FALSE, FALSE, count, 0, 1.0, ems->s.x.rvec_array(), f_rvec, f_rvec,
- ems->s.box, ems->s.lambda[efptBONDED], &dvdl_constr, nullptr, &shake_vir,
- gmx::ConstraintVariable::ForceDispl);
+ dvdl_constr = 0;
+ auto f = ems->f.arrayRefWithPadding();
+ constr->apply(FALSE, FALSE, count, 0, 1.0, ems->s.x.arrayRefWithPadding(), f,
+ f.unpaddedArrayRef(), ems->s.box, ems->s.lambda[efptBONDED], &dvdl_constr,
+ gmx::ArrayRefWithPadding<RVec>(), &shake_vir, gmx::ConstraintVariable::ForceDispl);
enerd->term[F_DVDL_CONSTR] += dvdl_constr;
m_add(force_vir, shake_vir, vir);
}
}
clear_mat(ekin);
- enerd->term[F_PRES] = calc_pres(fr->ePBC, inputrec->nwall, ems->s.box, ekin, vir, pres);
+ enerd->term[F_PRES] = calc_pres(fr->pbcType, inputrec->nwall, ems->s.box, ekin, vir, pres);
sum_dhdl(enerd, ems->s.lambda, *inputrec->fepvals);
if (vsite)
{
construct_vsites(vsite, state_global->x.rvec_array(), 1, nullptr, top.idef.iparams,
- top.idef.il, fr->ePBC, fr->bMolPBC, cr, state_global->box);
+ top.idef.il, fr->pbcType, fr->bMolPBC, cr, state_global->box);
}
/* Call the force routine and some auxiliary (neighboursearching etc.) */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/mdsetup.h"
#include "gromacs/domdec/partition.h"
#include "gromacs/essentialdynamics/edsam.h"
-#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_load_balancing.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
/* Following is necessary because the graph may get out of sync
* with the coordinates if we only have every N'th coordinate set
*/
- mk_mshift(nullptr, graph, forceRec.ePBC, globalState->box, globalState->x.rvec_array());
+ mk_mshift(nullptr, graph, forceRec.pbcType, globalState->box, globalState->x.rvec_array());
shift_self(graph, globalState->box, as_rvec_array(globalState->x.data()));
}
construct_vsites(vsite, globalState->x.rvec_array(), timeStep, globalState->v.rvec_array(),
- idef.iparams, idef.il, forceRec.ePBC, forceRec.bMolPBC, nullptr,
+ idef.iparams, idef.il, forceRec.pbcType, forceRec.bMolPBC, nullptr,
globalState->box);
if (graph)
{
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
bool bSumEkinhOld = false;
t_vcm* vcm = nullptr;
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &nullSignaller,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms, nrnb,
+ vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags);
}
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global, &top,
- state->x.rvec_array(), state->box,
+ makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
if (MASTER(cr))
rerun_fr.natoms, top_global->natoms);
}
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
if (!rerun_fr.bBox)
{
"does not contain a box, while pbc is used",
rerun_fr.step, rerun_fr.time);
}
- if (max_cutoff2(ir->ePBC, rerun_fr.box) < gmx::square(fr->rlist))
+ if (max_cutoff2(ir->pbcType, rerun_fr.box) < gmx::square(fr->rlist))
{
gmx_fatal(FARGS,
"Rerun trajectory frame step %" PRId64
rerun_parallel_comm(cr, &rerun_fr, &isLastStep);
}
- if (ir->ePBC != epbcNONE)
+ if (ir->pbcType != PbcType::No)
{
/* Set the shift vectors.
* Necessary here when have a static box different from the tpr box.
}
construct_vsites(vsite, as_rvec_array(state->x.data()), ir->delta_t,
as_rvec_array(state->v.data()), top.idef.iparams, top.idef.il,
- fr->ePBC, fr->bMolPBC, cr, state->box);
+ fr->pbcType, fr->bMolPBC, cr, state->box);
if (graph != nullptr)
{
t_vcm* vcm = nullptr;
SimulationSignaller signaller(&signals, cr, ms, doInterSimSignal, doIntraSimSignal);
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, mu_tot, constr, &signaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &signaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_ENERGY
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
- &top, state->x.rvec_array(), state->box,
+ &top, makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
}
#include "gromacs/domdec/localatomsetmanager.h"
#include "gromacs/domdec/partition.h"
#include "gromacs/ewald/ewald_utils.h"
-#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_gpu_program.h"
+#include "gromacs/ewald/pme_only.h"
#include "gromacs/ewald/pme_pp_comm_gpu.h"
#include "gromacs/fileio/checkpoint.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/mdlib/sighandler.h"
#include "gromacs/mdlib/stophandler.h"
#include "gromacs/mdlib/updategroups.h"
+#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdrun/mdmodules.h"
#include "gromacs/mdrun/simulationcontext.h"
#include "gromacs/mdrunutility/handlerestart.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/mdtypes/observableshistory.h"
#include "gromacs/mdtypes/simulation_workload.h"
GMX_LOG(mdlog.warning)
.asParagraph()
.appendTextFormatted(
- "This run uses the 'GPU halo exchange' feature, enabled by the "
+ "This run has requested the 'GPU halo exchange' feature, enabled by "
+ "the "
"GMX_GPU_DD_COMMS environment variable.");
}
else
bool makeGpuPairList,
const gmx::CpuInfo& cpuinfo)
{
+ // We checked the cut-offs in grompp, but double-check here.
+ // We have PME+LJcutoff kernels for rcoulomb>rvdw.
+ if (EEL_PME_EWALD(ir->coulombtype) && ir->vdwtype == eelCUT)
+ {
+ GMX_RELEASE_ASSERT(ir->rcoulomb >= ir->rvdw,
+ "With Verlet lists and PME we should have rcoulomb>=rvdw");
+ }
+ else
+ {
+ GMX_RELEASE_ASSERT(ir->rcoulomb == ir->rvdw,
+ "With Verlet lists and no PME rcoulomb and rvdw should be identical");
+ }
/* For NVE simulations, we will retain the initial list buffer */
if (EI_DYNAMICS(ir->eI) && ir->verletbuf_tol > 0 && !(EI_MD(ir->eI) && ir->etc == etcNO))
{
// the inputrec read by the master rank. The ranks can now all run
// the task-deciding functions and will agree on the result
// without needing to communicate.
- //
- // TODO Should we do the communication in debug mode to support
- // having an assertion?
const bool useDomainDecomposition = (PAR(cr) && !(EI_TPI(inputrec->eI) || inputrec->eI == eiNM));
// Note that these variables describe only their own node.
// TODO: Error handling
mdModules_->assignOptionsToModules(*inputrec->params, nullptr);
- const auto& mdModulesNotifier = mdModules_->notifier().notifier_;
+ const auto& mdModulesNotifier = mdModules_->notifier().simulationSetupNotifications_;
if (inputrec->internalParameters != nullptr)
{
cr->npmenodes = 0;
cr->duty = (DUTY_PP | DUTY_PME);
- if (inputrec->ePBC == epbcSCREW)
+ if (inputrec->pbcType == PbcType::Screw)
{
gmx_fatal(FARGS, "pbc=screw is only implemented with domain decomposition");
}
EEL_PME(inputrec->coulombtype) && thisRankHasDuty(cr, DUTY_PME));
// Get the device handles for the modules, nullptr when no task is assigned.
- gmx_device_info_t* nonbondedDeviceInfo = gpuTaskAssignments.initNonbondedDevice(cr);
- gmx_device_info_t* pmeDeviceInfo = gpuTaskAssignments.initPmeDevice();
+ DeviceInformation* nonbondedDeviceInfo = gpuTaskAssignments.initNonbondedDevice(cr);
+ DeviceInformation* pmeDeviceInfo = gpuTaskAssignments.initPmeDevice();
// TODO Initialize GPU streams here.
const bool thisRankHasPmeGpuTask = gpuTaskAssignments.thisRankHasPmeGpuTask();
std::unique_ptr<MDAtoms> mdAtoms;
std::unique_ptr<gmx_vsite_t> vsite;
+ std::unique_ptr<GpuBonded> gpuBonded;
t_nrnb nrnb;
if (thisRankHasDuty(cr, DUTY_PP))
{
mdModulesNotifier.notify(*cr);
mdModulesNotifier.notify(&atomSets);
- mdModulesNotifier.notify(PeriodicBoundaryConditionType{ inputrec->ePBC });
+ mdModulesNotifier.notify(inputrec->pbcType);
mdModulesNotifier.notify(SimulationTimeStep{ inputrec->delta_t });
/* Initiate forcerecord */
fr = new t_forcerec;
init_forcerec(fplog, mdlog, fr, fcd, inputrec, &mtop, cr, box,
opt2fn("-table", filenames.size(), filenames.data()),
opt2fn("-tablep", filenames.size(), filenames.data()),
- opt2fns("-tableb", filenames.size(), filenames.data()), *hwinfo,
- nonbondedDeviceInfo, useGpuForBonded,
- pmeRunMode == PmeRunMode::GPU && !thisRankHasDuty(cr, DUTY_PME), pforce, wcycle);
-
- // TODO Move this to happen during domain decomposition setup,
- // once stream and event handling works well with that.
- // TODO remove need to pass local stream into GPU halo exchange - Redmine #3093
- if (havePPDomainDecomposition(cr) && prefer1DAnd1PulseDD && is1DAnd1PulseDD(*cr->dd))
+ opt2fns("-tableb", filenames.size(), filenames.data()), pforce);
+
+ if (devFlags.enableGpuPmePPComm && !thisRankHasDuty(cr, DUTY_PME))
{
- GMX_RELEASE_ASSERT(devFlags.enableGpuBufferOps,
- "Must use GMX_USE_GPU_BUFFER_OPS=1 to use GMX_GPU_DD_COMMS=1");
- void* streamLocal =
- Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv, InteractionLocality::Local);
- void* streamNonLocal =
- Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv, InteractionLocality::NonLocal);
- GMX_LOG(mdlog.warning)
- .asParagraph()
- .appendTextFormatted(
- "NOTE: This run uses the 'GPU halo exchange' feature, enabled by the "
- "GMX_GPU_DD_COMMS environment variable.");
- cr->dd->gpuHaloExchange = std::make_unique<GpuHaloExchange>(
- cr->dd, cr->mpi_comm_mysim, streamLocal, streamNonLocal);
+ fr->pmePpCommGpu = std::make_unique<gmx::PmePpCommGpu>(cr->mpi_comm_mysim, cr->dd->pme_nodeid);
+ }
+
+ fr->nbv = Nbnxm::init_nb_verlet(mdlog, inputrec, fr, cr, *hwinfo, nonbondedDeviceInfo,
+ &mtop, box, wcycle);
+ if (useGpuForBonded)
+ {
+ auto stream = havePPDomainDecomposition(cr)
+ ? Nbnxm::gpu_get_command_stream(
+ fr->nbv->gpu_nbv, gmx::InteractionLocality::NonLocal)
+ : Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv,
+ gmx::InteractionLocality::Local);
+ gpuBonded = std::make_unique<GpuBonded>(mtop.ffparams, stream, wcycle);
+ fr->gpuBonded = gpuBonded.get();
}
/* Initialize the mdAtoms structure.
/* With periodic molecules the charge groups should be whole at start up
* and the virtual sites should not be far from their proper positions.
*/
- if (!inputrec->bContinuation && MASTER(cr) && !(inputrec->ePBC != epbcNONE && inputrec->bPeriodicMols))
+ if (!inputrec->bContinuation && MASTER(cr)
+ && !(inputrec->pbcType != PbcType::No && inputrec->bPeriodicMols))
{
/* Make molecules whole at start of run */
- if (fr->ePBC != epbcNONE)
+ if (fr->pbcType != PbcType::No)
{
- do_pbc_first_mtop(fplog, inputrec->ePBC, box, &mtop, globalState->x.rvec_array());
+ do_pbc_first_mtop(fplog, inputrec->pbcType, box, &mtop, globalState->x.rvec_array());
}
if (vsite)
{
/* This call is not included in init_domain_decomposition mainly
* because fr->cginfo_mb is set later.
*/
- dd_init_bondeds(fplog, cr->dd, &mtop, vsite.get(), inputrec,
+ dd_init_bondeds(fplog, cr->dd, mtop, vsite.get(), inputrec,
domdecOptions.checkBondedInteractions, fr->cginfo_mb);
}
// make it work.
MdrunScheduleWorkload runScheduleWork;
// Also populates the simulation constant workload description.
- runScheduleWork.simulationWork = createSimulationWorkload(
- useGpuForNonbonded, pmeRunMode, useGpuForBonded, useGpuForUpdate,
- devFlags.enableGpuBufferOps, devFlags.enableGpuHaloExchange,
- devFlags.enableGpuPmePPComm, haveEwaldSurfaceContribution(*inputrec));
+ runScheduleWork.simulationWork =
+ createSimulationWorkload(*inputrec, useGpuForNonbonded, pmeRunMode, useGpuForBonded,
+ useGpuForUpdate, devFlags.enableGpuBufferOps,
+ devFlags.enableGpuHaloExchange, devFlags.enableGpuPmePPComm);
std::unique_ptr<gmx::StatePropagatorDataGpu> stateGpu;
if (gpusWereDetected
}
// FIXME: this is only here to manually unpin mdAtoms->chargeA_ and state->x,
- // before we destroy the GPU context(s) in free_gpu_resources().
+ // before we destroy the GPU context(s) in free_gpu().
// Pinned buffers are associated with contexts in CUDA.
// As soon as we destroy GPU contexts after mdrunner() exits, these lines should go.
mdAtoms.reset(nullptr);
globalState.reset(nullptr);
mdModules_.reset(nullptr); // destruct force providers here as they might also use the GPU
+ gpuBonded.reset(nullptr);
+ /* Free pinned buffers in *fr */
+ delete fr;
+ fr = nullptr;
+
+ if (hwinfo->gpu_info.n_dev > 0)
+ {
+ /* stop the GPU profiler (only CUDA) */
+ stopGpuProfiler();
+ }
+
+ /* With tMPI we need to wait for all ranks to finish deallocation before
+ * destroying the CUDA context in free_gpu() as some tMPI ranks may be sharing
+ * GPU and context.
+ *
+ * This is not a concern in OpenCL where we use one context per rank which
+ * is freed in nbnxn_gpu_free().
+ *
+ * Note: it is safe to not call the barrier on the ranks which do not use GPU,
+ * but it is easier and more futureproof to call it on the whole node.
+ *
+ * Note that this function needs to be called even if GPUs are not used
+ * in this run because the PME ranks have no knowledge of whether GPUs
+ * are used or not, but all ranks need to enter the barrier below.
+ * \todo Remove this physical node barrier after making sure
+ * that it's not needed anymore (with a shared GPU run).
+ */
+ if (GMX_THREAD_MPI)
+ {
+ physicalNodeComm.barrier();
+ }
- /* Free GPU memory and set a physical node tMPI barrier (which should eventually go away) */
- free_gpu_resources(fr, physicalNodeComm, hwinfo->gpu_info);
free_gpu(nonbondedDeviceInfo);
free_gpu(pmeDeviceInfo);
- done_forcerec(fr, mtop.molblock.size());
sfree(fcd);
if (doMembed)
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/mshift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
-#include "gromacs/utility/smalloc.h"
-typedef struct
+using gmx::ArrayRef;
+using gmx::ArrayRefWithPadding;
+using gmx::RVec;
+
+struct t_shell
{
- int nnucl;
- int shell; /* The shell id */
- int nucl1, nucl2, nucl3; /* The nuclei connected to the shell */
- /* gmx_bool bInterCG; */ /* Coupled to nuclei outside cg? */
- real k; /* force constant */
- real k_1; /* 1 over force constant */
- rvec xold;
- rvec fold;
- rvec step;
-} t_shell;
+ int nnucl = 0; /* The number of nuclei */
+ int shellIndex = -1; /* The shell index */
+ int nucl1 = -1; /* The first nuclei connected to the shell */
+ int nucl2 = -1; /* The second nuclei connected to the shell */
+ int nucl3 = -1; /* The third nuclei connected to the shell */
+ real k = 0; /* force constant */
+ real k_1 = 0; /* 1 over force constant */
+ rvec xold; /* The old shell coordinates */
+ rvec fold; /* The old force on the shell */
+ rvec step; /* Step size for steepest descents */
+};
struct gmx_shellfc_t
{
/* Shell counts, indices, parameters and working data */
- int nshell_gl; /* The number of shells in the system */
- t_shell* shell_gl; /* All the shells (for DD only) */
- int* shell_index_gl; /* Global shell index (for DD only) */
- gmx_bool bInterCG; /* Are there inter charge-group shells? */
- int nshell; /* The number of local shells */
- t_shell* shell; /* The local shells */
- int shell_nalloc; /* The allocation size of shell */
- gmx_bool bPredict; /* Predict shell positions */
- gmx_bool bRequireInit; /* Require initialization of shell positions */
- int nflexcon; /* The number of flexible constraints */
-
- /* Temporary arrays, should be fixed size 2 when fully converted to C++ */
- PaddedHostVector<gmx::RVec>* x; /* Array for iterative minimization */
- PaddedHostVector<gmx::RVec>* f; /* Array for iterative minimization */
+ std::vector<t_shell> shell_gl; /* All the shells (for DD only) */
+ std::vector<int> shell_index_gl; /* Global shell index (for DD only) */
+ gmx_bool bInterCG; /* Are there inter charge-group shells? */
+ std::vector<t_shell> shells; /* The local shells */
+ bool predictShells = false; /* Predict shell positions */
+ bool requireInit = false; /* Require initialization of shell positions */
+ int nflexcon = 0; /* The number of flexible constraints */
+
+ std::array<PaddedHostVector<RVec>, 2> x; /* Coordinate buffers for iterative minimization */
+ std::array<PaddedHostVector<RVec>, 2> f; /* Force buffers for iterative minimization */
/* Flexible constraint working data */
- rvec* acc_dir; /* Acceleration direction for flexcon */
- rvec* x_old; /* Old coordinates for flexcon */
- int flex_nalloc; /* The allocation size of acc_dir and x_old */
- rvec* adir_xnold; /* Work space for init_adir */
- rvec* adir_xnew; /* Work space for init_adir */
- int adir_nalloc; /* Work space for init_adir */
- std::int64_t numForceEvaluations; /* Total number of force evaluations */
- int numConvergedIterations; /* Total number of iterations that converged */
+ std::vector<RVec> acc_dir; /* Acceleration direction for flexcon */
+ gmx::PaddedVector<RVec> x_old; /* Old coordinates for flexcon */
+ gmx::PaddedVector<RVec> adir_xnold; /* Work space for init_adir */
+ gmx::PaddedVector<RVec> adir_xnew; /* Work space for init_adir */
+ std::int64_t numForceEvaluations; /* Total number of force evaluations */
+ int numConvergedIterations; /* Total number of iterations that converged */
};
-static void pr_shell(FILE* fplog, int ns, t_shell s[])
+static void pr_shell(FILE* fplog, ArrayRef<const t_shell> shells)
{
- int i;
-
fprintf(fplog, "SHELL DATA\n");
fprintf(fplog, "%5s %8s %5s %5s %5s\n", "Shell", "Force k", "Nucl1", "Nucl2", "Nucl3");
- for (i = 0; (i < ns); i++)
+ for (const t_shell& shell : shells)
{
- fprintf(fplog, "%5d %8.3f %5d", s[i].shell, 1.0 / s[i].k_1, s[i].nucl1);
- if (s[i].nnucl == 2)
+ fprintf(fplog, "%5d %8.3f %5d", shell.shellIndex, 1.0 / shell.k_1, shell.nucl1);
+ if (shell.nnucl == 2)
{
- fprintf(fplog, " %5d\n", s[i].nucl2);
+ fprintf(fplog, " %5d\n", shell.nucl2);
}
- else if (s[i].nnucl == 3)
+ else if (shell.nnucl == 3)
{
- fprintf(fplog, " %5d %5d\n", s[i].nucl2, s[i].nucl3);
+ fprintf(fplog, " %5d %5d\n", shell.nucl2, shell.nucl3);
}
else
{
* started, but even when called, the prediction was always
* over-written by a subsequent call in the MD loop, so has been
* removed. */
-static void predict_shells(FILE* fplog,
- rvec x[],
- rvec v[],
- real dt,
- int ns,
- t_shell s[],
- const real mass[],
- gmx_mtop_t* mtop,
- gmx_bool bInit)
+static void predict_shells(FILE* fplog,
+ ArrayRef<RVec> x,
+ ArrayRef<RVec> v,
+ real dt,
+ ArrayRef<const t_shell> shells,
+ const real mass[],
+ gmx_mtop_t* mtop,
+ gmx_bool bInit)
{
- int i, m, s1, n1, n2, n3;
- real dt_1, fudge, tm, m1, m2, m3;
- rvec* ptr;
+ int m, n1, n2, n3;
+ real dt_1, fudge, tm, m1, m2, m3;
GMX_RELEASE_ASSERT(mass || mtop, "Must have masses or a way to look them up");
*/
fudge = 1.0;
+ ArrayRef<RVec> xOrV;
if (bInit)
{
if (fplog)
{
fprintf(fplog, "RELAX: Using prediction for initial shell placement\n");
}
- ptr = x;
+ xOrV = x;
dt_1 = 1;
}
else
{
- ptr = v;
+ xOrV = v;
dt_1 = fudge * dt;
}
int molb = 0;
- for (i = 0; (i < ns); i++)
+ for (const t_shell& shell : shells)
{
- s1 = s[i].shell;
+ const int s1 = shell.shellIndex;
if (bInit)
{
clear_rvec(x[s1]);
}
- switch (s[i].nnucl)
+ switch (shell.nnucl)
{
case 1:
- n1 = s[i].nucl1;
+ n1 = shell.nucl1;
for (m = 0; (m < DIM); m++)
{
- x[s1][m] += ptr[n1][m] * dt_1;
+ x[s1][m] += xOrV[n1][m] * dt_1;
}
break;
case 2:
- n1 = s[i].nucl1;
- n2 = s[i].nucl2;
+ n1 = shell.nucl1;
+ n2 = shell.nucl2;
if (mass)
{
m1 = mass[n1];
tm = dt_1 / (m1 + m2);
for (m = 0; (m < DIM); m++)
{
- x[s1][m] += (m1 * ptr[n1][m] + m2 * ptr[n2][m]) * tm;
+ x[s1][m] += (m1 * xOrV[n1][m] + m2 * xOrV[n2][m]) * tm;
}
break;
case 3:
- n1 = s[i].nucl1;
- n2 = s[i].nucl2;
- n3 = s[i].nucl3;
+ n1 = shell.nucl1;
+ n2 = shell.nucl2;
+ n3 = shell.nucl3;
if (mass)
{
m1 = mass[n1];
tm = dt_1 / (m1 + m2 + m3);
for (m = 0; (m < DIM); m++)
{
- x[s1][m] += (m1 * ptr[n1][m] + m2 * ptr[n2][m] + m3 * ptr[n3][m]) * tm;
+ x[s1][m] += (m1 * xOrV[n1][m] + m2 * xOrV[n2][m] + m3 * xOrV[n3][m]) * tm;
}
break;
- default: gmx_fatal(FARGS, "Shell %d has %d nuclei!", i, s[i].nnucl);
+ default: gmx_fatal(FARGS, "Shell %d has %d nuclei!", s1, shell.nnucl);
}
}
}
gmx_shellfc_t* init_shell_flexcon(FILE* fplog, const gmx_mtop_t* mtop, int nflexcon, int nstcalcenergy, bool usingDomainDecomposition)
{
gmx_shellfc_t* shfc;
- t_shell* shell;
- int* shell_index = nullptr;
int ns, nshell, nsi;
int i, j, type, a_offset, mol, ftype, nra;
return nullptr;
}
- snew(shfc, 1);
- shfc->x = new PaddedHostVector<gmx::RVec>[2] {};
- shfc->f = new PaddedHostVector<gmx::RVec>[2] {};
+ shfc = new gmx_shellfc_t;
shfc->nflexcon = nflexcon;
if (nshell == 0)
/* Only flexible constraints, no shells.
* Note that make_local_shells() does not need to be called.
*/
- shfc->nshell = 0;
- shfc->bPredict = FALSE;
-
return shfc;
}
/* We have shells: fill the shell data structure */
/* Global system sized array, this should be avoided */
- snew(shell_index, mtop->natoms);
+ std::vector<int> shell_index(mtop->natoms);
nshell = 0;
for (const AtomProxy atomP : AtomRange(*mtop))
}
}
- snew(shell, nshell);
-
- /* Initiate the shell structures */
- for (i = 0; (i < nshell); i++)
- {
- shell[i].shell = -1;
- shell[i].nnucl = 0;
- shell[i].nucl1 = -1;
- shell[i].nucl2 = -1;
- shell[i].nucl3 = -1;
- /* shell[i].bInterCG=FALSE; */
- shell[i].k_1 = 0;
- shell[i].k = 0;
- }
+ std::vector<t_shell> shell(nshell);
ffparams = &mtop->ffparams;
{
gmx_fatal(FARGS, "nsi is %d should be within 0 - %d. aS = %d", nsi, nshell, aS);
}
- if (shell[nsi].shell == -1)
+ if (shell[nsi].shellIndex == -1)
{
- shell[nsi].shell = a_offset + aS;
+ shell[nsi].shellIndex = a_offset + aS;
ns++;
}
- else if (shell[nsi].shell != a_offset + aS)
+ else if (shell[nsi].shellIndex != a_offset + aS)
{
gmx_fatal(FARGS, "Weird stuff in %s, %d", __FILE__, __LINE__);
}
{
if (fplog)
{
- pr_shell(fplog, ns, shell);
+ pr_shell(fplog, shell);
}
gmx_fatal(FARGS, "Can not handle more than three bonds per shell\n");
}
if (debug)
{
- pr_shell(debug, ns, shell);
+ pr_shell(debug, shell);
}
- shfc->nshell_gl = ns;
shfc->shell_gl = shell;
shfc->shell_index_gl = shell_index;
- shfc->bPredict = (getenv("GMX_NOPREDICT") == nullptr);
- shfc->bRequireInit = FALSE;
- if (!shfc->bPredict)
+ shfc->predictShells = (getenv("GMX_NOPREDICT") == nullptr);
+ shfc->requireInit = false;
+ if (!shfc->predictShells)
{
if (fplog)
{
}
else
{
- shfc->bRequireInit = (getenv("GMX_REQUIRE_SHELL_INIT") != nullptr);
- if (shfc->bRequireInit && fplog)
+ shfc->requireInit = (getenv("GMX_REQUIRE_SHELL_INIT") != nullptr);
+ if (shfc->requireInit && fplog)
{
fprintf(fplog, "\nWill always initiate shell positions\n");
}
}
- if (shfc->bPredict)
+ if (shfc->predictShells)
{
if (shfc->bInterCG)
{
* shell velocities are zeroed, it's a bit tricky to keep
* track of the shell displacements and thus the velocity.
*/
- shfc->bPredict = FALSE;
+ shfc->predictShells = false;
}
}
void make_local_shells(const t_commrec* cr, const t_mdatoms* md, gmx_shellfc_t* shfc)
{
- t_shell* shell;
- int a0, a1, *ind, nshell, i;
+ int a0, a1;
gmx_domdec_t* dd = nullptr;
if (DOMAINDECOMP(cr))
}
else
{
- /* Single node: we need all shells, just copy the pointer */
- shfc->nshell = shfc->nshell_gl;
- shfc->shell = shfc->shell_gl;
+ /* Single node: we need all shells, copy them */
+ shfc->shells = shfc->shell_gl;
return;
}
- ind = shfc->shell_index_gl;
+ ArrayRef<const int> ind = shfc->shell_index_gl;
- nshell = 0;
- shell = shfc->shell;
- for (i = a0; i < a1; i++)
+ std::vector<t_shell>& shells = shfc->shells;
+ shells.clear();
+ for (int i = a0; i < a1; i++)
{
if (md->ptype[i] == eptShell)
{
- if (nshell + 1 > shfc->shell_nalloc)
- {
- shfc->shell_nalloc = over_alloc_dd(nshell + 1);
- srenew(shell, shfc->shell_nalloc);
- }
if (dd)
{
- shell[nshell] = shfc->shell_gl[ind[dd->globalAtomIndices[i]]];
+ shells.push_back(shfc->shell_gl[ind[dd->globalAtomIndices[i]]]);
}
else
{
- shell[nshell] = shfc->shell_gl[ind[i]];
+ shells.push_back(shfc->shell_gl[ind[i]]);
}
+ t_shell& shell = shells.back();
/* With inter-cg shells we can no do shell prediction,
* so we do not need the nuclei numbers.
*/
if (!shfc->bInterCG)
{
- shell[nshell].nucl1 = i + shell[nshell].nucl1 - shell[nshell].shell;
- if (shell[nshell].nnucl > 1)
+ shell.nucl1 = i + shell.nucl1 - shell.shellIndex;
+ if (shell.nnucl > 1)
{
- shell[nshell].nucl2 = i + shell[nshell].nucl2 - shell[nshell].shell;
+ shell.nucl2 = i + shell.nucl2 - shell.shellIndex;
}
- if (shell[nshell].nnucl > 2)
+ if (shell.nnucl > 2)
{
- shell[nshell].nucl3 = i + shell[nshell].nucl3 - shell[nshell].shell;
+ shell.nucl3 = i + shell.nucl3 - shell.shellIndex;
}
}
- shell[nshell].shell = i;
- nshell++;
+ shell.shellIndex = i;
}
}
-
- shfc->nshell = nshell;
- shfc->shell = shell;
}
static void do_1pos(rvec xnew, const rvec xold, const rvec f, real step)
xnew[ZZ] = zo + dz;
}
-static void directional_sd(gmx::ArrayRef<const gmx::RVec> xold,
- gmx::ArrayRef<gmx::RVec> xnew,
- const rvec acc_dir[],
- int homenr,
- real step)
+static void directional_sd(ArrayRef<const RVec> xold,
+ ArrayRef<RVec> xnew,
+ ArrayRef<const RVec> acc_dir,
+ int homenr,
+ real step)
{
const rvec* xo = as_rvec_array(xold.data());
rvec* xn = as_rvec_array(xnew.data());
}
}
-static void shell_pos_sd(gmx::ArrayRef<const gmx::RVec> xcur,
- gmx::ArrayRef<gmx::RVec> xnew,
- gmx::ArrayRef<const gmx::RVec> f,
- int ns,
- t_shell s[],
- int count)
+static void shell_pos_sd(ArrayRef<const RVec> xcur,
+ ArrayRef<RVec> xnew,
+ ArrayRef<const RVec> f,
+ ArrayRef<t_shell> shells,
+ int count)
{
const real step_scale_min = 0.8, step_scale_increment = 0.2, step_scale_max = 1.2,
step_scale_multiple = (step_scale_max - step_scale_min) / step_scale_increment;
- int i, shell, d;
+ int d;
real dx, df, k_est;
const real zero = 0;
#ifdef PRINT_STEP
step_min = 1e30;
step_max = 0;
#endif
- for (i = 0; (i < ns); i++)
+ for (t_shell& shell : shells)
{
- shell = s[i].shell;
+ const int ind = shell.shellIndex;
if (count == 1)
{
for (d = 0; d < DIM; d++)
{
- s[i].step[d] = s[i].k_1;
+ shell.step[d] = shell.k_1;
#ifdef PRINT_STEP
- step_min = std::min(step_min, s[i].step[d]);
- step_max = std::max(step_max, s[i].step[d]);
+ step_min = std::min(step_min, shell.step[d]);
+ step_max = std::max(step_max, shell.step[d]);
#endif
}
}
{
for (d = 0; d < DIM; d++)
{
- dx = xcur[shell][d] - s[i].xold[d];
- df = f[shell][d] - s[i].fold[d];
+ dx = xcur[ind][d] - shell.xold[d];
+ df = f[ind][d] - shell.fold[d];
/* -dx/df gets used to generate an interpolated value, but would
* cause a NaN if df were binary-equal to zero. Values close to
* zero won't cause problems (because of the min() and max()), so
k_est = -dx / df;
/* Scale the step size by a factor interpolated from
* step_scale_min to step_scale_max, as k_est goes from 0 to
- * step_scale_multiple * s[i].step[d] */
- s[i].step[d] = step_scale_min * s[i].step[d]
- + step_scale_increment
- * std::min(step_scale_multiple * s[i].step[d],
- std::max(k_est, zero));
+ * step_scale_multiple * shell.step[d] */
+ shell.step[d] = step_scale_min * shell.step[d]
+ + step_scale_increment
+ * std::min(step_scale_multiple * shell.step[d],
+ std::max(k_est, zero));
}
else
{
}
else /* 0 != dx */
{
- s[i].step[d] *= step_scale_max;
+ shell.step[d] *= step_scale_max;
}
}
#ifdef PRINT_STEP
- step_min = std::min(step_min, s[i].step[d]);
- step_max = std::max(step_max, s[i].step[d]);
+ step_min = std::min(step_min, shell.step[d]);
+ step_max = std::max(step_max, shell.step[d]);
#endif
}
}
- copy_rvec(xcur[shell], s[i].xold);
- copy_rvec(f[shell], s[i].fold);
+ copy_rvec(xcur[ind], shell.xold);
+ copy_rvec(f[ind], shell.fold);
- do_1pos3(xnew[shell], xcur[shell], f[shell], s[i].step);
+ do_1pos3(xnew[ind], xcur[ind], f[ind], shell.step);
if (gmx_debug_at)
{
- fprintf(debug, "shell[%d] = %d\n", i, shell);
- pr_rvec(debug, 0, "fshell", f[shell], DIM, TRUE);
- pr_rvec(debug, 0, "xold", xcur[shell], DIM, TRUE);
- pr_rvec(debug, 0, "step", s[i].step, DIM, TRUE);
- pr_rvec(debug, 0, "xnew", xnew[shell], DIM, TRUE);
+ fprintf(debug, "shell = %d\n", ind);
+ pr_rvec(debug, 0, "fshell", f[ind], DIM, TRUE);
+ pr_rvec(debug, 0, "xold", xcur[ind], DIM, TRUE);
+ pr_rvec(debug, 0, "step", shell.step, DIM, TRUE);
+ pr_rvec(debug, 0, "xnew", xnew[ind], DIM, TRUE);
}
}
#ifdef PRINT_STEP
#endif
}
-static void decrease_step_size(int nshell, t_shell s[])
+static void decrease_step_size(ArrayRef<t_shell> shells)
{
- int i;
-
- for (i = 0; i < nshell; i++)
+ for (t_shell& shell : shells)
{
- svmul(0.8, s[i].step, s[i].step);
+ svmul(0.8, shell.step, shell.step);
}
}
}
-static real rms_force(const t_commrec* cr,
- gmx::ArrayRef<const gmx::RVec> force,
- int ns,
- t_shell s[],
- int ndir,
- real* sf_dir,
- real* Epot)
+static real rms_force(const t_commrec* cr,
+ ArrayRef<const RVec> force,
+ ArrayRef<const t_shell> shells,
+ int ndir,
+ real* sf_dir,
+ real* Epot)
{
double buf[4];
const rvec* f = as_rvec_array(force.data());
buf[0] = *sf_dir;
- for (int i = 0; i < ns; i++)
+ for (const t_shell& shell : shells)
{
- int shell = s[i].shell;
- buf[0] += norm2(f[shell]);
+ buf[0] += norm2(f[shell.shellIndex]);
}
- int ntot = ns;
+ int ntot = shells.ssize();
if (PAR(cr))
{
return (ntot ? std::sqrt(buf[0] / ntot) : 0);
}
-static void dump_shells(FILE* fp, gmx::ArrayRef<gmx::RVec> f, real ftol, int ns, t_shell s[])
+static void dump_shells(FILE* fp, ArrayRef<RVec> f, real ftol, ArrayRef<const t_shell> shells)
{
- int i, shell;
real ft2, ff2;
ft2 = gmx::square(ftol);
- for (i = 0; (i < ns); i++)
+ for (const t_shell& shell : shells)
{
- shell = s[i].shell;
- ff2 = iprod(f[shell], f[shell]);
+ const int ind = shell.shellIndex;
+ ff2 = iprod(f[ind], f[ind]);
if (ff2 > ft2)
{
- fprintf(fp, "SHELL %5d, force %10.5f %10.5f %10.5f, |f| %10.5f\n", shell,
- f[shell][XX], f[shell][YY], f[shell][ZZ], std::sqrt(ff2));
+ fprintf(fp, "SHELL %5d, force %10.5f %10.5f %10.5f, |f| %10.5f\n", ind, f[ind][XX],
+ f[ind][YY], f[ind][ZZ], std::sqrt(ff2));
}
}
}
int64_t step,
const t_mdatoms* md,
int end,
- rvec* x_old,
- rvec* x_init,
- rvec* x,
- rvec* f,
- rvec* acc_dir,
+ ArrayRefWithPadding<RVec> xOld,
+ ArrayRef<RVec> x_init,
+ ArrayRefWithPadding<RVec> xCurrent,
+ ArrayRef<RVec> f,
+ ArrayRef<RVec> acc_dir,
const matrix box,
- gmx::ArrayRef<const real> lambda,
+ ArrayRef<const real> lambda,
real* dvdlambda)
{
- rvec * xnold, *xnew;
double dt, w_dt;
int n, d;
unsigned short* ptype;
{
n = end;
}
- if (n > shfc->adir_nalloc)
- {
- shfc->adir_nalloc = over_alloc_dd(n);
- srenew(shfc->adir_xnold, shfc->adir_nalloc);
- srenew(shfc->adir_xnew, shfc->adir_nalloc);
- }
- xnold = shfc->adir_xnold;
- xnew = shfc->adir_xnew;
+ shfc->adir_xnold.resizeWithPadding(n);
+ shfc->adir_xnew.resizeWithPadding(n);
+ rvec* xnold = as_rvec_array(shfc->adir_xnold.data());
+ rvec* xnew = as_rvec_array(shfc->adir_xnew.data());
+ rvec* x_old = as_rvec_array(xOld.paddedArrayRef().data());
+ rvec* x = as_rvec_array(xCurrent.paddedArrayRef().data());
ptype = md->ptype;
}
}
}
- constr->apply(FALSE, FALSE, step, 0, 1.0, x, xnold, nullptr, box, lambda[efptBONDED],
- &(dvdlambda[efptBONDED]), nullptr, nullptr, gmx::ConstraintVariable::Positions);
- constr->apply(FALSE, FALSE, step, 0, 1.0, x, xnew, nullptr, box, lambda[efptBONDED],
- &(dvdlambda[efptBONDED]), nullptr, nullptr, gmx::ConstraintVariable::Positions);
+ constr->apply(FALSE, FALSE, step, 0, 1.0, xCurrent, shfc->adir_xnold.arrayRefWithPadding(), {},
+ box, lambda[efptBONDED], &(dvdlambda[efptBONDED]), {}, nullptr,
+ gmx::ConstraintVariable::Positions);
+ constr->apply(FALSE, FALSE, step, 0, 1.0, xCurrent, shfc->adir_xnew.arrayRefWithPadding(), {},
+ box, lambda[efptBONDED], &(dvdlambda[efptBONDED]), {}, nullptr,
+ gmx::ConstraintVariable::Positions);
for (n = 0; n < end; n++)
{
}
/* Project the acceleration on the old bond directions */
- constr->apply(FALSE, FALSE, step, 0, 1.0, x_old, xnew, acc_dir, box, lambda[efptBONDED],
- &(dvdlambda[efptBONDED]), nullptr, nullptr, gmx::ConstraintVariable::Deriv_FlexCon);
+ constr->apply(FALSE, FALSE, step, 0, 1.0, xOld, shfc->adir_xnew.arrayRefWithPadding(), acc_dir,
+ box, lambda[efptBONDED], &(dvdlambda[efptBONDED]), {}, nullptr,
+ gmx::ConstraintVariable::Deriv_FlexCon);
}
-void relax_shell_flexcon(FILE* fplog,
- const t_commrec* cr,
- const gmx_multisim_t* ms,
- gmx_bool bVerbose,
- gmx_enfrot* enforcedRotation,
- int64_t mdstep,
- const t_inputrec* inputrec,
- gmx::ImdSession* imdSession,
- pull_t* pull_work,
- gmx_bool bDoNS,
- int force_flags,
- const gmx_localtop_t* top,
- gmx::Constraints* constr,
- gmx_enerdata_t* enerd,
- t_fcdata* fcd,
- int natoms,
- gmx::ArrayRefWithPadding<gmx::RVec> x,
- gmx::ArrayRefWithPadding<gmx::RVec> v,
- const matrix box,
- gmx::ArrayRef<real> lambda,
- history_t* hist,
- gmx::ArrayRefWithPadding<gmx::RVec> f,
- tensor force_vir,
- const t_mdatoms* md,
- t_nrnb* nrnb,
- gmx_wallcycle_t wcycle,
- t_graph* graph,
- gmx_shellfc_t* shfc,
- t_forcerec* fr,
- gmx::MdrunScheduleWorkload* runScheduleWork,
- double t,
- rvec mu_tot,
- const gmx_vsite_t* vsite,
- const DDBalanceRegionHandler& ddBalanceRegionHandler)
+void relax_shell_flexcon(FILE* fplog,
+ const t_commrec* cr,
+ const gmx_multisim_t* ms,
+ gmx_bool bVerbose,
+ gmx_enfrot* enforcedRotation,
+ int64_t mdstep,
+ const t_inputrec* inputrec,
+ gmx::ImdSession* imdSession,
+ pull_t* pull_work,
+ gmx_bool bDoNS,
+ int force_flags,
+ const gmx_localtop_t* top,
+ gmx::Constraints* constr,
+ gmx_enerdata_t* enerd,
+ t_fcdata* fcd,
+ int natoms,
+ ArrayRefWithPadding<RVec> xPadded,
+ ArrayRefWithPadding<RVec> vPadded,
+ const matrix box,
+ ArrayRef<real> lambda,
+ history_t* hist,
+ ArrayRefWithPadding<RVec> f,
+ tensor force_vir,
+ const t_mdatoms* md,
+ t_nrnb* nrnb,
+ gmx_wallcycle_t wcycle,
+ t_graph* graph,
+ gmx_shellfc_t* shfc,
+ t_forcerec* fr,
+ gmx::MdrunScheduleWorkload* runScheduleWork,
+ double t,
+ rvec mu_tot,
+ const gmx_vsite_t* vsite,
+ const DDBalanceRegionHandler& ddBalanceRegionHandler)
{
- auto xRvec = as_rvec_array(x.paddedArrayRef().data());
- auto vRvec = as_rvec_array(v.paddedArrayRef().data());
-
- int nshell;
- t_shell* shell;
- const t_idef* idef;
- rvec * acc_dir = nullptr, *x_old = nullptr;
- real Epot[2], df[2];
- real sf_dir, invdt;
- real ftol, dum = 0;
- char sbuf[22];
- gmx_bool bCont, bInit, bConverged;
- int nat, dd_ac0, dd_ac1 = 0, i;
- int homenr = md->homenr, end = homenr;
- int nflexcon, number_steps, d, Min = 0, count = 0;
+ real Epot[2], df[2];
+ real sf_dir, invdt;
+ real dum = 0;
+ char sbuf[22];
+ int nat, dd_ac0, dd_ac1 = 0, i;
+ int homenr = md->homenr, end = homenr;
+ int d, Min = 0, count = 0;
#define Try (1 - Min) /* At start Try = 1 */
- bCont = (mdstep == inputrec->init_step) && inputrec->bContinuation;
- bInit = (mdstep == inputrec->init_step) || shfc->bRequireInit;
- ftol = inputrec->em_tol;
- number_steps = inputrec->niter;
- nshell = shfc->nshell;
- shell = shfc->shell;
- nflexcon = shfc->nflexcon;
+ const bool bCont = (mdstep == inputrec->init_step) && inputrec->bContinuation;
+ const bool bInit = (mdstep == inputrec->init_step) || shfc->requireInit;
+ const real ftol = inputrec->em_tol;
+ const int number_steps = inputrec->niter;
+ ArrayRef<t_shell> shells = shfc->shells;
+ const int nflexcon = shfc->nflexcon;
- idef = &top->idef;
+ const t_idef* idef = &top->idef;
if (DOMAINDECOMP(cr))
{
shfc->f[i].resizeWithPadding(nat);
}
- /* Create views that we can swap */
- gmx::ArrayRefWithPadding<gmx::RVec> posWithPadding[2];
- gmx::ArrayRefWithPadding<gmx::RVec> forceWithPadding[2];
- gmx::ArrayRef<gmx::RVec> pos[2];
- gmx::ArrayRef<gmx::RVec> force[2];
+ /* Create views that we can swap for trail and minimum for positions and forces */
+ ArrayRefWithPadding<RVec> posWithPadding[2];
+ ArrayRefWithPadding<RVec> forceWithPadding[2];
+ ArrayRef<RVec> pos[2];
+ ArrayRef<RVec> force[2];
for (i = 0; (i < 2); i++)
{
posWithPadding[i] = shfc->x[i].arrayRefWithPadding();
force[i] = forceWithPadding[i].paddedArrayRef();
}
- if (bDoNS && inputrec->ePBC != epbcNONE && !DOMAINDECOMP(cr))
+ ArrayRef<RVec> x = xPadded.unpaddedArrayRef();
+ ArrayRef<RVec> v = vPadded.unpaddedArrayRef();
+
+ if (bDoNS && inputrec->pbcType != PbcType::No && !DOMAINDECOMP(cr))
{
/* This is the only time where the coordinates are used
* before do_force is called, which normally puts all
* charge groups in the box.
*/
- auto xRef = x.paddedArrayRef();
- put_atoms_in_box_omp(fr->ePBC, box, xRef.subArray(0, md->homenr),
+ put_atoms_in_box_omp(fr->pbcType, box, x.subArray(0, md->homenr),
gmx_omp_nthreads_get(emntDefault));
if (graph)
{
- mk_mshift(fplog, graph, fr->ePBC, box, xRvec);
+ mk_mshift(fplog, graph, fr->pbcType, box, as_rvec_array(x.data()));
}
}
/* After this all coordinate arrays will contain whole charge groups */
if (graph)
{
- shift_self(graph, box, xRvec);
+ shift_self(graph, box, as_rvec_array(x.data()));
}
if (nflexcon)
{
- if (nat > shfc->flex_nalloc)
- {
- shfc->flex_nalloc = over_alloc_dd(nat);
- srenew(shfc->acc_dir, shfc->flex_nalloc);
- srenew(shfc->x_old, shfc->flex_nalloc);
- }
- acc_dir = shfc->acc_dir;
- x_old = shfc->x_old;
- auto xArrayRef = x.paddedArrayRef();
- auto vArrayRef = v.paddedArrayRef();
+ shfc->acc_dir.resize(nat);
+ shfc->x_old.resizeWithPadding(nat);
+ ArrayRef<RVec> x_old = shfc->x_old.arrayRefWithPadding().unpaddedArrayRef();
for (i = 0; i < homenr; i++)
{
for (d = 0; d < DIM; d++)
{
- shfc->x_old[i][d] = xArrayRef[i][d] - vArrayRef[i][d] * inputrec->delta_t;
+ x_old[i][d] = x[i][d] - v[i][d] * inputrec->delta_t;
}
}
}
/* Do a prediction of the shell positions, when appropriate.
* Without velocities (EM, NM, BD) we only do initial prediction.
*/
- if (shfc->bPredict && !bCont && (EI_STATE_VELOCITY(inputrec->eI) || bInit))
+ if (shfc->predictShells && !bCont && (EI_STATE_VELOCITY(inputrec->eI) || bInit))
{
- predict_shells(fplog, xRvec, vRvec, inputrec->delta_t, nshell, shell, md->massT, nullptr, bInit);
+ predict_shells(fplog, x, v, inputrec->delta_t, shells, md->massT, nullptr, bInit);
}
/* do_force expected the charge groups to be in the box */
if (graph)
{
- unshift_self(graph, box, xRvec);
+ unshift_self(graph, box, as_rvec_array(x.data()));
}
/* Calculate the forces first time around */
if (gmx_debug_at)
{
- pr_rvecs(debug, 0, "x b4 do_force", xRvec, homenr);
+ pr_rvecs(debug, 0, "x b4 do_force", as_rvec_array(x.data()), homenr);
}
int shellfc_flags = force_flags | (bVerbose ? GMX_FORCE_ENERGY : 0);
do_force(fplog, cr, ms, inputrec, nullptr, enforcedRotation, imdSession, pull_work, mdstep,
- nrnb, wcycle, top, box, x, hist, forceWithPadding[Min], force_vir, md, enerd, fcd,
- lambda, graph, fr, runScheduleWork, vsite, mu_tot, t, nullptr,
+ nrnb, wcycle, top, box, xPadded, hist, forceWithPadding[Min], force_vir, md, enerd,
+ fcd, lambda, graph, fr, runScheduleWork, vsite, mu_tot, t, nullptr,
(bDoNS ? GMX_FORCE_NS : 0) | shellfc_flags, ddBalanceRegionHandler);
sf_dir = 0;
if (nflexcon)
{
- init_adir(shfc, constr, inputrec, cr, dd_ac1, mdstep, md, end, shfc->x_old, xRvec, xRvec,
- as_rvec_array(force[Min].data()), shfc->acc_dir, box, lambda, &dum);
+ init_adir(shfc, constr, inputrec, cr, dd_ac1, mdstep, md, end, shfc->x_old.arrayRefWithPadding(),
+ x, xPadded, force[Min], shfc->acc_dir, box, lambda, &dum);
for (i = 0; i < end; i++)
{
sum_epot(&(enerd->grpp), enerd->term);
Epot[Min] = enerd->term[F_EPOT];
- df[Min] = rms_force(cr, forceWithPadding[Min].paddedArrayRef(), nshell, shell, nflexcon,
- &sf_dir, &Epot[Min]);
+ df[Min] = rms_force(cr, forceWithPadding[Min].paddedArrayRef(), shells, nflexcon, &sf_dir, &Epot[Min]);
df[Try] = 0;
if (debug)
{
pr_rvecs(debug, 0, "force0", as_rvec_array(force[Min].data()), md->nr);
}
- if (nshell + nflexcon > 0)
+ if (!shells.empty() || nflexcon > 0)
{
/* Copy x to pos[Min] & pos[Try]: during minimization only the
* shell positions are updated, therefore the other particles must
* be set here, in advance.
*/
- std::copy(x.paddedArrayRef().begin(), x.paddedArrayRef().end(),
+ std::copy(xPadded.paddedArrayRef().begin(), xPadded.paddedArrayRef().end(),
posWithPadding[Min].paddedArrayRef().begin());
- std::copy(x.paddedArrayRef().begin(), x.paddedArrayRef().end(),
+ std::copy(xPadded.paddedArrayRef().begin(), xPadded.paddedArrayRef().end(),
posWithPadding[Try].paddedArrayRef().begin());
}
/* First check whether we should do shells, or whether the force is
* low enough even without minimization.
*/
- bConverged = (df[Min] < ftol);
+ bool bConverged = (df[Min] < ftol);
for (count = 1; (!(bConverged) && (count < number_steps)); count++)
{
if (vsite)
{
- construct_vsites(vsite, as_rvec_array(pos[Min].data()), inputrec->delta_t, vRvec,
- idef->iparams, idef->il, fr->ePBC, fr->bMolPBC, cr, box);
+ construct_vsites(vsite, as_rvec_array(pos[Min].data()), inputrec->delta_t,
+ as_rvec_array(v.data()), idef->iparams, idef->il, fr->pbcType,
+ fr->bMolPBC, cr, box);
}
if (nflexcon)
{
- init_adir(shfc, constr, inputrec, cr, dd_ac1, mdstep, md, end, x_old, xRvec,
- as_rvec_array(pos[Min].data()), as_rvec_array(force[Min].data()), acc_dir,
- box, lambda, &dum);
+ init_adir(shfc, constr, inputrec, cr, dd_ac1, mdstep, md, end,
+ shfc->x_old.arrayRefWithPadding(), x, posWithPadding[Min], force[Min],
+ shfc->acc_dir, box, lambda, &dum);
- directional_sd(pos[Min], pos[Try], acc_dir, end, fr->fc_stepsize);
+ directional_sd(pos[Min], pos[Try], shfc->acc_dir, end, fr->fc_stepsize);
}
/* New positions, Steepest descent */
- shell_pos_sd(pos[Min], pos[Try], force[Min], nshell, shell, count);
+ shell_pos_sd(pos[Min], pos[Try], force[Min], shells, count);
/* do_force expected the charge groups to be in the box */
if (graph)
sf_dir = 0;
if (nflexcon)
{
- init_adir(shfc, constr, inputrec, cr, dd_ac1, mdstep, md, end, x_old, xRvec,
- as_rvec_array(pos[Try].data()), as_rvec_array(force[Try].data()), acc_dir,
- box, lambda, &dum);
+ init_adir(shfc, constr, inputrec, cr, dd_ac1, mdstep, md, end,
+ shfc->x_old.arrayRefWithPadding(), x, posWithPadding[Try], force[Try],
+ shfc->acc_dir, box, lambda, &dum);
+ ArrayRef<const RVec> acc_dir = shfc->acc_dir;
for (i = 0; i < end; i++)
{
sf_dir += md->massT[i] * norm2(acc_dir[i]);
Epot[Try] = enerd->term[F_EPOT];
- df[Try] = rms_force(cr, force[Try], nshell, shell, nflexcon, &sf_dir, &Epot[Try]);
+ df[Try] = rms_force(cr, force[Try], shells, nflexcon, &sf_dir, &Epot[Try]);
if (debug)
{
if (gmx_debug_at)
{
fprintf(debug, "SHELL ITER %d\n", count);
- dump_shells(debug, force[Try], ftol, nshell, shell);
+ dump_shells(debug, force[Try], ftol, shells);
}
}
if (nflexcon)
{
/* Correct the velocities for the flexible constraints */
- invdt = 1 / inputrec->delta_t;
- auto vArrayRef = v.paddedArrayRef();
+ invdt = 1 / inputrec->delta_t;
for (i = 0; i < end; i++)
{
for (d = 0; d < DIM; d++)
{
- vArrayRef[i][d] += (pos[Try][i][d] - pos[Min][i][d]) * invdt;
+ v[i][d] += (pos[Try][i][d] - pos[Min][i][d]) * invdt;
}
}
}
}
else
{
- decrease_step_size(nshell, shell);
+ decrease_step_size(shells);
}
}
shfc->numForceEvaluations += count;
}
/* Copy back the coordinates and the forces */
- std::copy(pos[Min].begin(), pos[Min].end(), x.paddedArrayRef().data());
+ std::copy(pos[Min].begin(), pos[Min].end(), x.data());
std::copy(force[Min].begin(), force[Min].end(), f.unpaddedArrayRef().begin());
}
shfc->numForceEvaluations / numStepsAsDouble);
}
- // TODO Deallocate memory in shfc
+ delete shfc;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <cstdio>
-#include "gromacs/math/arrayrefwithpadding.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/topology/atoms.h"
namespace gmx
{
+template<typename>
+class ArrayRef;
+template<typename>
+class ArrayRefWithPadding;
class Constraints;
class ImdSession;
class MdrunScheduleWorkload;
} // namespace gmx
/* Initialization function, also predicts the initial shell postions.
+ * Returns a pointer to an initialized shellfc object.
*/
gmx_shellfc_t* init_shell_flexcon(FILE* fplog,
const gmx_mtop_t* mtop,
const gmx_vsite_t* vsite,
const DDBalanceRegionHandler& ddBalanceRegionHandler);
-/* Print some final output */
+/* Print some final output and delete shellfc */
void done_shellfc(FILE* fplog, gmx_shellfc_t* shellfc, int64_t numSteps);
/*! \brief Count the different particle types in a system
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/nbnxm/nbnxm.h"
init_em(fplog,TPI,inputrec,&lambda,nrnb,mu_tot,
state_global->box,fr,mdatoms,top,cr,nfile,fnm,NULL,NULL);*/
/* We never need full pbc for TPI */
- fr->ePBC = epbcXYZ;
+ fr->pbcType = PbcType::Xyz;
/* Determine the temperature for the Boltzmann weighting */
temp = inputrec->opts.ref_t[0];
if (fplog)
bStateChanged = TRUE;
bNS = TRUE;
- put_atoms_in_box(fr->ePBC, box, x);
+ put_atoms_in_box(fr->pbcType, box, x);
/* Put all atoms except for the inserted ones on the grid */
rvec vzero = { 0, 0, 0 };
/* TODO: Avoid updating all atoms at every bNS step */
fr->nbv->setAtomProperties(*mdatoms, fr->cginfo);
- fr->nbv->constructPairlist(InteractionLocality::Local, &top.excls, step, nrnb);
+ fr->nbv->constructPairlist(InteractionLocality::Local, top.excls, step, nrnb);
bNS = FALSE;
}
sprintf(str, "t%g_step%d.pdb", t, static_cast<int>(step));
sprintf(str2, "t: %f step %d ener: %f", t, static_cast<int>(step), epot);
write_sto_conf_mtop(str, str2, top_global, state_global->x.rvec_array(),
- state_global->v.rvec_array(), inputrec->ePBC, state_global->box);
+ state_global->v.rvec_array(), inputrec->pbcType, state_global->box);
}
step++;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return basicMdspan.data() + basicMdspan.mapping().required_span_size();
}
+//! Convenience type for often-used two dimensional extents
+using dynamicExtents2D = extents<dynamic_extent, dynamic_extent>;
+
//! Convenience type for often-used three dimensional extents
using dynamicExtents3D = extents<dynamic_extent, dynamic_extent, dynamic_extent>;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int fep_state = 0; /*current fep state -- just for printing */
std::vector<double> enerpart_lambda; /* Partial Hamiltonian for lambda and flambda[], includes at least all perturbed terms */
+ std::vector<double> dhdlLambda; /* dHdL at all neighboring lambda points (the current lambda point also at index 0). */
real foreign_term[F_NRE] = { 0 }; /* alternate array for storing foreign lambda energies */
struct gmx_grppairener_t foreign_grpp; /* alternate array for storing foreign lambda energies */
};
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
/* Abstract type for PME that is defined only in the routine that use them. */
-struct gmx_ns_t;
struct gmx_pme_t;
struct nonbonded_verlet_t;
struct bonded_threading_t;
struct cginfo_mb_t
{
- int cg_start;
- int cg_end;
- int cg_mod;
- int* cginfo;
+ int cg_start = 0;
+ int cg_end = 0;
+ int cg_mod = 0;
+ std::vector<int> cginfo;
};
struct interaction_const_t* ic = nullptr;
/* PBC stuff */
- int ePBC = 0;
+ PbcType pbcType = PbcType::Xyz;
//! Tells whether atoms inside a molecule can be in different periodic images,
// i.e. whether we need to take into account PBC when computing distances inside molecules.
// This determines whether PBC must be considered for e.g. bonded interactions.
real sc_sigma6_min = 0;
/* Information about atom properties for the molecule blocks in the system */
- struct cginfo_mb_t* cginfo_mb = nullptr;
+ std::vector<cginfo_mb_t> cginfo_mb;
/* Information about atom properties for local and non-local atoms */
std::vector<int> cginfo;
std::vector<gmx::RVec> shiftForces;
/* Non bonded Parameter lists */
- int ntype = 0; /* Number of atom types */
- gmx_bool bBHAM = FALSE;
- real* nbfp = nullptr;
- real* ljpme_c6grid = nullptr; /* C6-values used on grid in LJPME */
+ int ntype = 0; /* Number of atom types */
+ gmx_bool bBHAM = FALSE;
+ std::vector<real> nbfp;
+ real* ljpme_c6grid = nullptr; /* C6-values used on grid in LJPME */
/* Energy group pair flags */
int* egp_flags = nullptr;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2010, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
PR("period", awhDimParams->period);
PR("force-constant", awhDimParams->forceConstant);
PR("diffusion", awhDimParams->diffusion);
- PR("start", awhDimParams->origin);
- PR("end", awhDimParams->end);
PR("cover-diameter", awhDimParams->coverDiameter);
}
/* Neighborsearching parameters */
PS("cutoff-scheme", ECUTSCHEME(ir->cutoff_scheme));
PI("nstlist", ir->nstlist);
- PS("pbc", epbc_names[ir->ePBC]);
+ PS("pbc", c_pbcTypeNames[ir->pbcType].c_str());
PS("periodic-molecules", EBOOL(ir->bPeriodicMols));
PR("verlet-buffer-tolerance", ir->verletbuf_tol);
PR("rlist", ir->rlist);
cmp_int64(fp, "inputrec->nsteps", ir1->nsteps, ir2->nsteps);
cmp_int64(fp, "inputrec->init_step", ir1->init_step, ir2->init_step);
cmp_int(fp, "inputrec->simulation_part", -1, ir1->simulation_part, ir2->simulation_part);
- cmp_int(fp, "inputrec->ePBC", -1, ir1->ePBC, ir2->ePBC);
+ cmp_int(fp, "inputrec->pbcType", -1, static_cast<int>(ir1->pbcType), static_cast<int>(ir2->pbcType));
cmp_bool(fp, "inputrec->bPeriodicMols", -1, ir1->bPeriodicMols, ir2->bPeriodicMols);
cmp_int(fp, "inputrec->cutoff_scheme", -1, ir1->cutoff_scheme, ir2->cutoff_scheme);
cmp_int(fp, "inputrec->nstlist", -1, ir1->nstlist, ir2->nstlist);
bool inputrecPbcXY2Walls(const t_inputrec* ir)
{
- return (ir->ePBC == epbcXY && ir->nwall == 2);
+ return (ir->pbcType == PbcType::XY && ir->nwall == 2);
}
bool integratorHasConservedEnergyQuantity(const t_inputrec* ir)
}
else
{
- return ePBC2npbcdim(ir->ePBC);
+ return numPbcDimensions(ir->pbcType);
}
}
{
int n = 0;
- switch (ir->ePBC)
+ switch (ir->pbcType)
{
- case epbcXYZ:
- case epbcNONE: n = 3; break;
- case epbcXY: n = (ir->nwall == 0 ? 3 : 2); break;
- case epbcSCREW: n = 1; break;
+ case PbcType::Xyz:
+ case PbcType::No: n = 3; break;
+ case PbcType::XY: n = (ir->nwall == 0 ? 3 : 2); break;
+ case PbcType::Screw: n = 1; break;
default: gmx_incons("Unknown pbc in calc_nrdf");
}
{
return EEL_PME_EWALD(ir.coulombtype) && (ir.ewald_geometry == eewg3DC || ir.epsilon_surface != 0);
}
+
+bool haveFreeEnergyType(const t_inputrec& ir, const int fepType)
+{
+ for (int i = 0; i < ir.fepvals->n_lambda; i++)
+ {
+ if (ir.fepvals->all_lambda[fepType][i] > 0)
+ {
+ return true;
+ }
+ }
+ return false;
+}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
class KeyValueTreeObject;
} // namespace gmx
+enum class PbcType;
+
struct t_grpopts
{
//! Number of T-Coupl groups
//! Type of combination rule in LJ-PME
int ljpme_combination_rule;
//! Type of periodic boundary conditions
- int ePBC;
+ PbcType pbcType;
//! Periodic molecules
bool bPeriodicMols;
//! Continuation run: starting state is correct (ie. constrained)
*/
bool haveEwaldSurfaceContribution(const t_inputrec& ir);
+/*! \brief Check if calculation of the specific FEP type was requested.
+ *
+ * \param[in] ir Input record.
+ * \param[in] fepType Free-energy perturbation type to check for.
+ *
+ * \returns If the \p fepType is perturbed in this run.
+ */
+bool haveFreeEnergyType(const t_inputrec& ir, int fepType);
+
#endif /* GMX_MDTYPES_INPUTREC_H */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
class SimulationWorkload
{
public:
+ //! Whether total dipole needs to be computed
+ bool computeMuTot = false;
//! If we have calculation of short range nonbondeds on CPU
bool useCpuNonbonded = false;
//! If we have calculation of short range nonbondeds on GPU
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* \returns GPU positions buffer.
*/
- DeviceBuffer<float> getCoordinates();
+ DeviceBuffer<RVec> getCoordinates();
/*! \brief Copy positions to the GPU memory.
*
*
* \returns GPU velocities buffer.
*/
- DeviceBuffer<float> getVelocities();
+ DeviceBuffer<RVec> getVelocities();
/*! \brief Copy velocities to the GPU memory.
*
*
* \returns GPU force buffer.
*/
- DeviceBuffer<float> getForces();
+ DeviceBuffer<RVec> getForces();
/*! \brief Copy forces to the GPU memory.
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return std::make_tuple(0, 0);
}
-DeviceBuffer<float> StatePropagatorDataGpu::getCoordinates()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getCoordinates()
{
GMX_ASSERT(false,
"A CPU stub method from GPU state propagator data was called instead of one from "
"GPU implementation.");
- return DeviceBuffer<float>{};
+ return {};
}
GpuEventSynchronizer* StatePropagatorDataGpu::getCoordinatesReadyOnDeviceEvent(
}
-DeviceBuffer<float> StatePropagatorDataGpu::getVelocities()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getVelocities()
{
GMX_ASSERT(false,
"A CPU stub method from GPU state propagator data was called instead of one from "
"GPU implementation.");
- return DeviceBuffer<float>{};
+ return {};
}
void StatePropagatorDataGpu::copyVelocitiesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_v */,
}
-DeviceBuffer<float> StatePropagatorDataGpu::getForces()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getForces()
{
GMX_ASSERT(false,
"A CPU stub method from GPU state propagator data was called instead of one from "
"GPU implementation.");
- return DeviceBuffer<float>{};
+ return {};
}
void StatePropagatorDataGpu::copyForcesToGpu(const gmx::ArrayRef<const gmx::RVec> /* h_f */,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* \returns GPU positions buffer.
*/
- DeviceBuffer<float> getCoordinates();
+ DeviceBuffer<RVec> getCoordinates();
/*! \brief Copy positions to the GPU memory.
*
*
* \returns GPU velocities buffer.
*/
- DeviceBuffer<float> getVelocities();
+ DeviceBuffer<RVec> getVelocities();
/*! \brief Copy velocities to the GPU memory.
*
*
* \returns GPU force buffer.
*/
- DeviceBuffer<float> getForces();
+ DeviceBuffer<RVec> getForces();
/*! \brief Copy forces to the GPU memory.
*
int numAtomsAll_ = -1;
//! Device positions buffer
- DeviceBuffer<float> d_x_;
+ DeviceBuffer<RVec> d_x_;
//! Number of particles saved in the positions buffer
int d_xSize_ = -1;
//! Allocation size for the positions buffer
int d_xCapacity_ = -1;
//! Device velocities buffer
- DeviceBuffer<float> d_v_;
+ DeviceBuffer<RVec> d_v_;
//! Number of particles saved in the velocities buffer
int d_vSize_ = -1;
//! Allocation size for the velocities buffer
int d_vCapacity_ = -1;
//! Device force buffer
- DeviceBuffer<float> d_f_;
+ DeviceBuffer<RVec> d_f_;
//! Number of particles saved in the force buffer
int d_fSize_ = -1;
//! Allocation size for the force buffer
* \param[in] atomLocality If all, local or non-local ranges should be copied.
* \param[in] commandStream GPU stream to execute copy in.
*/
- void copyToDevice(DeviceBuffer<float> d_data,
+ void copyToDevice(DeviceBuffer<RVec> d_data,
gmx::ArrayRef<const gmx::RVec> h_data,
int dataSize,
AtomLocality atomLocality,
* \param[in] commandStream GPU stream to execute copy in.
*/
void copyFromDevice(gmx::ArrayRef<gmx::RVec> h_data,
- DeviceBuffer<float> d_data,
+ DeviceBuffer<RVec> d_data,
int dataSize,
AtomLocality atomLocality,
CommandStream commandStream);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
numAtomsPadded = numAtomsAll_;
}
- reallocateDeviceBuffer(&d_x_, DIM * numAtomsPadded, &d_xSize_, &d_xCapacity_, deviceContext_);
+ reallocateDeviceBuffer(&d_x_, numAtomsPadded, &d_xSize_, &d_xCapacity_, deviceContext_);
const size_t paddingAllocationSize = numAtomsPadded - numAtomsAll_;
if (paddingAllocationSize > 0)
{
// The PME stream is used here because the padding region of d_x_ is only in the PME task.
- clearDeviceBufferAsync(&d_x_, DIM * numAtomsAll_, DIM * paddingAllocationSize, pmeStream_);
+ clearDeviceBufferAsync(&d_x_, numAtomsAll_, paddingAllocationSize, pmeStream_);
}
- reallocateDeviceBuffer(&d_v_, DIM * numAtomsAll_, &d_vSize_, &d_vCapacity_, deviceContext_);
+ reallocateDeviceBuffer(&d_v_, numAtomsAll_, &d_vSize_, &d_vCapacity_, deviceContext_);
const int d_fOldCapacity = d_fCapacity_;
- reallocateDeviceBuffer(&d_f_, DIM * numAtomsAll_, &d_fSize_, &d_fCapacity_, deviceContext_);
+ reallocateDeviceBuffer(&d_f_, numAtomsAll_, &d_fSize_, &d_fCapacity_, deviceContext_);
// Clearing of the forces can be done in local stream since the nonlocal stream cannot reach
// the force accumulation stage before syncing with the local stream. Only done in CUDA,
// since the force buffer ops are not implemented in OpenCL.
return std::make_tuple(atomsStartAt, numAtomsToCopy);
}
-void StatePropagatorDataGpu::Impl::copyToDevice(DeviceBuffer<float> d_data,
+void StatePropagatorDataGpu::Impl::copyToDevice(DeviceBuffer<RVec> d_data,
const gmx::ArrayRef<const gmx::RVec> h_data,
int dataSize,
AtomLocality atomLocality,
{
GMX_UNUSED_VALUE(dataSize);
+ GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
+
GMX_ASSERT(dataSize >= 0, "Trying to copy to device buffer before it was allocated.");
+ GMX_ASSERT(commandStream != nullptr,
+ "No stream is valid for copying with given atom locality.");
wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
int atomsStartAt, numAtomsToCopy;
std::tie(atomsStartAt, numAtomsToCopy) = getAtomRangesFromAtomLocality(atomLocality);
- int elementsStartAt = atomsStartAt * DIM;
- int numElementsToCopy = numAtomsToCopy * DIM;
-
if (numAtomsToCopy != 0)
{
- GMX_ASSERT(elementsStartAt + numElementsToCopy <= dataSize,
+ GMX_ASSERT(atomsStartAt + numAtomsToCopy <= dataSize,
"The device allocation is smaller than requested copy range.");
GMX_ASSERT(atomsStartAt + numAtomsToCopy <= h_data.ssize(),
"The host buffer is smaller than the requested copy range.");
- copyToDeviceBuffer(&d_data, reinterpret_cast<const float*>(&h_data.data()[atomsStartAt]),
- elementsStartAt, numElementsToCopy, commandStream, transferKind_, nullptr);
+ copyToDeviceBuffer(&d_data, reinterpret_cast<const RVec*>(&h_data.data()[atomsStartAt]),
+ atomsStartAt, numAtomsToCopy, commandStream, transferKind_, nullptr);
}
wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
}
void StatePropagatorDataGpu::Impl::copyFromDevice(gmx::ArrayRef<gmx::RVec> h_data,
- DeviceBuffer<float> d_data,
+ DeviceBuffer<RVec> d_data,
int dataSize,
AtomLocality atomLocality,
CommandStream commandStream)
{
GMX_UNUSED_VALUE(dataSize);
+ GMX_ASSERT(atomLocality < AtomLocality::Count, "Wrong atom locality.");
+
GMX_ASSERT(dataSize >= 0, "Trying to copy from device buffer before it was allocated.");
+ GMX_ASSERT(commandStream != nullptr,
+ "No stream is valid for copying with given atom locality.");
wallcycle_start_nocount(wcycle_, ewcLAUNCH_GPU);
wallcycle_sub_start(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
int atomsStartAt, numAtomsToCopy;
std::tie(atomsStartAt, numAtomsToCopy) = getAtomRangesFromAtomLocality(atomLocality);
- int elementsStartAt = atomsStartAt * DIM;
- int numElementsToCopy = numAtomsToCopy * DIM;
-
if (numAtomsToCopy != 0)
{
- GMX_ASSERT(elementsStartAt + numElementsToCopy <= dataSize,
+ GMX_ASSERT(atomsStartAt + numAtomsToCopy <= dataSize,
"The device allocation is smaller than requested copy range.");
GMX_ASSERT(atomsStartAt + numAtomsToCopy <= h_data.ssize(),
"The host buffer is smaller than the requested copy range.");
- copyFromDeviceBuffer(reinterpret_cast<float*>(&h_data.data()[atomsStartAt]), &d_data,
- elementsStartAt, numElementsToCopy, commandStream, transferKind_, nullptr);
+ copyFromDeviceBuffer(reinterpret_cast<RVec*>(&h_data.data()[atomsStartAt]), &d_data,
+ atomsStartAt, numAtomsToCopy, commandStream, transferKind_, nullptr);
}
wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
wallcycle_stop(wcycle_, ewcLAUNCH_GPU);
}
-DeviceBuffer<float> StatePropagatorDataGpu::Impl::getCoordinates()
+DeviceBuffer<RVec> StatePropagatorDataGpu::Impl::getCoordinates()
{
return d_x_;
}
// TODO: remove this by adding an event-mark free flavor of this function
if (GMX_GPU == GMX_GPU_CUDA)
{
- xReadyOnDevice_[atomLocality].markEvent(commandStream);
+ xReadyOnDevice_[atomLocality].markEvent(xCopyStreams_[atomLocality]);
}
wallcycle_sub_stop(wcycle_, ewcsLAUNCH_STATE_PROPAGATOR_DATA);
}
-DeviceBuffer<float> StatePropagatorDataGpu::Impl::getVelocities()
+DeviceBuffer<RVec> StatePropagatorDataGpu::Impl::getVelocities()
{
return d_v_;
}
}
-DeviceBuffer<float> StatePropagatorDataGpu::Impl::getForces()
+DeviceBuffer<RVec> StatePropagatorDataGpu::Impl::getForces()
{
return d_f_;
}
}
-DeviceBuffer<float> StatePropagatorDataGpu::getCoordinates()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getCoordinates()
{
return impl_->getCoordinates();
}
}
-DeviceBuffer<float> StatePropagatorDataGpu::getVelocities()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getVelocities()
{
return impl_->getVelocities();
}
}
-DeviceBuffer<float> StatePropagatorDataGpu::getForces()
+DeviceBuffer<RVec> StatePropagatorDataGpu::getForces()
{
return impl_->getForces();
}
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
file(GLOB MODULARSIMULATOR_SOURCES *.cpp)
add_library(modularsimulator OBJECT ${MODULARSIMULATOR_SOURCES})
+target_include_directories(modularsimulator SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
gmx_target_compile_options(modularsimulator)
target_compile_definitions(modularsimulator PRIVATE HAVE_CONFIG_H)
+# Should be possible to remove this when resolving #3290
target_include_directories(modularsimulator SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
if(GMX_OPENMP)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/topology/topology.h"
#include "freeenergyperturbationelement.h"
FILE* fplog,
const MDLogger& mdlog,
t_commrec* cr,
- t_inputrec* inputrec,
+ const t_inputrec* inputrec,
const MDAtoms* mdAtoms,
t_nrnb* nrnb,
gmx_wallcycle* wcycle,
bool hasReadEkinState) :
energyReductionStep_(-1),
virialReductionStep_(-1),
+ vvSchedulingStep_(-1),
doStopCM_(inputrec->comm_mode != ecmNO),
nstcomm_(inputrec->nstcomm),
nstglobalcomm_(nstglobalcomm),
{
GMX_ASSERT(localTopology_, "Setup called before local topology was set.");
- // Only do initial communication step for one of the velocity-verlet stages
- if (algorithm == ComputeGlobalsAlgorithm::LeapFrog
- || algorithm == ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep)
+ if (doStopCM_ && !inputrec_->bContinuation)
{
- unsigned int cglo_flags =
- (CGLO_TEMPERATURE | CGLO_GSTAT
- | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0)
- | (hasReadEkinState_ ? CGLO_READEKIN : 0));
-
- if (algorithm == ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep)
- {
- cglo_flags |= CGLO_PRESSURE | CGLO_CONSTRAINT;
- }
-
- const bool stopCM = doStopCM_ && !inputrec_->bContinuation;
-
// To minimize communication, compute_globals computes the COM velocity
// and the kinetic energy for the velocities without COM motion removed.
// Thus to get the kinetic energy without the COM contribution, we need
// to call compute_globals twice.
- for (int cgloIteration = 0; cgloIteration < (stopCM ? 2 : 1); cgloIteration++)
- {
- unsigned int cglo_flags_iteration = cglo_flags;
- if (stopCM && cgloIteration == 0)
- {
- cglo_flags_iteration |= CGLO_STOPCM;
- cglo_flags_iteration &= ~CGLO_TEMPERATURE;
- }
- compute(-1, cglo_flags_iteration, nullSignaller_.get(), false, true);
+ compute(-1, CGLO_GSTAT | CGLO_STOPCM, nullSignaller_.get(), false, true);
- if (cglo_flags_iteration & CGLO_STOPCM)
- {
- auto v = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
- // At initialization, do not pass x with acceleration-correction mode
- // to avoid (incorrect) correction of the initial coordinates.
- rvec* xPtr = nullptr;
- if (vcm_.mode != ecmLINEAR_ACCELERATION_CORRECTION)
- {
- xPtr = as_rvec_array(statePropagatorData_->positionsView().paddedArrayRef().data());
- }
- process_and_stopcm_grp(fplog_, &vcm_, *mdAtoms_->mdatoms(), xPtr, v);
- inc_nrnb(nrnb_, eNR_STOPCM, mdAtoms_->mdatoms()->homenr);
- }
- }
+ auto v = statePropagatorData_->velocitiesView();
+ // At initialization, do not pass x with acceleration-correction mode
+ // to avoid (incorrect) correction of the initial coordinates.
+ auto x = vcm_.mode == ecmLINEAR_ACCELERATION_CORRECTION ? ArrayRefWithPadding<RVec>()
+ : statePropagatorData_->positionsView();
+ process_and_stopcm_grp(fplog_, &vcm_, *mdAtoms_->mdatoms(), x.unpaddedArrayRef(),
+ v.unpaddedArrayRef());
+ inc_nrnb(nrnb_, eNR_STOPCM, mdAtoms_->mdatoms()->homenr);
+ }
- // Calculate the initial half step temperature, and save the ekinh_old
- for (int i = 0; (i < inputrec_->opts.ngtc); i++)
- {
- copy_mat(energyElement_->ekindata()->tcstat[i].ekinh,
- energyElement_->ekindata()->tcstat[i].ekinh_old);
- }
+ unsigned int cglo_flags =
+ (CGLO_TEMPERATURE | CGLO_GSTAT
+ | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0)
+ | (hasReadEkinState_ ? CGLO_READEKIN : 0));
+
+ if (algorithm == ComputeGlobalsAlgorithm::VelocityVerlet)
+ {
+ cglo_flags |= CGLO_PRESSURE | CGLO_CONSTRAINT;
+ }
+
+ compute(-1, cglo_flags, nullSignaller_.get(), false, true);
+
+ // Calculate the initial half step temperature, and save the ekinh_old
+ for (int i = 0; (i < inputrec_->opts.ngtc); i++)
+ {
+ copy_mat(energyElement_->ekindata()->tcstat[i].ekinh,
+ energyElement_->ekindata()->tcstat[i].ekinh_old);
}
}
compute(step, flags, signaller.get(), true);
}));
}
- else if (algorithm == ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep)
+ else if (algorithm == ComputeGlobalsAlgorithm::VelocityVerlet)
{
- // For vv, the state at the beginning of the step is positions at time t, velocities at time t - dt/2
- // The first velocity propagation (+dt/2) therefore actually corresponds to the previous step.
- // So we need information from the last step in the first half of the integration
- if (!needGlobalReduction && !do_per_step(step - 1, nstglobalcomm_))
+ // For VV, we schedule two calls to compute globals per step.
+ if (step != vvSchedulingStep_)
{
- return;
- }
+ // This is the first scheduling call for this step (positions & velocities at full time
+ // step) Set this as the current scheduling step
+ vvSchedulingStep_ = step;
+
+ // For vv, the state at the beginning of the step is positions at time t, velocities at time t - dt/2
+ // The first velocity propagation (+dt/2) therefore actually corresponds to the previous step.
+ // So we need information from the last step in the first half of the integration
+ if (!needGlobalReduction && !do_per_step(step - 1, nstglobalcomm_))
+ {
+ return;
+ }
- const bool doTemperature = step != initStep_ || inputrec_->bContinuation;
- const bool doEnergy = step == energyReductionStep_;
+ const bool doTemperature = step != initStep_ || inputrec_->bContinuation;
+ const bool doEnergy = step == energyReductionStep_;
- int flags = (needGlobalReduction ? CGLO_GSTAT : 0) | (doEnergy ? CGLO_ENERGY : 0)
- | (doTemperature ? CGLO_TEMPERATURE : 0) | CGLO_PRESSURE | CGLO_CONSTRAINT
- | (needComReduction ? CGLO_STOPCM : 0)
- | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0)
- | CGLO_SCALEEKIN;
+ int flags = (needGlobalReduction ? CGLO_GSTAT : 0) | (doEnergy ? CGLO_ENERGY : 0)
+ | (doTemperature ? CGLO_TEMPERATURE : 0) | CGLO_PRESSURE | CGLO_CONSTRAINT
+ | (needComReduction ? CGLO_STOPCM : 0)
+ | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
+ : 0)
+ | CGLO_SCALEEKIN;
- (*registerRunFunction)(std::make_unique<SimulatorRunFunction>(
- [this, step, flags]() { compute(step, flags, nullSignaller_.get(), false); }));
- }
- else if (algorithm == ComputeGlobalsAlgorithm::VelocityVerletAfterCoordinateUpdate)
- {
- // second call to compute_globals for this step
- if (!needGlobalReduction)
- {
- return;
+ (*registerRunFunction)(std::make_unique<SimulatorRunFunction>(
+ [this, step, flags]() { compute(step, flags, nullSignaller_.get(), false); }));
}
- int flags = CGLO_GSTAT | CGLO_CONSTRAINT
- | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
- : 0);
-
- // Since we're already communicating at this step, we
- // can propagate intra-simulation signals. Note that
- // check_nstglobalcomm has the responsibility for
- // choosing the value of nstglobalcomm which satisfies
- // the need of the different signallers.
- const bool doIntraSimSignal = true;
- // Disable functionality
- const bool doInterSimSignal = false;
-
- auto signaller = std::make_shared<SimulationSignaller>(signals_, cr_, nullptr,
- doInterSimSignal, doIntraSimSignal);
+ else
+ {
+ // second call to compute_globals for this step
+ // Reset the scheduling step to avoid confusion if scheduling needs
+ // to be repeated (in case of unexpected simulation termination)
+ vvSchedulingStep_ = -1;
- (*registerRunFunction)(std::make_unique<SimulatorRunFunction>(
- [this, step, flags, signaller = std::move(signaller)]() {
- compute(step, flags, signaller.get(), true);
- }));
+ if (!needGlobalReduction)
+ {
+ return;
+ }
+ int flags = CGLO_GSTAT | CGLO_CONSTRAINT
+ | (shouldCheckNumberOfBondedInteractions_ ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
+ : 0);
+
+ // Since we're already communicating at this step, we
+ // can propagate intra-simulation signals. Note that
+ // check_nstglobalcomm has the responsibility for
+ // choosing the value of nstglobalcomm which satisfies
+ // the need of the different signallers.
+ const bool doIntraSimSignal = true;
+ // Disable functionality
+ const bool doInterSimSignal = false;
+
+ auto signaller = std::make_shared<SimulationSignaller>(
+ signals_, cr_, nullptr, doInterSimSignal, doIntraSimSignal);
+
+ (*registerRunFunction)(std::make_unique<SimulatorRunFunction>(
+ [this, step, flags, signaller = std::move(signaller)]() {
+ compute(step, flags, signaller.get(), true);
+ }));
+ }
}
}
bool useLastBox,
bool isInit)
{
- auto x = as_rvec_array(statePropagatorData_->positionsView().paddedArrayRef().data());
- auto v = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
+ auto x = statePropagatorData_->positionsView().unpaddedArrayRef();
+ auto v = statePropagatorData_->velocitiesView().unpaddedArrayRef();
auto box = statePropagatorData_->constBox();
auto lastbox = useLastBox ? statePropagatorData_->constPreviousBox()
: statePropagatorData_->constBox();
mdAtoms_->mdatoms(), nrnb_, &vcm_, step != -1 ? wcycle_ : nullptr,
energyElement_->enerdata(), energyElement_->forceVirial(step),
energyElement_->constraintVirial(step), energyElement_->totalVirial(step),
- energyElement_->pressure(step), energyElement_->muTot(), constr_, signaller, lastbox,
+ energyElement_->pressure(step), constr_, signaller, lastbox,
&totalNumberOfBondedInteractions_, energyElement_->needToSumEkinhOld(), flags);
checkNumberOfBondedInteractions(mdlog_, cr_, totalNumberOfBondedInteractions_, top_global_,
localTopology_, x, box, &shouldCheckNumberOfBondedInteractions_);
//! Explicit template instantiation
//! @{
template class ComputeGlobalsElement<ComputeGlobalsAlgorithm::LeapFrog>;
-template class ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep>;
-template class ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAfterCoordinateUpdate>;
+template class ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerlet>;
//! @}
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
enum class ComputeGlobalsAlgorithm
{
LeapFrog,
- VelocityVerletAtFullTimeStep,
- VelocityVerletAfterCoordinateUpdate
+ VelocityVerlet
};
//! The function type allowing to request a check of the number of bonded interactions
FILE* fplog,
const MDLogger& mdlog,
t_commrec* cr,
- t_inputrec* inputrec,
+ const t_inputrec* inputrec,
const MDAtoms* mdAtoms,
t_nrnb* nrnb,
gmx_wallcycle* wcycle,
//! Next step at which virial needs to be reduced
Step virialReductionStep_;
+ //! For VV only, we need to schedule twice per step. This keeps track of the scheduling stage.
+ Step vvSchedulingStep_;
+
//! Whether center of mass motion stopping is enabled
const bool doStopCM_;
//! Number of steps after which center of mass motion is removed
//! Handles communication.
t_commrec* cr_;
//! Contains user input mdp options.
- t_inputrec* inputrec_;
+ const t_inputrec* inputrec_;
//! Full system topology - only needed for checkNumberOfBondedInteractions.
const gmx_mtop_t* top_global_;
//! Atom parameters for this domain.
{
tensor vir_con;
- rvec *x, *xprime, *min_proj, *v;
+ ArrayRefWithPadding<RVec> x;
+ ArrayRefWithPadding<RVec> xprime;
+ ArrayRef<RVec> min_proj;
+ ArrayRefWithPadding<RVec> v;
const real lambdaBonded = freeEnergyPerturbationElement_
? freeEnergyPerturbationElement_->constLambdaView()[efptBONDED]
switch (variable)
{
case ConstraintVariable::Positions:
- x = as_rvec_array(statePropagatorData_->previousPositionsView().paddedArrayRef().data());
- xprime = as_rvec_array(statePropagatorData_->positionsView().paddedArrayRef().data());
- min_proj = nullptr;
- v = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
+ x = statePropagatorData_->previousPositionsView();
+ xprime = statePropagatorData_->positionsView();
+ v = statePropagatorData_->velocitiesView();
break;
case ConstraintVariable::Velocities:
- x = as_rvec_array(statePropagatorData_->positionsView().paddedArrayRef().data());
- xprime = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
- min_proj = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
- v = nullptr;
+ x = statePropagatorData_->positionsView();
+ xprime = statePropagatorData_->velocitiesView();
+ min_proj = statePropagatorData_->velocitiesView().unpaddedArrayRef();
break;
default: gmx_fatal(FARGS, "Constraint algorithm not implemented for modular simulator.");
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/energyhistory.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/observableshistory.h"
#include "gromacs/mdtypes/pullhistory.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
#include "energyelement.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/md_support.h"
#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/state.h"
namespace gmx
#include "gromacs/domdec/domdec.h"
#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_load_balancing.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdrunutility/printtime.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/mdtypes/observableshistory.h"
#include "gromacs/mdtypes/state.h"
}
else if (inputrec->eI == eiVV)
{
- auto computeGlobalsElementAtFullTimeStep =
- std::make_unique<ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep>>(
- statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
- &signals_, nstglobalcomm_, fplog, mdlog, cr, inputrec, mdAtoms, nrnb,
- wcycle, fr, &topologyHolder_->globalTopology(), constr, hasReadEkinState);
- topologyHolder_->registerClient(computeGlobalsElementAtFullTimeStep.get());
- energySignallerBuilder->registerSignallerClient(
- compat::make_not_null(computeGlobalsElementAtFullTimeStep.get()));
- trajectoryElementBuilder->registerSignallerClient(
- compat::make_not_null(computeGlobalsElementAtFullTimeStep.get()));
-
- auto computeGlobalsElementAfterCoordinateUpdate =
- std::make_unique<ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAfterCoordinateUpdate>>(
+ auto computeGlobalsElement =
+ std::make_unique<ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerlet>>(
statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
&signals_, nstglobalcomm_, fplog, mdlog, cr, inputrec, mdAtoms, nrnb,
wcycle, fr, &topologyHolder_->globalTopology(), constr, hasReadEkinState);
- topologyHolder_->registerClient(computeGlobalsElementAfterCoordinateUpdate.get());
- energySignallerBuilder->registerSignallerClient(
- compat::make_not_null(computeGlobalsElementAfterCoordinateUpdate.get()));
+ topologyHolder_->registerClient(computeGlobalsElement.get());
+ energySignallerBuilder->registerSignallerClient(compat::make_not_null(computeGlobalsElement.get()));
trajectoryElementBuilder->registerSignallerClient(
- compat::make_not_null(computeGlobalsElementAfterCoordinateUpdate.get()));
+ compat::make_not_null(computeGlobalsElement.get()));
*checkBondedInteractionsCallback =
- computeGlobalsElementAfterCoordinateUpdate->getCheckNumberOfBondedInteractionsCallback();
+ computeGlobalsElement->getCheckNumberOfBondedInteractionsCallback();
auto propagatorVelocities = std::make_unique<Propagator<IntegrationStep::VelocitiesOnly>>(
inputrec->delta_t * 0.5, statePropagatorDataPtr, mdAtoms, wcycle);
addToCallListAndMove(std::move(constraintElement), elementCallList, elementsOwnershipList);
}
- addToCallListAndMove(std::move(computeGlobalsElementAtFullTimeStep), elementCallList,
- elementsOwnershipList);
+ addToCallList(compat::make_not_null(computeGlobalsElement.get()), elementCallList);
addToCallList(statePropagatorDataPtr, elementCallList); // we have a full microstate at time t here!
if (inputrec->etc == etcVRESCALE)
{
addToCallListAndMove(std::move(constraintElement), elementCallList, elementsOwnershipList);
}
- addToCallListAndMove(std::move(computeGlobalsElementAfterCoordinateUpdate), elementCallList,
- elementsOwnershipList);
+ addToCallListAndMove(std::move(computeGlobalsElement), elementCallList, elementsOwnershipList);
addToCallList(energyElementPtr, elementCallList); // we have the energies at time t here!
if (prBarostat)
{
//! \cond
//! Helper function to add elements or signallers to the call list via raw pointer
template<typename T, typename U>
+ static void addToCallList(U* element, std::vector<compat::not_null<T*>>& callList);
+ //! Helper function to add elements or signallers to the call list via non-null raw pointer
+ template<typename T, typename U>
static void addToCallList(compat::not_null<U*> element, std::vector<compat::not_null<T*>>& callList);
//! Helper function to add elements or signallers to the call list via smart pointer
template<typename T, typename U>
}
//! \cond
+template<typename T, typename U>
+void ModularSimulator::addToCallList(U* element, std::vector<compat::not_null<T*>>& callList)
+{
+ if (element)
+ {
+ callList.emplace_back(element);
+ }
+}
+
template<typename T, typename U>
void ModularSimulator::addToCallList(gmx::compat::not_null<U*> element,
std::vector<compat::not_null<T*>>& callList)
template<typename T, typename U>
void ModularSimulator::addToCallList(std::unique_ptr<U>& element, std::vector<compat::not_null<T*>>& callList)
{
- callList.emplace_back(compat::make_not_null(element.get()));
+ if (element)
+ {
+ callList.emplace_back(compat::make_not_null(element.get()));
+ }
}
template<typename T, typename U>
std::vector<compat::not_null<T*>>& callList,
std::vector<std::unique_ptr<T>>& elementList)
{
- callList.emplace_back(compat::make_not_null(element.get()));
- elementList.emplace_back(std::move(element));
+ if (element)
+ {
+ callList.emplace_back(compat::make_not_null(element.get()));
+ elementList.emplace_back(std::move(element));
+ }
}
//! \endcond
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/update.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/boxutilities.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/nbnxm/nbnxm.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdlib/update.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdrun/shellfc.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/atoms.h"
#include "gromacs/topology/mtop_util.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
lastStep_(-1),
canMoleculesBeDistributedOverPBC_(canMoleculesBeDistributedOverPBC),
systemHasPeriodicMolecules_(inputrec->bPeriodicMols),
- pbcType_(inputrec->ePBC),
+ pbcType_(inputrec->pbcType),
topologyHolder_(topologyHolder),
lastPlannedStep_(inputrec->nsteps + inputrec->init_step),
writeFinalConfiguration_(writeFinalConfiguration),
return box_;
}
-const rvec* StatePropagatorData::constBox()
+const rvec* StatePropagatorData::constBox() const
{
return box_;
}
return previousBox_;
}
-const rvec* StatePropagatorData::constPreviousBox()
+const rvec* StatePropagatorData::constPreviousBox() const
{
return previousBox_;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "topologyholder.h"
struct gmx_mdoutf;
+enum class PbcType : int;
struct t_commrec;
struct t_inputrec;
class t_state;
//! Get pointer to box
rvec* box();
//! Get const pointer to box
- const rvec* constBox();
+ const rvec* constBox() const;
//! Get pointer to previous box
rvec* previousBox();
//! Get const pointer to previous box
- const rvec* constPreviousBox();
+ const rvec* constPreviousBox() const;
//! Get the local number of atoms
int localNumAtoms();
//! Whether system has molecules self-interacting through PBC (used for final output only)
const bool systemHasPeriodicMolecules_;
//! The PBC type (used for final output only)
- const int pbcType_;
+ const PbcType pbcType_;
//! Pointer to the topology (used for final output only)
const TopologyHolder* topologyHolder_;
//! The (planned) last step - determines whether final configuration is written (used for final output only)
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2012-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "grid.h"
#include "gridset.h"
#include "nbnxm_geometry.h"
+#include "nbnxm_gpu.h"
#include "pairlist.h"
using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
const Nbnxm::KernelType kernelType,
int enbnxninitcombrule,
int ntype,
- const real* nbfp,
+ ArrayRef<const real> nbfp,
int n_energygroups)
{
real c6, c12, tol;
const Nbnxm::KernelType kernelType,
int enbnxninitcombrule,
int ntype,
- const real* nbfp,
+ ArrayRef<const real> nbfp,
int n_energygroups,
int nout)
{
void nbnxn_atomdata_x_to_nbat_x_gpu(const Nbnxm::GridSet& gridSet,
const gmx::AtomLocality locality,
bool fillLocal,
- gmx_nbnxn_gpu_t* gpu_nbv,
- DeviceBuffer<float> d_x,
+ NbnxmGpu* gpu_nbv,
+ DeviceBuffer<RVec> d_x,
GpuEventSynchronizer* xReadyOnDevice)
{
/* Add the force array(s) from nbnxn_atomdata_t to f */
void reduceForcesGpu(const gmx::AtomLocality locality,
- DeviceBuffer<float> totalForcesDevice,
+ DeviceBuffer<RVec> totalForcesDevice,
const Nbnxm::GridSet& gridSet,
void* pmeForcesDevice,
gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
- gmx_nbnxn_gpu_t* gpu_nbv,
+ NbnxmGpu* gpu_nbv,
bool useGpuFPmeReduction,
bool accumulateForce)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \libinternal \file
+ * \brief
+ * Functionality for per-atom data in the nbnxm module
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ * \inlibraryapi
+ */
+
#ifndef GMX_NBNXN_ATOMDATA_H
#define GMX_NBNXN_ATOMDATA_H
#include "gromacs/utility/bitmask.h"
#include "gromacs/utility/real.h"
-#include "gpu_types.h"
-
namespace gmx
{
class MDLogger;
}
+struct NbnxmGpu;
struct nbnxn_atomdata_t;
struct nonbonded_verlet_t;
struct t_mdatoms;
enum class KernelType;
} // namespace Nbnxm
-/* Convenience type for vector with aligned memory */
+//! Convenience type for vector with aligned memory
template<typename T>
using AlignedVector = std::vector<T, gmx::AlignedAllocator<T>>;
return DIM * (a & ~(packSize - 1)) + (a & (packSize - 1));
}
-// Struct that holds force and energy output buffers
+/*! \internal
+ * \brief Struct that holds force and energy output buffers */
struct nbnxn_atomdata_output_t
{
- /* Constructor
+ /*! \brief Constructor
*
* \param[in] kernelType Type of non-bonded kernel
* \param[in] numEnergyGroups The number of energy groups
*/
nbnxn_atomdata_output_t(Nbnxm::KernelType kernelType,
int numEnergyGroups,
- int simdEnergyBUfferStride,
+ int simdEnergyBufferStride,
gmx::PinningPolicy pinningPolicy);
- gmx::HostVector<real> f; // f, size natoms*fstride
- gmx::HostVector<real> fshift; // Shift force array, size SHIFTS*DIM
- gmx::HostVector<real> Vvdw; // Temporary Van der Waals group energy storage
- gmx::HostVector<real> Vc; // Temporary Coulomb group energy storage
- AlignedVector<real> VSvdw; // Temporary SIMD Van der Waals group energy storage
- AlignedVector<real> VSc; // Temporary SIMD Coulomb group energy storage
+ //! f, size natoms*fstride
+ gmx::HostVector<real> f;
+ //! Shift force array, size SHIFTS*DIM
+ gmx::HostVector<real> fshift;
+ //! Temporary Van der Waals group energy storage
+ gmx::HostVector<real> Vvdw;
+ //! Temporary Coulomb group energy storage
+ gmx::HostVector<real> Vc;
+ //! Temporary SIMD Van der Waals group energy storage
+ AlignedVector<real> VSvdw;
+ //! Temporary SIMD Coulomb group energy storage
+ AlignedVector<real> VSc;
};
-/* Block size in atoms for the non-bonded thread force-buffer reduction,
- * should be a multiple of all cell and x86 SIMD sizes (i.e. 2, 4 and 8).
+/*! \brief Block size in atoms for the non-bonded thread force-buffer reduction.
+ *
+ * Should be a multiple of all cell and x86 SIMD sizes (i.e. 2, 4 and 8).
* Should be small to reduce the reduction and zeroing cost,
* but too small will result in overhead.
* Currently the block size is NBNXN_BUFFERFLAG_SIZE*3*sizeof(real)=192 bytes.
# define NBNXN_BUFFERFLAG_SIZE 16
#endif
-/* We store the reduction flags as gmx_bitmask_t.
+/*! \brief We store the reduction flags as gmx_bitmask_t.
* This limits the number of flags to BITMASK_SIZE.
*/
#define NBNXN_BUFFERFLAG_MAX_THREADS (BITMASK_SIZE)
-/* Flags for telling if threads write to force output buffers */
+/*! \internal
+ * \brief Flags for telling if threads write to force output buffers */
typedef struct
{
- int nflag; /* The number of flag blocks */
- gmx_bitmask_t* flag; /* Bit i is set when thread i writes to a cell-block */
- int flag_nalloc; /* Allocation size of cxy_flag */
+ //! The number of flag blocks
+ int nflag;
+ //! Bit i is set when thread i writes to a cell-block
+ gmx_bitmask_t* flag;
+ //! Allocation size of cxy_flag
+ int flag_nalloc;
} nbnxn_buffer_flags_t;
-/* LJ combination rules: geometric, Lorentz-Berthelot, none */
+/*! \brief LJ combination rules: geometric, Lorentz-Berthelot, none */
enum
{
ljcrGEOM,
ljcrNR
};
-/* Struct that stores atom related data for the nbnxn module
+/*! \internal
+ * \brief Struct that stores atom related data for the nbnxn module
*
* Note: performance would improve slightly when all std::vector containers
* in this struct would not initialize during resize().
*/
struct nbnxn_atomdata_t
{ //NOLINT(clang-analyzer-optin.performance.Padding)
+ /*! \internal
+ * \brief The actual atom data parameter values */
struct Params
{
- /* Constructor
+ /*! \brief Constructor
*
* \param[in] pinningPolicy Sets the pinning policy for all data that might be transfered to a GPU
*/
Params(gmx::PinningPolicy pinningPolicy);
- // The number of different atom types
+ //! The number of different atom types
int numTypes;
- // Lennard-Jone 6*C6 and 12*C12 parameters, size numTypes*2*2
+ //! Lennard-Jone 6*C6 and 12*C12 parameters, size numTypes*2*2
gmx::HostVector<real> nbfp;
- // Combination rule, see enum defined above
+ //! Combination rule, see enum defined above
int comb_rule;
- // LJ parameters per atom type, size numTypes*2
+ //! LJ parameters per atom type, size numTypes*2
gmx::HostVector<real> nbfp_comb;
- // As nbfp, but with a stride for the present SIMD architecture
+ //! As nbfp, but with a stride for the present SIMD architecture
AlignedVector<real> nbfp_aligned;
- // Atom types per atom
+ //! Atom types per atom
gmx::HostVector<int> type;
- // LJ parameters per atom for fast SIMD loading
+ //! LJ parameters per atom for fast SIMD loading
gmx::HostVector<real> lj_comb;
- // Charges per atom, not set with format nbatXYZQ
+ //! Charges per atom, not set with format nbatXYZQ
gmx::HostVector<real> q;
- // The number of energy groups
+ //! The number of energy groups
int nenergrp;
- // 2log(nenergrp)
+ //! 2log(nenergrp)
int neg_2log;
- // The energy groups, one int entry per cluster, only set when needed
+ //! The energy groups, one int entry per cluster, only set when needed
gmx::HostVector<int> energrp;
};
- // Diagonal and topology exclusion helper data for all SIMD kernels
+ /*! \internal
+ * \brief Diagonal and topology exclusion helper data for all SIMD kernels. */
struct SimdMasks
{
SimdMasks();
- // Helper data for setting up diagonal exclusion masks in the SIMD 4xN kernels
+ //! Helper data for setting up diagonal exclusion masks in the SIMD 4xN kernels
AlignedVector<real> diagonal_4xn_j_minus_i;
- // Helper data for setting up diaginal exclusion masks in the SIMD 2xNN kernels
+ //! Helper data for setting up diaginal exclusion masks in the SIMD 2xNN kernels
AlignedVector<real> diagonal_2xnn_j_minus_i;
- // Filters for topology exclusion masks for the SIMD kernels
+ //! Filters for topology exclusion masks for the SIMD kernels
AlignedVector<uint32_t> exclusion_filter;
- // Filters for topology exclusion masks for double SIMD kernels without SIMD int32 logical support
+ //! Filters for topology exclusion masks for double SIMD kernels without SIMD int32 logical support
AlignedVector<uint64_t> exclusion_filter64;
- // Array of masks needed for exclusions
+ //! Array of masks needed for exclusions
AlignedVector<real> interaction_array;
};
- /* Constructor
+ /*! \brief Constructor
*
* \param[in] pinningPolicy Sets the pinning policy for all data that might be transfered to a GPU
*/
nbnxn_atomdata_t(gmx::PinningPolicy pinningPolicy);
- /* Returns a const reference to the parameters */
+ //! Returns a const reference to the parameters
const Params& params() const { return params_; }
- /* Returns a non-const reference to the parameters */
+ //! Returns a non-const reference to the parameters
Params& paramsDeprecated() { return params_; }
- /* Returns the current total number of atoms stored */
+ //! Returns the current total number of atoms stored
int numAtoms() const { return numAtoms_; }
- /* Return the coordinate buffer, and q with xFormat==nbatXYZQ */
+ //! Return the coordinate buffer, and q with xFormat==nbatXYZQ
gmx::ArrayRef<const real> x() const { return x_; }
- /* Return the coordinate buffer, and q with xFormat==nbatXYZQ */
+ //! Return the coordinate buffer, and q with xFormat==nbatXYZQ
gmx::ArrayRef<real> x() { return x_; }
- /* Resizes the coordinate buffer and sets the number of atoms */
+ //! Resizes the coordinate buffer and sets the number of atoms
void resizeCoordinateBuffer(int numAtoms);
- /* Resizes the force buffers for the current number of atoms */
+ //! Resizes the force buffers for the current number of atoms
void resizeForceBuffers();
private:
- // The LJ and charge parameters
+ //! The LJ and charge parameters
Params params_;
- // The total number of atoms currently stored
+ //! The total number of atoms currently stored
int numAtoms_;
public:
- int natoms_local; /* Number of local atoms */
- int XFormat; /* The format of x (and q), enum */
- int FFormat; /* The format of f, enum */
- gmx_bool bDynamicBox; /* Do we need to update shift_vec every step? */
- gmx::HostVector<gmx::RVec> shift_vec; /* Shift vectors, copied from t_forcerec */
- int xstride; /* stride for a coordinate in x (usually 3 or 4) */
- int fstride; /* stride for a coordinate in f (usually 3 or 4) */
+ //! Number of local atoms
+ int natoms_local;
+ //! The format of x (and q), enum
+ int XFormat;
+ //! The format of f, enum
+ int FFormat;
+ //! Do we need to update shift_vec every step?
+ gmx_bool bDynamicBox;
+ //! Shift vectors, copied from t_forcerec
+ gmx::HostVector<gmx::RVec> shift_vec;
+ //! stride for a coordinate in x (usually 3 or 4)
+ int xstride;
+ //! stride for a coordinate in f (usually 3 or 4)
+ int fstride;
+
private:
- gmx::HostVector<real> x_; /* x and possibly q, size natoms*xstride */
+ //! x and possibly q, size natoms*xstride
+ gmx::HostVector<real> x_;
public:
- // Masks for handling exclusions in the SIMD kernels
+ //! Masks for handling exclusions in the SIMD kernels
const SimdMasks simdMasks;
- /* Output data */
- std::vector<nbnxn_atomdata_output_t> out; /* Output data structures, 1 per thread */
-
- /* Reduction related data */
- gmx_bool bUseBufferFlags; /* Use the flags or operate on all atoms */
- nbnxn_buffer_flags_t buffer_flags; /* Flags for buffer zeroing+reduc. */
- gmx_bool bUseTreeReduce; /* Use tree for force reduction */
- tMPI_Atomic* syncStep; /* Synchronization step for tree reduce */
+ //! Output data structures, 1 per thread
+ std::vector<nbnxn_atomdata_output_t> out;
+
+ //! Reduction related data
+ //! \{
+ //! Use the flags or operate on all atoms
+ gmx_bool bUseBufferFlags;
+ //! Flags for buffer zeroing+reduc.
+ nbnxn_buffer_flags_t buffer_flags;
+ //! Use tree for force reduction
+ gmx_bool bUseTreeReduce;
+ //! Synchronization step for tree reduce
+ tMPI_Atomic* syncStep;
+ //! \}
};
-/* Copy na rvec elements from x to xnb using nbatFormat, start dest a0,
+/*! \brief Copy na rvec elements from x to xnb using nbatFormat, start dest a0,
* and fills up to na_round with coordinates that are far away.
*/
void copy_rvec_to_nbat_real(const int* a, int na, int na_round, const rvec* x, int nbatFormat, real* xnb, int a0);
+//! Describes the combination rule in use by this force field
enum
{
enbnxninitcombruleDETECT,
enbnxninitcombruleNONE
};
-/* Initialize the non-bonded atom data structure.
+/*! \brief Initialize the non-bonded atom data structure.
+ *
* The enum for nbatXFormat is in the file defining nbnxn_atomdata_t.
* Copy the ntypes*ntypes*2 sized nbfp non-bonded parameter list
* to the atom data structure.
* enbnxninitcombrule sets what combination rule data gets stored in nbat.
*/
-void nbnxn_atomdata_init(const gmx::MDLogger& mdlog,
- nbnxn_atomdata_t* nbat,
- Nbnxm::KernelType kernelType,
- int enbnxninitcombrule,
- int ntype,
- const real* nbfp,
- int n_energygroups,
- int nout);
-
+void nbnxn_atomdata_init(const gmx::MDLogger& mdlog,
+ nbnxn_atomdata_t* nbat,
+ Nbnxm::KernelType kernelType,
+ int enbnxninitcombrule,
+ int ntype,
+ gmx::ArrayRef<const real> nbfp,
+ int n_energygroups,
+ int nout);
+
+//! Sets the atomdata after pair search
void nbnxn_atomdata_set(nbnxn_atomdata_t* nbat,
const Nbnxm::GridSet& gridSet,
const t_mdatoms* mdatoms,
const int* atinfo);
-/* Copy the shift vectors to nbat */
+//! Copy the shift vectors to nbat
void nbnxn_atomdata_copy_shiftvec(gmx_bool dynamic_box, rvec* shift_vec, nbnxn_atomdata_t* nbat);
/*! \brief Transform coordinates to xbat layout
* \param[in] d_x Coordinates to be copied (in plain rvec format).
* \param[in] xReadyOnDevice Event synchronizer indicating that the coordinates are ready in the device memory.
*/
-void nbnxn_atomdata_x_to_nbat_x_gpu(const Nbnxm::GridSet& gridSet,
- gmx::AtomLocality locality,
- bool fillLocal,
- gmx_nbnxn_gpu_t* gpu_nbv,
- DeviceBuffer<float> d_x,
- GpuEventSynchronizer* xReadyOnDevice);
+void nbnxn_atomdata_x_to_nbat_x_gpu(const Nbnxm::GridSet& gridSet,
+ gmx::AtomLocality locality,
+ bool fillLocal,
+ NbnxmGpu* gpu_nbv,
+ DeviceBuffer<gmx::RVec> d_x,
+ GpuEventSynchronizer* xReadyOnDevice);
/*! \brief Add the computed forces to \p f, an internal reduction might be performed as well
*
* \param[in] accumulateForce Whether there are usefull data already in the total force buffer.
*/
void reduceForcesGpu(gmx::AtomLocality locality,
- DeviceBuffer<float> totalForcesDevice,
+ DeviceBuffer<gmx::RVec> totalForcesDevice,
const Nbnxm::GridSet& gridSet,
void* pmeForcesDevice,
gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
- gmx_nbnxn_gpu_t* gpu_nbv,
+ NbnxmGpu* gpu_nbv,
bool useGpuFPmeReduction,
bool accumulateForce);
-/* Add the fshift force stored in nbat to fshift */
+//! Add the fshift force stored in nbat to fshift
void nbnxn_atomdata_add_nbat_fshift_to_fshift(const nbnxn_atomdata_t& nbat, gmx::ArrayRef<gmx::RVec> fshift);
-/* Get the atom start index and number of atoms for a given locality */
+//! Get the atom start index and number of atoms for a given locality
void nbnxn_get_atom_range(gmx::AtomLocality atomLocality,
const Nbnxm::GridSet& gridSet,
int* atomStart,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
PairlistParams pairlistParams(kernelSetup.kernelType, false, options.pairlistCutoff, false);
- GridSet gridSet(epbcXYZ, false, nullptr, nullptr, pairlistParams.pairlistType, false,
+ GridSet gridSet(PbcType::Xyz, false, nullptr, nullptr, pairlistParams.pairlistType, false,
numThreads, pinPolicy);
auto pairlistSets = std::make_unique<PairlistSets>(pairlistParams, false, 0);
- auto pairSearch = std::make_unique<PairSearch>(
- epbcXYZ, false, nullptr, nullptr, pairlistParams.pairlistType, false, numThreads, pinPolicy);
+ auto pairSearch =
+ std::make_unique<PairSearch>(PbcType::Xyz, false, nullptr, nullptr,
+ pairlistParams.pairlistType, false, numThreads, pinPolicy);
auto atomData = std::make_unique<nbnxn_atomdata_t>(pinPolicy);
std::move(atomData), kernelSetup, nullptr, nullptr);
nbnxn_atomdata_init(gmx::MDLogger(), nbv->nbat.get(), kernelSetup.kernelType, combinationRule,
- system.numAtomTypes, system.nonbondedParameters.data(), 1, numThreads);
+ system.numAtomTypes, system.nonbondedParameters, 1, numThreads);
t_nrnb nrnb;
{ 0, int(system.coordinates.size()) }, atomDensity, atomInfo,
system.coordinates, 0, nullptr);
- nbv->constructPairlist(gmx::InteractionLocality::Local, &system.excls, 0, &nrnb);
+ nbv->constructPairlist(gmx::InteractionLocality::Local, system.excls, 0, &nrnb);
t_mdatoms mdatoms;
// We only use (read) the atom type and charge from mdatoms
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "bench_system.h"
+#include <numeric>
#include <vector>
#include "gromacs/math/vec.h"
nonbondedParameters[1] = c12Oxygen;
generateCoordinates(multiplicationFactor, &coordinates, box);
- put_atoms_in_box(epbcXYZ, box, coordinates);
+ put_atoms_in_box(PbcType::Xyz, box, coordinates);
int numAtoms = coordinates.size();
GMX_RELEASE_ASSERT(numAtoms % numAtomsInMolecule == 0,
charges.resize(numAtoms);
atomInfoAllVdw.resize(numAtoms);
atomInfoOxygenVdw.resize(numAtoms);
- snew(excls.index, numAtoms + 1);
- snew(excls.a, numAtoms * numAtomsInMolecule);
- excls.index[0] = 0;
for (int a = 0; a < numAtoms; a++)
{
SET_CGINFO_HAS_Q(atomInfoAllVdw[a]);
SET_CGINFO_HAS_Q(atomInfoOxygenVdw[a]);
- const int firstAtomInMolecule = a - (a % numAtomsInMolecule);
- for (int aj = 0; aj < numAtomsInMolecule; aj++)
- {
- excls.a[a * numAtomsInMolecule + aj] = firstAtomInMolecule + aj;
- }
- excls.index[a + 1] = (a + 1) * numAtomsInMolecule;
+ excls.pushBackListOfSize(numAtomsInMolecule);
+ gmx::ArrayRef<int> exclusionsForAtom = excls.back();
+ const int firstAtomInMolecule = a - (a % numAtomsInMolecule);
+ std::iota(exclusionsForAtom.begin(), exclusionsForAtom.end(), firstAtomInMolecule);
}
forceRec.ntype = numAtomTypes;
- forceRec.nbfp = nonbondedParameters.data();
+ forceRec.nbfp = nonbondedParameters;
snew(forceRec.shift_vec, SHIFTS);
calc_shifts(box, forceRec.shift_vec);
}
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/forcerec.h"
-#include "gromacs/topology/block.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/smalloc.h"
namespace gmx
//! Atom info where only oxygen atoms are marked to have Van der Waals interactions
std::vector<int> atomInfoOxygenVdw;
//! Information about exclusions.
- t_blocka excls;
+ ListOfLists<int> excls;
//! Storage for atom positions.
std::vector<gmx::RVec> coordinates;
//! System simulation box.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* the research papers on the package. Check out http://www.gromacs.org.
*/
-/*! \internal \file
+/*! \file
+ * \internal
*
* \brief Declares constants and helper functions used when handling
* bounding boxes for clusters of particles.
#ifndef DOXYGEN
-/* Bounding box calculations are (currently) always in single precision, so
+/*! \brief Bounding box calculations are (currently) always in single precision, so
* we only need to check for single precision support here.
* This uses less (cache-)memory and SIMD is faster, at least on x86.
*/
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_NBNXM_CLUSTERDISTANCEKERNELTYPE_H
#define GMX_NBNXM_CLUSTERDISTANCEKERNELTYPE_H
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/simd/simd.h"
#include "gromacs/utility/gmxassert.h"
-#include "atomdata.h"
#include "pairlistparams.h"
//! The types of kernel for calculating the distance between pairs of atom clusters
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief CUDA kernel for transforming position coordinates from rvec to nbnxm layout.
*
* TODO:
- * - improve/simplify/document use of cxy_na and na_round
* - rename kernel so naming matches with the other NBNXM kernels;
* - enable separate compilation unit
* \param[in] numColumns Extent of cell-level parallelism.
* \param[out] gm_xq Coordinates buffer in nbnxm layout.
- * \param[in] setFillerCoords Whether to set the coordinates of the filler particles.
+ * \tparam setFillerCoords Whether to set the coordinates of the filler particles.
* \param[in] gm_x Coordinates buffer.
* \param[in] gm_atomIndex Atom index mapping.
* \param[in] gm_numAtoms Array of number of atoms.
* \param[in] gm_cellIndex Array of cell indices.
- * \param[in] cellOffset Airst cell.
+ * \param[in] cellOffset First cell.
* \param[in] numAtomsPerCell Number of atoms per cell.
*/
+template<bool setFillerCoords>
static __global__ void nbnxn_gpu_x_to_nbat_x_kernel(int numColumns,
float4* __restrict__ gm_xq,
- bool setFillerCoords,
const float3* __restrict__ gm_x,
const int* __restrict__ gm_atomIndex,
const int* __restrict__ gm_numAtoms,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/cudautils.cuh"
#include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
+#include "gromacs/gpu_utils/typecasts.cuh"
#include "gromacs/gpu_utils/vectype_ops.cuh"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/nbnxm/atomdata.h"
/*********************************/
/*! Returns the number of blocks to be used for the nonbonded GPU kernel. */
-static inline int calc_nb_kernel_nblock(int nwork_units, const gmx_device_info_t* dinfo)
+static inline int calc_nb_kernel_nblock(int nwork_units, const DeviceInformation* deviceInfo)
{
int max_grid_x_size;
- assert(dinfo);
+ assert(deviceInfo);
/* CUDA does not accept grid dimension of 0 (which can happen e.g. with an
empty domain) and that case should be handled before this point. */
assert(nwork_units > 0);
- max_grid_x_size = dinfo->prop.maxGridSize[0];
+ max_grid_x_size = deviceInfo->prop.maxGridSize[0];
/* do we exceed the grid x dimension limit? */
if (nwork_units > max_grid_x_size)
int evdwtype,
bool bDoEne,
bool bDoPrune,
- const gmx_device_info_t gmx_unused* devInfo)
+ const DeviceInformation gmx_unused* deviceInfo)
{
nbnxn_cu_kfunc_ptr_t res;
/* assert assumptions made by the kernels */
GMX_ASSERT(c_nbnxnGpuClusterSize * c_nbnxnGpuClusterSize / c_nbnxnGpuClusterpairSplit
- == devInfo->prop.warpSize,
+ == deviceInfo->prop.warpSize,
"The CUDA kernels require the "
"cluster_size_i*cluster_size_j/nbnxn_gpu_clusterpair_split to match the warp size "
"of the architecture targeted.");
/*! \brief Calculates the amount of shared memory required by the nonbonded kernel in use. */
static inline int calc_shmem_required_nonbonded(const int num_threads_z,
- const gmx_device_info_t gmx_unused* dinfo,
+ const DeviceInformation gmx_unused* deviceInfo,
const cu_nbparam_t* nbp)
{
int shmem;
- assert(dinfo);
+ assert(deviceInfo);
/* size of shmem (force-buffers/xq/atom type preloading) */
/* NOTE: with the default kernel on sm3.0 we need shmem only for pre-loading */
/* i-atom x+q in shared memory */
- shmem = c_numClPerSupercl * c_clSize * sizeof(float4);
+ shmem = c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float4);
/* cj in shared memory, for each warp separately */
shmem += num_threads_z * c_nbnxnGpuClusterpairSplit * c_nbnxnGpuJgroupSize * sizeof(int);
if (nbp->vdwtype == evdwCuCUTCOMBGEOM || nbp->vdwtype == evdwCuCUTCOMBLB)
{
/* i-atom LJ combination parameters in shared memory */
- shmem += c_numClPerSupercl * c_clSize * sizeof(float2);
+ shmem += c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float2);
}
else
{
/* i-atom types in shared memory */
- shmem += c_numClPerSupercl * c_clSize * sizeof(int);
+ shmem += c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(int);
}
return shmem;
* the local, this function records the event if called with the local stream as
* argument and inserts in the GPU stream a wait on the event on the nonlocal.
*/
-void nbnxnInsertNonlocalGpuDependency(const gmx_nbnxn_cuda_t* nb, const InteractionLocality interactionLocality)
+void nbnxnInsertNonlocalGpuDependency(const NbnxmGpu* nb, const InteractionLocality interactionLocality)
{
cudaStream_t stream = nb->stream[interactionLocality];
}
/*! \brief Launch asynchronously the xq buffer host to device copy. */
-void gpu_copy_xq_to_gpu(gmx_nbnxn_cuda_t* nb, const nbnxn_atomdata_t* nbatom, const AtomLocality atomLocality)
+void gpu_copy_xq_to_gpu(NbnxmGpu* nb, const nbnxn_atomdata_t* nbatom, const AtomLocality atomLocality)
{
GMX_ASSERT(nb, "Need a valid nbnxn_gpu object");
the local x+q H2D (and all preceding) tasks are complete and synchronize
with this event in the non-local stream before launching the non-bonded kernel.
*/
-void gpu_launch_kernel(gmx_nbnxn_cuda_t* nb, const gmx::StepWorkload& stepWork, const InteractionLocality iloc)
+void gpu_launch_kernel(NbnxmGpu* nb, const gmx::StepWorkload& stepWork, const InteractionLocality iloc)
{
cu_atomdata_t* adat = nb->atdat;
cu_nbparam_t* nbp = nb->nbparam;
* - The 1D block-grid contains as many blocks as super-clusters.
*/
int num_threads_z = 1;
- if (nb->dev_info->prop.major == 3 && nb->dev_info->prop.minor == 7)
+ if (nb->deviceInfo->prop.major == 3 && nb->deviceInfo->prop.minor == 7)
{
num_threads_z = 2;
}
- int nblock = calc_nb_kernel_nblock(plist->nsci, nb->dev_info);
+ int nblock = calc_nb_kernel_nblock(plist->nsci, nb->deviceInfo);
KernelLaunchConfig config;
config.blockSize[1] = c_clSize;
config.blockSize[2] = num_threads_z;
config.gridSize[0] = nblock;
- config.sharedMemorySize = calc_shmem_required_nonbonded(num_threads_z, nb->dev_info, nbp);
+ config.sharedMemorySize = calc_shmem_required_nonbonded(num_threads_z, nb->deviceInfo, nbp);
config.stream = stream;
if (debug)
"\tGrid: %zux%zu\n\t#Super-clusters/clusters: %d/%d (%d)\n"
"\tShMem: %zu\n",
config.blockSize[0], config.blockSize[1], config.blockSize[2], config.gridSize[0],
- config.gridSize[1], plist->nsci * c_numClPerSupercl, c_numClPerSupercl, plist->na_c,
- config.sharedMemorySize);
+ config.gridSize[1], plist->nsci * c_nbnxnGpuNumClusterPerSupercluster,
+ c_nbnxnGpuNumClusterPerSupercluster, plist->na_c, config.sharedMemorySize);
}
auto* timingEvent = bDoTime ? t->interaction[iloc].nb_k.fetchNextEvent() : nullptr;
const auto kernel = select_nbnxn_kernel(
nbp->eeltype, nbp->vdwtype, stepWork.computeEnergy,
- (plist->haveFreshList && !nb->timers->interaction[iloc].didPrune), nb->dev_info);
+ (plist->haveFreshList && !nb->timers->interaction[iloc].didPrune), nb->deviceInfo);
const auto kernelArgs =
prepareGpuKernelArguments(kernel, config, adat, nbp, plist, &stepWork.computeVirial);
launchGpuKernel(kernel, config, timingEvent, "k_calc_nb", kernelArgs);
int shmem;
/* i-atom x in shared memory */
- shmem = c_numClPerSupercl * c_clSize * sizeof(float4);
+ shmem = c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float4);
/* cj in shared memory, for each warp separately */
shmem += num_threads_z * c_nbnxnGpuClusterpairSplit * c_nbnxnGpuJgroupSize * sizeof(int);
return shmem;
}
-void gpu_launch_kernel_pruneonly(gmx_nbnxn_cuda_t* nb, const InteractionLocality iloc, const int numParts)
+void gpu_launch_kernel_pruneonly(NbnxmGpu* nb, const InteractionLocality iloc, const int numParts)
{
cu_atomdata_t* adat = nb->atdat;
cu_nbparam_t* nbp = nb->nbparam;
* - The 1D block-grid contains as many blocks as super-clusters.
*/
int num_threads_z = c_cudaPruneKernelJ4Concurrency;
- int nblock = calc_nb_kernel_nblock(numSciInPart, nb->dev_info);
+ int nblock = calc_nb_kernel_nblock(numSciInPart, nb->deviceInfo);
KernelLaunchConfig config;
config.blockSize[0] = c_clSize;
config.blockSize[1] = c_clSize;
"\tGrid: %zux%zu\n\t#Super-clusters/clusters: %d/%d (%d)\n"
"\tShMem: %zu\n",
config.blockSize[0], config.blockSize[1], config.blockSize[2], config.gridSize[0],
- config.gridSize[1], numSciInPart * c_numClPerSupercl, c_numClPerSupercl,
- plist->na_c, config.sharedMemorySize);
+ config.gridSize[1], numSciInPart * c_nbnxnGpuNumClusterPerSupercluster,
+ c_nbnxnGpuNumClusterPerSupercluster, plist->na_c, config.sharedMemorySize);
}
auto* timingEvent = bDoTime ? timer->fetchNextEvent() : nullptr;
}
}
-void gpu_launch_cpyback(gmx_nbnxn_cuda_t* nb,
+void gpu_launch_cpyback(NbnxmGpu* nb,
nbnxn_atomdata_t* nbatom,
const gmx::StepWorkload& stepWork,
const AtomLocality atomLocality)
/* X buffer operations on GPU: performs conversion from rvec to nb format. */
void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid& grid,
bool setFillerCoords,
- gmx_nbnxn_gpu_t* nb,
- DeviceBuffer<float> d_x,
+ NbnxmGpu* nb,
+ DeviceBuffer<gmx::RVec> d_x,
GpuEventSynchronizer* xReadyOnDevice,
const Nbnxm::AtomLocality locality,
int gridId,
config.sharedMemorySize = 0;
config.stream = stream;
- auto kernelFn = nbnxn_gpu_x_to_nbat_x_kernel;
+ auto kernelFn = setFillerCoords ? nbnxn_gpu_x_to_nbat_x_kernel<true>
+ : nbnxn_gpu_x_to_nbat_x_kernel<false>;
float4* d_xq = adat->xq;
+ float3* d_xFloat3 = asFloat3(d_x);
const int* d_atomIndices = nb->atomIndices;
const int* d_cxy_na = &nb->cxy_na[numColumnsMax * gridId];
const int* d_cxy_ind = &nb->cxy_ind[numColumnsMax * gridId];
- const auto kernelArgs = prepareGpuKernelArguments(
- kernelFn, config, &numColumns, &d_xq, &setFillerCoords, &d_x, &d_atomIndices,
- &d_cxy_na, &d_cxy_ind, &cellOffset, &numAtomsPerCell);
+ const auto kernelArgs = prepareGpuKernelArguments(kernelFn, config, &numColumns, &d_xq,
+ &d_xFloat3, &d_atomIndices, &d_cxy_na,
+ &d_cxy_ind, &cellOffset, &numAtomsPerCell);
launchGpuKernel(kernelFn, config, nullptr, "XbufferOps", kernelArgs);
}
* forces only after Local stream already done so.
*/
void nbnxn_gpu_add_nbat_f_to_f(const AtomLocality atomLocality,
- DeviceBuffer<float> totalForcesDevice,
- gmx_nbnxn_gpu_t* nb,
+ DeviceBuffer<gmx::RVec> totalForcesDevice,
+ NbnxmGpu* nb,
void* pmeForcesDevice,
gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
int atomStart,
}
const float3* d_fNB = adat->f;
- const float3* d_fPme = (float3*)pmeForcesDevice;
- float3* d_fTotal = (float3*)totalForcesDevice;
+ const float3* d_fPme = static_cast<float3*>(pmeForcesDevice);
+ float3* d_fTotal = asFloat3(totalForcesDevice);
const int* d_cell = nb->cell;
const auto kernelArgs = prepareGpuKernelArguments(kernelFn, config, &d_fNB, &d_fPme, &d_fTotal,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdio.h>
#include <stdlib.h>
-// TODO We would like to move this down, but the way gmx_nbnxn_gpu_t
+// TODO We would like to move this down, but the way NbnxmGpu
// is currently declared means this has to be before gpu_types.h
#include "nbnxm_cuda_types.h"
static unsigned int gpu_min_ci_balanced_factor = 44;
/* Fw. decl. */
-static void nbnxn_cuda_clear_e_fshift(gmx_nbnxn_cuda_t* nb);
+static void nbnxn_cuda_clear_e_fshift(NbnxmGpu* nb);
/* Fw. decl, */
static void nbnxn_cuda_free_nbparam_table(cu_nbparam_t* nbparam);
}
/*! Initializes simulation constant data. */
-static void cuda_init_const(gmx_nbnxn_cuda_t* nb,
+static void cuda_init_const(NbnxmGpu* nb,
const interaction_const_t* ic,
const PairlistParams& listParams,
const nbnxn_atomdata_t::Params& nbatParams)
nbnxn_cuda_clear_e_fshift(nb);
}
-gmx_nbnxn_cuda_t* gpu_init(const gmx_device_info_t* deviceInfo,
- const interaction_const_t* ic,
- const PairlistParams& listParams,
- const nbnxn_atomdata_t* nbat,
- int /*rank*/,
- gmx_bool bLocalAndNonlocal)
+NbnxmGpu* gpu_init(const DeviceInformation* deviceInfo,
+ const interaction_const_t* ic,
+ const PairlistParams& listParams,
+ const nbnxn_atomdata_t* nbat,
+ int /*rank*/,
+ bool bLocalAndNonlocal)
{
cudaError_t stat;
- gmx_nbnxn_cuda_t* nb;
- snew(nb, 1);
+ auto nb = new NbnxmGpu;
snew(nb->atdat, 1);
snew(nb->nbparam, 1);
snew(nb->plist[InteractionLocality::Local], 1);
init_plist(nb->plist[InteractionLocality::Local]);
/* set device info, just point it to the right GPU among the detected ones */
- nb->dev_info = deviceInfo;
+ nb->deviceInfo = deviceInfo;
/* local/non-local GPU streams */
stat = cudaStreamCreate(&nb->stream[InteractionLocality::Local]);
return nb;
}
-void gpu_init_pairlist(gmx_nbnxn_cuda_t* nb, const NbnxnPairlistGpu* h_plist, const InteractionLocality iloc)
+void gpu_init_pairlist(NbnxmGpu* nb, const NbnxnPairlistGpu* h_plist, const InteractionLocality iloc)
{
char sbuf[STRLEN];
bool bDoTime = (nb->bDoTime && !h_plist->sci.empty());
d_plist->haveFreshList = true;
}
-void gpu_upload_shiftvec(gmx_nbnxn_cuda_t* nb, const nbnxn_atomdata_t* nbatom)
+void gpu_upload_shiftvec(NbnxmGpu* nb, const nbnxn_atomdata_t* nbatom)
{
cu_atomdata_t* adat = nb->atdat;
cudaStream_t ls = nb->stream[InteractionLocality::Local];
}
/*! Clears the first natoms_clear elements of the GPU nonbonded force output array. */
-static void nbnxn_cuda_clear_f(gmx_nbnxn_cuda_t* nb, int natoms_clear)
+static void nbnxn_cuda_clear_f(NbnxmGpu* nb, int natoms_clear)
{
cudaError_t stat;
cu_atomdata_t* adat = nb->atdat;
}
/*! Clears nonbonded shift force output array and energy outputs on the GPU. */
-static void nbnxn_cuda_clear_e_fshift(gmx_nbnxn_cuda_t* nb)
+static void nbnxn_cuda_clear_e_fshift(NbnxmGpu* nb)
{
cudaError_t stat;
cu_atomdata_t* adat = nb->atdat;
CU_RET_ERR(stat, "cudaMemsetAsync on e_el falied");
}
-void gpu_clear_outputs(gmx_nbnxn_cuda_t* nb, bool computeVirial)
+void gpu_clear_outputs(NbnxmGpu* nb, bool computeVirial)
{
nbnxn_cuda_clear_f(nb, nb->atdat->natoms);
/* clear shift force array and energies if the outputs were
}
}
-void gpu_init_atomdata(gmx_nbnxn_cuda_t* nb, const nbnxn_atomdata_t* nbat)
+void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
{
cudaError_t stat;
int nalloc, natoms;
}
}
-void gpu_free(gmx_nbnxn_cuda_t* nb)
+void gpu_free(NbnxmGpu* nb)
{
cudaError_t stat;
cu_atomdata_t* atdat;
sfree(atdat);
sfree(nbparam);
sfree(nb->timings);
- sfree(nb);
+ delete nb;
if (debug)
{
}
//! This function is documented in the header file
-gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(gmx_nbnxn_cuda_t* nb)
+gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(NbnxmGpu* nb)
{
return (nb != nullptr && nb->bDoTime) ? nb->timings : nullptr;
}
}
}
-int gpu_min_ci_balanced(gmx_nbnxn_cuda_t* nb)
+int gpu_min_ci_balanced(NbnxmGpu* nb)
{
- return nb != nullptr ? gpu_min_ci_balanced_factor * nb->dev_info->prop.multiProcessorCount : 0;
+ return nb != nullptr ? gpu_min_ci_balanced_factor * nb->deviceInfo->prop.multiProcessorCount : 0;
}
-gmx_bool gpu_is_kernel_ewald_analytical(const gmx_nbnxn_cuda_t* nb)
+gmx_bool gpu_is_kernel_ewald_analytical(const NbnxmGpu* nb)
{
return ((nb->nbparam->eeltype == eelCuEWALD_ANA) || (nb->nbparam->eeltype == eelCuEWALD_ANA_TWIN));
}
-void* gpu_get_command_stream(gmx_nbnxn_gpu_t* nb, const InteractionLocality iloc)
+void* gpu_get_command_stream(NbnxmGpu* nb, const InteractionLocality iloc)
{
assert(nb);
return static_cast<void*>(&nb->stream[iloc]);
}
-void* gpu_get_xq(gmx_nbnxn_gpu_t* nb)
+void* gpu_get_xq(NbnxmGpu* nb)
{
assert(nb);
return static_cast<void*>(nb->atdat->xq);
}
-void* gpu_get_f(gmx_nbnxn_gpu_t* nb)
+DeviceBuffer<gmx::RVec> gpu_get_f(NbnxmGpu* nb)
{
assert(nb);
- return static_cast<void*>(nb->atdat->f);
+ return reinterpret_cast<DeviceBuffer<gmx::RVec>>(nb->atdat->f);
}
-rvec* gpu_get_fshift(gmx_nbnxn_gpu_t* nb)
+DeviceBuffer<gmx::RVec> gpu_get_fshift(NbnxmGpu* nb)
{
assert(nb);
- return reinterpret_cast<rvec*>(nb->atdat->fshift);
+ return reinterpret_cast<DeviceBuffer<gmx::RVec>>(nb->atdat->fshift);
}
/* Initialization for X buffer operations on GPU. */
/* TODO Remove explicit pinning from host arrays from here and manage in a more natural way*/
-void nbnxn_gpu_init_x_to_nbat_x(const Nbnxm::GridSet& gridSet, gmx_nbnxn_gpu_t* gpu_nbv)
+void nbnxn_gpu_init_x_to_nbat_x(const Nbnxm::GridSet& gridSet, NbnxmGpu* gpu_nbv)
{
cudaStream_t stream = gpu_nbv->stream[InteractionLocality::Local];
bool bDoTime = gpu_nbv->bDoTime;
/* Initialization for F buffer operations on GPU. */
void nbnxn_gpu_init_add_nbat_f_to_f(const int* cell,
- gmx_nbnxn_gpu_t* gpu_nbv,
+ NbnxmGpu* gpu_nbv,
int natoms_total,
GpuEventSynchronizer* const localReductionDone)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
unsigned int wexcl, imask, mask_ji;
float4 xqbuf;
float3 xi, xj, rv, f_ij, fcj_buf;
- float3 fci_buf[c_numClPerSupercl]; /* i force buffer */
+ float3 fci_buf[c_nbnxnGpuNumClusterPerSupercluster]; /* i force buffer */
nbnxn_sci_t nb_sci;
- /*! i-cluster interaction mask for a super-cluster with all c_numClPerSupercl=8 bits set */
- const unsigned superClInteractionMask = ((1U << c_numClPerSupercl) - 1U);
+ /*! i-cluster interaction mask for a super-cluster with all c_nbnxnGpuNumClusterPerSupercluster=8 bits set */
+ const unsigned superClInteractionMask = ((1U << c_nbnxnGpuNumClusterPerSupercluster) - 1U);
/*********************************************************************
* Set up shared memory pointers.
/* shmem buffer for i x+q pre-loading */
float4* xqib = (float4*)sm_nextSlotPtr;
- sm_nextSlotPtr += (c_numClPerSupercl * c_clSize * sizeof(*xqib));
+ sm_nextSlotPtr += (c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(*xqib));
/* shmem buffer for cj, for each warp separately */
int* cjs = (int*)(sm_nextSlotPtr);
# ifndef LJ_COMB
/* shmem buffer for i atom-type pre-loading */
int* atib = (int*)sm_nextSlotPtr;
- sm_nextSlotPtr += (c_numClPerSupercl * c_clSize * sizeof(*atib));
+ sm_nextSlotPtr += (c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(*atib));
# else
/* shmem buffer for i-atom LJ combination rule parameters */
float2* ljcpib = (float2*)sm_nextSlotPtr;
- sm_nextSlotPtr += (c_numClPerSupercl * c_clSize * sizeof(*ljcpib));
+ sm_nextSlotPtr += (c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(*ljcpib));
# endif
/*********************************************************************/
if (tidxz == 0)
{
/* Pre-load i-atom x and q into shared memory */
- ci = sci * c_numClPerSupercl + tidxj;
+ ci = sci * c_nbnxnGpuNumClusterPerSupercluster + tidxj;
ai = ci * c_clSize + tidxi;
float* shiftptr = (float*)&shift_vec[nb_sci.shift];
}
__syncthreads();
- for (i = 0; i < c_numClPerSupercl; i++)
+ for (i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
fci_buf[i] = make_float3(0.0f);
}
E_el = 0.0f;
# ifdef EXCLUSION_FORCES /* Ewald or RF */
- if (nb_sci.shift == CENTRAL && pl_cj4[cij4_start].cj[0] == sci * c_numClPerSupercl)
+ if (nb_sci.shift == CENTRAL && pl_cj4[cij4_start].cj[0] == sci * c_nbnxnGpuNumClusterPerSupercluster)
{
/* we have the diagonal: add the charge and LJ self interaction energy term */
- for (i = 0; i < c_numClPerSupercl; i++)
+ for (i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
# if defined EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF
qi = xqib[i * c_clSize + tidxi].w;
# ifdef LJ_EWALD
# if DISABLE_CUDA_TEXTURES
- E_lj += LDG(
- &nbparam.nbfp[atom_types[(sci * c_numClPerSupercl + i) * c_clSize + tidxi] * (ntypes + 1) * 2]);
+ E_lj += LDG(&nbparam.nbfp[atom_types[(sci * c_nbnxnGpuNumClusterPerSupercluster + i) * c_clSize + tidxi]
+ * (ntypes + 1) * 2]);
# else
E_lj += tex1Dfetch<float>(
nbparam.nbfp_texobj,
- atom_types[(sci * c_numClPerSupercl + i) * c_clSize + tidxi] * (ntypes + 1) * 2);
+ atom_types[(sci * c_nbnxnGpuNumClusterPerSupercluster + i) * c_clSize + tidxi]
+ * (ntypes + 1) * 2);
# endif
# endif
}
Tested with up to nvcc 7.5 */
for (jm = 0; jm < c_nbnxnGpuJgroupSize; jm++)
{
- if (imask & (superClInteractionMask << (jm * c_numClPerSupercl)))
+ if (imask & (superClInteractionMask << (jm * c_nbnxnGpuNumClusterPerSupercluster)))
{
- mask_ji = (1U << (jm * c_numClPerSupercl));
+ mask_ji = (1U << (jm * c_nbnxnGpuNumClusterPerSupercluster));
cj = cjs[jm + (tidxj & 4) * c_nbnxnGpuJgroupSize / c_splitClSize];
aj = cj * c_clSize + tidxj;
# if !defined PRUNE_NBL
# pragma unroll 8
# endif
- for (i = 0; i < c_numClPerSupercl; i++)
+ for (i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
if (imask & mask_ji)
{
- ci = sci * c_numClPerSupercl + i; /* i cluster index */
+ ci = sci * c_nbnxnGpuNumClusterPerSupercluster + i; /* i cluster index */
/* all threads load an atom from i cluster ci into shmem! */
xqbuf = xqib[i * c_clSize + tidxi];
# endif /* LJ_COMB */
// Ensure distance do not become so small that r^-12 overflows
- r2 = max(r2, NBNXN_MIN_RSQ);
+ r2 = max(r2, c_nbnxnMinDistanceSquared);
inv_r = rsqrt(r2);
inv_r2 = inv_r * inv_r;
float fshift_buf = 0.0f;
/* reduce i forces */
- for (i = 0; i < c_numClPerSupercl; i++)
+ for (i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
- ai = (sci * c_numClPerSupercl + i) * c_clSize + tidxi;
+ ai = (sci * c_nbnxnGpuNumClusterPerSupercluster + i) * c_clSize + tidxi;
reduce_force_i_warp_shfl(fci_buf[i], f, &fshift_buf, bCalcFshift, tidxj, ai, c_fullWarpMask);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* shmem buffer for i x+q pre-loading */
float4* xib = (float4*)sm_nextSlotPtr;
- sm_nextSlotPtr += (c_numClPerSupercl * c_clSize * sizeof(*xib));
+ sm_nextSlotPtr += (c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(*xib));
/* shmem buffer for cj, for each warp separately */
int* cjs = (int*)(sm_nextSlotPtr);
if (tidxz == 0)
{
/* Pre-load i-atom x and q into shared memory */
- int ci = sci * c_numClPerSupercl + tidxj;
+ int ci = sci * c_nbnxnGpuNumClusterPerSupercluster + tidxj;
int ai = ci * c_clSize + tidxi;
/* We don't need q, but using float4 in shmem avoids bank conflicts.
# pragma unroll 4
for (int jm = 0; jm < c_nbnxnGpuJgroupSize; jm++)
{
- if (imaskCheck & (superClInteractionMask << (jm * c_numClPerSupercl)))
+ if (imaskCheck & (superClInteractionMask << (jm * c_nbnxnGpuNumClusterPerSupercluster)))
{
- unsigned int mask_ji = (1U << (jm * c_numClPerSupercl));
+ unsigned int mask_ji = (1U << (jm * c_nbnxnGpuNumClusterPerSupercluster));
int cj = cjs[jm + (tidxj & 4) * c_nbnxnGpuJgroupSize / c_splitClSize];
int aj = cj * c_clSize + tidxj;
float3 xj = make_float3(tmp.x, tmp.y, tmp.z);
# pragma unroll 8
- for (int i = 0; i < c_numClPerSupercl; i++)
+ for (int i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
if (imaskCheck & mask_ji)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static const int __device__ c_splitClSize = c_clSize / c_nbnxnGpuClusterpairSplit;
/*! \brief Stride in the force accumualation buffer */
static const int __device__ c_fbufStride = c_clSizeSq;
-/*! \brief i-cluster interaction mask for a super-cluster with all c_numClPerSupercl=8 bits set */
-static const unsigned __device__ superClInteractionMask = ((1U << c_numClPerSupercl) - 1U);
+/*! \brief i-cluster interaction mask for a super-cluster with all c_nbnxnGpuNumClusterPerSupercluster=8 bits set */
+static const unsigned __device__ superClInteractionMask =
+ ((1U << c_nbnxnGpuNumClusterPerSupercluster) - 1U);
static const float __device__ c_oneSixth = 0.16666667f;
static const float __device__ c_oneTwelveth = 0.08333333f;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2012, The GROMACS development team.
- * Copyright (c) 2013-2019, by the GROMACS development team, led by
+ * Copyright (c) 2013-2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* TODO: consider moving this to kernel_utils */
/* Convenience defines */
-/*! \brief number of clusters per supercluster. */
-static const int c_numClPerSupercl = c_nbnxnGpuNumClusterPerSupercluster;
/*! \brief cluster size = number of atoms per cluster. */
-static const int c_clSize = c_nbnxnGpuClusterSize;
+static constexpr int c_clSize = c_nbnxnGpuClusterSize;
/*! \brief Electrostatic CUDA kernel flavors.
*
/*! \cond */
typedef struct cu_atomdata cu_atomdata_t;
typedef struct cu_nbparam cu_nbparam_t;
-typedef struct nb_staging nb_staging_t;
/*! \endcond */
* The energies/shift forces get downloaded here first, before getting added
* to the CPU-side aggregate values.
*/
-struct nb_staging
+struct nb_staging_t
{
- float* e_lj; /**< LJ energy */
- float* e_el; /**< electrostatic energy */
- float3* fshift; /**< shift forces */
+ //! LJ energy
+ float* e_lj = nullptr;
+ //! electrostatic energy
+ float* e_el = nullptr;
+ //! shift forces
+ float3* fshift = nullptr;
};
/** \internal
*/
struct cu_atomdata
{
- int natoms; /**< number of atoms */
- int natoms_local; /**< number of local atoms */
- int nalloc; /**< allocation size for the atom data (xq, f) */
-
- float4* xq; /**< atom coordinates + charges, size natoms */
- float3* f; /**< force output array, size natoms */
-
- float* e_lj; /**< LJ energy output, size 1 */
- float* e_el; /**< Electrostatics energy input, size 1 */
-
- float3* fshift; /**< shift forces */
-
- int ntypes; /**< number of atom types */
- int* atom_types; /**< atom type indices, size natoms */
- float2* lj_comb; /**< sqrt(c6),sqrt(c12) size natoms */
-
- float3* shift_vec; /**< shifts */
- bool bShiftVecUploaded; /**< true if the shift vector has been uploaded */
+ //! number of atoms
+ int natoms;
+ //! number of local atoms
+ int natoms_local;
+ //! allocation size for the atom data (xq, f)
+ int nalloc;
+
+ //! atom coordinates + charges, size natoms
+ float4* xq;
+ //! force output array, size natoms
+ float3* f;
+
+ //! LJ energy output, size 1
+ float* e_lj;
+ //! Electrostatics energy input, size 1
+ float* e_el;
+
+ //! shift forces
+ float3* fshift;
+
+ //! number of atom types
+ int ntypes;
+ //! atom type indices, size natoms
+ int* atom_types;
+ //! sqrt(c6),sqrt(c12) size natoms
+ float2* lj_comb;
+
+ //! shifts
+ float3* shift_vec;
+ //! true if the shift vector has been uploaded
+ bool bShiftVecUploaded;
};
/** \internal
struct cu_nbparam
{
- int eeltype; /**< type of electrostatics, takes values from #eelCu */
- int vdwtype; /**< type of VdW impl., takes values from #evdwCu */
-
- float epsfac; /**< charge multiplication factor */
- float c_rf; /**< Reaction-field/plain cutoff electrostatics const. */
- float two_k_rf; /**< Reaction-field electrostatics constant */
- float ewald_beta; /**< Ewald/PME parameter */
- float sh_ewald; /**< Ewald/PME correction term substracted from the direct-space potential */
- float sh_lj_ewald; /**< LJ-Ewald/PME correction term added to the correction potential */
- float ewaldcoeff_lj; /**< LJ-Ewald/PME coefficient */
-
- float rcoulomb_sq; /**< Coulomb cut-off squared */
-
- float rvdw_sq; /**< VdW cut-off squared */
- float rvdw_switch; /**< VdW switched cut-off */
- float rlistOuter_sq; /**< Full, outer pair-list cut-off squared */
- float rlistInner_sq; /**< Inner, dynamic pruned pair-list cut-off squared */
- bool useDynamicPruning; /**< True if we use dynamic pair-list pruning */
-
- shift_consts_t dispersion_shift; /**< VdW shift dispersion constants */
- shift_consts_t repulsion_shift; /**< VdW shift repulsion constants */
- switch_consts_t vdw_switch; /**< VdW switch constants */
+ //! type of electrostatics, takes values from #eelCu
+ int eeltype;
+ //! type of VdW impl., takes values from #evdwCu
+ int vdwtype;
+
+ //! charge multiplication factor
+ float epsfac;
+ //! Reaction-field/plain cutoff electrostatics const.
+ float c_rf;
+ //! Reaction-field electrostatics constant
+ float two_k_rf;
+ //! Ewald/PME parameter
+ float ewald_beta;
+ //! Ewald/PME correction term substracted from the direct-space potential
+ float sh_ewald;
+ //! LJ-Ewald/PME correction term added to the correction potential
+ float sh_lj_ewald;
+ //! LJ-Ewald/PME coefficient
+ float ewaldcoeff_lj;
+
+ //! Coulomb cut-off squared
+ float rcoulomb_sq;
+
+ //! VdW cut-off squared
+ float rvdw_sq;
+ //! VdW switched cut-off
+ float rvdw_switch;
+ //! Full, outer pair-list cut-off squared
+ float rlistOuter_sq;
+ //! Inner, dynamic pruned pair-list cut-off squared
+ float rlistInner_sq;
+ //! True if we use dynamic pair-list pruning
+ bool useDynamicPruning;
+
+ //! VdW shift dispersion constants
+ shift_consts_t dispersion_shift;
+ //! VdW shift repulsion constants
+ shift_consts_t repulsion_shift;
+ //! VdW switch constants
+ switch_consts_t vdw_switch;
/* LJ non-bonded parameters - accessed through texture memory */
- float* nbfp; /**< nonbonded parameter table with C6/C12 pairs per atom type-pair, 2*ntype^2 elements */
- cudaTextureObject_t nbfp_texobj; /**< texture object bound to nbfp */
- float* nbfp_comb; /**< nonbonded parameter table per atom type, 2*ntype elements */
- cudaTextureObject_t nbfp_comb_texobj; /**< texture object bound to nbfp_texobj */
+ //! nonbonded parameter table with C6/C12 pairs per atom type-pair, 2*ntype^2 elements
+ float* nbfp;
+ //! texture object bound to nbfp
+ cudaTextureObject_t nbfp_texobj;
+ //! nonbonded parameter table per atom type, 2*ntype elements
+ float* nbfp_comb;
+ //! texture object bound to nbfp_texobj
+ cudaTextureObject_t nbfp_comb_texobj;
/* Ewald Coulomb force table data - accessed through texture memory */
- float coulomb_tab_scale; /**< table scale/spacing */
- float* coulomb_tab; /**< pointer to the table in the device memory */
- cudaTextureObject_t coulomb_tab_texobj; /**< texture object bound to coulomb_tab */
+ //! table scale/spacing
+ float coulomb_tab_scale;
+ //! pointer to the table in the device memory
+ float* coulomb_tab;
+ //! texture object bound to coulomb_tab
+ cudaTextureObject_t coulomb_tab_texobj;
};
/** \internal
class GpuEventSynchronizer;
-/** \internal
+/*! \internal
* \brief Main data structure for CUDA nonbonded force calculations.
*/
-struct gmx_nbnxn_cuda_t
+struct NbnxmGpu
{
- //! CUDA device information
- const gmx_device_info_t* dev_info;
- //! true if doing both local/non-local NB work on GPU
- bool bUseTwoStreams;
- //! atom data
- cu_atomdata_t* atdat;
- //! f buf ops cell index mapping
- int* cell;
- //! number of indices in cell buffer
- int ncell;
- //! number of indices allocated in cell buffer
- int ncell_alloc;
- //! array of atom indices
- int* atomIndices;
- //! size of atom indices
- int atomIndicesSize;
- //! size of atom indices allocated in device buffer
- int atomIndicesSize_alloc;
- //! x buf ops num of atoms
- int* cxy_na;
- //! number of elements in cxy_na
- int ncxy_na;
- //! number of elements allocated allocated in device buffer
- int ncxy_na_alloc;
- //! x buf ops cell index mapping
- int* cxy_ind;
- //! number of elements in cxy_ind
- int ncxy_ind;
- //! number of elements allocated allocated in device buffer
- int ncxy_ind_alloc;
- //! parameters required for the non-bonded calc.
- cu_nbparam_t* nbparam;
- //! pair-list data structures (local and non-local)
- gmx::EnumerationArray<Nbnxm::InteractionLocality, cu_plist_t*> plist;
- //! staging area where fshift/energies get downloaded
+ /*! \brief CUDA device information */
+ const DeviceInformation* deviceInfo = nullptr;
+ /*! \brief true if doing both local/non-local NB work on GPU */
+ bool bUseTwoStreams = false;
+ /*! \brief atom data */
+ cu_atomdata_t* atdat = nullptr;
+ /*! \brief f buf ops cell index mapping */
+ int* cell = nullptr;
+ /*! \brief number of indices in cell buffer */
+ int ncell = 0;
+ /*! \brief number of indices allocated in cell buffer */
+ int ncell_alloc = 0;
+ /*! \brief array of atom indices */
+ int* atomIndices = nullptr;
+ /*! \brief size of atom indices */
+ int atomIndicesSize = 0;
+ /*! \brief size of atom indices allocated in device buffer */
+ int atomIndicesSize_alloc = 0;
+ /*! \brief x buf ops num of atoms */
+ int* cxy_na = nullptr;
+ /*! \brief number of elements in cxy_na */
+ int ncxy_na = 0;
+ /*! \brief number of elements allocated allocated in device buffer */
+ int ncxy_na_alloc = 0;
+ /*! \brief x buf ops cell index mapping */
+ int* cxy_ind = nullptr;
+ /*! \brief number of elements in cxy_ind */
+ int ncxy_ind = 0;
+ /*! \brief number of elements allocated allocated in device buffer */
+ int ncxy_ind_alloc = 0;
+ /*! \brief parameters required for the non-bonded calc. */
+ cu_nbparam_t* nbparam = nullptr;
+ /*! \brief pair-list data structures (local and non-local) */
+ gmx::EnumerationArray<Nbnxm::InteractionLocality, cu_plist_t*> plist = { { nullptr } };
+ /*! \brief staging area where fshift/energies get downloaded */
nb_staging_t nbst;
- //! local and non-local GPU streams
- gmx::EnumerationArray<Nbnxm::InteractionLocality, cudaStream_t> stream;
-
- /** events used for synchronization */
- cudaEvent_t nonlocal_done; /**< event triggered when the non-local non-bonded kernel
- is done (and the local transfer can proceed) */
- cudaEvent_t misc_ops_and_local_H2D_done; /**< event triggered when the tasks issued in
- the local stream that need to precede the
- non-local force or buffer operation calculations are
- done (e.g. f buffer 0-ing, local x/q H2D, buffer op
- initialization in local stream that is required also
- by nonlocal stream ) */
-
- //! True if there has been local/nonlocal GPU work, either bonded or nonbonded, scheduled
- // to be executed in the current domain. As long as bonded work is not split up into
- // local/nonlocal, if there is bonded GPU work, both flags will be true.
- gmx::EnumerationArray<Nbnxm::InteractionLocality, bool> haveWork;
-
- /*! \brief Pointer to event synchronizer triggered when the local GPU buffer ops / reduction is complete
+ /*! \brief local and non-local GPU streams */
+ gmx::EnumerationArray<Nbnxm::InteractionLocality, cudaStream_t> stream = { { nullptr } };
+
+ /*! \brief Events used for synchronization */
+ /*! \{ */
+ /*! \brief Event triggered when the non-local non-bonded
+ * kernel is done (and the local transfer can proceed) */
+ cudaEvent_t nonlocal_done = nullptr;
+ /*! \brief Event triggered when the tasks issued in the local
+ * stream that need to precede the non-local force or buffer
+ * operation calculations are done (e.g. f buffer 0-ing, local
+ * x/q H2D, buffer op initialization in local stream that is
+ * required also by nonlocal stream ) */
+ cudaEvent_t misc_ops_and_local_H2D_done = nullptr;
+ /*! \} */
+
+ /*! \brief True if there is work for the current domain in the
+ * respective locality.
+ *
+ * This includes local/nonlocal GPU work, either bonded or
+ * nonbonded, scheduled to be executed in the current
+ * domain. As long as bonded work is not split up into
+ * local/nonlocal, if there is bonded GPU work, both flags
+ * will be true. */
+ gmx::EnumerationArray<Nbnxm::InteractionLocality, bool> haveWork = { { false } };
+
+ /*! \brief Pointer to event synchronizer triggered when the local
+ * GPU buffer ops / reduction is complete
*
- * \note That the synchronizer is managed outside of this module in StatePropagatorDataGpu.
+ * \note That the synchronizer is managed outside of this module
+ * in StatePropagatorDataGpu.
*/
- GpuEventSynchronizer* localFReductionDone;
+ GpuEventSynchronizer* localFReductionDone = nullptr;
- GpuEventSynchronizer* xNonLocalCopyD2HDone; /**< event triggered when
- non-local coordinate buffer has been
- copied from device to host*/
+ /*! \brief Event triggered when non-local coordinate buffer
+ * has been copied from device to host. */
+ GpuEventSynchronizer* xNonLocalCopyD2HDone = nullptr;
/* NOTE: With current CUDA versions (<=5.0) timing doesn't work with multiple
* concurrent streams, so we won't time if both l/nl work is done on GPUs.
* Timer init/uninit is still done even with timing off so only the condition
* setting bDoTime needs to be change if this CUDA "feature" gets fixed. */
- //! True if event-based timing is enabled.
- bool bDoTime;
- //! CUDA event-based timers.
- cu_timers_t* timers;
- //! Timing data. TODO: deprecate this and query timers for accumulated data instead
- gmx_wallclock_gpu_nbnxn_t* timings;
+ /*! \brief True if event-based timing is enabled. */
+ bool bDoTime = false;
+ /*! \brief CUDA event-based timers. */
+ cu_timers_t* timers = nullptr;
+ /*! \brief Timing data. TODO: deprecate this and query timers for accumulated data instead */
+ gmx_wallclock_gpu_nbnxn_t* timings = nullptr;
};
#endif /* NBNXN_CUDA_TYPES_H */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//NOLINTNEXTLINE(misc-definitions-in-headers)
-void setupGpuShortRangeWork(gmx_nbnxn_gpu_t* nb,
- const gmx::GpuBonded* gpuBonded,
- const gmx::InteractionLocality iLocality)
+void setupGpuShortRangeWork(NbnxmGpu* nb, const gmx::GpuBonded* gpuBonded, const gmx::InteractionLocality iLocality)
{
GMX_ASSERT(nb, "Need a valid nbnxn_gpu object");
* \param[inout] nb Pointer to the nonbonded GPU data structure
* \param[in] iLocality Interaction locality identifier
*/
-static bool haveGpuShortRangeWork(const gmx_nbnxn_gpu_t& nb, const gmx::InteractionLocality iLocality)
+static bool haveGpuShortRangeWork(const NbnxmGpu& nb, const gmx::InteractionLocality iLocality)
{
return nb.haveWork[iLocality];
}
//NOLINTNEXTLINE(misc-definitions-in-headers)
-bool haveGpuShortRangeWork(const gmx_nbnxn_gpu_t* nb, const gmx::AtomLocality aLocality)
+bool haveGpuShortRangeWork(const NbnxmGpu* nb, const gmx::AtomLocality aLocality)
{
GMX_ASSERT(nb, "Need a valid nbnxn_gpu object");
* \todo Move into shared source file with gmx_compile_cpp_as_cuda
*/
//NOLINTNEXTLINE(misc-definitions-in-headers)
-bool gpu_try_finish_task(gmx_nbnxn_gpu_t* nb,
+bool gpu_try_finish_task(NbnxmGpu* nb,
const gmx::StepWorkload& stepWork,
const AtomLocality aloc,
real* e_lj,
// TODO: this needs to be moved later because conditional wait could brake timing
// with a future OpenCL implementation, but with CUDA timing is anyway disabled
// in all cases where we skip the wait.
- gpu_accumulate_timings(nb->timings, nb->timers, nb->plist[iLocality], aloc, stepWork,
- nb->bDoTime != 0);
+ gpu_accumulate_timings(nb->timings, nb->timers, nb->plist[iLocality], aloc, stepWork, nb->bDoTime);
if (stepWork.computeEnergy || stepWork.computeVirial)
{
* \return The number of cycles the gpu wait took
*/
//NOLINTNEXTLINE(misc-definitions-in-headers) TODO: move into source file
-float gpu_wait_finish_task(gmx_nbnxn_gpu_t* nb,
+float gpu_wait_finish_task(NbnxmGpu* nb,
const gmx::StepWorkload& stepWork,
AtomLocality aloc,
real* e_lj,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* local part of the force array also depends on the non-local kernel.
* The skip of the local kernel is taken care of separately.
*/
-static inline bool canSkipNonbondedWork(const gmx_nbnxn_gpu_t& nb, InteractionLocality iloc)
+static inline bool canSkipNonbondedWork(const NbnxmGpu& nb, InteractionLocality iloc)
{
assert(nb.plist[iloc]);
return (iloc == InteractionLocality::NonLocal && nb.plist[iloc]->nsci == 0);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
+#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/gpu_utils/gpu_macros.h"
-#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/locality.h"
-#include "gpu_types.h"
-
-struct NbnxnPairlistGpu;
+struct NbnxmGpu;
+struct gmx_gpu_info_t;
+struct DeviceInformation;
+struct gmx_wallclock_gpu_nbnxn_t;
struct nbnxn_atomdata_t;
+struct NbnxnPairlistGpu;
struct PairlistParams;
-struct gmx_wallclock_gpu_nbnxn_t;
-struct gmx_gpu_info_t;
-struct gmx_device_info_t;
+struct interaction_const_t;
namespace Nbnxm
{
/** Initializes the data structures related to GPU nonbonded calculations. */
GPU_FUNC_QUALIFIER
-gmx_nbnxn_gpu_t* gpu_init(const gmx_device_info_t gmx_unused* deviceInfo,
- const interaction_const_t gmx_unused* ic,
- const PairlistParams gmx_unused& listParams,
- const nbnxn_atomdata_t gmx_unused* nbat,
- int gmx_unused rank,
- /* true if both local and non-local are done on GPU */
- gmx_bool gmx_unused bLocalAndNonlocal) GPU_FUNC_TERM_WITH_RETURN(nullptr);
+NbnxmGpu* gpu_init(const DeviceInformation gmx_unused* deviceInfo,
+ const interaction_const_t gmx_unused* ic,
+ const PairlistParams gmx_unused& listParams,
+ const nbnxn_atomdata_t gmx_unused* nbat,
+ int gmx_unused rank,
+ /* true if both local and non-local are done on GPU */
+ bool gmx_unused bLocalAndNonlocal) GPU_FUNC_TERM_WITH_RETURN(nullptr);
/** Initializes pair-list data for GPU, called at every pair search step. */
GPU_FUNC_QUALIFIER
-void gpu_init_pairlist(gmx_nbnxn_gpu_t gmx_unused* nb,
+void gpu_init_pairlist(NbnxmGpu gmx_unused* nb,
const struct NbnxnPairlistGpu gmx_unused* h_nblist,
gmx::InteractionLocality gmx_unused iloc) GPU_FUNC_TERM;
/** Initializes atom-data on the GPU, called at every pair search step. */
GPU_FUNC_QUALIFIER
-void gpu_init_atomdata(gmx_nbnxn_gpu_t gmx_unused* nb, const nbnxn_atomdata_t gmx_unused* nbat) GPU_FUNC_TERM;
+void gpu_init_atomdata(NbnxmGpu gmx_unused* nb, const nbnxn_atomdata_t gmx_unused* nbat) GPU_FUNC_TERM;
/*! \brief Re-generate the GPU Ewald force table, resets rlist, and update the
* electrostatic type switching to twin cut-off (or back) if needed.
/** Uploads shift vector to the GPU if the box is dynamic (otherwise just returns). */
GPU_FUNC_QUALIFIER
-void gpu_upload_shiftvec(gmx_nbnxn_gpu_t gmx_unused* nb, const nbnxn_atomdata_t gmx_unused* nbatom) GPU_FUNC_TERM;
+void gpu_upload_shiftvec(NbnxmGpu gmx_unused* nb, const nbnxn_atomdata_t gmx_unused* nbatom) GPU_FUNC_TERM;
/** Clears GPU outputs: nonbonded force, shift force and energy. */
GPU_FUNC_QUALIFIER
-void gpu_clear_outputs(gmx_nbnxn_gpu_t gmx_unused* nb, bool gmx_unused computeVirial) GPU_FUNC_TERM;
+void gpu_clear_outputs(NbnxmGpu gmx_unused* nb, bool gmx_unused computeVirial) GPU_FUNC_TERM;
/** Frees all GPU resources used for the nonbonded calculations. */
GPU_FUNC_QUALIFIER
-void gpu_free(gmx_nbnxn_gpu_t gmx_unused* nb) GPU_FUNC_TERM;
+void gpu_free(NbnxmGpu gmx_unused* nb) GPU_FUNC_TERM;
/** Returns the GPU timings structure or NULL if GPU is not used or timing is off. */
GPU_FUNC_QUALIFIER
-struct gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(gmx_nbnxn_gpu_t gmx_unused* nb)
+struct gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(NbnxmGpu gmx_unused* nb)
GPU_FUNC_TERM_WITH_RETURN(nullptr);
/** Resets nonbonded GPU timings. */
/** Calculates the minimum size of proximity lists to improve SM load balance
* with GPU non-bonded kernels. */
GPU_FUNC_QUALIFIER
-int gpu_min_ci_balanced(gmx_nbnxn_gpu_t gmx_unused* nb) GPU_FUNC_TERM_WITH_RETURN(-1);
+int gpu_min_ci_balanced(NbnxmGpu gmx_unused* nb) GPU_FUNC_TERM_WITH_RETURN(-1);
/** Returns if analytical Ewald GPU kernels are used. */
GPU_FUNC_QUALIFIER
-gmx_bool gpu_is_kernel_ewald_analytical(const gmx_nbnxn_gpu_t gmx_unused* nb)
- GPU_FUNC_TERM_WITH_RETURN(FALSE);
+gmx_bool gpu_is_kernel_ewald_analytical(const NbnxmGpu gmx_unused* nb) GPU_FUNC_TERM_WITH_RETURN(FALSE);
/** Returns an opaque pointer to the GPU command stream
* Note: CUDA only.
*/
CUDA_FUNC_QUALIFIER
-void* gpu_get_command_stream(gmx_nbnxn_gpu_t gmx_unused* nb, gmx::InteractionLocality gmx_unused iloc)
+void* gpu_get_command_stream(NbnxmGpu gmx_unused* nb, gmx::InteractionLocality gmx_unused iloc)
CUDA_FUNC_TERM_WITH_RETURN(nullptr);
/** Returns an opaque pointer to the GPU coordinate+charge array
* Note: CUDA only.
*/
CUDA_FUNC_QUALIFIER
-void* gpu_get_xq(gmx_nbnxn_gpu_t gmx_unused* nb) CUDA_FUNC_TERM_WITH_RETURN(nullptr);
+void* gpu_get_xq(NbnxmGpu gmx_unused* nb) CUDA_FUNC_TERM_WITH_RETURN(nullptr);
/** Returns an opaque pointer to the GPU force array
* Note: CUDA only.
*/
CUDA_FUNC_QUALIFIER
-void* gpu_get_f(gmx_nbnxn_gpu_t gmx_unused* nb) CUDA_FUNC_TERM_WITH_RETURN(nullptr);
+DeviceBuffer<gmx::RVec> gpu_get_f(NbnxmGpu gmx_unused* nb)
+ CUDA_FUNC_TERM_WITH_RETURN(DeviceBuffer<gmx::RVec>{});
/** Returns an opaque pointer to the GPU shift force array
* Note: CUDA only.
*/
CUDA_FUNC_QUALIFIER
-rvec* gpu_get_fshift(gmx_nbnxn_gpu_t gmx_unused* nb) CUDA_FUNC_TERM_WITH_RETURN(nullptr);
+DeviceBuffer<gmx::RVec> gpu_get_fshift(NbnxmGpu gmx_unused* nb)
+ CUDA_FUNC_TERM_WITH_RETURN(DeviceBuffer<gmx::RVec>{});
} // namespace Nbnxm
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/basedefinitions.h"
-#include "gpu_types.h"
+struct NbnxmGpu;
/*! \brief Handles any JIT compilation of nbnxn kernels for the selected device */
-OPENCL_FUNC_QUALIFIER void nbnxn_gpu_compile_kernels(gmx_nbnxn_gpu_t gmx_unused* nb) OPENCL_FUNC_TERM;
+OPENCL_FUNC_QUALIFIER void nbnxn_gpu_compile_kernels(NbnxmGpu gmx_unused* nb) OPENCL_FUNC_TERM;
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
struct XFTransfers
{
- GpuRegionTimer nb_h2d; /**< timer for x/q H2D transfers (l/nl, every step) */
- GpuRegionTimer nb_d2h; /**< timer for f D2H transfer (l/nl, every step) */
+ //! timer for x/q H2D transfers (l/nl, every step)
+ GpuRegionTimer nb_h2d;
+ //! timer for f D2H transfer (l/nl, every step)
+ GpuRegionTimer nb_d2h;
};
/*! \internal
*/
struct Interaction
{
- GpuRegionTimer pl_h2d; /**< timer for pair-list H2D transfers (l/nl, every PS step) */
- bool didPairlistH2D = false; /**< true when a pair-list transfer has been done at this step */
- GpuRegionTimer nb_k; /**< timer for non-bonded kernels (l/nl, every step) */
- GpuRegionTimer prune_k; /**< timer for the 1st pass list pruning kernel (l/nl, every PS step) */
- bool didPrune = false; /**< true when we timed pruning and the timings need to be accounted for */
- GpuRegionTimer rollingPrune_k; /**< timer for rolling pruning kernels (l/nl, frequency depends on chunk size) */
- bool didRollingPrune =
- false; /**< true when we timed rolling pruning (at the previous step) and the timings need to be accounted for */
+ //! timer for pair-list H2D transfers (l/nl, every PS step)
+ GpuRegionTimer pl_h2d;
+ //! true when a pair-list transfer has been done at this step
+ bool didPairlistH2D = false;
+ //! timer for non-bonded kernels (l/nl, every step)
+ GpuRegionTimer nb_k;
+ //! timer for the 1st pass list pruning kernel (l/nl, every PS step)
+ GpuRegionTimer prune_k;
+ //! true when we timed pruning and the timings need to be accounted for
+ bool didPrune = false;
+ //! timer for rolling pruning kernels (l/nl, frequency depends on chunk size)
+ GpuRegionTimer rollingPrune_k;
+ //! true when we timed rolling pruning (at the previous step) and the timings need to be accounted for
+ bool didRollingPrune = false;
};
//! timer for atom data transfer (every PS step)
gmx::EnumerationArray<InteractionLocality, Nbnxm::gpu_timers_t::Interaction> interaction;
};
+/*! \internal
+ * \brief GPU pair list structure */
struct gpu_plist
{
- int na_c; /**< number of atoms per cluster */
-
- int nsci; /**< size of sci, # of i clusters in the list */
- int sci_nalloc; /**< allocation size of sci */
- DeviceBuffer<nbnxn_sci_t> sci; /**< list of i-cluster ("super-clusters") */
-
- int ncj4; /**< total # of 4*j clusters */
- int cj4_nalloc; /**< allocation size of cj4 */
- DeviceBuffer<nbnxn_cj4_t> cj4; /**< 4*j cluster list, contains j cluster number
- and index into the i cluster list */
- int nimask; /**< # of 4*j clusters * # of warps */
- int imask_nalloc; /**< allocation size of imask */
- DeviceBuffer<unsigned int> imask; /**< imask for 2 warps for each 4*j cluster group */
- DeviceBuffer<nbnxn_excl_t> excl; /**< atom interaction bits */
- int nexcl; /**< count for excl */
- int excl_nalloc; /**< allocation size of excl */
+ //! number of atoms per cluster
+ int na_c;
+
+ //! size of sci, # of i clusters in the list
+ int nsci;
+ //! allocation size of sci
+ int sci_nalloc;
+ //! list of i-cluster ("super-clusters")
+ DeviceBuffer<nbnxn_sci_t> sci;
+
+ //! total # of 4*j clusters
+ int ncj4;
+ //! allocation size of cj4
+ int cj4_nalloc;
+ //! 4*j cluster list, contains j cluster number and index into the i cluster list
+ DeviceBuffer<nbnxn_cj4_t> cj4;
+ //! # of 4*j clusters * # of warps
+ int nimask;
+ //! allocation size of imask
+ int imask_nalloc;
+ //! imask for 2 warps for each 4*j cluster group
+ DeviceBuffer<unsigned int> imask;
+ //! atom interaction bits
+ DeviceBuffer<nbnxn_excl_t> excl;
+ //! count for excl
+ int nexcl;
+ //! allocation size of excl
+ int excl_nalloc;
/* parameter+variables for normal and rolling pruning */
- bool haveFreshList; /**< true after search, indictes that initial pruning with outer prunning is needed */
- int rollingPruningNumParts; /**< the number of parts/steps over which one cyle of roling pruning takes places */
- int rollingPruningPart; /**< the next part to which the roling pruning needs to be applied */
+ //! true after search, indictes that initial pruning with outer prunning is needed
+ bool haveFreshList;
+ //! the number of parts/steps over which one cyle of roling pruning takes places
+ int rollingPruningNumParts;
+ //! the next part to which the roling pruning needs to be applied
+ int rollingPruningPart;
};
} // namespace Nbnxm
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/updategroupscog.h"
#include "gromacs/mdtypes/forcerec.h" // only for GET_CGINFO_*
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/simd/simd.h"
#include "gromacs/simd/vector_operations.h"
-#include "atomdata.h"
#include "boundingboxes.h"
#include "gridsetdata.h"
#include "nbnxm_geometry.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Returns a pointer for SIMD storing of a Corner object
float* ptr() { return &x; }
- float x; //!< x coordinate
- float y; //!< y coordinate
- float z; //!< z coordinate
- float padding; //!< padding, unused, but should be set to avoid operations on unitialized data
+ //! x coordinate
+ float x;
+ //! y coordinate
+ float y;
+ //! z coordinate
+ float z;
+ //! padding, unused, but should be set to avoid operations on unitialized data
+ float padding;
};
- Corner lower; //!< lower, along x and y and z, corner
- Corner upper; //!< upper, along x and y and z, corner
+ //! lower, along x and y and z, corner
+ Corner lower;
+ //! upper, along x and y and z, corner
+ Corner upper;
};
/*! \internal
*/
struct BoundingBox1D
{
- float lower; //!< lower bound
- float upper; //!< upper bound
+ //! lower bound
+ float lower;
+ //! upper bound
+ float upper;
};
} // namespace Nbnxm
//! Constructs the cluster/cell geometry given the type of pairlist
Geometry(PairlistType pairlistType);
- bool isSimple; //!< Is this grid simple (CPU) or hierarchical (GPU)
- int numAtomsICluster; //!< Number of atoms per cluster
- int numAtomsJCluster; //!< Number of atoms for list j-clusters
- int numAtomsPerCell; //!< Number of atoms per cell
- int numAtomsICluster2Log; //!< 2log of na_c
+ //! Is this grid simple (CPU) or hierarchical (GPU)
+ bool isSimple;
+ //! Number of atoms per cluster
+ int numAtomsICluster;
+ //! Number of atoms for list j-clusters
+ int numAtomsJCluster;
+ //! Number of atoms per cell
+ int numAtomsPerCell;
+ //! 2log of na_c
+ int numAtomsICluster2Log;
};
- // The physical dimensions of a grid
+ //! The physical dimensions of a grid \internal
struct Dimensions
{
//! The lower corner of the (local) grid
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/updategroupscog.h"
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/utility/fatalerror.h"
-#include "atomdata.h"
-
namespace Nbnxm
{
return numGrids;
}
-GridSet::DomainSetup::DomainSetup(const int ePBC,
+GridSet::DomainSetup::DomainSetup(const PbcType pbcType,
const bool doTestParticleInsertion,
const ivec* numDDCells,
const gmx_domdec_zones_t* ddZones) :
- ePBC(ePBC),
+ pbcType(pbcType),
doTestParticleInsertion(doTestParticleInsertion),
haveMultipleDomains(numDDCells != nullptr),
zones(ddZones)
}
}
-GridSet::GridSet(const int ePBC,
+GridSet::GridSet(const PbcType pbcType,
const bool doTestParticleInsertion,
const ivec* numDDCells,
const gmx_domdec_zones_t* ddZones,
const bool haveFep,
const int numThreads,
gmx::PinningPolicy pinningPolicy) :
- domainSetup_(ePBC, doTestParticleInsertion, numDDCells, ddZones),
+ domainSetup_(pbcType, doTestParticleInsertion, numDDCells, ddZones),
grids_(numGrids(domainSetup_), Grid(pairlistType, haveFep_)),
haveFep_(haveFep),
numRealAtomsLocal_(0),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct nbnxn_atomdata_t;
enum class PairlistType;
+enum class PbcType : int;
namespace gmx
{
struct DomainSetup
{
//! Constructor, without DD \p numDDCells and \p ddZones should be nullptr
- DomainSetup(int ePBC,
+ DomainSetup(PbcType pbcType,
bool doTestParticleInsertion,
const ivec* numDDCells,
const gmx_domdec_zones_t* ddZones);
//! The type of PBC
- int ePBC;
+ PbcType pbcType;
//! Tells whether we are doing test-particle insertion
bool doTestParticleInsertion;
//! Are there multiple domains?
};
//! Constructs a grid set for 1 or multiple DD zones, when numDDCells!=nullptr
- GridSet(int ePBC,
+ GridSet(PbcType pbcType,
bool doTestParticleInsertion,
const ivec* numDDCells,
const gmx_domdec_zones_t* ddZones,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
+#include "gromacs/gpu_utils/hostallocator.h"
namespace Nbnxm
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/vectypes.h"
/* nbnxn_atomdata_t and nbnxn_pairlist_t could be forward declared, but that requires modifications in all SIMD kernel files */
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/utility/real.h"
-#include "atomdata.h"
#include "pairlist.h"
struct interaction_const_t;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/forceoutput.h"
+#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/utility/real.h"
#include "kernel_common.h"
+#include "nbnxm_gpu.h"
#include "nbnxm_simd.h"
#include "pairlistset.h"
#include "pairlistsets.h"
kernel_data.flags = (donb_flags & ~(GMX_NONBONDED_DO_FORCE | GMX_NONBONDED_DO_SHIFTFORCE))
| GMX_NONBONDED_DO_FOREIGNLAMBDA;
kernel_data.lambda = lam_i;
+ kernel_data.dvdl = dvdl_nb;
kernel_data.energygrp_elec = enerd->foreign_grpp.ener[egCOULSR].data();
kernel_data.energygrp_vdw = enerd->foreign_grpp.ener[egLJSR].data();
- /* Note that we add to kernel_data.dvdl, but ignore the result */
for (size_t i = 0; i < enerd->enerpart_lambda.size(); i++)
{
+ std::fill(std::begin(dvdl_nb), std::end(dvdl_nb), 0);
for (int j = 0; j < efptNR; j++)
{
lam_i[j] = (i == 0 ? lambda[j] : fepvals->all_lambda[j][i - 1]);
sum_epot(&(enerd->foreign_grpp), enerd->foreign_term);
enerd->enerpart_lambda[i] += enerd->foreign_term[F_EPOT];
+ enerd->dhdlLambda[i] += dvdl_nb[efptVDW] + dvdl_nb[efptCOUL];
+ }
+ }
+ else
+ {
+ for (size_t i = 0; i < enerd->enerpart_lambda.size(); i++)
+ {
+ enerd->dhdlLambda[i] += dvdl_nb[efptVDW] + dvdl_nb[efptCOUL];
}
}
wallcycle_sub_stop(wcycle_, ewcsNONBONDED_FEP);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/functions.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/utility/fatalerror.h"
-static const int c_numClPerSupercl = c_nbnxnGpuNumClusterPerSupercluster;
-static const int c_clSize = c_nbnxnGpuClusterSize;
+static constexpr int c_clSize = c_nbnxnGpuClusterSize;
void nbnxn_kernel_gpu_ref(const NbnxnPairlistGpu* nbl,
const nbnxn_atomdata_t* nbat,
vctot = 0;
Vvdwtot = 0;
- if (nbln.shift == CENTRAL && nbl->cj4[cj4_ind0].cj[0] == sci * c_numClPerSupercl)
+ if (nbln.shift == CENTRAL && nbl->cj4[cj4_ind0].cj[0] == sci * c_nbnxnGpuNumClusterPerSupercluster)
{
/* we have the diagonal:
* add the charge self interaction energy term
*/
- for (im = 0; im < c_numClPerSupercl; im++)
+ for (im = 0; im < c_nbnxnGpuNumClusterPerSupercluster; im++)
{
- ci = sci * c_numClPerSupercl + im;
+ ci = sci * c_nbnxnGpuNumClusterPerSupercluster + im;
for (ic = 0; ic < c_clSize; ic++)
{
ia = ci * c_clSize + ic;
{
cj = nbl->cj4[cj4_ind].cj[jm];
- for (im = 0; im < c_numClPerSupercl; im++)
+ for (im = 0; im < c_nbnxnGpuNumClusterPerSupercluster; im++)
{
/* We're only using the first imask,
* but here imei[1].imask is identical.
*/
- if ((nbl->cj4[cj4_ind].imei[0].imask >> (jm * c_numClPerSupercl + im)) & 1)
+ if ((nbl->cj4[cj4_ind].imei[0].imask >> (jm * c_nbnxnGpuNumClusterPerSupercluster + im))
+ & 1)
{
gmx_bool within_rlist;
- ci = sci * c_numClPerSupercl + im;
+ ci = sci * c_nbnxnGpuNumClusterPerSupercluster + im;
within_rlist = FALSE;
npair = 0;
c_nbnxnGpuClusterSize / c_nbnxnGpuClusterpairSplit;
int_bit = static_cast<real>(
(excl[jc / clusterPerSplit]->pair[(jc & (clusterPerSplit - 1)) * c_clSize + ic]
- >> (jm * c_numClPerSupercl + im))
+ >> (jm * c_nbnxnGpuNumClusterPerSupercluster + im))
& 1);
js = ja * nbat->xstride;
}
// Ensure distance do not become so small that r^-12 overflows
- rsq = std::max(rsq, NBNXN_MIN_RSQ);
+ rsq = std::max(rsq, c_nbnxnMinDistanceSquared);
rinv = gmx::invsqrt(rsq);
rinvsq = rinv * rinv;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ *
+ * \brief
+ * Declares GPU reference kernel
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
-#ifndef _nbnxn_kernel_gpu_ref_h
-#define _nbnxn_kernel_gpu_ref_h
+#ifndef GMX_NBNXM_KERNELS_REFERENCE_KERNEL_GPU_REF_H
+#define GMX_NBNXM_KERNELS_REFERENCE_KERNEL_GPU_REF_H
#include "gromacs/math/vectypes.h"
-#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/real.h"
struct NbnxnPairlistGpu;
struct nbnxn_atomdata_t;
+struct interaction_const_t;
+struct t_forcerec;
namespace gmx
{
class StepWorkload;
}
-/* Reference (slow) kernel for nb n vs n GPU type pair lists */
+//! Reference (slow) kernel for nb n vs n GPU type pair lists
void nbnxn_kernel_gpu_ref(const NbnxnPairlistGpu* nbl,
const nbnxn_atomdata_t* nbat,
const interaction_const_t* iconst,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 The GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ *
+ * \brief
+ * Declares CPU reference kernels
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
+#ifndef GMX_NBNXM_KERNELS_REFERENCE_KERNEL_REF_H
+#define GMX_NBNXM_KERNELS_REFERENCE_KERNEL_REF_H
#include "gromacs/nbnxm/kernel_common.h"
-/* Declare all the different kernel functions.
- */
+//! All the different CPU reference kernel functions.
+//! \{
nbk_func_noener nbnxn_kernel_ElecRF_VdwLJ_F_ref;
nbk_func_noener nbnxn_kernel_ElecRF_VdwLJFsw_F_ref;
nbk_func_noener nbnxn_kernel_ElecRF_VdwLJPsw_F_ref;
nbk_func_ener nbnxn_kernel_ElecQSTabTwinCut_VdwLJPsw_VgrpF_ref;
nbk_func_ener nbnxn_kernel_ElecQSTabTwinCut_VdwLJEwCombGeom_VgrpF_ref;
nbk_func_ener nbnxn_kernel_ElecQSTabTwinCut_VdwLJEwCombLB_VgrpF_ref;
+//! \}
#ifdef INCLUDE_KERNELFUNCTION_TABLES
-/* Declare and define the kernel function pointer lookup tables.
+/*! \brief Declare and define the kernel function pointer lookup tables.
+ *
* The minor index of the array goes over both the LJ combination rules,
* which is only supported by plain cut-off, and the LJ switch/PME functions.
* For the C reference kernels, unlike the SIMD kernels, there is not much
* advantage in using combination rules, so we (re-)use the same kernel.
*/
+//! \{
static p_nbk_func_noener nbnxn_kernel_noener_ref[coulktNR][vdwktNR_ref] = {
{ nbnxn_kernel_ElecRF_VdwLJ_F_ref, nbnxn_kernel_ElecRF_VdwLJ_F_ref, nbnxn_kernel_ElecRF_VdwLJ_F_ref,
nbnxn_kernel_ElecRF_VdwLJFsw_F_ref, nbnxn_kernel_ElecRF_VdwLJPsw_F_ref,
nbnxn_kernel_ElecQSTabTwinCut_VdwLJPsw_VgrpF_ref, nbnxn_kernel_ElecQSTabTwinCut_VdwLJEwCombGeom_VgrpF_ref,
nbnxn_kernel_ElecQSTabTwinCut_VdwLJEwCombLB_VgrpF_ref }
};
+//! \}
#endif /* INCLUDE_KERNELFUNCTION_TABLES */
+
+#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// Ensure the distances do not fall below the limit where r^-12 overflows.
// This should never happen for normal interactions.
- rsq = std::max(rsq, NBNXN_MIN_RSQ);
+ rsq = std::max(rsq, c_nbnxnMinDistanceSquared);
#ifdef COUNT_PAIRS
npair++;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#endif
#ifdef LJ_EWALD_GEOM
real lj_ewaldcoeff2, lj_ewaldcoeff6_6;
- SimdReal mone_S, half_S, lje_c2_S, lje_c6_6_S;
+ SimdReal half_S, lje_c2_S, lje_c6_6_S;
#endif
#ifdef LJ_COMB_LB
# endif
#endif
#ifdef LJ_EWALD_GEOM
- mone_S = SimdReal(-1.0);
half_S = SimdReal(0.5);
lj_ewaldcoeff2 = ic->ewaldcoeff_lj * ic->ewaldcoeff_lj;
lj_ewaldcoeff6_6 = lj_ewaldcoeff2 * lj_ewaldcoeff2 * lj_ewaldcoeff2 / 6;
rcvdw2_S = SimdReal(ic->rvdw * ic->rvdw);
#endif
- minRsq_S = SimdReal(NBNXN_MIN_RSQ);
+ minRsq_S = SimdReal(c_nbnxnMinDistanceSquared);
const real* gmx_restrict q = nbatParams.q.data();
const real facel = ic->epsfac;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#endif
#ifdef LJ_EWALD_GEOM
real lj_ewaldcoeff2, lj_ewaldcoeff6_6;
- SimdReal mone_S, half_S, lje_c2_S, lje_c6_6_S;
+ SimdReal half_S, lje_c2_S, lje_c6_6_S;
#endif
#ifdef LJ_COMB_LB
# endif
#endif
#ifdef LJ_EWALD_GEOM
- mone_S = SimdReal(-1.0);
half_S = SimdReal(0.5);
lj_ewaldcoeff2 = ic->ewaldcoeff_lj * ic->ewaldcoeff_lj;
lj_ewaldcoeff6_6 = lj_ewaldcoeff2 * lj_ewaldcoeff2 * lj_ewaldcoeff2 / 6;
rcvdw2_S = SimdReal(ic->rvdw * ic->rvdw);
#endif
- minRsq_S = SimdReal(NBNXN_MIN_RSQ);
+ minRsq_S = SimdReal(c_nbnxnMinDistanceSquared);
const real* gmx_restrict q = nbatParams.q.data();
const real facel = ic->epsfac;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "nbnxm.h"
#include "gromacs/domdec/domdec_struct.h"
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/timing/wallcycle.h"
-#include "atomdata.h"
+#include "nbnxm_gpu.h"
#include "pairlistsets.h"
#include "pairsearch.h"
void nonbonded_verlet_t::convertCoordinatesGpu(const gmx::AtomLocality locality,
const bool fillLocal,
- DeviceBuffer<float> d_x,
+ DeviceBuffer<gmx::RVec> d_x,
GpuEventSynchronizer* xReadyOnDevice)
{
wallcycle_start(wcycle_, ewcNB_XF_BUF_OPS);
/* Skip the reduction if there was no short-range GPU work to do
* (either NB or both NB and bonded work). */
- if (!pairlistIsSimple() && !haveGpuShortRangeWork(locality))
+ if (!pairlistIsSimple() && !Nbnxm::haveGpuShortRangeWork(gpu_nbv, locality))
{
return;
}
}
void nonbonded_verlet_t::atomdata_add_nbat_f_to_f_gpu(const gmx::AtomLocality locality,
- DeviceBuffer<float> totalForcesDevice,
+ DeviceBuffer<gmx::RVec> totalForcesDevice,
void* forcesPmeDevice,
gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
bool useGpuFPmeReduction,
/* Skip the reduction if there was no short-range GPU work to do
* (either NB or both NB and bonded work). */
- if (!pairlistIsSimple() && !haveGpuShortRangeWork(locality))
+ if (!pairlistIsSimple() && !Nbnxm::haveGpuShortRangeWork(gpu_nbv, locality))
{
return;
}
pairlistSets_->changePairlistRadii(rlistOuter, rlistInner);
}
+void nonbonded_verlet_t::setupGpuShortRangeWork(const gmx::GpuBonded* gpuBonded,
+ const gmx::InteractionLocality iLocality)
+{
+ if (useGpu() && !emulateGpu())
+ {
+ Nbnxm::setupGpuShortRangeWork(gpu_nbv, gpuBonded, iLocality);
+ }
+}
+
void nonbonded_verlet_t::atomdata_init_copy_x_to_nbat_x_gpu()
{
Nbnxm::nbnxn_gpu_init_x_to_nbat_x(pairSearch_->gridSet(), gpu_nbv);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/locality.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/enumerationhelpers.h"
-#include "gromacs/utility/range.h"
#include "gromacs/utility/real.h"
-// TODO: Remove this include
-#include "nbnxm_gpu.h"
-
-struct gmx_device_info_t;
+struct DeviceInformation;
struct gmx_domdec_zones_t;
struct gmx_enerdata_t;
struct gmx_hw_info_t;
struct gmx_mtop_t;
+struct NbnxmGpu;
struct gmx_wallcycle;
struct interaction_const_t;
+struct nbnxn_atomdata_t;
struct nonbonded_verlet_t;
class PairSearch;
class PairlistSets;
-struct t_blocka;
struct t_commrec;
struct t_lambda;
struct t_mdatoms;
struct t_forcerec;
struct t_inputrec;
-/*! \brief Switch for whether to use GPU for buffer ops*/
-enum class BufferOpsUseGpu
-{
- True,
- False
-};
-
class GpuEventSynchronizer;
namespace gmx
{
class ForceWithShiftForces;
+class GpuBonded;
+template<typename>
+class ListOfLists;
class MDLogger;
+template<typename>
+class Range;
+class StepWorkload;
class UpdateGroupsCog;
} // namespace gmx
std::unique_ptr<PairSearch> pairSearch,
std::unique_ptr<nbnxn_atomdata_t> nbat,
const Nbnxm::KernelSetup& kernelSetup,
- gmx_nbnxn_gpu_t* gpu_nbv,
+ NbnxmGpu* gpu_nbv,
gmx_wallcycle* wcycle);
~nonbonded_verlet_t();
//! Returns the index position of the atoms on the search grid
gmx::ArrayRef<const int> getGridIndices() const;
- //! Constructs the pairlist for the given locality
- void constructPairlist(gmx::InteractionLocality iLocality, const t_blocka* excl, int64_t step, t_nrnb* nrnb);
+ /*! \brief Constructs the pairlist for the given locality
+ *
+ * When there are no non-self exclusions, \p exclusions can be empty.
+ * Otherwise the number of lists in \p exclusions should match the number
+ * of atoms when not using DD, or the total number of atoms in the i-zones
+ * when using DD.
+ *
+ * \param[in] iLocality The interaction locality: local or non-local
+ * \param[in] exclusions Lists of exclusions for every atom.
+ * \param[in] step Used to set the list creation step
+ * \param[in,out] nrnb Flop accounting struct, can be nullptr
+ */
+ void constructPairlist(gmx::InteractionLocality iLocality,
+ const gmx::ListOfLists<int>& exclusions,
+ int64_t step,
+ t_nrnb* nrnb);
//! Updates all the atom properties in Nbnxm
void setAtomProperties(const t_mdatoms& mdatoms, gmx::ArrayRef<const int> atomInfo);
* \param[in] d_x GPU coordinates buffer in plain rvec format to be transformed.
* \param[in] xReadyOnDevice Event synchronizer indicating that the coordinates are ready in the device memory.
*/
- void convertCoordinatesGpu(gmx::AtomLocality locality,
- bool fillLocal,
- DeviceBuffer<float> d_x,
- GpuEventSynchronizer* xReadyOnDevice);
+ void convertCoordinatesGpu(gmx::AtomLocality locality,
+ bool fillLocal,
+ DeviceBuffer<gmx::RVec> d_x,
+ GpuEventSynchronizer* xReadyOnDevice);
//! Init for GPU version of setup coordinates in Nbnxm
void atomdata_init_copy_x_to_nbat_x_gpu();
* \param [in] accumulateForce If the total force buffer already contains data
*/
void atomdata_add_nbat_f_to_f_gpu(gmx::AtomLocality locality,
- DeviceBuffer<float> totalForcesDevice,
+ DeviceBuffer<gmx::RVec> totalForcesDevice,
void* forcesPmeDevice,
gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
bool useGpuFPmeReduction,
void changePairlistRadii(real rlistOuter, real rlistInner);
//! Set up internal flags that indicate what type of short-range work there is.
- void setupGpuShortRangeWork(const gmx::GpuBonded* gpuBonded, const gmx::InteractionLocality iLocality)
- {
- if (useGpu() && !emulateGpu())
- {
- Nbnxm::setupGpuShortRangeWork(gpu_nbv, gpuBonded, iLocality);
- }
- }
-
- //! Returns true if there is GPU short-range work for the given atom locality.
- bool haveGpuShortRangeWork(const gmx::AtomLocality aLocality)
- {
- return ((useGpu() && !emulateGpu()) && Nbnxm::haveGpuShortRangeWork(gpu_nbv, aLocality));
- }
+ void setupGpuShortRangeWork(const gmx::GpuBonded* gpuBonded, gmx::InteractionLocality iLocality);
// TODO: Make all data members private
public:
public:
//! GPU Nbnxm data, only used with a physical GPU (TODO: use unique_ptr)
- gmx_nbnxn_gpu_t* gpu_nbv;
+ NbnxmGpu* gpu_nbv;
};
namespace Nbnxm
/*! \brief Creates an Nbnxm object */
std::unique_ptr<nonbonded_verlet_t> init_nb_verlet(const gmx::MDLogger& mdlog,
- gmx_bool bFEP_NonBonded,
const t_inputrec* ir,
const t_forcerec* fr,
const t_commrec* cr,
const gmx_hw_info_t& hardwareInfo,
- const gmx_device_info_t* deviceInfo,
+ const DeviceInformation* deviceInfo,
const gmx_mtop_t* mtop,
matrix box,
gmx_wallcycle* wcycle);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-
+/*! \internal \file
+ *
+ * \brief
+ * Declares the geometry-related functionality
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
#ifndef GMX_NBNXM_NBNXM_GEOMETRY_H
#define GMX_NBNXM_NBNXM_GEOMETRY_H
#include "pairlist.h"
-/* Returns the base-2 log of n.
+/*! \copybrief Returns the base-2 log of n.
+ * *
* Generates a fatal error when n is not an integer power of 2.
*/
static inline int get_2log(int n)
namespace Nbnxm
{
-/* The nbnxn i-cluster size in atoms for each nbnxn kernel type */
+/*! \brief The nbnxn i-cluster size in atoms for each nbnxn kernel type */
static constexpr gmx::EnumerationArray<KernelType, int> IClusterSizePerKernelType = {
{ 0, c_nbnxnCpuIClusterSize, c_nbnxnCpuIClusterSize, c_nbnxnCpuIClusterSize,
c_nbnxnGpuClusterSize, c_nbnxnGpuClusterSize }
};
-/* The nbnxn j-cluster size in atoms for each nbnxn kernel type */
+/*! \brief The nbnxn j-cluster size in atoms for each nbnxn kernel type */
static constexpr gmx::EnumerationArray<KernelType, int> JClusterSizePerKernelType = {
{ 0, c_nbnxnCpuIClusterSize,
#if GMX_SIMD
c_nbnxnGpuClusterSize, c_nbnxnGpuClusterSize / 2 }
};
-/* Returns whether the pair-list corresponding to nb_kernel_type is simple */
+/*! \brief Returns whether the pair-list corresponding to nb_kernel_type is simple */
static inline bool kernelTypeUsesSimplePairlist(const KernelType kernelType)
{
return (kernelType == KernelType::Cpu4x4_PlainC || kernelType == KernelType::Cpu4xN_Simd_4xN
|| kernelType == KernelType::Cpu4xN_Simd_2xNN);
}
+//! Returns whether a SIMD kernel is in use
static inline bool kernelTypeIsSimd(const KernelType kernelType)
{
return (kernelType == KernelType::Cpu4xN_Simd_4xN || kernelType == KernelType::Cpu4xN_Simd_2xNN);
} // namespace Nbnxm
-/* Returns the effective list radius of the pair-list
+/*! \brief Returns the effective list radius of the pair-list
*
* Due to the cluster size the effective pair-list is longer than
* that of a simple atom pair-list. This function gives the extra distance.
*/
real nbnxn_get_rlist_effective_inc(int jClusterSize, real atomDensity);
-/* Returns the effective list radius of the pair-list
+/*! \brief Returns the effective list radius of the pair-list
*
* Due to the cluster size the effective pair-list is longer than
* that of a simple atom pair-list. This function gives the extra distance.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gpu_utils/gpu_macros.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/locality.h"
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
-#include "atomdata.h"
-#include "gpu_types.h"
-
struct interaction_const_t;
struct nbnxn_atomdata_t;
struct gmx_wallcycle;
* \param [in] aloc Atom locality flag.
*/
GPU_FUNC_QUALIFIER
-void gpu_copy_xq_to_gpu(gmx_nbnxn_gpu_t gmx_unused* nb,
+void gpu_copy_xq_to_gpu(NbnxmGpu gmx_unused* nb,
const struct nbnxn_atomdata_t gmx_unused* nbdata,
gmx::AtomLocality gmx_unused aloc) GPU_FUNC_TERM;
*
*/
GPU_FUNC_QUALIFIER
-void gpu_launch_kernel(gmx_nbnxn_gpu_t gmx_unused* nb,
+void gpu_launch_kernel(NbnxmGpu gmx_unused* nb,
const gmx::StepWorkload gmx_unused& stepWork,
gmx::InteractionLocality gmx_unused iloc) GPU_FUNC_TERM;
* \param [in] numParts Number of parts the pair list is split into in the rolling kernel.
*/
GPU_FUNC_QUALIFIER
-void gpu_launch_kernel_pruneonly(gmx_nbnxn_gpu_t gmx_unused* nb,
+void gpu_launch_kernel_pruneonly(NbnxmGpu gmx_unused* nb,
gmx::InteractionLocality gmx_unused iloc,
int gmx_unused numParts) GPU_FUNC_TERM;
* (and energies/shift forces if required).
*/
GPU_FUNC_QUALIFIER
-void gpu_launch_cpyback(gmx_nbnxn_gpu_t gmx_unused* nb,
+void gpu_launch_cpyback(NbnxmGpu gmx_unused* nb,
nbnxn_atomdata_t gmx_unused* nbatom,
const gmx::StepWorkload gmx_unused& stepWork,
gmx::AtomLocality gmx_unused aloc) GPU_FUNC_TERM;
* \returns True if the nonbonded tasks associated with \p aloc locality have completed
*/
GPU_FUNC_QUALIFIER
-bool gpu_try_finish_task(gmx_nbnxn_gpu_t gmx_unused* nb,
+bool gpu_try_finish_task(NbnxmGpu gmx_unused* nb,
const gmx::StepWorkload gmx_unused& stepWork,
gmx::AtomLocality gmx_unused aloc,
real gmx_unused* e_lj,
* \param[out] shiftForces Shift forces buffer to accumulate into
* \param[out] wcycle Pointer to wallcycle data structure */
GPU_FUNC_QUALIFIER
-float gpu_wait_finish_task(gmx_nbnxn_gpu_t gmx_unused* nb,
+float gpu_wait_finish_task(NbnxmGpu gmx_unused* nb,
const gmx::StepWorkload gmx_unused& stepWork,
gmx::AtomLocality gmx_unused aloc,
real gmx_unused* e_lj,
* Called on the NS step and performs (re-)allocations and memory copies. !*/
CUDA_FUNC_QUALIFIER
void nbnxn_gpu_init_x_to_nbat_x(const Nbnxm::GridSet gmx_unused& gridSet,
- gmx_nbnxn_gpu_t gmx_unused* gpu_nbv) CUDA_FUNC_TERM;
+ NbnxmGpu gmx_unused* gpu_nbv) CUDA_FUNC_TERM;
/*! \brief X buffer operations on GPU: performs conversion from rvec to nb format.
*
CUDA_FUNC_QUALIFIER
void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid gmx_unused& grid,
bool gmx_unused setFillerCoords,
- gmx_nbnxn_gpu_t gmx_unused* gpu_nbv,
- DeviceBuffer<float> gmx_unused d_x,
+ NbnxmGpu gmx_unused* gpu_nbv,
+ DeviceBuffer<gmx::RVec> gmx_unused d_x,
GpuEventSynchronizer gmx_unused* xReadyOnDevice,
gmx::AtomLocality gmx_unused locality,
int gmx_unused gridId,
* \param[in] interactionLocality Local or NonLocal sync point
*/
CUDA_FUNC_QUALIFIER
-void nbnxnInsertNonlocalGpuDependency(const gmx_nbnxn_gpu_t gmx_unused* nb,
+void nbnxnInsertNonlocalGpuDependency(const NbnxmGpu gmx_unused* nb,
gmx::InteractionLocality gmx_unused interactionLocality) CUDA_FUNC_TERM;
/*! \brief Set up internal flags that indicate what type of short-range work there is.
* \param[in] iLocality Interaction locality identifier
*/
GPU_FUNC_QUALIFIER
-void setupGpuShortRangeWork(gmx_nbnxn_gpu_t gmx_unused* nb,
+void setupGpuShortRangeWork(NbnxmGpu gmx_unused* nb,
const gmx::GpuBonded gmx_unused* gpuBonded,
gmx::InteractionLocality gmx_unused iLocality) GPU_FUNC_TERM;
* \param[in] aLocality Atom locality identifier
*/
GPU_FUNC_QUALIFIER
-bool haveGpuShortRangeWork(const gmx_nbnxn_gpu_t gmx_unused* nb, gmx::AtomLocality gmx_unused aLocality)
+bool haveGpuShortRangeWork(const NbnxmGpu gmx_unused* nb, gmx::AtomLocality gmx_unused aLocality)
GPU_FUNC_TERM_WITH_RETURN(false);
/*! \brief Initialization for F buffer operations on GPU */
CUDA_FUNC_QUALIFIER
void nbnxn_gpu_init_add_nbat_f_to_f(const int gmx_unused* cell,
- gmx_nbnxn_gpu_t gmx_unused* gpu_nbv,
+ NbnxmGpu gmx_unused* gpu_nbv,
int gmx_unused natoms_total,
GpuEventSynchronizer gmx_unused* localReductionDone) CUDA_FUNC_TERM;
*/
CUDA_FUNC_QUALIFIER
void nbnxn_gpu_add_nbat_f_to_f(gmx::AtomLocality gmx_unused atomLocality,
- DeviceBuffer<float> gmx_unused totalForcesDevice,
- gmx_nbnxn_gpu_t gmx_unused* gpu_nbv,
+ DeviceBuffer<gmx::RVec> gmx_unused totalForcesDevice,
+ NbnxmGpu gmx_unused* gpu_nbv,
void gmx_unused* pmeForcesDevice,
gmx::ArrayRef<GpuEventSynchronizer* const> gmx_unused dependencyList,
int gmx_unused atomStart,
* \param[in] nb The nonbonded data GPU structure
*/
CUDA_FUNC_QUALIFIER
-void nbnxn_wait_x_on_device(gmx_nbnxn_gpu_t gmx_unused* nb) CUDA_FUNC_TERM;
+void nbnxn_wait_x_on_device(NbnxmGpu gmx_unused* nb) CUDA_FUNC_TERM;
} // namespace Nbnxm
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/interaction_const.h"
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/nbnxm/pairlist_tuning.h"
#include "gromacs/simd/simd.h"
+#include "gromacs/topology/mtop_util.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/logger.h"
-#include "atomdata.h"
-#include "gpu_types.h"
#include "grid.h"
#include "nbnxm_geometry.h"
#include "nbnxm_simd.h"
{
/*! \brief Gets and returns the minimum i-list count for balacing based on the GPU used or env.var. when set */
-static int getMinimumIlistCountForGpuBalancing(gmx_nbnxn_gpu_t* nbnxmGpu)
+static int getMinimumIlistCountForGpuBalancing(NbnxmGpu* nbnxmGpu)
{
int minimumIlistCount;
}
std::unique_ptr<nonbonded_verlet_t> init_nb_verlet(const gmx::MDLogger& mdlog,
- gmx_bool bFEP_NonBonded,
const t_inputrec* ir,
const t_forcerec* fr,
const t_commrec* cr,
const gmx_hw_info_t& hardwareInfo,
- const gmx_device_info_t* deviceInfo,
+ const DeviceInformation* deviceInfo,
const gmx_mtop_t* mtop,
matrix box,
gmx_wallcycle* wcycle)
const bool haveMultipleDomains = (DOMAINDECOMP(cr) && cr->dd->nnodes > 1);
+ bool bFEP_NonBonded = (fr->efep != efepNO) && haveFepPerturbedNBInteractions(mtop);
PairlistParams pairlistParams(kernelSetup.kernelType, bFEP_NonBonded, ir->rlist,
havePPDomainDecomposition(cr));
fr->nbfp, mimimumNumEnergyGroupNonbonded,
(useGpu || emulateGpu) ? 1 : gmx_omp_nthreads_get(emntNonbonded));
- gmx_nbnxn_gpu_t* gpu_nbv = nullptr;
- int minimumIlistCountForGpuBalancing = 0;
+ NbnxmGpu* gpu_nbv = nullptr;
+ int minimumIlistCountForGpuBalancing = 0;
if (useGpu)
{
/* init the NxN GPU data; the last argument tells whether we'll have
minimumIlistCountForGpuBalancing);
auto pairSearch = std::make_unique<PairSearch>(
- ir->ePBC, EI_TPI(ir->eI), DOMAINDECOMP(cr) ? &cr->dd->nc : nullptr,
+ ir->pbcType, EI_TPI(ir->eI), DOMAINDECOMP(cr) ? &cr->dd->numCells : nullptr,
DOMAINDECOMP(cr) ? domdec_zones(cr->dd) : nullptr, pairlistParams.pairlistType,
bFEP_NonBonded, gmx_omp_nthreads_get(emntPairsearch), pinPolicy);
std::unique_ptr<PairSearch> pairSearch,
std::unique_ptr<nbnxn_atomdata_t> nbat_in,
const Nbnxm::KernelSetup& kernelSetup,
- gmx_nbnxn_gpu_t* gpu_nbv_ptr,
+ NbnxmGpu* gpu_nbv_ptr,
gmx_wallcycle* wcycle) :
pairlistSets_(std::move(pairlistSets)),
pairSearch_(std::move(pairSearch)),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-
+/*! \internal \file
+ *
+ * \brief
+ * Defines constants used to know which Nbnxm kernel flavours (4xn or 2xnn)
+ * can be supported by the SIMD layer in use.
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
#ifndef GMX_NBNXM_NBNXM_SIMD_H
#define GMX_NBNXM_NBNXM_SIMD_H
#include "gromacs/utility/real.h"
#if GMX_SIMD
-/* The nbnxn SIMD 4xN and 2x(N+N) kernels can be added independently.
+/*! \brief The nbnxn SIMD 4xN and 2x(N+N) kernels can be added independently.
* Currently the 2xNN SIMD kernels only make sense with:
* 8-way SIMD: 4x4 setup, works with AVX-256 in single precision
* 16-way SIMD: 4x8 setup, works with Intel MIC in single precision
#endif // GMX_SIMD
-#endif /* _nbnxn_simd_h */
+#endif
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
string(REGEX REPLACE ".*=" "" ELEC_NAME "${ELEC_DEF}")
string(REGEX REPLACE ".*=" "" VDW_NAME "${VDW_DEF}")
set(OBJ_FILE nbnxm_ocl_kernel${ELEC_NAME}${VDW_NAME}_${VENDOR}.o)
+ # The constants below duplicate various others (e.g. from pairlist.h)
+ # but as the kernels compiled here are not used for production,
+ # it will be OK if the values would fall out of sync.
add_custom_command(OUTPUT ${OBJ_FILE} COMMAND ${OCL_COMPILER}
${CMAKE_CURRENT_SOURCE_DIR}/nbnxm_ocl_kernels.cl ${CLANG_TIDY_ARGS}
-Xclang -finclude-default-header -D_${VENDOR}_SOURCE_
-DGMX_OCL_FASTGEN ${ELEC_DEF} ${VDW_DEF}
- -DNBNXN_GPU_CLUSTER_SIZE=${CLUSTER_SIZE} -DIATYPE_SHMEM
+ -Dc_nbnxnGpuClusterSize=${CLUSTER_SIZE}
+ -Dc_nbnxnMinDistanceSquared=3.82e-07F
+ -Dc_nbnxnGpuNumClusterPerSupercluster=8
+ -Dc_nbnxnGpuJgroupSize=4
+ -DIATYPE_SHMEM
-c -I ${CMAKE_SOURCE_DIR}/src -std=cl1.2
-Weverything -Wno-conversion -Wno-missing-variable-declarations -Wno-used-but-marked-unused
-Wno-cast-align -Wno-incompatible-pointer-types
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief Convenience constants */
//@{
-static const int c_numClPerSupercl = c_nbnxnGpuNumClusterPerSupercluster;
-static const int c_clSize = c_nbnxnGpuClusterSize;
+static constexpr int c_clSize = c_nbnxnGpuClusterSize;
//@}
*/
static inline void validate_global_work_size(const KernelLaunchConfig& config,
int work_dim,
- const gmx_device_info_t* dinfo)
+ const DeviceInformation* dinfo)
{
cl_uint device_size_t_size_bits;
cl_uint host_size_t_size_bits;
- assert(dinfo);
+ GMX_ASSERT(dinfo, "Need a valid device info object");
size_t global_work_size[3];
GMX_ASSERT(work_dim <= 3, "Not supporting hyper-grids just yet");
* OpenCL kernel objects are cached in nb. If the requested kernel is not
* found in the cache, it will be created and the cache will be updated.
*/
-static inline cl_kernel select_nbnxn_kernel(gmx_nbnxn_ocl_t* nb, int eeltype, int evdwtype, bool bDoEne, bool bDoPrune)
+static inline cl_kernel select_nbnxn_kernel(NbnxmGpu* nb, int eeltype, int evdwtype, bool bDoEne, bool bDoPrune)
{
const char* kernel_name_to_run;
cl_kernel* kernel_ptr;
cl_int cl_error;
- assert(eeltype < eelOclNR);
- assert(evdwtype < evdwOclNR);
+ GMX_ASSERT(eeltype < eelOclNR,
+ "The electrostatics type requested is not implemented in the OpenCL kernels.");
+ GMX_ASSERT(evdwtype < evdwOclNR,
+ "The VdW type requested is not implemented in the OpenCL kernels.");
if (bDoEne)
{
if (nullptr == kernel_ptr[0])
{
*kernel_ptr = clCreateKernel(nb->dev_rundata->program, kernel_name_to_run, &cl_error);
- assert(cl_error == CL_SUCCESS);
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clCreateKernel failed: " + ocl_get_error_string(cl_error)).c_str());
}
- // TODO: handle errors
return *kernel_ptr;
}
/* size of shmem (force-buffers/xq/atom type preloading) */
/* NOTE: with the default kernel on sm3.0 we need shmem only for pre-loading */
/* i-atom x+q in shared memory */
- shmem = c_numClPerSupercl * c_clSize * sizeof(float) * 4; /* xqib */
+ shmem = c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float) * 4; /* xqib */
/* cj in shared memory, for both warps separately
* TODO: in the "nowarp kernels we load cj only once so the factor 2 is not needed.
*/
if (useLjCombRule(vdwType))
{
/* i-atom LJ combination parameters in shared memory */
- shmem += c_numClPerSupercl * c_clSize * 2 * sizeof(float); /* atib abused for ljcp, float2 */
+ shmem += c_nbnxnGpuNumClusterPerSupercluster * c_clSize * 2
+ * sizeof(float); /* atib abused for ljcp, float2 */
}
else
{
/* i-atom types in shared memory */
- shmem += c_numClPerSupercl * c_clSize * sizeof(int); /* atib */
+ shmem += c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(int); /* atib */
}
}
/* force reduction buffers in shared memory */
/* Release event and reset it to 0. It is ok to release it as enqueuewaitforevents performs implicit retain for events. */
cl_error = clReleaseEvent(*ocl_event);
- assert(CL_SUCCESS == cl_error);
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clReleaseEvent failed: " + ocl_get_error_string(cl_error)).c_str());
*ocl_event = nullptr;
}
/*! \brief Launch asynchronously the xq buffer host to device copy. */
-void gpu_copy_xq_to_gpu(gmx_nbnxn_ocl_t* nb, const nbnxn_atomdata_t* nbatom, const AtomLocality atomLocality)
+void gpu_copy_xq_to_gpu(NbnxmGpu* nb, const nbnxn_atomdata_t* nbatom, const AtomLocality atomLocality)
{
GMX_ASSERT(nb, "Need a valid nbnxn_gpu object");
cl_timers_t* t = nb->timers;
cl_command_queue stream = nb->stream[iloc];
- bool bDoTime = (nb->bDoTime) != 0;
+ bool bDoTime = nb->bDoTime;
/* Don't launch the non-local H2D copy if there is no dependent
work to do: neither non-local nor other (e.g. bonded) work
{
cl_int gmx_used_in_debug cl_error = clEnqueueMarkerWithWaitList(
stream, 0, nullptr, &(nb->misc_ops_and_local_H2D_done));
- assert(CL_SUCCESS == cl_error);
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clEnqueueMarkerWithWaitList failed: " + ocl_get_error_string(cl_error)).c_str());
/* Based on the v1.2 section 5.13 of the OpenCL spec, a flush is needed
* in the local stream in order to be able to sync with the above event
* from the non-local stream.
*/
cl_error = clFlush(stream);
- assert(CL_SUCCESS == cl_error);
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clFlush failed: " + ocl_get_error_string(cl_error)).c_str());
}
else
{
misc_ops_done event to record the point in time when the above operations
are finished and synchronize with this event in the non-local stream.
*/
-void gpu_launch_kernel(gmx_nbnxn_ocl_t* nb, const gmx::StepWorkload& stepWork, const Nbnxm::InteractionLocality iloc)
+void gpu_launch_kernel(NbnxmGpu* nb, const gmx::StepWorkload& stepWork, const Nbnxm::InteractionLocality iloc)
{
cl_atomdata_t* adat = nb->atdat;
cl_nbparam_t* nbp = nb->nbparam;
cl_timers_t* t = nb->timers;
cl_command_queue stream = nb->stream[iloc];
- bool bDoTime = (nb->bDoTime) != 0;
+ bool bDoTime = nb->bDoTime;
cl_nbparam_params_t nbparams_params;
config.blockSize[1] = c_clSize;
config.gridSize[0] = plist->nsci;
- validate_global_work_size(config, 3, nb->dev_info);
+ validate_global_work_size(config, 3, nb->deviceInfo);
if (debug)
{
"Global work size : %zux%zu\n\t#Super-clusters/clusters: %d/%d (%d)\n",
config.blockSize[0], config.blockSize[1], config.blockSize[2],
config.blockSize[0] * config.gridSize[0], config.blockSize[1] * config.gridSize[1],
- plist->nsci * c_numClPerSupercl, c_numClPerSupercl, plist->na_c);
+ plist->nsci * c_nbnxnGpuNumClusterPerSupercluster,
+ c_nbnxnGpuNumClusterPerSupercluster, plist->na_c);
}
fillin_ocl_structures(nbp, &nbparams_params);
int shmem;
/* i-atom x in shared memory (for convenience we load all 4 components including q) */
- shmem = c_numClPerSupercl * c_clSize * sizeof(float) * 4;
+ shmem = c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float) * 4;
/* cj in shared memory, for each warp separately
* Note: only need to load once per wavefront, but to keep the code simple,
* for now we load twice on AMD.
* Launch the pairlist prune only kernel for the given locality.
* \p numParts tells in how many parts, i.e. calls the list will be pruned.
*/
-void gpu_launch_kernel_pruneonly(gmx_nbnxn_gpu_t* nb, const InteractionLocality iloc, const int numParts)
+void gpu_launch_kernel_pruneonly(NbnxmGpu* nb, const InteractionLocality iloc, const int numParts)
{
cl_atomdata_t* adat = nb->atdat;
cl_nbparam_t* nbp = nb->nbparam;
cl_plist_t* plist = nb->plist[iloc];
cl_timers_t* t = nb->timers;
cl_command_queue stream = nb->stream[iloc];
- bool bDoTime = nb->bDoTime == CL_TRUE;
+ bool bDoTime = nb->bDoTime;
if (plist->haveFreshList)
{
* and j-cluster concurrency, in x, y, and z, respectively.
* - The 1D block-grid contains as many blocks as super-clusters.
*/
- int num_threads_z = getOclPruneKernelJ4Concurrency(nb->dev_info->vendor_e);
+ int num_threads_z = c_oclPruneKernelJ4ConcurrencyDEFAULT;
+
/* kernel launch config */
KernelLaunchConfig config;
config.blockSize[2] = num_threads_z;
config.gridSize[0] = numSciInPart;
- validate_global_work_size(config, 3, nb->dev_info);
+ validate_global_work_size(config, 3, nb->deviceInfo);
if (debug)
{
"\tShMem: %zu\n",
config.blockSize[0], config.blockSize[1], config.blockSize[2],
config.blockSize[0] * config.gridSize[0], config.blockSize[1] * config.gridSize[1],
- plist->nsci * c_numClPerSupercl, c_numClPerSupercl, plist->na_c, config.sharedMemorySize);
+ plist->nsci * c_nbnxnGpuNumClusterPerSupercluster,
+ c_nbnxnGpuNumClusterPerSupercluster, plist->na_c, config.sharedMemorySize);
}
cl_nbparam_params_t nbparams_params;
* Launch asynchronously the download of nonbonded forces from the GPU
* (and energies/shift forces if required).
*/
-void gpu_launch_cpyback(gmx_nbnxn_ocl_t* nb,
+void gpu_launch_cpyback(NbnxmGpu* nb,
struct nbnxn_atomdata_t* nbatom,
const gmx::StepWorkload& stepWork,
const AtomLocality aloc)
cl_atomdata_t* adat = nb->atdat;
cl_timers_t* t = nb->timers;
- bool bDoTime = nb->bDoTime == CL_TRUE;
+ bool bDoTime = nb->bDoTime;
cl_command_queue stream = nb->stream[iloc];
/* don't launch non-local copy-back if there was no non-local work to do */
}
/* DtoH f */
- ocl_copy_D2H_async(nbatom->out[0].f.data() + adat_begin * 3, adat->f,
- adat_begin * 3 * sizeof(float), (adat_len)*adat->f_elem_size, stream,
+ ocl_copy_D2H_async(nbatom->out[0].f.data() + adat_begin * DIM, adat->f,
+ adat_begin * DIM * sizeof(nbatom->out[0].f[0]),
+ adat_len * DIM * sizeof(nbatom->out[0].f[0]), stream,
bDoTime ? t->xf[aloc].nb_d2h.fetchNextEvent() : nullptr);
/* kick off work */
cl_error = clFlush(stream);
- assert(CL_SUCCESS == cl_error);
+ GMX_ASSERT(cl_error == CL_SUCCESS, ("clFlush failed: " + ocl_get_error_string(cl_error)).c_str());
/* After the non-local D2H is launched the nonlocal_done event can be
recorded which signals that the local D2H can proceed. This event is not
if (iloc == InteractionLocality::NonLocal)
{
cl_error = clEnqueueMarkerWithWaitList(stream, 0, nullptr, &(nb->nonlocal_done));
- assert(CL_SUCCESS == cl_error);
+ GMX_ASSERT(cl_error == CL_SUCCESS,
+ ("clEnqueueMarkerWithWaitList failed: " + ocl_get_error_string(cl_error)).c_str());
nb->bNonLocalStreamActive = CL_TRUE;
}
/* DtoH fshift when virial is needed */
if (stepWork.computeVirial)
{
- ocl_copy_D2H_async(nb->nbst.fshift, adat->fshift, 0, SHIFTS * adat->fshift_elem_size,
+ ocl_copy_D2H_async(nb->nbst.fshift, adat->fshift, 0, SHIFTS * sizeof(nb->nbst.fshift[0]),
stream, bDoTime ? t->xf[aloc].nb_d2h.fetchNextEvent() : nullptr);
}
/* OpenCL: By default, use analytical Ewald
* TODO: tabulated does not work, it needs fixing, see init_nbparam() in nbnxn_ocl_data_mgmt.cpp
*
- * TODO: decide if dev_info parameter should be added to recognize NVIDIA CC>=3.0 devices.
- *
*/
/* By default use analytical Ewald. */
bUseAnalyticalEwald = true;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ *
+ * \brief
+ * Declares constants for OpenCL code
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
#ifndef NBNXN_OPENCL_CONSTS_H
#define NBNXN_OPENCL_CONSTS_H
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <cmath>
-// TODO We would like to move this down, but the way gmx_nbnxn_gpu_t
-// is currently declared means this has to be before gpu_types.h
-#include "nbnxm_ocl_types.h"
-
-// TODO Remove this comment when the above order issue is resolved
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/gpu_utils/oclutils.h"
#include "gromacs/hardware/gpu_hw_info.h"
#include "gromacs/utility/smalloc.h"
#include "nbnxm_ocl_internal.h"
+#include "nbnxm_ocl_types.h"
namespace Nbnxm
{
ad->ntypes = ntypes;
- /* An element of the shift_vec device buffer has the same size as one element
- of the host side shift_vec buffer. */
- ad->shift_vec_elem_size = sizeof(*nbnxn_atomdata_t::shift_vec.data());
-
ad->shift_vec = clCreateBuffer(runData->context, CL_MEM_READ_ONLY | CL_MEM_HOST_WRITE_ONLY,
- SHIFTS * ad->shift_vec_elem_size, nullptr, &cl_error);
+ SHIFTS * sizeof(nbnxn_atomdata_t::shift_vec[0]), nullptr, &cl_error);
GMX_RELEASE_ASSERT(cl_error == CL_SUCCESS,
("clCreateBuffer failed: " + ocl_get_error_string(cl_error)).c_str());
ad->bShiftVecUploaded = CL_FALSE;
- /* An element of the fshift device buffer has the same size as one element
- of the host side fshift buffer. */
- ad->fshift_elem_size = sizeof(*cl_nb_staging_t::fshift);
-
ad->fshift = clCreateBuffer(runData->context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY,
- SHIFTS * ad->fshift_elem_size, nullptr, &cl_error);
+ SHIFTS * sizeof(nb_staging_t::fshift[0]), nullptr, &cl_error);
GMX_RELEASE_ASSERT(cl_error == CL_SUCCESS,
("clCreateBuffer failed: " + ocl_get_error_string(cl_error)).c_str());
{
return;
}
- gmx_nbnxn_ocl_t* nb = nbv->gpu_nbv;
- cl_nbparam_t* nbp = nb->nbparam;
+ NbnxmGpu* nb = nbv->gpu_nbv;
+ cl_nbparam_t* nbp = nb->nbparam;
set_cutoff_parameters(nbp, ic, nbv->pairlistSets().params());
*
* A fatal error results if creation fails.
*
- * \param[inout] runtimeData runtime data including program and context
- * \param[in] devInfo device info struct
+ * \param[inout] runtimeData Runtime data including program and context
+ * \param[in] deviceInfo Device info struct
* \param[in] rank MPI rank (for error reporting)
*/
static void nbnxn_gpu_create_context(gmx_device_runtime_data_t* runtimeData,
- const gmx_device_info_t* devInfo,
+ const DeviceInformation* deviceInfo,
int rank)
{
cl_context_properties context_properties[5];
cl_context context;
cl_int cl_error;
- assert(runtimeData != nullptr);
- assert(devInfo != nullptr);
+ GMX_ASSERT(runtimeData, "Need a valid runtimeData object");
+ GMX_ASSERT(deviceInfo, "Need a valid device info object");
- platform_id = devInfo->ocl_gpu_id.ocl_platform_id;
- device_id = devInfo->ocl_gpu_id.ocl_device_id;
+ platform_id = deviceInfo->oclPlatformId;
+ device_id = deviceInfo->oclDeviceId;
int i = 0;
context_properties[i++] = CL_CONTEXT_PLATFORM;
if (CL_SUCCESS != cl_error)
{
gmx_fatal(FARGS, "On rank %d failed to create context for GPU #%s:\n OpenCL error %d: %s",
- rank, devInfo->device_name, cl_error, ocl_get_error_string(cl_error).c_str());
+ rank, deviceInfo->device_name, cl_error, ocl_get_error_string(cl_error).c_str());
}
runtimeData->context = context;
}
/*! \brief Initializes the OpenCL kernel pointers of the nbnxn_ocl_ptr_t input data structure. */
-static cl_kernel nbnxn_gpu_create_kernel(gmx_nbnxn_ocl_t* nb, const char* kernel_name)
+static cl_kernel nbnxn_gpu_create_kernel(NbnxmGpu* nb, const char* kernel_name)
{
cl_kernel kernel;
cl_int cl_error;
if (CL_SUCCESS != cl_error)
{
gmx_fatal(FARGS, "Failed to create kernel '%s' for GPU #%s: OpenCL error %d", kernel_name,
- nb->dev_info->device_name, cl_error);
+ nb->deviceInfo->device_name, cl_error);
}
return kernel;
/*! \brief Clears nonbonded shift force output array and energy outputs on the GPU.
*/
-static void nbnxn_ocl_clear_e_fshift(gmx_nbnxn_ocl_t* nb)
+static void nbnxn_ocl_clear_e_fshift(NbnxmGpu* nb)
{
cl_int cl_error;
}
/*! \brief Initializes the OpenCL kernel pointers of the nbnxn_ocl_ptr_t input data structure. */
-static void nbnxn_gpu_init_kernels(gmx_nbnxn_ocl_t* nb)
+static void nbnxn_gpu_init_kernels(NbnxmGpu* nb)
{
/* Init to 0 main kernel arrays */
/* They will be later on initialized in select_nbnxn_kernel */
* Initializes members of the atomdata and nbparam structs and
* clears e/fshift output buffers.
*/
-static void nbnxn_ocl_init_const(gmx_nbnxn_ocl_t* nb,
+static void nbnxn_ocl_init_const(NbnxmGpu* nb,
const interaction_const_t* ic,
const PairlistParams& listParams,
const nbnxn_atomdata_t::Params& nbatParams)
//! This function is documented in the header file
-gmx_nbnxn_ocl_t* gpu_init(const gmx_device_info_t* deviceInfo,
- const interaction_const_t* ic,
- const PairlistParams& listParams,
- const nbnxn_atomdata_t* nbat,
- const int rank,
- const gmx_bool bLocalAndNonlocal)
+NbnxmGpu* gpu_init(const DeviceInformation* deviceInfo,
+ const interaction_const_t* ic,
+ const PairlistParams& listParams,
+ const nbnxn_atomdata_t* nbat,
+ const int rank,
+ const bool bLocalAndNonlocal)
{
- gmx_nbnxn_ocl_t* nb;
cl_int cl_error;
cl_command_queue_properties queue_properties;
- assert(ic);
+ GMX_ASSERT(ic, "Need a valid interaction constants object");
- snew(nb, 1);
+ auto nb = new NbnxmGpu;
snew(nb->atdat, 1);
snew(nb->nbparam, 1);
snew(nb->plist[InteractionLocality::Local], 1);
snew(nb->plist[InteractionLocality::NonLocal], 1);
}
- nb->bUseTwoStreams = static_cast<cl_bool>(bLocalAndNonlocal);
+ nb->bUseTwoStreams = bLocalAndNonlocal;
nb->timers = new cl_timers_t();
snew(nb->timings, 1);
/* set device info, just point it to the right GPU among the detected ones */
- nb->dev_info = deviceInfo;
+ nb->deviceInfo = deviceInfo;
snew(nb->dev_rundata, 1);
/* init nbst */
init_plist(nb->plist[InteractionLocality::Local]);
/* OpenCL timing disabled if GMX_DISABLE_GPU_TIMING is defined. */
- nb->bDoTime = static_cast<cl_bool>(getenv("GMX_DISABLE_GPU_TIMING") == nullptr);
+ nb->bDoTime = (getenv("GMX_DISABLE_GPU_TIMING") == nullptr);
/* Create queues only after bDoTime has been initialized */
if (nb->bDoTime)
queue_properties = 0;
}
- nbnxn_gpu_create_context(nb->dev_rundata, nb->dev_info, rank);
+ nbnxn_gpu_create_context(nb->dev_rundata, nb->deviceInfo, rank);
/* local/non-local GPU streams */
nb->stream[InteractionLocality::Local] = clCreateCommandQueue(
- nb->dev_rundata->context, nb->dev_info->ocl_gpu_id.ocl_device_id, queue_properties, &cl_error);
+ nb->dev_rundata->context, nb->deviceInfo->oclDeviceId, queue_properties, &cl_error);
if (CL_SUCCESS != cl_error)
{
gmx_fatal(FARGS, "On rank %d failed to create context for GPU #%s: OpenCL error %d", rank,
- nb->dev_info->device_name, cl_error);
+ nb->deviceInfo->device_name, cl_error);
}
if (nb->bUseTwoStreams)
{
init_plist(nb->plist[InteractionLocality::NonLocal]);
- nb->stream[InteractionLocality::NonLocal] =
- clCreateCommandQueue(nb->dev_rundata->context, nb->dev_info->ocl_gpu_id.ocl_device_id,
- queue_properties, &cl_error);
+ nb->stream[InteractionLocality::NonLocal] = clCreateCommandQueue(
+ nb->dev_rundata->context, nb->deviceInfo->oclDeviceId, queue_properties, &cl_error);
if (CL_SUCCESS != cl_error)
{
gmx_fatal(FARGS, "On rank %d failed to create context for GPU #%s: OpenCL error %d",
- rank, nb->dev_info->device_name, cl_error);
+ rank, nb->deviceInfo->device_name, cl_error);
}
}
* TODO: decide about NVIDIA
*/
nb->bPrefetchLjParam = (getenv("GMX_OCL_DISABLE_I_PREFETCH") == nullptr)
- && ((nb->dev_info->vendor_e == OCL_VENDOR_AMD)
- || (nb->dev_info->vendor_e == OCL_VENDOR_INTEL)
+ && ((nb->deviceInfo->deviceVendor == DeviceVendor::Amd)
+ || (nb->deviceInfo->deviceVendor == DeviceVendor::Intel)
|| (getenv("GMX_OCL_ENABLE_I_PREFETCH") != nullptr));
/* NOTE: in CUDA we pick L1 cache configuration for the nbnxn kernels here,
/*! \brief Clears the first natoms_clear elements of the GPU nonbonded force output array.
*/
-static void nbnxn_ocl_clear_f(gmx_nbnxn_ocl_t* nb, int natoms_clear)
+static void nbnxn_ocl_clear_f(NbnxmGpu* nb, int natoms_clear)
{
if (natoms_clear == 0)
{
}
//! This function is documented in the header file
-void gpu_clear_outputs(gmx_nbnxn_ocl_t* nb, bool computeVirial)
+void gpu_clear_outputs(NbnxmGpu* nb, bool computeVirial)
{
nbnxn_ocl_clear_f(nb, nb->atdat->natoms);
/* clear shift force array and energies if the outputs were
/* kick off buffer clearing kernel to ensure concurrency with constraints/update */
cl_int gmx_unused cl_error;
cl_error = clFlush(nb->stream[InteractionLocality::Local]);
- assert(CL_SUCCESS == cl_error);
+ GMX_ASSERT(cl_error == CL_SUCCESS, ("clFlush failed: " + ocl_get_error_string(cl_error)).c_str());
}
//! This function is documented in the header file
-void gpu_init_pairlist(gmx_nbnxn_ocl_t* nb, const NbnxnPairlistGpu* h_plist, const InteractionLocality iloc)
+void gpu_init_pairlist(NbnxmGpu* nb, const NbnxnPairlistGpu* h_plist, const InteractionLocality iloc)
{
char sbuf[STRLEN];
// Timing accumulation should happen only if there was work to do
// because getLastRangeTime() gets skipped with empty lists later
// which leads to the counter not being reset.
- bool bDoTime = ((nb->bDoTime == CL_TRUE) && !h_plist->sci.empty());
+ bool bDoTime = (nb->bDoTime && !h_plist->sci.empty());
cl_command_queue stream = nb->stream[iloc];
cl_plist_t* d_plist = nb->plist[iloc];
}
//! This function is documented in the header file
-void gpu_upload_shiftvec(gmx_nbnxn_ocl_t* nb, const nbnxn_atomdata_t* nbatom)
+void gpu_upload_shiftvec(NbnxmGpu* nb, const nbnxn_atomdata_t* nbatom)
{
cl_atomdata_t* adat = nb->atdat;
cl_command_queue ls = nb->stream[InteractionLocality::Local];
if (nbatom->bDynamicBox || !adat->bShiftVecUploaded)
{
ocl_copy_H2D_async(adat->shift_vec, nbatom->shift_vec.data(), 0,
- SHIFTS * adat->shift_vec_elem_size, ls, nullptr);
+ SHIFTS * sizeof(nbatom->shift_vec[0]), ls, nullptr);
adat->bShiftVecUploaded = CL_TRUE;
}
}
//! This function is documented in the header file
-void gpu_init_atomdata(gmx_nbnxn_ocl_t* nb, const nbnxn_atomdata_t* nbat)
+void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
{
cl_int cl_error;
int nalloc, natoms;
bool realloced;
- bool bDoTime = nb->bDoTime == CL_TRUE;
+ bool bDoTime = nb->bDoTime;
cl_timers_t* timers = nb->timers;
cl_atomdata_t* d_atdat = nb->atdat;
cl_command_queue ls = nb->stream[InteractionLocality::Local];
freeDeviceBuffer(&d_atdat->atom_types);
}
- d_atdat->f_elem_size = sizeof(rvec);
-
d_atdat->f = clCreateBuffer(nb->dev_rundata->context, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY,
- nalloc * d_atdat->f_elem_size, nullptr, &cl_error);
+ nalloc * DIM * sizeof(nbat->out[0].f[0]), nullptr, &cl_error);
GMX_RELEASE_ASSERT(cl_error == CL_SUCCESS,
("clCreateBuffer failed: " + ocl_get_error_string(cl_error)).c_str());
{
cl_int gmx_unused cl_error;
- assert(nullptr != kernel_ptr);
+ GMX_ASSERT(kernel_ptr, "Need a valid kernel pointer");
if (*kernel_ptr)
{
}
//! This function is documented in the header file
-void gpu_free(gmx_nbnxn_ocl_t* nb)
+void gpu_free(NbnxmGpu* nb)
{
if (nb == nullptr)
{
/* Free timers and timings */
delete nb->timers;
sfree(nb->timings);
- sfree(nb);
+ delete nb;
if (debug)
{
}
//! This function is documented in the header file
-gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(gmx_nbnxn_ocl_t* nb)
+gmx_wallclock_gpu_nbnxn_t* gpu_get_timings(NbnxmGpu* nb)
{
return (nb != nullptr && nb->bDoTime) ? nb->timings : nullptr;
}
}
//! This function is documented in the header file
-int gpu_min_ci_balanced(gmx_nbnxn_ocl_t* nb)
+int gpu_min_ci_balanced(NbnxmGpu* nb)
{
- return nb != nullptr ? gpu_min_ci_balanced_factor * nb->dev_info->compute_units : 0;
+ return nb != nullptr ? gpu_min_ci_balanced_factor * nb->deviceInfo->compute_units : 0;
}
//! This function is documented in the header file
-gmx_bool gpu_is_kernel_ewald_analytical(const gmx_nbnxn_ocl_t* nb)
+gmx_bool gpu_is_kernel_ewald_analytical(const NbnxmGpu* nb)
{
return ((nb->nbparam->eeltype == eelOclEWALD_ANA) || (nb->nbparam->eeltype == eelOclEWALD_ANA_TWIN));
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* A fatal error results if compilation fails.
*
- * \param[inout] nb Manages OpenCL non-bonded calculations; compiled kernels returned in dev_info members
+ * \param[inout] nb Manages OpenCL non-bonded calculations; compiled kernels returned in deviceInfo members
*
* Does not throw
*/
-void nbnxn_gpu_compile_kernels(gmx_nbnxn_ocl_t* nb)
+void nbnxn_gpu_compile_kernels(NbnxmGpu* nb)
{
gmx_bool bFastGen = TRUE;
cl_program program = nullptr;
std::string extraDefines =
makeDefinesForKernelTypes(bFastGen, nb->nbparam->eeltype, nb->nbparam->vdwtype);
- /* Here we pass macros and static const int variables defined
+ /* Here we pass macros and static const/constexpr int variables defined
* in include files outside the opencl as macros, to avoid
- * including those files in the JIT compilation that happens
- * at runtime. This is particularly a problem for headers that
- * depend on config.h, such as pairlist.h. */
+ * including those files in the plain-C JIT compilation that happens
+ * at runtime. */
extraDefines += gmx::formatString(
- " -DNBNXN_GPU_CLUSTER_SIZE=%d "
+ " -Dc_nbnxnGpuClusterSize=%d"
+ " -Dc_nbnxnMinDistanceSquared=%g"
+ " -Dc_nbnxnGpuNumClusterPerSupercluster=%d"
+ " -Dc_nbnxnGpuJgroupSize=%d"
"%s",
- c_nbnxnGpuClusterSize, /* Defined in nbnxn_pairlist.h */
- (nb->bPrefetchLjParam) ? "-DIATYPE_SHMEM" : "");
+ c_nbnxnGpuClusterSize, c_nbnxnMinDistanceSquared, c_nbnxnGpuNumClusterPerSupercluster,
+ c_nbnxnGpuJgroupSize, (nb->bPrefetchLjParam) ? " -DIATYPE_SHMEM" : "");
try
{
/* TODO when we have a proper MPI-aware logging module,
the log output here should be written there */
program = gmx::ocl::compileProgram(
stderr, "gromacs/nbnxm/opencl", "nbnxm_ocl_kernels.cl", extraDefines,
- nb->dev_rundata->context, nb->dev_info->ocl_gpu_id.ocl_device_id,
- nb->dev_info->vendor_e);
+ nb->dev_rundata->context, nb->deviceInfo->oclDeviceId, nb->deviceInfo->deviceVendor);
}
catch (gmx::GromacsException& e)
{
e.prependContext(gmx::formatString("Failed to compile NBNXN kernels for GPU #%s\n",
- nb->dev_info->device_name));
+ nb->deviceInfo->device_name));
throw;
}
}
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2012-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const int bidx = get_group_id(0);
const int widx = tidx / WARP_SIZE; /* warp index */
- /*! i-cluster interaction mask for a super-cluster with all NCL_PER_SUPERCL=8 bits set */
- const unsigned superClInteractionMask = ((1U << NCL_PER_SUPERCL) - 1U);
+ /*! i-cluster interaction mask for a super-cluster with all c_nbnxnGpuNumClusterPerSupercluster=8 bits set */
+ const unsigned superClInteractionMask = ((1U << c_nbnxnGpuNumClusterPerSupercluster) - 1U);
-#define LOCAL_OFFSET (xqib + NCL_PER_SUPERCL * CL_SIZE)
+#define LOCAL_OFFSET (xqib + c_nbnxnGpuNumClusterPerSupercluster * CL_SIZE)
CjType cjs = 0;
#if USE_CJ_PREFETCH
/* shmem buffer for cj, for both warps separately */
/* shmem buffer for i atom-type pre-loading */
__local int* atib = (__local int*)(LOCAL_OFFSET); //NOLINT(google-readability-casting)
# undef LOCAL_OFFSET
-# define LOCAL_OFFSET (atib + NCL_PER_SUPERCL * CL_SIZE)
+# define LOCAL_OFFSET (atib + c_nbnxnGpuNumClusterPerSupercluster * CL_SIZE)
# else
__local float2* ljcpib = (__local float2*)(LOCAL_OFFSET);
# undef LOCAL_OFFSET
-# define LOCAL_OFFSET (ljcpib + NCL_PER_SUPERCL * CL_SIZE)
+# define LOCAL_OFFSET (ljcpib + c_nbnxnGpuNumClusterPerSupercluster * CL_SIZE)
# endif
#endif
const int cij4_start = nb_sci.cj4_ind_start; /* first ...*/
const int cij4_end = nb_sci.cj4_ind_end; /* and last index of j clusters */
- for (int i = 0; i < NCL_PER_SUPERCL; i += CL_SIZE)
+ for (int i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i += CL_SIZE)
{
/* Pre-load i-atom x and q into shared memory */
- const int ci = sci * NCL_PER_SUPERCL + tidxj + i;
+ const int ci = sci * c_nbnxnGpuNumClusterPerSupercluster + tidxj + i;
const int ai = ci * CL_SIZE + tidxi;
float4 xqbuf = xq[ai]
#endif
barrier(CLK_LOCAL_MEM_FENCE);
- float3 fci_buf[NCL_PER_SUPERCL]; /* i force buffer */
- for (int ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
+ float3 fci_buf[c_nbnxnGpuNumClusterPerSupercluster]; /* i force buffer */
+ for (int ci_offset = 0; ci_offset < c_nbnxnGpuNumClusterPerSupercluster; ci_offset++)
{
fci_buf[ci_offset] = (float3)(0.0F);
}
float E_el = 0.0F;
# if defined EXCLUSION_FORCES /* Ewald or RF */
- if (nb_sci.shift == CENTRAL && pl_cj4[cij4_start].cj[0] == sci * NCL_PER_SUPERCL)
+ if (nb_sci.shift == CENTRAL && pl_cj4[cij4_start].cj[0] == sci * c_nbnxnGpuNumClusterPerSupercluster)
{
/* we have the diagonal: add the charge and LJ self interaction energy term */
- for (int i = 0; i < NCL_PER_SUPERCL; i++)
+ for (int i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
# if defined EL_EWALD_ANY || defined EL_RF || defined EL_CUTOFF
const float qi = xqib[i * CL_SIZE + tidxi].w;
E_el += qi * qi;
# endif
# if defined LJ_EWALD
- E_lj += nbfp_climg2d[atom_types[(sci * NCL_PER_SUPERCL + i) * CL_SIZE + tidxi] * (ntypes + 1) * 2];
+ E_lj += nbfp_climg2d[atom_types[(sci * c_nbnxnGpuNumClusterPerSupercluster + i) * CL_SIZE + tidxi]
+ * (ntypes + 1) * 2];
# endif /* LJ_EWALD */
}
#endif
for (int jm = 0; jm < c_nbnxnGpuJgroupSize; jm++)
{
- if (imask & (superClInteractionMask << (jm * NCL_PER_SUPERCL)))
+ if (imask & (superClInteractionMask << (jm * c_nbnxnGpuNumClusterPerSupercluster)))
{
- unsigned int mask_ji = (1U << (jm * NCL_PER_SUPERCL));
+ unsigned int mask_ji = (1U << (jm * c_nbnxnGpuNumClusterPerSupercluster));
const int cj = loadCj(cjs, pl_cj4[j4].cj, jm, tidxi, tidxj);
const int aj = cj * CL_SIZE + tidxj;
#if !defined PRUNE_NBL
# pragma unroll 8
#endif
- for (int i = 0; i < NCL_PER_SUPERCL; i++)
+ for (int i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
if (imask & mask_ji)
{
- const int gmx_unused ci = sci * NCL_PER_SUPERCL + i; /* i cluster index */
+ const int gmx_unused ci = sci * c_nbnxnGpuNumClusterPerSupercluster + i; /* i cluster index */
/* all threads load an atom from i cluster ci into shmem! */
const float4 xiqbuf = xqib[i * CL_SIZE + tidxi];
# endif /* LJ_COMB_GEOM */
#endif /* LJ_COMB */
- // Ensure distance do not become so small that r^-12 overflows
- r2 = max(r2, NBNXN_MIN_RSQ);
+ // Ensure distance do not become so small that r^-12 overflows.
+ // Cast to float to ensure the correct built-in max() function
+ // is called.
+ r2 = max(r2, (float)c_nbnxnMinDistanceSquared);
const float inv_r = rsqrt(r2);
const float inv_r2 = inv_r * inv_r;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#endif
// TODO move these consts to utils and unify their use with the nonbonded kernels
- const int c_numClPerSupercl = NCL_PER_SUPERCL;
- const int c_clSize = CL_SIZE;
+ const int c_clSize = CL_SIZE;
// TODO pass this value at compile-time as a macro
const int c_nbnxnGpuClusterpairSplit = 2;
- /*! i-cluster interaction mask for a super-cluster with all c_numClPerSupercl=8 bits set */
- const unsigned superClInteractionMask = ((1U << c_numClPerSupercl) - 1U);
+ /*! i-cluster interaction mask for a super-cluster with all c_nbnxnGpuNumClusterPerSupercluster=8 bits set */
+ const unsigned superClInteractionMask = ((1U << c_nbnxnGpuNumClusterPerSupercluster) - 1U);
-#define LOCAL_OFFSET (xib + c_numClPerSupercl * c_clSize)
+#define LOCAL_OFFSET (xib + c_nbnxnGpuNumClusterPerSupercluster * c_clSize)
/* shmem buffer for i cj pre-loading */
CjType cjs = 0;
#if USE_CJ_PREFETCH
cjs = (((__local int*)(LOCAL_OFFSET)) + tidxz * c_nbnxnGpuClusterpairSplit * c_nbnxnGpuJgroupSize);
# undef LOCAL_OFFSET
/* Offset calculated using xib because cjs depends on on tidxz! */
-# define LOCAL_OFFSET \
- (((__local int*)(xib + c_numClPerSupercl * c_clSize)) \
+# define LOCAL_OFFSET \
+ (((__local int*)(xib + c_nbnxnGpuNumClusterPerSupercluster * c_clSize)) \
+ (NTHREAD_Z * c_nbnxnGpuClusterpairSplit * c_nbnxnGpuJgroupSize))
#endif
#if !USE_SUBGROUP_ANY
if (tidxz == 0)
{
- for (int i = 0; i < NCL_PER_SUPERCL; i += CL_SIZE)
+ for (int i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i += CL_SIZE)
{
/* Pre-load i-atom x and q into shared memory */
- const int ci = sci * c_numClPerSupercl + tidxj + i;
+ const int ci = sci * c_nbnxnGpuNumClusterPerSupercluster + tidxj + i;
const int ai = ci * c_clSize + tidxi;
/* We don't need q, but using float4 in shmem avoids bank conflicts */
#pragma unroll 4
for (int jm = 0; jm < c_nbnxnGpuJgroupSize; jm++)
{
- if (imaskCheck & (superClInteractionMask << (jm * c_numClPerSupercl)))
+ if (imaskCheck & (superClInteractionMask << (jm * c_nbnxnGpuNumClusterPerSupercluster)))
{
- unsigned int mask_ji = (1U << (jm * c_numClPerSupercl));
+ unsigned int mask_ji = (1U << (jm * c_nbnxnGpuNumClusterPerSupercluster));
const int cj = loadCj(cjs, pl_cj4[j4].cj, jm, tidxi, tidxj);
const int aj = cj * c_clSize + tidxj;
const float3 xj = (float3)(tmp.xyz);
#pragma unroll 8
- for (int i = 0; i < c_numClPerSupercl; i++)
+ for (int i = 0; i < c_nbnxnGpuNumClusterPerSupercluster; i++)
{
if (imaskCheck & mask_ji)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ * \brief
+ * Utility constant and function declaration for the OpenCL non-bonded kernels.
+ * This header should be included once at the top level, just before the
+ * kernels are included (has to be preceded by nbnxn_ocl_types.h).
+ *
+ * \author Szilárd Páll <pall.szilard@gmail.com>
+ * \ingroup module_nbnxm
+ */
#define GMX_DOUBLE 0
#include "gromacs/gpu_utils/device_utils.clh"
#include "gromacs/gpu_utils/vectype_ops.clh"
-#include "gromacs/nbnxm/constants.h"
#include "gromacs/pbcutil/ishift.h"
#include "nbnxm_ocl_consts.h"
-#define CL_SIZE (NBNXN_GPU_CLUSTER_SIZE)
-#define NCL_PER_SUPERCL c_nbnxnGpuNumClusterPerSupercluster
+#define CL_SIZE (c_nbnxnGpuClusterSize)
#define WARP_SIZE (CL_SIZE * CL_SIZE / 2) // Currently only c_nbnxnGpuClusterpairSplit=2 supported
typedef struct cl_nbparam_params
{
- int eeltype; /**< type of electrostatics, takes values from #eelCu */
- int vdwtype; /**< type of VdW impl., takes values from #evdwCu */
-
- float epsfac; /**< charge multiplication factor */
- float c_rf; /**< Reaction-field/plain cutoff electrostatics const. */
- float two_k_rf; /**< Reaction-field electrostatics constant */
- float ewald_beta; /**< Ewald/PME parameter */
- float sh_ewald; /**< Ewald/PME correction term substracted from the direct-space potential */
- float sh_lj_ewald; /**< LJ-Ewald/PME correction term added to the correction potential */
- float ewaldcoeff_lj; /**< LJ-Ewald/PME coefficient */
-
- float rcoulomb_sq; /**< Coulomb cut-off squared */
-
- float rvdw_sq; /**< VdW cut-off squared */
- float rvdw_switch; /**< VdW switched cut-off */
- float rlistOuter_sq; /**< Full, outer pair-list cut-off squared */
- float rlistInner_sq; /**< Inner, dynamic pruned pair-list cut-off squared XXX: this is only needed in the pruning kernels, but for now we also pass it to the nonbondeds */
-
- shift_consts_t dispersion_shift; /**< VdW shift dispersion constants */
- shift_consts_t repulsion_shift; /**< VdW shift repulsion constants */
- switch_consts_t vdw_switch; /**< VdW switch constants */
+ //! type of electrostatics, takes values from #eelCu
+ int eeltype;
+ //! type of VdW impl., takes values from #evdwCu
+ int vdwtype;
+
+ //! charge multiplication factor
+ float epsfac;
+ //! Reaction-field/plain cutoff electrostatics const.
+ float c_rf;
+ //! Reaction-field electrostatics constant
+ float two_k_rf;
+ //! Ewald/PME parameter
+ float ewald_beta;
+ //! Ewald/PME correction term substracted from the direct-space potential
+ float sh_ewald;
+ //! LJ-Ewald/PME correction term added to the correction potential
+ float sh_lj_ewald;
+ //! LJ-Ewald/PME coefficient
+ float ewaldcoeff_lj;
+
+ //! Coulomb cut-off squared
+ float rcoulomb_sq;
+
+ //! VdW cut-off squared
+ float rvdw_sq;
+ //! VdW switched cut-off
+ float rvdw_switch;
+ //! Full, outer pair-list cut-off squared
+ float rlistOuter_sq;
+ //! Inner, dynamic pruned pair-list cut-off squared XXX: this is only needed in the pruning kernels, but for now we also pass it to the nonbondeds
+ float rlistInner_sq;
+
+ //! VdW shift dispersion constants
+ shift_consts_t dispersion_shift;
+ //! VdW shift repulsion constants
+ shift_consts_t repulsion_shift;
+ //! VdW switch constants
+ switch_consts_t vdw_switch;
/* Ewald Coulomb force table data - accessed through texture memory */
- float coulomb_tab_scale; /**< table scale/spacing */
+ //! table scale/spacing
+ float coulomb_tab_scale;
} cl_nbparam_params_t;
typedef struct
{
- int sci; /* i-super-cluster */
- int shift; /* Shift vector index plus possible flags */
- int cj4_ind_start; /* Start index into cj4 */
- int cj4_ind_end; /* End index into cj4 */
+ //! i-super-cluster
+ int sci;
+ //! Shift vector index plus possible flags
+ int shift;
+ //! Start index into cj4
+ int cj4_ind_start;
+ //! End index into cj4
+ int cj4_ind_end;
} nbnxn_sci_t;
typedef struct
{
- unsigned int imask; /* The i-cluster interactions mask for 1 warp */
- int excl_ind; /* Index into the exclusion array for 1 warp */
+ //! The i-cluster interactions mask for 1 warp
+ unsigned int imask;
+ //! Index into the exclusion array for 1 warp
+ int excl_ind;
} nbnxn_im_ei_t;
typedef struct
{
- int cj[4]; /* The 4 j-clusters */
- nbnxn_im_ei_t imei[2]; /* The i-cluster mask data for 2 warps */
+ //! The 4 j-clusters
+ int cj[4];
+ //! The i-cluster mask data for 2 warps
+ nbnxn_im_ei_t imei[2];
} nbnxn_cj4_t;
*/
} nbnxn_excl_t;
-/*! i-cluster interaction mask for a super-cluster with all NCL_PER_SUPERCL bits set */
-__constant unsigned supercl_interaction_mask = ((1U << NCL_PER_SUPERCL) - 1U);
+/*! i-cluster interaction mask for a super-cluster with all c_nbnxnGpuNumClusterPerSupercluster bits set */
+__constant unsigned supercl_interaction_mask = ((1U << c_nbnxnGpuNumClusterPerSupercluster) - 1U);
gmx_opencl_inline void preloadCj4Generic(__local int* sm_cjPreload,
const __global int* gm_cj,
/* Only does reduction over 4 elements in cluster (2 per warp). Needs to be changed
* for CL_SIZE>4.*/
float2 fshift_buf = 0;
- for (int ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
+ for (int ci_offset = 0; ci_offset < c_nbnxnGpuNumClusterPerSupercluster; ci_offset++)
{
- int aidx = (sci * NCL_PER_SUPERCL + ci_offset) * CL_SIZE + tidxi;
+ int aidx = (sci * c_nbnxnGpuNumClusterPerSupercluster + ci_offset) * CL_SIZE + tidxi;
float3 fin = fci_buf[ci_offset];
fin.x += intel_sub_group_shuffle_down(fin.x, fin.x, CL_SIZE);
fin.y += intel_sub_group_shuffle_up(fin.y, fin.y, CL_SIZE);
__global float* fshift)
{
float fshift_buf = 0;
- for (int ci_offset = 0; ci_offset < NCL_PER_SUPERCL; ci_offset++)
+ for (int ci_offset = 0; ci_offset < c_nbnxnGpuNumClusterPerSupercluster; ci_offset++)
{
- int aidx = (sci * NCL_PER_SUPERCL + ci_offset) * CL_SIZE + tidxi;
+ int aidx = (sci * c_nbnxnGpuNumClusterPerSupercluster + ci_offset) * CL_SIZE + tidxi;
int tidx = tidxi + tidxj * CL_SIZE;
/* store i forces in shmem */
f_buf[tidx] = fci_buf[ci_offset].x;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "nbnxm_ocl_consts.h"
+struct gmx_wallclock_gpu_nbnxn_t;
+
/* kernel does #include "gromacs/math/utilities.h" */
/* Move the actual useful stuff here: */
const int c_oclPruneKernelJ4ConcurrencyDEFAULT = GMX_NBNXN_PRUNE_KERNEL_J4_CONCURRENCY_DEFAULT;
/*! @} */
-/*! \brief Returns the j4 processing concurrency parameter for the vendor \p vendorId
- * \param vendorId takes values from #ocl_vendor_id_t.
- */
-static inline int getOclPruneKernelJ4Concurrency(int vendorId)
-{
- switch (vendorId)
- {
- default: return c_oclPruneKernelJ4ConcurrencyDEFAULT;
- }
-}
-
-
/*! \brief Electrostatic OpenCL kernel flavors.
*
* Types of electrostatics implementations available in the OpenCL non-bonded
* The energies/shift forces get downloaded here first, before getting added
* to the CPU-side aggregate values.
*/
-typedef struct cl_nb_staging
+struct nb_staging_t
{
- float* e_lj; /**< LJ energy */
- float* e_el; /**< electrostatic energy */
- float (*fshift)[3]; /**< float3 buffer with shift forces */
-} cl_nb_staging_t;
+ //! LJ energy
+ float* e_lj = nullptr;
+ //! electrostatic energy
+ float* e_el = nullptr;
+ //! float3 buffer with shift forces
+ float (*fshift)[3] = nullptr;
+};
/*! \internal
* \brief Nonbonded atom data - both inputs and outputs.
*/
typedef struct cl_atomdata
{
- int natoms; /**< number of atoms */
- int natoms_local; /**< number of local atoms */
- int nalloc; /**< allocation size for the atom data (xq, f) */
-
- cl_mem xq; /**< float4 buffer with atom coordinates + charges, size natoms */
-
- cl_mem f; /**< float3 buffer with force output array, size natoms */
- size_t f_elem_size; /**< Size in bytes for one element of f buffer */
-
- cl_mem e_lj; /**< LJ energy output, size 1 */
- cl_mem e_el; /**< Electrostatics energy input, size 1 */
-
- cl_mem fshift; /**< float3 buffer with shift forces */
- size_t fshift_elem_size; /**< Size in bytes for one element of fshift buffer */
-
- int ntypes; /**< number of atom types */
- cl_mem atom_types; /**< int buffer with atom type indices, size natoms */
- cl_mem lj_comb; /**< float2 buffer with sqrt(c6),sqrt(c12), size natoms */
-
- cl_mem shift_vec; /**< float3 buffer with shifts values */
- size_t shift_vec_elem_size; /**< Size in bytes for one element of shift_vec buffer */
-
- cl_bool bShiftVecUploaded; /**< true if the shift vector has been uploaded */
+ //! number of atoms
+ int natoms;
+ //! number of local atoms
+ int natoms_local;
+ //! allocation size for the atom data (xq, f)
+ int nalloc;
+
+ //! float4 buffer with atom coordinates + charges, size natoms
+ cl_mem xq;
+
+ //! float3 buffer with force output array, size natoms
+ cl_mem f;
+
+ //! LJ energy output, size 1
+ cl_mem e_lj;
+ //! Electrostatics energy input, size 1
+ cl_mem e_el;
+
+ //! float3 buffer with shift forces
+ cl_mem fshift;
+
+ //! number of atom types
+ int ntypes;
+ //! int buffer with atom type indices, size natoms
+ cl_mem atom_types;
+ //! float2 buffer with sqrt(c6),sqrt(c12), size natoms
+ cl_mem lj_comb;
+
+ //! float3 buffer with shifts values
+ cl_mem shift_vec;
+
+ //! true if the shift vector has been uploaded
+ bool bShiftVecUploaded;
} cl_atomdata_t;
/*! \internal
typedef struct cl_nbparam
{
- int eeltype; /**< type of electrostatics, takes values from #eelOcl */
- int vdwtype; /**< type of VdW impl., takes values from #evdwOcl */
-
- float epsfac; /**< charge multiplication factor */
- float c_rf; /**< Reaction-field/plain cutoff electrostatics const. */
- float two_k_rf; /**< Reaction-field electrostatics constant */
- float ewald_beta; /**< Ewald/PME parameter */
- float sh_ewald; /**< Ewald/PME correction term substracted from the direct-space potential */
- float sh_lj_ewald; /**< LJ-Ewald/PME correction term added to the correction potential */
- float ewaldcoeff_lj; /**< LJ-Ewald/PME coefficient */
-
- float rcoulomb_sq; /**< Coulomb cut-off squared */
-
- float rvdw_sq; /**< VdW cut-off squared */
- float rvdw_switch; /**< VdW switched cut-off */
- float rlistOuter_sq; /**< Full, outer pair-list cut-off squared */
- float rlistInner_sq; /**< Inner, dynamic pruned pair-list cut-off squared */
- bool useDynamicPruning; /**< True if we use dynamic pair-list pruning */
-
- shift_consts_t dispersion_shift; /**< VdW shift dispersion constants */
- shift_consts_t repulsion_shift; /**< VdW shift repulsion constants */
- switch_consts_t vdw_switch; /**< VdW switch constants */
+ //! type of electrostatics, takes values from #eelOcl
+ int eeltype;
+ //! type of VdW impl., takes values from #evdwOcl
+ int vdwtype;
+
+ //! charge multiplication factor
+ float epsfac;
+ //! Reaction-field/plain cutoff electrostatics const.
+ float c_rf;
+ //! Reaction-field electrostatics constant
+ float two_k_rf;
+ //! Ewald/PME parameter
+ float ewald_beta;
+ //! Ewald/PME correction term substracted from the direct-space potential
+ float sh_ewald;
+ //! LJ-Ewald/PME correction term added to the correction potential
+ float sh_lj_ewald;
+ //! LJ-Ewald/PME coefficient
+ float ewaldcoeff_lj;
+
+ //! Coulomb cut-off squared
+ float rcoulomb_sq;
+
+ //! VdW cut-off squared
+ float rvdw_sq;
+ //! VdW switched cut-off
+ float rvdw_switch;
+ //! Full, outer pair-list cut-off squared
+ float rlistOuter_sq;
+ //! Inner, dynamic pruned pair-list cut-off squared
+ float rlistInner_sq;
+ //! True if we use dynamic pair-list pruning
+ bool useDynamicPruning;
+
+ //! VdW shift dispersion constants
+ shift_consts_t dispersion_shift;
+ //! VdW shift repulsion constants
+ shift_consts_t repulsion_shift;
+ //! VdW switch constants
+ switch_consts_t vdw_switch;
/* LJ non-bonded parameters - accessed through texture memory */
- cl_mem nbfp_climg2d; /**< nonbonded parameter table with C6/C12 pairs per atom type-pair, 2*ntype^2 elements */
- cl_mem nbfp_comb_climg2d; /**< nonbonded parameter table per atom type, 2*ntype elements */
+ //! nonbonded parameter table with C6/C12 pairs per atom type-pair, 2*ntype^2 elements
+ cl_mem nbfp_climg2d;
+ //! nonbonded parameter table per atom type, 2*ntype elements
+ cl_mem nbfp_comb_climg2d;
/* Ewald Coulomb force table data - accessed through texture memory */
- float coulomb_tab_scale; /**< table scale/spacing */
- cl_mem coulomb_tab_climg2d; /**< pointer to the table in the device memory */
+ //! table scale/spacing
+ float coulomb_tab_scale;
+ //! pointer to the table in the device memory
+ cl_mem coulomb_tab_climg2d;
} cl_nbparam_t;
/*! \internal
typedef struct cl_nbparam_params
{
- int eeltype; /**< type of electrostatics, takes values from #eelCu */
- int vdwtype; /**< type of VdW impl., takes values from #evdwCu */
-
- float epsfac; /**< charge multiplication factor */
- float c_rf; /**< Reaction-field/plain cutoff electrostatics const. */
- float two_k_rf; /**< Reaction-field electrostatics constant */
- float ewald_beta; /**< Ewald/PME parameter */
- float sh_ewald; /**< Ewald/PME correction term substracted from the direct-space potential */
- float sh_lj_ewald; /**< LJ-Ewald/PME correction term added to the correction potential */
- float ewaldcoeff_lj; /**< LJ-Ewald/PME coefficient */
-
- float rcoulomb_sq; /**< Coulomb cut-off squared */
-
- float rvdw_sq; /**< VdW cut-off squared */
- float rvdw_switch; /**< VdW switched cut-off */
- float rlistOuter_sq; /**< Full, outer pair-list cut-off squared */
- float rlistInner_sq; /**< Inner, dynamic pruned pair-list cut-off squared */
-
- shift_consts_t dispersion_shift; /**< VdW shift dispersion constants */
- shift_consts_t repulsion_shift; /**< VdW shift repulsion constants */
- switch_consts_t vdw_switch; /**< VdW switch constants */
+ //! type of electrostatics, takes values from #eelCu
+ int eeltype;
+ //! type of VdW impl., takes values from #evdwCu
+ int vdwtype;
+
+ //! charge multiplication factor
+ float epsfac;
+ //! Reaction-field/plain cutoff electrostatics const.
+ float c_rf;
+ //! Reaction-field electrostatics constant
+ float two_k_rf;
+ //! Ewald/PME parameter
+ float ewald_beta;
+ //! Ewald/PME correction term substracted from the direct-space potential
+ float sh_ewald;
+ //! LJ-Ewald/PME correction term added to the correction potential
+ float sh_lj_ewald;
+ //! LJ-Ewald/PME coefficient
+ float ewaldcoeff_lj;
+
+ //! Coulomb cut-off squared
+ float rcoulomb_sq;
+
+ //! VdW cut-off squared
+ float rvdw_sq;
+ //! VdW switched cut-off
+ float rvdw_switch;
+ //! Full, outer pair-list cut-off squared
+ float rlistOuter_sq;
+ //! Inner, dynamic pruned pair-list cut-off squared
+ float rlistInner_sq;
+
+ //! VdW shift dispersion constants
+ shift_consts_t dispersion_shift;
+ //! VdW shift repulsion constants
+ shift_consts_t repulsion_shift;
+ //! VdW switch constants
+ switch_consts_t vdw_switch;
/* Ewald Coulomb force table data - accessed through texture memory */
- float coulomb_tab_scale; /**< table scale/spacing */
+ //! table scale/spacing
+ float coulomb_tab_scale;
} cl_nbparam_params_t;
/*! \internal
* \brief Main data structure for OpenCL nonbonded force calculations.
*/
-struct gmx_nbnxn_ocl_t
+struct NbnxmGpu
{
- const gmx_device_info_t* dev_info; /**< OpenCL device information */
- struct gmx_device_runtime_data_t* dev_rundata; /**< OpenCL runtime data (context, kernels) */
+ //! OpenCL device information
+ const DeviceInformation* deviceInfo = nullptr;
+ //! OpenCL runtime data (context, kernels)
+ struct gmx_device_runtime_data_t* dev_rundata = nullptr;
/**< Pointers to non-bonded kernel functions
* organized similar with nb_kfunc_xxx arrays in nbnxn_ocl.cpp */
///@{
- cl_kernel kernel_noener_noprune_ptr[eelOclNR][evdwOclNR];
- cl_kernel kernel_ener_noprune_ptr[eelOclNR][evdwOclNR];
- cl_kernel kernel_noener_prune_ptr[eelOclNR][evdwOclNR];
- cl_kernel kernel_ener_prune_ptr[eelOclNR][evdwOclNR];
+ cl_kernel kernel_noener_noprune_ptr[eelOclNR][evdwOclNR] = { { nullptr } };
+ cl_kernel kernel_ener_noprune_ptr[eelOclNR][evdwOclNR] = { { nullptr } };
+ cl_kernel kernel_noener_prune_ptr[eelOclNR][evdwOclNR] = { { nullptr } };
+ cl_kernel kernel_ener_prune_ptr[eelOclNR][evdwOclNR] = { { nullptr } };
///@}
- cl_kernel kernel_pruneonly[ePruneNR]; /**< prune kernels, ePruneKind defined the kernel kinds */
+ //! prune kernels, ePruneKind defined the kernel kinds
+ cl_kernel kernel_pruneonly[ePruneNR] = { nullptr };
- bool bPrefetchLjParam; /**< true if prefetching fg i-atom LJ parameters should be used in the kernels */
+ //! true if prefetching fg i-atom LJ parameters should be used in the kernels
+ bool bPrefetchLjParam = false;
/**< auxiliary kernels implementing memset-like functions */
///@{
- cl_kernel kernel_memset_f;
- cl_kernel kernel_memset_f2;
- cl_kernel kernel_memset_f3;
- cl_kernel kernel_zero_e_fshift;
+ cl_kernel kernel_memset_f = nullptr;
+ cl_kernel kernel_memset_f2 = nullptr;
+ cl_kernel kernel_memset_f3 = nullptr;
+ cl_kernel kernel_zero_e_fshift = nullptr;
///@}
- cl_bool bUseTwoStreams; /**< true if doing both local/non-local NB work on GPU */
- cl_bool bNonLocalStreamActive; /**< true indicates that the nonlocal_done event was enqueued */
-
- cl_atomdata_t* atdat; /**< atom data */
- cl_nbparam_t* nbparam; /**< parameters required for the non-bonded calc. */
- gmx::EnumerationArray<Nbnxm::InteractionLocality, cl_plist_t*> plist; /**< pair-list data structures (local and non-local) */
- cl_nb_staging_t nbst; /**< staging area where fshift/energies get downloaded */
-
- gmx::EnumerationArray<Nbnxm::InteractionLocality, cl_command_queue> stream; /**< local and non-local GPU queues */
-
- /** events used for synchronization */
- cl_event nonlocal_done; /**< event triggered when the non-local non-bonded kernel
- is done (and the local transfer can proceed) */
- cl_event misc_ops_and_local_H2D_done; /**< event triggered when the tasks issued in
- the local stream that need to precede the
- non-local force calculations are done
- (e.g. f buffer 0-ing, local x/q H2D) */
+ //! true if doing both local/non-local NB work on GPU
+ bool bUseTwoStreams = false;
+ //! true indicates that the nonlocal_done event was enqueued
+ bool bNonLocalStreamActive = false;
+
+ //! atom data
+ cl_atomdata_t* atdat = nullptr;
+ //! parameters required for the non-bonded calc.
+ cl_nbparam_t* nbparam = nullptr;
+ //! pair-list data structures (local and non-local)
+ gmx::EnumerationArray<Nbnxm::InteractionLocality, cl_plist_t*> plist = { nullptr };
+ //! staging area where fshift/energies get downloaded
+ nb_staging_t nbst;
+
+ //! local and non-local GPU queues
+ gmx::EnumerationArray<Nbnxm::InteractionLocality, cl_command_queue> stream;
+
+ /*! \brief Events used for synchronization */
+ /*! \{ */
+ /*! \brief Event triggered when the non-local non-bonded
+ * kernel is done (and the local transfer can proceed) */
+ cl_event nonlocal_done = nullptr;
+ /*! \brief Event triggered when the tasks issued in the local
+ * stream that need to precede the non-local force or buffer
+ * operation calculations are done (e.g. f buffer 0-ing, local
+ * x/q H2D, buffer op initialization in local stream that is
+ * required also by nonlocal stream ) */
+ cl_event misc_ops_and_local_H2D_done = nullptr;
+ /*! \} */
//! True if there has been local/nonlocal GPU work, either bonded or nonbonded, scheduled
// to be executed in the current domain. As long as bonded work is not split up into
gmx::EnumerationArray<Nbnxm::InteractionLocality, bool> haveWork;
- cl_bool bDoTime; /**< True if event-based timing is enabled. */
- cl_timers_t* timers; /**< OpenCL event-based timers. */
- struct gmx_wallclock_gpu_nbnxn_t* timings; /**< Timing data. TODO: deprecate this and query timers for accumulated data instead */
+ //! True if event-based timing is enabled.
+ bool bDoTime = false;
+ //! OpenCL event-based timers.
+ cl_timers_t* timers = nullptr;
+ //! Timing data. TODO: deprecate this and query timers for accumulated data instead
+ gmx_wallclock_gpu_nbnxn_t* timings = nullptr;
};
#endif /* NBNXN_OPENCL_TYPES_H */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/simd/simd.h"
#include "gromacs/simd/vector_operations.h"
-#include "gromacs/topology/block.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxomp.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/smalloc.h"
-#include "atomdata.h"
#include "boundingboxes.h"
#include "clusterdistancekerneltype.h"
#include "gridset.h"
* Set all atom-pair exclusions from the topology stored in exclusions
* as masks in the pair-list for simple list entry iEntry.
*/
-static void setExclusionsForIEntry(const Nbnxm::GridSet& gridSet,
- NbnxnPairlistCpu* nbl,
- gmx_bool diagRemoved,
- int na_cj_2log,
- const nbnxn_ci_t& iEntry,
- const t_blocka& exclusions)
+static void setExclusionsForIEntry(const Nbnxm::GridSet& gridSet,
+ NbnxnPairlistCpu* nbl,
+ gmx_bool diagRemoved,
+ int na_cj_2log,
+ const nbnxn_ci_t& iEntry,
+ const ListOfLists<int>& exclusions)
{
if (iEntry.cj_ind_end == iEntry.cj_ind_start)
{
if (iAtom >= 0)
{
/* Loop over the topology-based exclusions for this i-atom */
- for (int exclIndex = exclusions.index[iAtom]; exclIndex < exclusions.index[iAtom + 1];
- exclIndex++)
+ for (const int jAtom : exclusions[iAtom])
{
- const int jAtom = exclusions.a[exclIndex];
-
if (jAtom == iAtom)
{
/* The self exclusion are already set, save some time */
static void setExclusionsForIEntry(const Nbnxm::GridSet& gridSet,
NbnxnPairlistGpu* nbl,
gmx_bool diagRemoved,
- int gmx_unused na_cj_2log,
- const nbnxn_sci_t& iEntry,
- const t_blocka& exclusions)
+ int gmx_unused na_cj_2log,
+ const nbnxn_sci_t& iEntry,
+ const ListOfLists<int>& exclusions)
{
if (iEntry.numJClusterGroups() == 0)
{
const int iCluster = i / c_clusterSize;
/* Loop over the topology-based exclusions for this i-atom */
- for (int exclIndex = exclusions.index[iAtom]; exclIndex < exclusions.index[iAtom + 1];
- exclIndex++)
+ for (const int jAtom : exclusions[iAtom])
{
- const int jAtom = exclusions.a[exclIndex];
-
if (jAtom == iAtom)
{
/* The self exclusions are already set, save some time */
const Grid& jGrid,
PairsearchWork* work,
const nbnxn_atomdata_t* nbat,
- const t_blocka& exclusions,
+ const ListOfLists<int>& exclusions,
real rlist,
const PairlistType pairlistType,
int ci_block,
/* Check if we need periodicity shifts.
* Without PBC or with domain decomposition we don't need them.
*/
- if (d >= ePBC2npbcdim(gridSet.domainSetup().ePBC)
+ if (d >= numPbcDimensions(gridSet.domainSetup().pbcType)
|| gridSet.domainSetup().haveMultipleDomainsPerDim[d])
{
shp[d] = 0;
}
}
- /* Set the exclusions for this ci list */
- setExclusionsForIEntry(gridSet, nbl, excludeSubDiagonal, na_cj_2log,
- *getOpenIEntry(nbl), exclusions);
+ if (!exclusions.empty())
+ {
+ /* Set the exclusions for this ci list */
+ setExclusionsForIEntry(gridSet, nbl, excludeSubDiagonal, na_cj_2log,
+ *getOpenIEntry(nbl), exclusions);
+ }
if (haveFep)
{
void PairlistSet::constructPairlists(const Nbnxm::GridSet& gridSet,
gmx::ArrayRef<PairsearchWork> searchWork,
nbnxn_atomdata_t* nbat,
- const t_blocka* excl,
+ const ListOfLists<int>& exclusions,
const int minimumIlistCountForGpuBalancing,
t_nrnb* nrnb,
SearchCycleCounting* searchCycleCounting)
/* Divide the i cells equally over the pairlists */
if (isCpuType_)
{
- nbnxn_make_pairlist_part(gridSet, iGrid, jGrid, &work, nbat, *excl, rlist,
+ nbnxn_make_pairlist_part(gridSet, iGrid, jGrid, &work, nbat, exclusions, rlist,
params_.pairlistType, ci_block, nbat->bUseBufferFlags,
nsubpair_target, progBal, nsubpair_tot_est, th,
numLists, &cpuLists_[th], fepListPtr);
}
else
{
- nbnxn_make_pairlist_part(gridSet, iGrid, jGrid, &work, nbat, *excl, rlist,
+ nbnxn_make_pairlist_part(gridSet, iGrid, jGrid, &work, nbat, exclusions, rlist,
params_.pairlistType, ci_block, nbat->bUseBufferFlags,
nsubpair_target, progBal, nsubpair_tot_est, th,
numLists, &gpuLists_[th], fepListPtr);
void PairlistSets::construct(const InteractionLocality iLocality,
PairSearch* pairSearch,
nbnxn_atomdata_t* nbat,
- const t_blocka* excl,
+ const ListOfLists<int>& exclusions,
const int64_t step,
t_nrnb* nrnb)
{
- pairlistSet(iLocality).constructPairlists(pairSearch->gridSet(), pairSearch->work(), nbat, excl,
+ const auto& gridSet = pairSearch->gridSet();
+ const auto* ddZones = gridSet.domainSetup().zones;
+
+ /* The Nbnxm code can also work with more exclusions than those in i-zones only
+ * when using DD, but the equality check can catch more issues.
+ */
+ GMX_RELEASE_ASSERT(
+ exclusions.empty() || (!ddZones && exclusions.ssize() == gridSet.numRealAtomsTotal())
+ || (ddZones && exclusions.ssize() == ddZones->cg_range[ddZones->iZones.size()]),
+ "exclusions should either be empty or the number of lists should match the number of "
+ "local i-atoms");
+
+ pairlistSet(iLocality).constructPairlists(gridSet, pairSearch->work(), nbat, exclusions,
minimumIlistCountForGpuBalancing_, nrnb,
&pairSearch->cycleCounting_);
}
void nonbonded_verlet_t::constructPairlist(const InteractionLocality iLocality,
- const t_blocka* excl,
+ const ListOfLists<int>& exclusions,
int64_t step,
t_nrnb* nrnb)
{
- pairlistSets_->construct(iLocality, pairSearch_.get(), nbat.get(), excl, step, nrnb);
+ pairlistSets_->construct(iLocality, pairSearch_.get(), nbat.get(), exclusions, step, nrnb);
if (useGpu())
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/real.h"
-// This file with constants is separate from this file to be able
-// to include it during OpenCL jitting without including config.h
-#include "constants.h"
#include "pairlistparams.h"
struct NbnxnPairlistCpuWork;
struct NbnxnPairlistGpuWork;
-/* Convenience type for vector with aligned memory */
+//! Convenience type for vector with aligned memory
template<typename T>
using AlignedVector = std::vector<T, gmx::AlignedAllocator<T>>;
-/* Convenience type for vector that avoids initialization at resize() */
+//! Convenience type for vector that avoids initialization at resize()
template<typename T>
using FastVector = std::vector<T, gmx::DefaultInitializationAllocator<T>>;
-/* A buffer data structure of 64 bytes
+/*! \brief Cache-line protection buffer
+ *
+ * A buffer data structure of 64 bytes
* to be placed at the beginning and end of structs
* to avoid cache invalidation of the real contents
* of the struct by writes to neighboring memory.
*/
typedef struct
{
+ //! Unused field used to create space to protect cache lines that are in use
int dummy[16];
} gmx_cache_protect_t;
-/* This is the actual cluster-pair list j-entry.
+/*! \brief This is the actual cluster-pair list j-entry.
+ *
* cj is the j-cluster.
* The interaction bits in excl are indexed i-major, j-minor.
* The cj entries are sorted such that ones with exclusions come first.
*/
struct nbnxn_cj_t
{
- int cj; /* The j-cluster */
- unsigned int excl; /* The exclusion (interaction) bits */
+ //! The j-cluster
+ int cj;
+ //! The exclusion (interaction) bits
+ unsigned int excl;
};
-/* In nbnxn_ci_t the integer shift contains the shift in the lower 7 bits.
+/*! \brief Constants for interpreting interaction flags
+ *
+ * In nbnxn_ci_t the integer shift contains the shift in the lower 7 bits.
* The upper bits contain information for non-bonded kernel optimization.
* Simply calculating LJ and Coulomb for all pairs in a cluster pair is fine.
* But three flags can be used to skip interactions, currently only for subc=0
* shift & NBNXN_CI_HALF_LJ(subc) => we can skip LJ for the second half of i
* !(shift & NBNXN_CI_DO_COUL(subc)) => we can skip Coulomb for all pairs
*/
+//! \{
#define NBNXN_CI_SHIFT 127
#define NBNXN_CI_DO_LJ(subc) (1 << (7 + 3 * (subc)))
#define NBNXN_CI_HALF_LJ(subc) (1 << (8 + 3 * (subc)))
#define NBNXN_CI_DO_COUL(subc) (1 << (9 + 3 * (subc)))
+//! \}
-/* Cluster-pair Interaction masks
+/*! \brief Cluster-pair Interaction masks
+ *
* Bit i*j-cluster-size + j tells if atom i and j interact.
*/
+//! \{
// TODO: Rename according to convention when moving into Nbnxn namespace
-/* All interaction mask is the same for all kernels */
+//! All interaction mask is the same for all kernels
constexpr unsigned int NBNXN_INTERACTION_MASK_ALL = 0xffffffffU;
-/* 4x4 kernel diagonal mask */
+//! 4x4 kernel diagonal mask
constexpr unsigned int NBNXN_INTERACTION_MASK_DIAG = 0x08ceU;
-/* 4x2 kernel diagonal masks */
+//! 4x2 kernel diagonal masks
+//! \{
constexpr unsigned int NBNXN_INTERACTION_MASK_DIAG_J2_0 = 0x0002U;
constexpr unsigned int NBNXN_INTERACTION_MASK_DIAG_J2_1 = 0x002fU;
-/* 4x8 kernel diagonal masks */
+//! \}
+//! 4x8 kernel diagonal masks
+//! \{
constexpr unsigned int NBNXN_INTERACTION_MASK_DIAG_J8_0 = 0xf0f8fcfeU;
constexpr unsigned int NBNXN_INTERACTION_MASK_DIAG_J8_1 = 0x0080c0e0U;
+//! \}
+//! \}
+
+/*! \brief Lower limit for square interaction distances in nonbonded kernels.
+ *
+ * For smaller values we will overflow when calculating r^-1 or r^-12, but
+ * to keep it simple we always apply the limit from the tougher r^-12 condition.
+ */
+#if GMX_DOUBLE
+// Some double precision SIMD architectures use single precision in the first
+// step, so although the double precision criterion would allow smaller rsq,
+// we need to stay in single precision with some margin for the N-R iterations.
+constexpr double c_nbnxnMinDistanceSquared = 1.0e-36;
+#else
+// The worst intermediate value we might evaluate is r^-12, which
+// means we should ensure r^2 stays above pow(GMX_FLOAT_MAX,-1.0/6.0)*1.01 (some margin)
+constexpr float c_nbnxnMinDistanceSquared = 3.82e-07F; // r > 6.2e-4
+#endif
-/* Simple pair-list i-unit */
+
+//! The number of clusters in a super-cluster, used for GPU
+constexpr int c_nbnxnGpuNumClusterPerSupercluster = 8;
+
+/*! \brief With GPU kernels we group cluster pairs in 4 to optimize memory usage
+ * of integers containing 32 bits.
+ */
+constexpr int c_nbnxnGpuJgroupSize = (32 / c_nbnxnGpuNumClusterPerSupercluster);
+
+/*! \internal
+ * \brief Simple pair-list i-unit
+ */
struct nbnxn_ci_t
{
- int ci; /* i-cluster */
- int shift; /* Shift vector index plus possible flags, see above */
- int cj_ind_start; /* Start index into cj */
- int cj_ind_end; /* End index into cj */
+ //! i-cluster
+ int ci;
+ //! Shift vector index plus possible flags, see above
+ int shift;
+ //! Start index into cj
+ int cj_ind_start;
+ //! End index into cj
+ int cj_ind_end;
};
-/* Grouped pair-list i-unit */
+//! Grouped pair-list i-unit
typedef struct
{
- /* Returns the number of j-cluster groups in this entry */
+ //! Returns the number of j-cluster groups in this entry
int numJClusterGroups() const { return cj4_ind_end - cj4_ind_start; }
- int sci; /* i-super-cluster */
- int shift; /* Shift vector index plus possible flags */
- int cj4_ind_start; /* Start index into cj4 */
- int cj4_ind_end; /* End index into cj4 */
+ //! i-super-cluster
+ int sci;
+ //! Shift vector index plus possible flags
+ int shift;
+ //! Start index into cj4
+ int cj4_ind_start;
+ //! End index into cj4
+ int cj4_ind_end;
} nbnxn_sci_t;
-/* Interaction data for a j-group for one warp */
+//! Interaction data for a j-group for one warp
struct nbnxn_im_ei_t
{
- // The i-cluster interactions mask for 1 warp
+ //! The i-cluster interactions mask for 1 warp
unsigned int imask = 0U;
- // Index into the exclusion array for 1 warp, default index 0 which means no exclusions
+ //! Index into the exclusion array for 1 warp, default index 0 which means no exclusions
int excl_ind = 0;
};
+//! Four-way j-cluster lists
typedef struct
{
- int cj[c_nbnxnGpuJgroupSize]; /* The 4 j-clusters */
- nbnxn_im_ei_t imei[c_nbnxnGpuClusterpairSplit]; /* The i-cluster mask data for 2 warps */
+ //! The 4 j-clusters
+ int cj[c_nbnxnGpuJgroupSize];
+ //! The i-cluster mask data for 2 warps
+ nbnxn_im_ei_t imei[c_nbnxnGpuClusterpairSplit];
} nbnxn_cj4_t;
-/* Struct for storing the atom-pair interaction bits for a cluster pair in a GPU pairlist */
+//! Struct for storing the atom-pair interaction bits for a cluster pair in a GPU pairlist
struct nbnxn_excl_t
{
- /* Constructor, sets no exclusions, so all atom pairs interacting */
+ //! Constructor, sets no exclusions, so all atom pairs interacting
nbnxn_excl_t()
{
for (unsigned int& pairEntry : pair)
}
}
- /* Topology exclusion interaction bits per warp */
+ //! Topology exclusion interaction bits per warp
unsigned int pair[c_nbnxnGpuExclSize];
};
-/* Cluster pairlist type for use on CPUs */
+//! Cluster pairlist type for use on CPUs
struct NbnxnPairlistCpu
{
NbnxnPairlistCpu();
+ //! Cache protection
gmx_cache_protect_t cp0;
- int na_ci; /* The number of atoms per i-cluster */
- int na_cj; /* The number of atoms per j-cluster */
- real rlist; /* The radius for constructing the list */
- FastVector<nbnxn_ci_t> ci; /* The i-cluster list */
- FastVector<nbnxn_ci_t> ciOuter; /* The outer, unpruned i-cluster list */
-
- FastVector<nbnxn_cj_t> cj; /* The j-cluster list, size ncj */
- FastVector<nbnxn_cj_t> cjOuter; /* The outer, unpruned j-cluster list */
- int ncjInUse; /* The number of j-clusters that are used by ci entries in this list, will be <= cj.size() */
-
- int nci_tot; /* The total number of i clusters */
+ //! The number of atoms per i-cluster
+ int na_ci;
+ //! The number of atoms per j-cluster
+ int na_cj;
+ //! The radius for constructing the list
+ real rlist;
+ //! The i-cluster list
+ FastVector<nbnxn_ci_t> ci;
+ //! The outer, unpruned i-cluster list
+ FastVector<nbnxn_ci_t> ciOuter;
+
+ //! The j-cluster list, size ncj
+ FastVector<nbnxn_cj_t> cj;
+ //! The outer, unpruned j-cluster list
+ FastVector<nbnxn_cj_t> cjOuter;
+ //! The number of j-clusters that are used by ci entries in this list, will be <= cj.size()
+ int ncjInUse;
+
+ //! The total number of i clusters
+ int nci_tot;
- /* Working data storage for list construction */
+ //! Working data storage for list construction
std::unique_ptr<NbnxnPairlistCpuWork> work;
+ //! Cache protection
gmx_cache_protect_t cp1;
};
*/
struct NbnxnPairlistGpu
{
- /* Constructor
+ /*! \brief Constructor
*
* \param[in] pinningPolicy Sets the pinning policy for all buffers used on the GPU
*/
NbnxnPairlistGpu(gmx::PinningPolicy pinningPolicy);
+ //! Cache protection
gmx_cache_protect_t cp0;
- int na_ci; /* The number of atoms per i-cluster */
- int na_cj; /* The number of atoms per j-cluster */
- int na_sc; /* The number of atoms per super cluster */
- real rlist; /* The radius for constructing the list */
+ //! The number of atoms per i-cluster
+ int na_ci;
+ //! The number of atoms per j-cluster
+ int na_cj;
+ //! The number of atoms per super cluster
+ int na_sc;
+ //! The radius for constructing the list
+ real rlist;
// The i-super-cluster list, indexes into cj4;
gmx::HostVector<nbnxn_sci_t> sci;
// The list of 4*j-cluster groups
// The total number of i-clusters
int nci_tot;
- /* Working data storage for list construction */
+ //! Working data storage for list construction
std::unique_ptr<NbnxnPairlistGpuWork> work;
+ //! Cache protection
gmx_cache_protect_t cp1;
};
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ *
+ * \brief
+ * Declares inline-friendly code for making 2xNN pairlists
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
+
-/* Stride of the packed x coordinate array */
+//! Stride of the packed x coordinate array
static constexpr int c_xStride2xNN = (GMX_SIMD_REAL_WIDTH >= 2 * c_nbnxnCpuIClusterSize)
? GMX_SIMD_REAL_WIDTH / 2
: c_nbnxnCpuIClusterSize;
-/* Copies PBC shifted i-cell packed atom coordinates to working array */
+//! Copies PBC shifted i-cell packed atom coordinates to working array
static inline void icell_set_x_simd_2xnn(int ci,
real shx,
real shy,
loadU1DualHsimd(x + ia + 2 * c_xStride2xNN + 2) + SimdReal(shz));
}
-/* SIMD code for checking and adding cluster-pairs to the list using coordinates in packed format.
+/*! \brief SIMD code for checking and adding cluster-pairs to the list using coordinates in packed format.
*
* Checks bouding box distances and possibly atom pair distances.
* This is an accelerated version of make_cluster_list_simple.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* the research papers on the package. Check out http://www.gromacs.org.
*/
-/* Stride of the packed x coordinate array */
+/*! \internal \file
+ *
+ * \brief
+ * Declares inline-friendly code for making 4xN pairlists
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
+
+//! Stride of the packed x coordinate array
static constexpr int c_xStride4xN =
(GMX_SIMD_REAL_WIDTH > c_nbnxnCpuIClusterSize ? GMX_SIMD_REAL_WIDTH : c_nbnxnCpuIClusterSize);
-/* Copies PBC shifted i-cell packed atom coordinates to working array */
+//! Copies PBC shifted i-cell packed atom coordinates to working array
static inline void icell_set_x_simd_4xn(int ci,
real shx,
real shy,
store(x_ci_simd + 11 * GMX_SIMD_REAL_WIDTH, SimdReal(x[ia + 2 * c_xStride4xN + 3] + shz));
}
-/* SIMD code for checking and adding cluster-pairs to the list using coordinates in packed format.
+/*! \brief SIMD code for checking and adding cluster-pairs to the list using coordinates in packed format.
*
* Checks bouding box distances and possibly atom pair distances.
* This is an accelerated version of make_cluster_list_simple.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
rlist_new = calcVerletBufferSize(*mtop, det(box), *ir, ir->nstlist, ir->nstlist - 1, -1, listSetup);
/* Does rlist fit in the box? */
- bBox = (gmx::square(rlist_new) < max_cutoff2(ir->ePBC, box));
+ bBox = (gmx::square(rlist_new) < max_cutoff2(ir->pbcType, box));
bDD = TRUE;
if (bBox && DOMAINDECOMP(cr))
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
PairlistParams(Nbnxm::KernelType kernelType, bool haveFep, real rlist, bool haveMultipleDomains);
- PairlistType pairlistType; //!< The type of cluster-pair list
- bool haveFep; //!< Tells whether we have perturbed interactions
- real rlistOuter; //!< Cut-off of the larger, outer pair-list
- real rlistInner; //!< Cut-off of the smaller, inner pair-list
- bool haveMultipleDomains; //!< True when using DD with multiple domains
- bool useDynamicPruning; //!< Are we using dynamic pair-list pruning
- int nstlistPrune; //!< Pair-list dynamic pruning interval
- int numRollingPruningParts; //!< The number parts to divide the pair-list into for rolling pruning, a value of 1 gives no rolling pruning
- int lifetime; //!< Lifetime in steps of the pair-list
+ //! The type of cluster-pair list
+ PairlistType pairlistType;
+ //! Tells whether we have perturbed interactions
+ bool haveFep;
+ //! Cut-off of the larger, outer pair-list
+ real rlistOuter;
+ //! Cut-off of the smaller, inner pair-list
+ real rlistInner;
+ //! True when using DD with multiple domains
+ bool haveMultipleDomains;
+ //! Are we using dynamic pair-list pruning
+ bool useDynamicPruning;
+ //! Pair-list dynamic pruning interval
+ int nstlistPrune;
+ //! The number parts to divide the pair-list into for rolling pruning, a value of 1 gives no rolling pruning
+ int numRollingPruningParts;
+ //! Lifetime in steps of the pair-list
+ int lifetime;
};
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct PairlistParams;
struct PairsearchWork;
struct SearchCycleCounting;
-struct t_blocka;
struct t_nrnb;
+namespace gmx
+{
+template<typename>
+class ListOfLists;
+}
+
namespace Nbnxm
{
class GridSet;
void constructPairlists(const Nbnxm::GridSet& gridSet,
gmx::ArrayRef<PairsearchWork> searchWork,
nbnxn_atomdata_t* nbat,
- const t_blocka* excl,
+ const gmx::ListOfLists<int>& exclusions,
int minimumIlistCountForGpuBalancing,
t_nrnb* nrnb,
SearchCycleCounting* searchCycleCounting);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
class PairlistSet;
enum class PairlistType;
class PairSearch;
-struct t_blocka;
struct t_nrnb;
+namespace gmx
+{
+template<typename>
+class ListOfLists;
+}
+//! Contains sets of pairlists \internal
class PairlistSets
{
public:
+ //! Constructor
PairlistSets(const PairlistParams& pairlistParams,
bool haveMultipleDomains,
int minimumIlistCountForGpuBalancing);
//! Construct the pairlist set for the given locality
- void construct(gmx::InteractionLocality iLocality,
- PairSearch* pairSearch,
- nbnxn_atomdata_t* nbat,
- const t_blocka* excl,
- int64_t step,
- t_nrnb* nrnb);
+ void construct(gmx::InteractionLocality iLocality,
+ PairSearch* pairSearch,
+ nbnxn_atomdata_t* nbat,
+ const gmx::ListOfLists<int>& exclusions,
+ int64_t step,
+ t_nrnb* nrnb);
//! Dispatches the dynamic pruning kernel for the given locality
void dispatchPruneKernel(gmx::InteractionLocality iLocality,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "grid.h"
#include "pairlist.h"
-/* Working data for the actual i-supercell during pair search */
+//! Working data for the actual i-supercell during pair search \internal
struct NbnxnPairlistCpuWork
{
- // Struct for storing coordinats and bounding box for an i-entry during search
+ //! Struct for storing coordinats and bounding box for an i-entry during search \internal
struct IClusterData
{
IClusterData() :
{
}
- // The bounding boxes, pbc shifted, for each cluster
+ //! The bounding boxes, pbc shifted, for each cluster
AlignedVector<Nbnxm::BoundingBox> bb;
- // The coordinates, pbc shifted, for each atom
+ //! The coordinates, pbc shifted, for each atom
std::vector<real> x;
- // Aligned list for storing 4*DIM*GMX_SIMD_REAL_WIDTH reals
+ //! Aligned list for storing 4*DIM*GMX_SIMD_REAL_WIDTH reals
AlignedVector<real> xSimd;
};
- // Protect data from cache pollution between threads
+ //! Protect data from cache pollution between threads
gmx_cache_protect_t cp0;
- // Work data for generating an IEntry in the pairlist
+ //! Work data for generating an IEntry in the pairlist
IClusterData iClusterData;
- // The current cj_ind index for the current list
+ //! The current cj_ind index for the current list
int cj_ind;
- // Temporary j-cluster list, used for sorting on exclusions
+ //! Temporary j-cluster list, used for sorting on exclusions
std::vector<nbnxn_cj_t> cj;
- // Nr. of cluster pairs without Coulomb for flop counting
+ //! Nr. of cluster pairs without Coulomb for flop counting
int ncj_noq;
- // Nr. of cluster pairs with 1/2 LJ for flop count
+ //! Nr. of cluster pairs with 1/2 LJ for flop count
int ncj_hlj;
- // Protect data from cache pollution between threads
+ //! Protect data from cache pollution between threads
gmx_cache_protect_t cp1;
};
{
}
- // The bounding boxes, pbc shifted, for each cluster
+ //! The bounding boxes, pbc shifted, for each cluster
AlignedVector<Nbnxm::BoundingBox> bb;
- // As bb, but in packed xxxx format
+ //! As bb, but in packed xxxx format
AlignedVector<float> bbPacked;
- // The coordinates, pbc shifted, for each atom
+ //! The coordinates, pbc shifted, for each atom
AlignedVector<real> x;
- // Aligned coordinate list used for 4*DIM*GMX_SIMD_REAL_WIDTH floats
+ //! Aligned coordinate list used for 4*DIM*GMX_SIMD_REAL_WIDTH floats
AlignedVector<real> xSimd;
};
{
}
- // Protect data from cache pollution between threads
+ //! Protect data from cache pollution between threads
gmx_cache_protect_t cp0;
- // Work data for generating an i-entry in the pairlist
+ //! Work data for generating an i-entry in the pairlist
ISuperClusterData iSuperClusterData;
- // The current j-cluster index for the current list
+ //! The current j-cluster index for the current list
int cj_ind;
- // Bounding box distance work array
+ //! Bounding box distance work array
AlignedVector<float> distanceBuffer;
- // Buffer for sorting list entries
+ //! Buffer for sorting list entries
std::vector<int> sortBuffer;
- // Second sci array, for sorting
+ //! Second sci array, for sorting
gmx::HostVector<nbnxn_sci_t> sci_sort;
- // Protect data from cache pollution between threads
+ //! Protect data from cache pollution between threads
gmx_cache_protect_t cp1;
};
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
free_nblist(nbl_fep.get());
}
-PairSearch::PairSearch(const int ePBC,
+PairSearch::PairSearch(const PbcType pbcType,
const bool doTestParticleInsertion,
const ivec* numDDCells,
const gmx_domdec_zones_t* ddZones,
const bool haveFep,
const int maxNumThreads,
gmx::PinningPolicy pinningPolicy) :
- gridSet_(ePBC, doTestParticleInsertion, numDDCells, ddZones, pairlistType, haveFep, maxNumThreads, pinningPolicy),
+ gridSet_(pbcType, doTestParticleInsertion, numDDCells, ddZones, pairlistType, haveFep, maxNumThreads, pinningPolicy),
work_(maxNumThreads)
{
cycleCounting_.recordCycles_ = (getenv("GMX_NBNXN_CYCLE") != nullptr);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/domdec/domdec.h"
#include "gromacs/math/vectypes.h"
+#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/timing/cyclecounter.h"
#include "gromacs/utility/alignedallocator.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/real.h"
-#include "atomdata.h"
#include "gridset.h"
#include "pairlist.h"
using AlignedVector = std::vector<T, gmx::AlignedAllocator<T>>;
-/* Local cycle count struct for profiling */
+//! Local cycle count struct for profiling \internal
class nbnxn_cycle_t
{
public:
+ //! Start counting cycles
void start() { start_ = gmx_cycles_read(); }
-
+ //! Stop counting cycles
void stop()
{
cycles_ += gmx_cycles_read() - start_;
count_++;
}
-
+ //! Return the number of periods of cycle counting
int count() const { return count_; }
+ //! Return the average number of million cycles per counting period
double averageMCycles() const
{
if (count_ > 0)
}
private:
- int count_ = 0;
+ //! Number of counting periods
+ int count_ = 0;
+ //! Total cycles in all counting periods
gmx_cycles_t cycles_ = 0;
- gmx_cycles_t start_ = 0;
+ //! Cycle count at the most recent start
+ gmx_cycles_t start_ = 0;
};
//! Local cycle count enum for profiling different parts of search
// TODO: Move nbnxn_search_work_t definition to its own file
-/* Thread-local work struct, contains working data for Grid */
+//! Thread-local work struct, contains working data for Grid \internal
struct PairsearchWork
{
PairsearchWork();
~PairsearchWork();
- gmx_cache_protect_t cp0; /* Buffer to avoid cache polution */
+ //! Buffer to avoid cache polution
+ gmx_cache_protect_t cp0;
- std::vector<int> sortBuffer; /* Temporary buffer for sorting atoms within a grid column */
+ //! Temporary buffer for sorting atoms within a grid column
+ std::vector<int> sortBuffer;
- nbnxn_buffer_flags_t buffer_flags; /* Flags for force buffer access */
+ //! Flags for force buffer access
+ nbnxn_buffer_flags_t buffer_flags;
- int ndistc; /* Number of distance checks for flop counting */
+ //! Number of distance checks for flop counting
+ int ndistc;
- std::unique_ptr<t_nblist> nbl_fep; /* Temporary FEP list for load balancing */
+ //! Temporary FEP list for load balancing
+ std::unique_ptr<t_nblist> nbl_fep;
- nbnxn_cycle_t cycleCounter; /* Counter for thread-local cycles */
+ //! Counter for thread-local cycles
+ nbnxn_cycle_t cycleCounter;
- gmx_cache_protect_t cp1; /* Buffer to avoid cache polution */
+ //! Buffer to avoid cache polution
+ gmx_cache_protect_t cp1;
};
-/* Main pair-search struct, contains the grid(s), not the pair-list(s) */
+//! Main pair-search struct, contains the grid(s), not the pair-list(s) \internal
class PairSearch
{
public:
cycleCounting_.stop(enbsCCgrid);
}
- /* \brief Constructor
+ /*! \brief Constructor
*
- * \param[in] ePBC The periodic boundary conditions
- * \param[in] numDDCells The number of domain decomposition cells per dimension, without DD nullptr should be passed
- * \param[in] zones The domain decomposition zone setup, without DD nullptr should be passed
- * \param[in] haveFep Tells whether non-bonded interactions are perturbed
- * \param[in] maxNumThreads The maximum number of threads used in the search
+ * \param[in] pbcType The periodic boundary conditions
+ * \param[in] doTestParticleInsertion Whether test-particle insertion is active
+ * \param[in] numDDCells The number of domain decomposition cells per dimension, without DD nullptr should be passed
+ * \param[in] zones The domain decomposition zone setup, without DD nullptr should be passed
+ * \param[in] pairlistType The type of tte pair list
+ * \param[in] haveFep Tells whether non-bonded interactions are perturbed
+ * \param[in] maxNumThreads The maximum number of threads used in the search
+ * \param[in] pinningPolicy Sets the pinning policy for all buffers used on the GPU
*/
- PairSearch(int ePBC,
+ PairSearch(PbcType pbcType,
bool doTestParticleInsertion,
const ivec* numDDCells,
const gmx_domdec_zones_t* zones,
PairlistType pairlistType,
bool haveFep,
- int maxNumthreads,
+ int maxNumThreads,
gmx::PinningPolicy pinningPolicy);
//! Sets the order of the local atoms to the order grid atom ordering
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/gmxassert.h"
#include "clusterdistancekerneltype.h"
+#include "nbnxm_gpu.h"
#include "pairlistset.h"
#include "pairlistsets.h"
#include "kernels_reference/kernel_ref_prune.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
file(GLOB PBCUTIL_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PBCUTIL_SOURCES} PARENT_SCOPE)
+if(GMX_INSTALL_LEGACY_API)
+ install(FILES
+ pbc.h
+ DESTINATION include/gromacs/pbcutil)
+endif()
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
if (gmx_debug_at)
{
- set_pbc(&pbc, -1, box);
+ set_pbc(&pbc, PbcType::Unset, box);
pbc_dx(&pbc, x[ai], x[aj], dx);
fprintf(debug,
"mk_grey: shifts for atom %d due to atom %d\n"
}
/* Returns the maximum length of the graph edges for coordinates x */
-static real maxEdgeLength(const t_graph g, int ePBC, const matrix box, const rvec x[])
+static real maxEdgeLength(const t_graph g, PbcType pbcType, const matrix box, const rvec x[])
{
t_pbc pbc;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
real maxEdgeLength2 = 0;
return std::sqrt(maxEdgeLength2);
}
-void mk_mshift(FILE* log, t_graph* g, int ePBC, const matrix box, const rvec x[])
+void mk_mshift(FILE* log, t_graph* g, PbcType pbcType, const matrix box, const rvec x[])
{
static int nerror_tot = 0;
int npbcdim;
int fW, fG; /* First of each category */
int nerror = 0;
- g->bScrewPBC = (ePBC == epbcSCREW);
+ g->bScrewPBC = (pbcType == PbcType::Screw);
- if (ePBC == epbcXY)
+ if (pbcType == PbcType::XY)
{
npbcdim = 2;
}
*/
constexpr real c_relativeDistanceThreshold = 0.25;
- int numPbcDimensions = ePBC2npbcdim(ePBC);
- GMX_RELEASE_ASSERT(numPbcDimensions > 0, "Expect PBC with graph");
+ int npbcdim = numPbcDimensions(pbcType);
+ GMX_RELEASE_ASSERT(npbcdim > 0, "Expect PBC with graph");
real minBoxSize = norm(box[XX]);
- for (int d = 1; d < numPbcDimensions; d++)
+ for (int d = 1; d < npbcdim; d++)
{
minBoxSize = std::min(minBoxSize, norm(box[d]));
}
- real maxDistance = maxEdgeLength(*g, ePBC, box, x);
+ real maxDistance = maxEdgeLength(*g, pbcType, box, x);
if (maxDistance >= c_relativeDistanceThreshold * minBoxSize)
{
std::string mesg = gmx::formatString(
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct InteractionList;
struct gmx_moltype_t;
struct t_idef;
+enum class PbcType : int;
typedef enum
{
void p_graph(FILE* log, const char* title, t_graph* g);
/* Print a graph to log */
-void mk_mshift(FILE* log, t_graph* g, int ePBC, const matrix box, const rvec x[]);
+void mk_mshift(FILE* log, t_graph* g, PbcType pbcType, const matrix box, const rvec x[]);
/* Calculate the mshift codes, based on the connection graph in g. */
void shift_x(const t_graph* g, const matrix box, const rvec x[], rvec x_s[]);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
-const char* epbc_names[epbcNR + 1] = { "xyz", "no", "xy", "screw", nullptr };
+const gmx::EnumerationArray<PbcType, std::string> c_pbcTypeNames = { { "xyz", "no", "xy", "screw",
+ "unset" } };
/* Skip 0 so we have more chance of detecting if we forgot to call set_pbc. */
enum
//! Margin correction if the box is too skewed
#define BOX_MARGIN_CORRECT 1.0005
-int ePBC2npbcdim(int ePBC)
+int numPbcDimensions(PbcType pbcType)
{
int npbcdim = 0;
- switch (ePBC)
+ switch (pbcType)
{
- case epbcXYZ: npbcdim = 3; break;
- case epbcXY: npbcdim = 2; break;
- case epbcSCREW: npbcdim = 3; break;
- case epbcNONE: npbcdim = 0; break;
- default: gmx_fatal(FARGS, "Unknown ePBC=%d in ePBC2npbcdim", ePBC);
+ case PbcType::Unset:
+ gmx_fatal(FARGS, "Number of PBC dimensions was requested before the PBC type set.");
+ case PbcType::Xyz: npbcdim = 3; break;
+ case PbcType::XY: npbcdim = 2; break;
+ case PbcType::Screw: npbcdim = 3; break;
+ case PbcType::No: npbcdim = 0; break;
+ default:
+ gmx_fatal(FARGS, "Unknown pbcType=%s in numPbcDimensions", c_pbcTypeNames[pbcType].c_str());
}
return npbcdim;
{
rvec sum_box;
- fprintf(fp, "ePBCDX = %d\n", pbc->ePBCDX);
+ fprintf(fp, "pbcTypeDX = %d\n", pbc->pbcTypeDX);
pr_rvecs(fp, 0, "box", pbc->box, DIM);
pr_rvecs(fp, 0, "fbox_diag", &pbc->fbox_diag, 1);
pr_rvecs(fp, 0, "hbox_diag", &pbc->hbox_diag, 1);
}
}
-const char* check_box(int ePBC, const matrix box)
+const char* check_box(PbcType pbcType, const matrix box)
{
const char* ptr;
- if (ePBC == -1)
+ if (pbcType == PbcType::Unset)
{
- ePBC = guess_ePBC(box);
+ pbcType = guessPbcType(box);
}
- if (ePBC == epbcNONE)
+ if (pbcType == PbcType::No)
{
return nullptr;
}
ptr = "Only triclinic boxes with the first vector parallel to the x-axis and the second "
"vector in the xy-plane are supported.";
}
- else if (ePBC == epbcSCREW && (box[YY][XX] != 0 || box[ZZ][XX] != 0))
+ else if (pbcType == PbcType::Screw && (box[YY][XX] != 0 || box[ZZ][XX] != 0))
{
ptr = "The unit cell can not have off-diagonal x-components with screw pbc";
}
else if (std::fabs(box[YY][XX]) > BOX_MARGIN * 0.5 * box[XX][XX]
- || (ePBC != epbcXY
+ || (pbcType != PbcType::XY
&& (std::fabs(box[ZZ][XX]) > BOX_MARGIN * 0.5 * box[XX][XX]
|| std::fabs(box[ZZ][YY]) > BOX_MARGIN * 0.5 * box[YY][YY])))
{
std::sqrt(gmx::square(vec[ZZ]) - box[ZZ][XX] * box[ZZ][XX] - box[ZZ][YY] * box[ZZ][YY]);
}
-real max_cutoff2(int ePBC, const matrix box)
+real max_cutoff2(PbcType pbcType, const matrix box)
{
real min_hv2, min_ss;
const real oneFourth = 0.25;
* by half the length of the shortest box vector.
*/
min_hv2 = oneFourth * std::min(norm2(box[XX]), norm2(box[YY]));
- if (ePBC != epbcXY)
+ if (pbcType != PbcType::XY)
{
min_hv2 = std::min(min_hv2, oneFourth * norm2(box[ZZ]));
}
* in the grid search and pbc_dx is a lot faster
* than checking all possible combinations.
*/
- if (ePBC == epbcXY)
+ if (pbcType == PbcType::XY)
{
min_ss = std::min(box[XX][XX], box[YY][YY]);
}
//! Set to true if warning has been printed
static gmx_bool bWarnedGuess = FALSE;
-int guess_ePBC(const matrix box)
+PbcType guessPbcType(const matrix box)
{
- int ePBC;
+ PbcType pbcType;
if (box[XX][XX] > 0 && box[YY][YY] > 0 && box[ZZ][ZZ] > 0)
{
- ePBC = epbcXYZ;
+ pbcType = PbcType::Xyz;
}
else if (box[XX][XX] > 0 && box[YY][YY] > 0 && box[ZZ][ZZ] == 0)
{
- ePBC = epbcXY;
+ pbcType = PbcType::XY;
}
else if (box[XX][XX] == 0 && box[YY][YY] == 0 && box[ZZ][ZZ] == 0)
{
- ePBC = epbcNONE;
+ pbcType = PbcType::No;
}
else
{
box[XX][XX], box[YY][YY], box[ZZ][ZZ]);
bWarnedGuess = TRUE;
}
- ePBC = epbcNONE;
+ pbcType = PbcType::No;
}
if (debug)
{
- fprintf(debug, "Guessed pbc = %s from the box matrix\n", epbc_names[ePBC]);
+ fprintf(debug, "Guessed pbc = %s from the box matrix\n", c_pbcTypeNames[pbcType].c_str());
}
- return ePBC;
+ return pbcType;
}
//! Check if the box still obeys the restrictions, if not, correct it
}
//! Do the real arithmetic for filling the pbc struct
-static void low_set_pbc(t_pbc* pbc, int ePBC, const ivec dd_pbc, const matrix box)
+static void low_set_pbc(t_pbc* pbc, PbcType pbcType, const ivec dd_pbc, const matrix box)
{
int order[3] = { 0, -1, 1 };
ivec bPBC;
const char* ptr;
- pbc->ePBC = ePBC;
- pbc->ndim_ePBC = ePBC2npbcdim(ePBC);
+ pbc->pbcType = pbcType;
+ pbc->ndim_ePBC = numPbcDimensions(pbcType);
- if (pbc->ePBC == epbcNONE)
+ if (pbc->pbcType == PbcType::No)
{
- pbc->ePBCDX = epbcdxNOPBC;
+ pbc->pbcTypeDX = epbcdxNOPBC;
return;
}
pbc->mhbox_diag[i] = -pbc->hbox_diag[i];
}
- ptr = check_box(ePBC, box);
+ ptr = check_box(pbcType, box);
if (ptr)
{
fprintf(stderr, "Warning: %s\n", ptr);
pr_rvecs(stderr, 0, " Box", box, DIM);
fprintf(stderr, " Can not fix pbc.\n\n");
- pbc->ePBCDX = epbcdxUNSUPPORTED;
+ pbc->pbcTypeDX = epbcdxUNSUPPORTED;
}
else
{
- if (ePBC == epbcSCREW && nullptr != dd_pbc)
+ if (pbcType == PbcType::Screw && nullptr != dd_pbc)
{
/* This combinated should never appear here */
gmx_incons("low_set_pbc called with screw pbc and dd_nc != NULL");
int npbcdim = 0;
for (int i = 0; i < DIM; i++)
{
- if ((dd_pbc && dd_pbc[i] == 0) || (ePBC == epbcXY && i == ZZ))
+ if ((dd_pbc && dd_pbc[i] == 0) || (pbcType == PbcType::XY && i == ZZ))
{
bPBC[i] = 0;
}
/* 1D pbc is not an mdp option and it is therefore only used
* with single shifts.
*/
- pbc->ePBCDX = epbcdx1D_RECT;
+ pbc->pbcTypeDX = epbcdx1D_RECT;
for (int i = 0; i < DIM; i++)
{
if (bPBC[i])
{
if (pbc->box[pbc->dim][i] != 0)
{
- pbc->ePBCDX = epbcdx1D_TRIC;
+ pbc->pbcTypeDX = epbcdx1D_TRIC;
}
}
break;
case 2:
- pbc->ePBCDX = epbcdx2D_RECT;
+ pbc->pbcTypeDX = epbcdx2D_RECT;
for (int i = 0; i < DIM; i++)
{
if (!bPBC[i])
{
if (pbc->box[i][j] != 0)
{
- pbc->ePBCDX = epbcdx2D_TRIC;
+ pbc->pbcTypeDX = epbcdx2D_TRIC;
}
}
}
}
break;
case 3:
- if (ePBC != epbcSCREW)
+ if (pbcType != PbcType::Screw)
{
if (TRICLINIC(box))
{
- pbc->ePBCDX = epbcdxTRICLINIC;
+ pbc->pbcTypeDX = epbcdxTRICLINIC;
}
else
{
- pbc->ePBCDX = epbcdxRECTANGULAR;
+ pbc->pbcTypeDX = epbcdxRECTANGULAR;
}
}
else
{
- pbc->ePBCDX = (box[ZZ][YY] == 0 ? epbcdxSCREW_RECT : epbcdxSCREW_TRIC);
- if (pbc->ePBCDX == epbcdxSCREW_TRIC)
+ pbc->pbcTypeDX = (box[ZZ][YY] == 0 ? epbcdxSCREW_RECT : epbcdxSCREW_TRIC);
+ if (pbc->pbcTypeDX == epbcdxSCREW_TRIC)
{
fprintf(stderr,
"Screw pbc is not yet implemented for triclinic boxes.\n"
"Can not fix pbc.\n");
- pbc->ePBCDX = epbcdxUNSUPPORTED;
+ pbc->pbcTypeDX = epbcdxUNSUPPORTED;
}
}
break;
default: gmx_fatal(FARGS, "Incorrect number of pbc dimensions with DD: %d", npbcdim);
}
- pbc->max_cutoff2 = max_cutoff2(ePBC, box);
+ pbc->max_cutoff2 = max_cutoff2(pbcType, box);
- if (pbc->ePBCDX == epbcdxTRICLINIC || pbc->ePBCDX == epbcdx2D_TRIC || pbc->ePBCDX == epbcdxSCREW_TRIC)
+ if (pbc->pbcTypeDX == epbcdxTRICLINIC || pbc->pbcTypeDX == epbcdx2D_TRIC
+ || pbc->pbcTypeDX == epbcdxSCREW_TRIC)
{
if (debug)
{
}
}
-void set_pbc(t_pbc* pbc, int ePBC, const matrix box)
+void set_pbc(t_pbc* pbc, PbcType pbcType, const matrix box)
{
- if (ePBC == -1)
+ if (pbcType == PbcType::Unset)
{
- ePBC = guess_ePBC(box);
+ pbcType = guessPbcType(box);
}
- low_set_pbc(pbc, ePBC, nullptr, box);
+ low_set_pbc(pbc, pbcType, nullptr, box);
}
-t_pbc* set_pbc_dd(t_pbc* pbc, int ePBC, const ivec domdecCells, gmx_bool bSingleDir, const matrix box)
+t_pbc* set_pbc_dd(t_pbc* pbc, PbcType pbcType, const ivec domdecCells, gmx_bool bSingleDir, const matrix box)
{
- if (ePBC == epbcNONE)
+ if (pbcType == PbcType::No)
{
- pbc->ePBC = ePBC;
+ pbc->pbcType = pbcType;
return nullptr;
}
if (nullptr == domdecCells)
{
- low_set_pbc(pbc, ePBC, nullptr, box);
+ low_set_pbc(pbc, pbcType, nullptr, box);
}
else
{
- if (ePBC == epbcSCREW && domdecCells[XX] > 1)
+ if (pbcType == PbcType::Screw && domdecCells[XX] > 1)
{
/* The rotation has been taken care of during coordinate communication */
- ePBC = epbcXYZ;
+ pbcType = PbcType::Xyz;
}
ivec usePBC;
for (int i = 0; i < DIM; i++)
{
usePBC[i] = 0;
- if (domdecCells[i] <= (bSingleDir ? 1 : 2) && !(ePBC == epbcXY && i == ZZ))
+ if (domdecCells[i] <= (bSingleDir ? 1 : 2) && !(pbcType == PbcType::XY && i == ZZ))
{
usePBC[i] = 1;
npbcdim++;
if (npbcdim > 0)
{
- low_set_pbc(pbc, ePBC, usePBC, box);
+ low_set_pbc(pbc, pbcType, usePBC, box);
}
else
{
- pbc->ePBC = epbcNONE;
+ pbc->pbcType = PbcType::No;
}
}
- return (pbc->ePBC != epbcNONE ? pbc : nullptr);
+ return (pbc->pbcType != PbcType::No ? pbc : nullptr);
}
void pbc_dx(const t_pbc* pbc, const rvec x1, const rvec x2, rvec dx)
rvec_sub(x1, x2, dx);
- switch (pbc->ePBCDX)
+ switch (pbc->pbcTypeDX)
{
case epbcdxRECTANGULAR:
for (i = 0; i < DIM; i++)
rvec_sub(x1, x2, dx);
clear_ivec(ishift);
- switch (pbc->ePBCDX)
+ switch (pbc->pbcTypeDX)
{
case epbcdxRECTANGULAR:
for (i = 0; i < DIM; i++)
dvec_sub(x1, x2, dx);
- switch (pbc->ePBCDX)
+ switch (pbc->pbcTypeDX)
{
case epbcdxRECTANGULAR:
case epbcdx2D_RECT:
return edge;
}
-void put_atoms_in_box(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x)
+void put_atoms_in_box(PbcType pbcType, const matrix box, gmx::ArrayRef<gmx::RVec> x)
{
int npbcdim, m, d;
- if (ePBC == epbcSCREW)
+ if (pbcType == PbcType::Screw)
{
- gmx_fatal(FARGS, "Sorry, %s pbc is not yet supported", epbc_names[ePBC]);
+ gmx_fatal(FARGS, "Sorry, %s pbc is not yet supported", c_pbcTypeNames[pbcType].c_str());
}
- if (ePBC == epbcXY)
+ if (pbcType == PbcType::XY)
{
npbcdim = 2;
}
}
}
-void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth)
+void put_atoms_in_box_omp(PbcType pbcType, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth)
{
#pragma omp parallel for num_threads(nth) schedule(static)
for (int t = 0; t < nth; t++)
size_t natoms = x.size();
size_t offset = (natoms * t) / nth;
size_t len = (natoms * (t + 1)) / nth - offset;
- put_atoms_in_box(ePBC, box, x.subArray(offset, len));
+ put_atoms_in_box(pbcType, box, x.subArray(offset, len));
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
}
}
-void put_atoms_in_compact_unitcell(int ePBC, int ecenter, const matrix box, gmx::ArrayRef<gmx::RVec> x)
+void put_atoms_in_compact_unitcell(PbcType pbcType, int ecenter, const matrix box, gmx::ArrayRef<gmx::RVec> x)
{
t_pbc pbc;
rvec box_center, dx;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
- if (pbc.ePBCDX == epbcdxUNSUPPORTED)
+ if (pbc.pbcTypeDX == epbcdxUNSUPPORTED)
{
gmx_fatal(FARGS, "Can not put atoms in compact unitcell with unsupported PBC");
}
/*! \brief Make molecules whole by shifting positions
*
* \param[in] fplog Log file
- * \param[in] ePBC The PBC type
+ * \param[in] pbcType The PBC type
* \param[in] box The simulation box
* \param[in] mtop System topology definition
* \param[in,out] x The coordinates of the atoms
* \param[in] bFirst Specifier for first-time PBC removal
*/
-static void low_do_pbc_mtop(FILE* fplog, int ePBC, const matrix box, const gmx_mtop_t* mtop, rvec x[], gmx_bool bFirst)
+static void
+low_do_pbc_mtop(FILE* fplog, PbcType pbcType, const matrix box, const gmx_mtop_t* mtop, rvec x[], gmx_bool bFirst)
{
t_graph* graph;
int as, mol;
for (mol = 0; mol < molb.nmol; mol++)
{
- mk_mshift(fplog, graph, ePBC, box, x + as);
+ mk_mshift(fplog, graph, pbcType, box, x + as);
shift_self(graph, box, x + as);
/* The molecule is whole now.
sfree(graph);
}
-void do_pbc_first_mtop(FILE* fplog, int ePBC, const matrix box, const gmx_mtop_t* mtop, rvec x[])
+void do_pbc_first_mtop(FILE* fplog, PbcType pbcType, const matrix box, const gmx_mtop_t* mtop, rvec x[])
{
- low_do_pbc_mtop(fplog, ePBC, box, mtop, x, TRUE);
+ low_do_pbc_mtop(fplog, pbcType, box, mtop, x, TRUE);
}
-void do_pbc_mtop(int ePBC, const matrix box, const gmx_mtop_t* mtop, rvec x[])
+void do_pbc_mtop(PbcType pbcType, const matrix box, const gmx_mtop_t* mtop, rvec x[])
{
- low_do_pbc_mtop(nullptr, ePBC, box, mtop, x, FALSE);
+ low_do_pbc_mtop(nullptr, pbcType, box, mtop, x, FALSE);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdio.h>
+#include <string>
+
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/real.h"
struct gmx_domdec_t;
struct gmx_mtop_t;
-enum
+//! Enumeration that contains all supported periodic boundary setups.
+enum class PbcType : int
{
- epbcXYZ,
- epbcNONE,
- epbcXY,
- epbcSCREW,
- epbcNR
+ Xyz = 0, //!< Periodic boundaries in all dimensions.
+ No = 1, //!< No periodic boundaries.
+ XY = 2, //!< Only two dimensions are periodic.
+ Screw = 3, //!< Screw.
+ Unset = 4, //!< The type of PBC is not set or invalid.
+ Count = 5
};
-//! Strings corresponding to epbc enum values.
-extern const char* epbc_names[epbcNR + 1];
+//! Names for all values in PBC types enumeration
+extern const gmx::EnumerationArray<PbcType, std::string> c_pbcTypeNames;
/* Maximum number of combinations of single triclinic box vectors
* required to shift atoms that are within a brick of the size of
typedef struct t_pbc
{
//! The PBC type
- int ePBC;
+ PbcType pbcType;
//! Number of dimensions in which PBC is exerted
int ndim_ePBC;
/*! \brief Determines how to compute distance vectors.
*
* Indicator of how to compute distance vectors, depending
- * on PBC type (depends on ePBC and dimensions with(out) DD)
+ * on PBC type (depends on pbcType and dimensions with(out) DD)
* and the box angles.
*/
- int ePBCDX;
+ int pbcTypeDX;
/*! \brief Used for selecting which dimensions to use in PBC.
*
* In case of 1-D PBC this indicates which dimension is used,
/*! \brief Returns the number of dimensions that use pbc
*
- * \param[in] ePBC The periodic boundary condition type
+ * \param[in] pbcType The periodic boundary condition type
* \return the number of dimensions that use pbc, starting at X
*/
-int ePBC2npbcdim(int ePBC);
+int numPbcDimensions(PbcType pbcType);
/*! \brief Dump the contents of the pbc structure to the file
*
/*! \brief Check the box for consistency
*
- * \param[in] ePBC The pbc identifier
- * \param[in] box The box matrix
+ * When \p pbcType=PbcTypes::Unset, the type of pbc is guessed from the box matrix.
+ *
+ * \param[in] pbcType The pbc identifier
+ * \param[in] box The box matrix
* \return NULL if the box is supported by Gromacs.
- * Otherwise returns a string with the problem.
- * When ePBC=-1, the type of pbc is guessed from the box matrix.
+ * Otherwise returns a string with the problem.
*/
-const char* check_box(int ePBC, const matrix box);
+const char* check_box(PbcType pbcType, const matrix box);
/*! \brief Creates box matrix from edge lengths and angles.
*
- * \param[in,out] box The box matrix
+ * \param[in,out] box The box matrix
* \param[in] vec The edge lengths
* \param[in] angleInDegrees The angles
*/
* Returns the square of the maximum cut-off allowed for the box,
* taking into account that the grid neighborsearch code and pbc_dx
* only check combinations of single box-vector shifts.
- * \param[in] ePBC The pbc identifier
+ *
+ * \param[in] pbcType The pbc identifier
* \param[in] box The box matrix
* \return the maximum cut-off.
*/
-real max_cutoff2(int ePBC, const matrix box);
+real max_cutoff2(PbcType pbcType, const matrix box);
-/*! \brief Guess PBC typr
+/*! \brief Guess PBC type
*
* Guesses the type of periodic boundary conditions using the box
+ *
* \param[in] box The box matrix
- * \return The pbc identifier
+ * \return The pbc type identifier
*/
-int guess_ePBC(const matrix box);
+PbcType guessPbcType(const matrix box);
/*! \brief Corrects the box if necessary
*
* Checks for un-allowed box angles and corrects the box
- * and the integer shift vectors in the graph (if graph!=NULL) if necessary.
+ * and the integer shift vectors in the graph (if \p graph!=NULL) if necessary.
+ *
* \param[in] fplog File for debug output
* \param[in] step The MD step number
* \param[in] box The simulation cell
*
* pbc_dx will not use pbc and return the normal difference vector
* when one or more of the diagonal elements of box are zero.
- * When ePBC=-1, the type of pbc is guessed from the box matrix.
+ * When \p pbcType=PbcType::Unset, the type of pbc is guessed from the box matrix.
+ *
* \param[in,out] pbc The pbc information structure
- * \param[in] ePBC The PBC identifier
- * \param[in] box The box tensor
+ * \param[in] pbcType The PBC identifier
+ * \param[in] box The box tensor
*/
-void set_pbc(t_pbc* pbc, int ePBC, const matrix box);
+void set_pbc(t_pbc* pbc, PbcType pbcType, const matrix box);
/*! \brief Initiate the periodic boundary condition algorithms.
*
* If domdecCells!=NULL pbc is not used for directions
* with dd->nc[i]==1 with bSingleDir==TRUE or
* with dd->nc[i]<=2 with bSingleDir==FALSE.
- * Note that when no PBC is required only pbc->ePBC is set,
+ * Note that when no PBC is required only pbc->pbcType is set,
* the rest of the struct will be invalid.
- * \param[in,out] pbc The pbc information structure
- * \param[in] ePBC The PBC identifier
+ *
+ * \param[in,out] pbc The pbc information structure
+ * \param[in] pbcType The PBC identifier
* \param[in] domdecCells 3D integer vector describing the number of DD cells
* or nullptr if not using DD.
* \param[in] bSingleDir TRUE if DD communicates only in one direction along dimensions
* \param[in] box The box tensor
* \return the pbc structure when pbc operations are required, NULL otherwise.
*/
-t_pbc* set_pbc_dd(t_pbc* pbc, int ePBC, const ivec domdecCells, gmx_bool bSingleDir, const matrix box);
+t_pbc* set_pbc_dd(t_pbc* pbc, PbcType pbcType, const ivec domdecCells, gmx_bool bSingleDir, const matrix box);
/*! \brief Compute distance with PBC
*
* These routines puts ONE or ALL atoms in the box, not caring
* about charge groups!
* Also works for triclinic cells.
- * \param[in] ePBC The pbc type
- * \param[in] box The simulation box
- * \param[in,out] x The coordinates of the atoms
+ *
+ * \param[in] pbcType The pbc type
+ * \param[in] box The simulation box
+ * \param[in,out] x The coordinates of the atoms
*/
-void put_atoms_in_box(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x);
+void put_atoms_in_box(PbcType pbcType, const matrix box, gmx::ArrayRef<gmx::RVec> x);
/*! \brief Parallellizes put_atoms_in_box()
*
* This wrapper function around put_atoms_in_box() with the ugly manual
* workload splitting is needed to avoid silently introducing multithreading
* in tools.
- * \param[in] ePBC The pbc type
+ *
+ * \param[in] pbcType The pbc type
* \param[in] box The simulation box
* \param[in,out] x The coordinates of the atoms
* \param[in] nth number of threads to be used in the given module
*/
-void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth);
+void put_atoms_in_box_omp(PbcType pbcType, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth);
/*! \brief Put atoms inside triclinic box
*
*
* This puts ALL atoms at the closest distance for the center of the box
* as calculated by calc_box_center.
- * When ePBC=-1, the type of pbc is guessed from the box matrix.
- * \param[in] ePBC The pbc type
+ * When \p pbcType=PbcType::Unset, the type of pbc is guessed from the box matrix.
+ *
+ * \param[in] pbcType The pbc type
* \param[in] ecenter The pbc center type
* \param[in] box The simulation box
- * \param[in,out] x The coordinates of the atoms
+ * \param[in,out] x The coordinates of the atoms
*/
-void put_atoms_in_compact_unitcell(int ePBC, int ecenter, const matrix box, gmx::ArrayRef<gmx::RVec> x);
+void put_atoms_in_compact_unitcell(PbcType pbcType, int ecenter, const matrix box, gmx::ArrayRef<gmx::RVec> x);
/*! \brief Make all molecules whole by shifting positions
*
* \param[in] fplog Log file
- * \param[in] ePBC The PBC type
+ * \param[in] pbcType The PBC type
* \param[in] box The simulation box
* \param[in] mtop System topology definition
* \param[in,out] x The coordinates of the atoms
*/
-void do_pbc_first_mtop(FILE* fplog, int ePBC, const matrix box, const gmx_mtop_t* mtop, rvec x[]);
+void do_pbc_first_mtop(FILE* fplog, PbcType pbcType, const matrix box, const gmx_mtop_t* mtop, rvec x[]);
/*! \brief Make molecules consisting of multiple charge groups whole by shifting positions
*
- * \param[in] ePBC The PBC type
+ * \param[in] pbcType The PBC type
* \param[in] box The simulation box
* \param[in] mtop System topology definition
* \param[in,out] x The coordinates of the atoms
*/
-void do_pbc_mtop(int ePBC, const matrix box, const gmx_mtop_t* mtop, rvec x[]);
+void do_pbc_mtop(PbcType pbcType, const matrix box, const gmx_mtop_t* mtop, rvec x[]);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_PBCUTIL_PBC_AIUC_CUDA_CUH
#define GMX_PBCUTIL_PBC_AIUC_CUDA_CUH
-#include "gromacs/gpu_utils/gpu_vec.cuh"
#include "gromacs/gpu_utils/vectype_ops.cuh"
#include "gromacs/pbcutil/pbc_aiuc.h"
*/
template<bool returnShift>
static __forceinline__ __device__ int
- pbcDxAiuc(const PbcAiuc& pbcAiuc, const float4& r1, const float4& r2, fvec dr)
+ pbcDxAiuc(const PbcAiuc& pbcAiuc, const float4 r1, const float4 r2, float3& dr)
{
- dr[XX] = r1.x - r2.x;
- dr[YY] = r1.y - r2.y;
- dr[ZZ] = r1.z - r2.z;
+ dr.x = r1.x - r2.x;
+ dr.y = r1.y - r2.y;
+ dr.z = r1.z - r2.z;
- float shz = rintf(dr[ZZ] * pbcAiuc.invBoxDiagZ);
- dr[XX] -= shz * pbcAiuc.boxZX;
- dr[YY] -= shz * pbcAiuc.boxZY;
- dr[ZZ] -= shz * pbcAiuc.boxZZ;
+ float shz = rintf(dr.z * pbcAiuc.invBoxDiagZ);
+ dr.x -= shz * pbcAiuc.boxZX;
+ dr.y -= shz * pbcAiuc.boxZY;
+ dr.z -= shz * pbcAiuc.boxZZ;
- float shy = rintf(dr[YY] * pbcAiuc.invBoxDiagY);
- dr[XX] -= shy * pbcAiuc.boxYX;
- dr[YY] -= shy * pbcAiuc.boxYY;
+ float shy = rintf(dr.y * pbcAiuc.invBoxDiagY);
+ dr.x -= shy * pbcAiuc.boxYX;
+ dr.y -= shy * pbcAiuc.boxYY;
- float shx = rintf(dr[XX] * pbcAiuc.invBoxDiagX);
- dr[XX] -= shx * pbcAiuc.boxXX;
+ float shx = rintf(dr.x * pbcAiuc.invBoxDiagX);
+ dr.x -= shx * pbcAiuc.boxXX;
if (returnShift)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void set_pbc_simd(const t_pbc gmx_unused* pbc, real gmx_unused* pbc_simd)
{
#if GMX_SIMD_HAVE_REAL
- if (pbc != nullptr && pbc->ePBC != epbcNONE)
+ if (pbc != nullptr && pbc->pbcType != PbcType::No)
{
rvec inv_box_diag = { 0, 0, 0 };
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
-void calc_pbc_cluster(int ecenter, int nrefat, t_topology* top, int ePBC, rvec x[], const int index[], matrix box)
+void calc_pbc_cluster(int ecenter, int nrefat, t_topology* top, PbcType pbcType, rvec x[], const int index[], matrix box)
{
int m, i, j, j0, j1, jj, ai, aj;
int imin, jmin;
/* Initiate the pbc structure */
std::memset(&pbc, 0, sizeof(pbc));
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
/* Convert atom index to molecular */
nmol = top->mols.nr;
t_block* mols,
int natoms,
t_atom atom[],
- int ePBC,
+ PbcType pbcType,
matrix box,
rvec x[])
{
t_pbc pbc;
calc_box_center(ecenter, box, box_center);
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
if (mols->nr <= 0)
{
gmx_fatal(FARGS,
auto newComArrayRef = gmx::arrayRefFromArray(&newCom, 1);
switch (unitcell_enum)
{
- case euRect: put_atoms_in_box(ePBC, box, newComArrayRef); break;
+ case euRect: put_atoms_in_box(pbcType, box, newComArrayRef); break;
case euTric: put_atoms_in_triclinic_unitcell(ecenter, box, newComArrayRef); break;
case euCompact:
- put_atoms_in_compact_unitcell(ePBC, ecenter, box, newComArrayRef);
+ put_atoms_in_compact_unitcell(pbcType, ecenter, box, newComArrayRef);
break;
}
rvec_sub(newCom, com, shift);
}
}
-void put_residue_com_in_box(int unitcell_enum, int ecenter, int natoms, t_atom atom[], int ePBC, matrix box, rvec x[])
+void put_residue_com_in_box(int unitcell_enum,
+ int ecenter,
+ int natoms,
+ t_atom atom[],
+ PbcType pbcType,
+ matrix box,
+ rvec x[])
{
int i, j, res_start, res_end;
int d, presnr;
auto newComArrayRef = gmx::arrayRefFromArray(&newCom, 1);
switch (unitcell_enum)
{
- case euRect: put_atoms_in_box(ePBC, box, newComArrayRef); break;
+ case euRect: put_atoms_in_box(pbcType, box, newComArrayRef); break;
case euTric: put_atoms_in_triclinic_unitcell(ecenter, box, newComArrayRef); break;
case euCompact:
- put_atoms_in_compact_unitcell(ePBC, ecenter, box, newComArrayRef);
+ put_atoms_in_compact_unitcell(pbcType, ecenter, box, newComArrayRef);
break;
}
rvec_sub(newCom, com, shift);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_topology;
struct t_block;
struct t_atom;
+enum class PbcType : int;
#include "gmxpre.h"
euNR
};
-void calc_pbc_cluster(int ecenter, int nrefat, t_topology* top, int ePBC, rvec x[], const int index[], matrix box);
+void calc_pbc_cluster(int ecenter, int nrefat, t_topology* top, PbcType pbcType, rvec x[], const int index[], matrix box);
void put_molecule_com_in_box(int unitcell_enum,
t_block* mols,
int natoms,
t_atom atom[],
- int ePBC,
+ PbcType pbcType,
matrix box,
rvec x[]);
-void put_residue_com_in_box(int unitcell_enum, int ecenter, int natoms, t_atom atom[], int ePBC, matrix box, rvec x[]);
+void put_residue_com_in_box(int unitcell_enum,
+ int ecenter,
+ int natoms,
+ t_atom atom[],
+ PbcType pbcType,
+ matrix box,
+ rvec x[]);
void center_x(int ecenter, rvec x[], matrix box, int n, int nc, const int ci[]);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
const t_idef* idef;
int natoms_init;
- int ePBC;
+ PbcType pbcType;
int ngraph;
rmpbc_graph_t* graph;
};
-static t_graph* gmx_rmpbc_get_graph(gmx_rmpbc_t gpbc, int ePBC, int natoms)
+static t_graph* gmx_rmpbc_get_graph(gmx_rmpbc_t gpbc, PbcType pbcType, int natoms)
{
int i;
rmpbc_graph_t* gr;
- if (ePBC == epbcNONE || nullptr == gpbc || nullptr == gpbc->idef || gpbc->idef->ntypes <= 0)
+ if (pbcType == PbcType::No || nullptr == gpbc || nullptr == gpbc->idef || gpbc->idef->ntypes <= 0)
{
return nullptr;
}
return gr->gr;
}
-gmx_rmpbc_t gmx_rmpbc_init(const t_idef* idef, int ePBC, int natoms)
+gmx_rmpbc_t gmx_rmpbc_init(const t_idef* idef, PbcType pbcType, int natoms)
{
gmx_rmpbc_t gpbc;
/* This sets pbc when we now it,
* otherwise we guess it from the instantaneous box in the trajectory.
*/
- gpbc->ePBC = ePBC;
+ gpbc->pbcType = pbcType;
gpbc->idef = idef;
if (gpbc->idef->ntypes <= 0)
}
}
-static int gmx_rmpbc_ePBC(gmx_rmpbc_t gpbc, const matrix box)
+static PbcType gmx_rmpbc_ePBC(gmx_rmpbc_t gpbc, const matrix box)
{
- if (nullptr != gpbc && gpbc->ePBC >= 0)
+ if (nullptr != gpbc && gpbc->pbcType != PbcType::Unset)
{
- return gpbc->ePBC;
+ return gpbc->pbcType;
}
else
{
- return guess_ePBC(box);
+ return guessPbcType(box);
}
}
void gmx_rmpbc(gmx_rmpbc_t gpbc, int natoms, const matrix box, rvec x[])
{
- int ePBC;
+ PbcType pbcType;
t_graph* gr;
- ePBC = gmx_rmpbc_ePBC(gpbc, box);
- gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms);
+ pbcType = gmx_rmpbc_ePBC(gpbc, box);
+ gr = gmx_rmpbc_get_graph(gpbc, pbcType, natoms);
if (gr != nullptr)
{
- mk_mshift(stdout, gr, ePBC, box, x);
+ mk_mshift(stdout, gr, pbcType, box, x);
shift_self(gr, box, x);
}
}
void gmx_rmpbc_copy(gmx_rmpbc_t gpbc, int natoms, const matrix box, rvec x[], rvec x_s[])
{
- int ePBC;
+ PbcType pbcType;
t_graph* gr;
int i;
- ePBC = gmx_rmpbc_ePBC(gpbc, box);
- gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms);
+ pbcType = gmx_rmpbc_ePBC(gpbc, box);
+ gr = gmx_rmpbc_get_graph(gpbc, pbcType, natoms);
if (gr != nullptr)
{
- mk_mshift(stdout, gr, ePBC, box, x);
+ mk_mshift(stdout, gr, pbcType, box, x);
shift_x(gr, box, x, x_s);
}
else
void gmx_rmpbc_trxfr(gmx_rmpbc_t gpbc, t_trxframe* fr)
{
- int ePBC;
+ PbcType pbcType;
t_graph* gr;
if (fr->bX && fr->bBox)
{
- ePBC = gmx_rmpbc_ePBC(gpbc, fr->box);
- gr = gmx_rmpbc_get_graph(gpbc, ePBC, fr->natoms);
+ pbcType = gmx_rmpbc_ePBC(gpbc, fr->box);
+ gr = gmx_rmpbc_get_graph(gpbc, pbcType, fr->natoms);
if (gr != nullptr)
{
- mk_mshift(stdout, gr, ePBC, fr->box, fr->x);
+ mk_mshift(stdout, gr, pbcType, fr->box, fr->x);
shift_self(gr, fr->box, fr->x);
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct t_atoms;
struct t_idef;
struct t_trxframe;
+enum class PbcType : int;
typedef struct gmx_rmpbc* gmx_rmpbc_t;
-gmx_rmpbc_t gmx_rmpbc_init(const t_idef* idef, int ePBC, int natoms);
+gmx_rmpbc_t gmx_rmpbc_init(const t_idef* idef, PbcType pbcType, int natoms);
void gmx_rmpbc_done(gmx_rmpbc_t gpbc);
* boundary conditions such that every molecule is whole.
* natoms is the size x and can be smaller than the number
* of atoms in idef, but should only contain complete molecules.
- * When ePBC=-1, the type of pbc is guessed from the box matrix.
+ * When pbcType=PbcType::Unset, the type of pbc is guessed from the box matrix.
*/
void gmx_rmpbc_copy(gmx_rmpbc_t gpbc, int natoms, const matrix box, rvec x[], rvec x_s[]);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
pull->numUnregisteredExternalPotentials = pull->numCoordinatesWithExternalPotential;
pull->numExternalPotentialsStillToBeAppliedThisStep = 0;
- pull->ePBC = ir->ePBC;
- switch (pull->ePBC)
+ pull->pbcType = ir->pbcType;
+ switch (pull->pbcType)
{
- case epbcNONE: pull->npbcdim = 0; break;
- case epbcXY: pull->npbcdim = 2; break;
+ case PbcType::No: pull->npbcdim = 0; break;
+ case PbcType::XY: pull->npbcdim = 2; break;
default: pull->npbcdim = 3; break;
}
else
{
t_pbc pbc;
- set_pbc(&pbc, ir->ePBC, state->box);
+ set_pbc(&pbc, ir->pbcType, state->box);
initPullComFromPrevStep(cr, pull_work, md, &pbc, state->x.rvec_array());
updatePrevStepPullCom(pull_work, state);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#endif
class PullHistory;
+enum class PbcType : int;
enum
{
gmx_bool bConstraint; /* Are there constrained coordinates? */
gmx_bool bAngle; /* Are there angle geometry coordinates? */
- int ePBC; /* the boundary conditions */
+ PbcType pbcType; /* the boundary conditions */
int npbcdim; /* do pbc in dims 0 <= dim < npbcdim */
gmx_bool bRefAt; /* do we need reference atoms for a group COM ? */
int cosdim; /* dimension for cosine weighting, -1 if none */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* When ir->bContinuation=TRUE this has already been done, but ok. */
snew(x_pbc, mtop->natoms);
copy_rvecn(globalState->x.rvec_array(), x_pbc, 0, mtop->natoms);
- do_pbc_first_mtop(nullptr, ir->ePBC, globalState->box, mtop, x_pbc);
+ do_pbc_first_mtop(nullptr, ir->pbcType, globalState->box, mtop, x_pbc);
/* All molecules will be whole now, but not necessarily in the home box.
* Additionally, if a rotation group consists of more than one molecule
* (e.g. two strands of DNA), each one of them can end up in a different
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int pullCheckPbcWithinGroups(const pull_t& pull, const rvec* x, const t_pbc& pbc, real pbcMargin)
{
- if (pbc.ePBC == epbcNONE)
+ if (pbc.pbcType == PbcType::No)
{
return -1;
}
int groupNr,
real pbcMargin)
{
- if (pbc.ePBC == epbcNONE)
+ if (pbc.pbcType == PbcType::No)
{
return true;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
protected:
PullTest() {}
- void test(int epbc, matrix box)
+ void test(PbcType pbcType, matrix box)
{
t_pbc pbc;
// PBC stuff
- set_pbc(&pbc, epbc, box);
+ set_pbc(&pbc, pbcType, box);
GMX_ASSERT(pbc.ndim_ePBC >= 1 && pbc.ndim_ePBC <= DIM,
"Tests only support PBC along at least x and at most x, y, and z");
{
matrix box = { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 0, 10 } };
- test(epbcSCREW, box);
+ test(PbcType::Screw, box);
}
TEST_F(PullTest, MaxPullDistanceXyzCubicBox)
{
matrix box = { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 0, 10 } };
- test(epbcXYZ, box);
+ test(PbcType::Xyz, box);
}
TEST_F(PullTest, MaxPullDistanceXyzTricBox)
{
matrix box = { { 10, 0, 0 }, { 3, 10, 0 }, { 3, 4, 10 } };
- test(epbcXYZ, box);
+ test(PbcType::Xyz, box);
}
TEST_F(PullTest, MaxPullDistanceXyzLongBox)
{
matrix box = { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 0, 30 } };
- test(epbcXYZ, box);
+ test(PbcType::Xyz, box);
}
TEST_F(PullTest, MaxPullDistanceXySkewedBox)
{
matrix box = { { 10, 0, 0 }, { 5, 8, 0 }, { 0, 0, 0 } };
- test(epbcXY, box);
+ test(PbcType::XY, box);
}
} // namespace
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
GMX_ASSERT(mdatoms.homenr >= 0, "number of home atoms must be non-negative.");
const auto& box = forceProviderInput.box_;
- GMX_ASSERT(check_box(-1, box) == nullptr, "Invalid box.");
+ GMX_ASSERT(check_box(PbcType::Unset, box) == nullptr, "Invalid box.");
t_pbc pbc{};
- set_pbc(&pbc, -1, box);
+ set_pbc(&pbc, PbcType::Unset, box);
const auto& x = forceProviderInput.x_;
const auto& cr = forceProviderInput.cr_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2012,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2012,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/math/functions.h"
#include "gromacs/math/vec.h"
#include "gromacs/pbcutil/pbc.h"
-#include "gromacs/topology/block.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/mutex.h"
#include "gromacs/utility/stringutil.h"
*/
void init(AnalysisNeighborhood::SearchMode mode,
bool bXY,
- const t_blocka* excls,
+ const ListOfLists<int>* excls,
const t_pbc* pbc,
const AnalysisNeighborhoodPositions& positions);
PairSearchImplPointer getPairSearch();
//! Reference position indices (NULL if no indices).
const int* refIndices_;
//! Exclusions.
- const t_blocka* excls_;
+ const ListOfLists<int>* excls_;
//! PBC data.
t_pbc pbc_;
testPositions_ = nullptr;
testExclusionIds_ = nullptr;
testIndices_ = nullptr;
- nexcl_ = 0;
- excl_ = nullptr;
clear_rvec(xtest_);
clear_rvec(testcell_);
clear_ivec(currCell_);
const int* testExclusionIds_;
//! Reference to the test position indices.
const int* testIndices_;
- //! Number of excluded reference positions for current test particle.
- int nexcl_;
//! Exclusions for current test particle.
- const int* excl_;
+ ArrayRef<const int> excl_;
//! Index of the currently active test position in \p testPositions_.
int testIndex_;
//! Stores test position during a pair loop.
// or remove throughout.
GMX_UNUSED_VALUE(bForce);
- switch (pbc.ePBC)
+ switch (pbc.pbcType)
{
- case epbcNONE:
+ case PbcType::No:
bGridPBC_[XX] = false;
bGridPBC_[YY] = false;
bGridPBC_[ZZ] = false;
break;
- case epbcXY:
+ case PbcType::XY:
bGridPBC_[XX] = true;
bGridPBC_[YY] = true;
bGridPBC_[ZZ] = false;
break;
- case epbcXYZ:
+ case PbcType::Xyz:
bGridPBC_[XX] = true;
bGridPBC_[YY] = true;
bGridPBC_[ZZ] = true;
void AnalysisNeighborhoodSearchImpl::init(AnalysisNeighborhood::SearchMode mode,
bool bXY,
- const t_blocka* excls,
+ const ListOfLists<int>* excls,
const t_pbc* pbc,
const AnalysisNeighborhoodPositions& positions)
{
GMX_RELEASE_ASSERT(positions.index_ == -1,
"Individual indexed positions not supported as reference");
bXY_ = bXY;
- if (bXY_ && pbc != nullptr && pbc->ePBC != epbcNONE)
+ if (bXY_ && pbc != nullptr && pbc->pbcType != PbcType::No)
{
- if (pbc->ePBC != epbcXY && pbc->ePBC != epbcXYZ)
+ if (pbc->pbcType != PbcType::XY && pbc->pbcType != PbcType::Xyz)
{
std::string message = formatString(
"Computations in the XY plane are not supported with PBC type '%s'",
- epbc_names[pbc->ePBC]);
+ c_pbcTypeNames[pbc->pbcType].c_str());
GMX_THROW(NotImplementedError(message));
}
- if (pbc->ePBC == epbcXYZ
+ if (pbc->pbcType == PbcType::Xyz
&& (std::fabs(pbc->box[ZZ][XX]) > GMX_REAL_EPS * pbc->box[ZZ][ZZ]
|| std::fabs(pbc->box[ZZ][YY]) > GMX_REAL_EPS * pbc->box[ZZ][ZZ]))
{
matrix box;
copy_mat(pbc->box, box);
clear_rvec(box[ZZ]);
- set_pbc(&pbc_, epbcXY, box);
+ set_pbc(&pbc_, PbcType::XY, box);
}
else if (pbc != nullptr)
{
}
else
{
- pbc_.ePBC = epbcNONE;
+ pbc_.pbcType = PbcType::No;
clear_mat(pbc_.box);
}
nref_ = positions.count_;
if (search_.excls_ != nullptr)
{
const int exclIndex = testExclusionIds_[index];
- if (exclIndex < search_.excls_->nr)
+ if (exclIndex < search_.excls_->ssize())
{
- const int startIndex = search_.excls_->index[exclIndex];
- nexcl_ = search_.excls_->index[exclIndex + 1] - startIndex;
- excl_ = &search_.excls_->a[startIndex];
+ excl_ = (*search_.excls_)[exclIndex];
}
else
{
- nexcl_ = 0;
- excl_ = nullptr;
+ excl_ = ArrayRef<const int>();
}
}
}
bool AnalysisNeighborhoodPairSearchImpl::isExcluded(int j)
{
- if (exclind_ < nexcl_)
+ const int nexcl = excl_.ssize();
+ if (exclind_ < nexcl)
{
const int index = (search_.refIndices_ != nullptr ? search_.refIndices_[j] : j);
const int refId = search_.refExclusionIds_[index];
- while (exclind_ < nexcl_ && excl_[exclind_] < refId)
+ while (exclind_ < nexcl && excl_[exclind_] < refId)
{
++exclind_;
}
- if (exclind_ < nexcl_ && refId == excl_[exclind_])
+ if (exclind_ < nexcl && refId == excl_[exclind_])
{
++exclind_;
return true;
continue;
}
rvec dx;
- if (search_.pbc_.ePBC != epbcNONE)
+ if (search_.pbc_.pbcType != PbcType::No)
{
pbc_dx(&search_.pbc_, search_.xref_[i], xtest_, dx);
}
SearchImplPointer getSearch();
- Mutex createSearchMutex_;
- SearchList searchList_;
- real cutoff_;
- const t_blocka* excls_;
- SearchMode mode_;
- bool bXY_;
+ Mutex createSearchMutex_;
+ SearchList searchList_;
+ real cutoff_;
+ const ListOfLists<int>* excls_;
+ SearchMode mode_;
+ bool bXY_;
};
AnalysisNeighborhood::Impl::SearchImplPointer AnalysisNeighborhood::Impl::getSearch()
impl_->bXY_ = bXY;
}
-void AnalysisNeighborhood::setTopologyExclusions(const t_blocka* excls)
+void AnalysisNeighborhood::setTopologyExclusions(const ListOfLists<int>* excls)
{
GMX_RELEASE_ASSERT(impl_->searchList_.empty(),
"Changing the exclusions after initSearch() not currently supported");
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/real.h"
-struct t_blocka;
struct t_pbc;
namespace gmx
{
+template<typename>
+class ListOfLists;
namespace internal
{
*
* \see AnalysisNeighborhoodPositions::exclusionIds()
*/
- void setTopologyExclusions(const t_blocka* excls);
+ void setTopologyExclusions(const ListOfLists<int>* excls);
/*! \brief
* Sets the algorithm to use for searching.
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2013,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2012,2013,2014,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/random/threefry.h"
#include "gromacs/random/uniformrealdistribution.h"
#include "gromacs/topology/block.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
refPosCount_(0)
{
clear_mat(box_);
- set_pbc(&pbc_, epbcNONE, box_);
+ set_pbc(&pbc_, PbcType::No, box_);
}
gmx::RVec NeighborhoodSearchTestData::generateRandomPosition()
class ExclusionsHelper
{
public:
- static void markExcludedPairs(RefPairList* refPairs, int testIndex, const t_blocka* excls);
+ static void markExcludedPairs(RefPairList* refPairs, int testIndex, const gmx::ListOfLists<int>* excls);
ExclusionsHelper(int refPosCount, int testPosCount);
void generateExclusions();
- const t_blocka* exclusions() const { return &excls_; }
+ const gmx::ListOfLists<int>* exclusions() const { return &excls_; }
gmx::ArrayRef<const int> refPosIds() const
{
}
private:
- int refPosCount_;
- int testPosCount_;
- std::vector<int> exclusionIds_;
- std::vector<int> exclsIndex_;
- std::vector<int> exclsAtoms_;
- t_blocka excls_;
+ int refPosCount_;
+ int testPosCount_;
+ std::vector<int> exclusionIds_;
+ gmx::ListOfLists<int> excls_;
};
// static
-void ExclusionsHelper::markExcludedPairs(RefPairList* refPairs, int testIndex, const t_blocka* excls)
+void ExclusionsHelper::markExcludedPairs(RefPairList* refPairs, int testIndex, const gmx::ListOfLists<int>* excls)
{
int count = 0;
- for (int i = excls->index[testIndex]; i < excls->index[testIndex + 1]; ++i)
+ for (const int excludedIndex : (*excls)[testIndex])
{
- const int excludedIndex = excls->a[i];
NeighborhoodSearchTestData::RefPair searchPair(excludedIndex, 0.0);
RefPairList::iterator excludedRefPair =
std::lower_bound(refPairs->begin(), refPairs->end(), searchPair);
exclusionIds_.resize(std::max(refPosCount, testPosCount), 1);
exclusionIds_[0] = 0;
std::partial_sum(exclusionIds_.begin(), exclusionIds_.end(), exclusionIds_.begin());
-
- excls_.nr = 0;
- excls_.index = nullptr;
- excls_.nra = 0;
- excls_.a = nullptr;
- excls_.nalloc_index = 0;
- excls_.nalloc_a = 0;
}
void ExclusionsHelper::generateExclusions()
// particles would be higher, or where the exclusions would not be random,
// to make a higher percentage of the exclusions to actually be within the
// cutoff.
- exclsIndex_.reserve(testPosCount_ + 1);
- exclsAtoms_.reserve(testPosCount_ * 20);
- exclsIndex_.push_back(0);
for (int i = 0; i < testPosCount_; ++i)
{
+ excls_.pushBackListOfSize(20);
+ gmx::ArrayRef<int> exclusionsForAtom = excls_.back();
for (int j = 0; j < 20; ++j)
{
- exclsAtoms_.push_back(i + j * 3);
+ exclusionsForAtom[j] = i + j * 3;
}
- exclsIndex_.push_back(exclsAtoms_.size());
}
- excls_.nr = exclsIndex_.size();
- excls_.index = exclsIndex_.data();
- excls_.nra = exclsAtoms_.size();
- excls_.a = exclsAtoms_.data();
}
/********************************************************************
void testPairSearchFull(gmx::AnalysisNeighborhoodSearch* search,
const NeighborhoodSearchTestData& data,
const gmx::AnalysisNeighborhoodPositions& pos,
- const t_blocka* excls,
+ const gmx::ListOfLists<int>* excls,
const gmx::ArrayRef<const int>& refIndices,
const gmx::ArrayRef<const int>& testIndices,
bool selfPairs);
void NeighborhoodSearchTest::testPairSearchFull(gmx::AnalysisNeighborhoodSearch* search,
const NeighborhoodSearchTestData& data,
const gmx::AnalysisNeighborhoodPositions& pos,
- const t_blocka* excls,
+ const gmx::ListOfLists<int>* excls,
const gmx::ArrayRef<const int>& refIndices,
const gmx::ArrayRef<const int>& testIndices,
bool selfPairs)
data_.box_[ZZ][ZZ] = 3.0;
data_.generateRandomRefPositions(10);
data_.generateRandomTestPositions(5);
- set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::Xyz, data_.box_);
data_.computeReferences(&data_.pbc_);
}
data_.box_[ZZ][ZZ] = 3.0;
data_.generateRandomRefPositions(20);
data_.useRefPositionsAsTestPositions();
- set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::Xyz, data_.box_);
data_.computeReferences(&data_.pbc_);
}
// test coverage.
data_.generateRandomRefPositions(1000);
data_.generateRandomTestPositions(100);
- set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::Xyz, data_.box_);
data_.computeReferences(&data_.pbc_);
}
data_.box_[ZZ][ZZ] = 7.0;
data_.generateRandomRefPositions(1000);
data_.useRefPositionsAsTestPositions();
- set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::Xyz, data_.box_);
data_.computeReferences(&data_.pbc_);
}
// test coverage.
data_.generateRandomRefPositions(1000);
data_.generateRandomTestPositions(100);
- set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::Xyz, data_.box_);
data_.computeReferencesXY(&data_.pbc_);
}
// test coverage.
data_.generateRandomRefPositions(1000);
data_.generateRandomTestPositions(100);
- set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::Xyz, data_.box_);
data_.computeReferences(&data_.pbc_);
}
// test coverage.
data_.generateRandomRefPositions(1000);
data_.generateRandomTestPositions(100);
- set_pbc(&data_.pbc_, epbcXY, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::XY, data_.box_);
data_.computeReferences(&data_.pbc_);
}
// test coverage.
data_.generateRandomRefPositions(1000);
data_.generateRandomTestPositions(100);
- set_pbc(&data_.pbc_, epbcNONE, data_.box_);
+ set_pbc(&data_.pbc_, PbcType::No, data_.box_);
data_.computeReferences(nullptr);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void TopologyManager::loadTopology(const char* filename)
{
- bool fullTopology;
- int ePBC;
- rvec* xtop = nullptr;
- matrix box;
+ bool fullTopology;
+ PbcType pbcType;
+ rvec* xtop = nullptr;
+ matrix box;
GMX_RELEASE_ASSERT(mtop_ == nullptr, "Topology initialized more than once");
mtop_ = std::make_unique<gmx_mtop_t>();
readConfAndTopology(gmx::test::TestFileManager::getInputFilePath(filename).c_str(), &fullTopology,
- mtop_.get(), &ePBC, frame_ != nullptr ? &xtop : nullptr, nullptr, box);
+ mtop_.get(), &pbcType, frame_ != nullptr ? &xtop : nullptr, nullptr, box);
if (frame_ != nullptr)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* If this is not correct, the ion counts per channel will be very likely
* wrong.
*/
-static void outputStartStructureIfWanted(gmx_mtop_t* mtop, rvec* x, int ePBC, const matrix box)
+static void outputStartStructureIfWanted(gmx_mtop_t* mtop, rvec* x, PbcType pbcType, const matrix box)
{
char* env = getenv("GMX_COMPELDUMP");
SwS, SwSEmpty);
write_sto_conf_mtop("CompELAssumedWholeConfiguration.pdb", *mtop->name, mtop, x, nullptr,
- ePBC, box);
+ pbcType, box);
}
}
copy_rvecn(x, x_pbc, 0, mtop->natoms);
/* This can only make individual molecules whole, not multimers */
- do_pbc_mtop(ir->ePBC, box, mtop, x_pbc);
+ do_pbc_mtop(ir->pbcType, box, mtop, x_pbc);
/* Output the starting structure? */
- outputStartStructureIfWanted(mtop, x_pbc, ir->ePBC, box);
+ outputStartStructureIfWanted(mtop, x_pbc, ir->pbcType, box);
/* If this is the first run (i.e. no checkpoint present) we assume
* that the starting positions give us the correct PBC representation */
sc = ir->swap;
- set_pbc(s->pbc, ir->ePBC, box);
+ set_pbc(s->pbc, ir->pbcType, box);
/* Assemble the positions of the split groups, i.e. the channels.
* Here we also pass a shifts array to communicate_group_positions(), so that it can make
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/fileio/xvgr.h"
#include "gromacs/math/functions.h"
+#include "gromacs/math/multidimarray.h"
#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
+#include "gromacs/mdspan/extensions.h"
#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/utility/arrayref.h"
static void read_tables(FILE* fp, const char* filename, int ntab, int angle, t_tabledata td[])
{
char buf[STRLEN];
- double **yy = nullptr, start, end, dx0, dx1, ssd, vm, vp, f, numf;
- int k, i, nx, nx0 = 0, ny, nny, ns;
+ double start, end, dx0, dx1, ssd, vm, vp, f, numf;
+ int k, i, nx0 = 0, nny, ns;
gmx_bool bAllZero, bZeroV, bZeroF;
double tabscale;
nny = 2 * ntab + 1;
std::string libfn = gmx::findLibraryFile(filename);
- nx = read_xvg(libfn.c_str(), &yy, &ny);
- if (ny != nny)
+ gmx::MultiDimArray<std::vector<double>, gmx::dynamicExtents2D> xvgData = readXvgData(libfn);
+ int numColumns = xvgData.extent(0);
+ if (numColumns != nny)
{
gmx_fatal(FARGS, "Trying to read file %s, but nr columns = %d, should be %d", libfn.c_str(),
- ny, nny);
+ numColumns, nny);
}
+ int numRows = xvgData.extent(1);
+
+ const auto& yy = xvgData.asView();
if (angle == 0)
{
if (yy[0][0] != 0.0)
start = -180.0;
}
end = 180.0;
- if (yy[0][0] != start || yy[0][nx - 1] != end)
+ if (yy[0][0] != start || yy[0][numRows - 1] != end)
{
gmx_fatal(FARGS, "The angles in file %s should go from %f to %f instead of %f to %f\n",
- libfn.c_str(), start, end, yy[0][0], yy[0][nx - 1]);
+ libfn.c_str(), start, end, yy[0][0], yy[0][numRows - 1]);
}
}
- tabscale = (nx - 1) / (yy[0][nx - 1] - yy[0][0]);
+ tabscale = (numRows - 1) / (yy[0][numRows - 1] - yy[0][0]);
if (fp)
{
- fprintf(fp, "Read user tables from %s with %d data points.\n", libfn.c_str(), nx);
+ fprintf(fp, "Read user tables from %s with %d data points.\n", libfn.c_str(), numRows);
if (angle == 0)
{
fprintf(fp, "Tabscale = %g points/nm\n", tabscale);
{
bZeroV = TRUE;
bZeroF = TRUE;
- for (i = 0; (i < nx); i++)
+ for (i = 0; (i < numRows); i++)
{
if (i >= 2)
{
if (!bZeroV && bZeroF)
{
- set_forces(fp, angle, nx, 1 / tabscale, yy[1 + k * 2], yy[1 + k * 2 + 1], k);
+ set_forces(fp, angle, numRows, 1 / tabscale, yy[1 + k * 2].data(),
+ yy[1 + k * 2 + 1].data(), k);
}
else
{
*/
ssd = 0;
ns = 0;
- for (i = 1; (i < nx - 1); i++)
+ for (i = 1; (i < numRows - 1); i++)
{
vm = yy[1 + 2 * k][i - 1];
vp = yy[1 + 2 * k][i + 1];
for (k = 0; (k < ntab); k++)
{
- init_table(nx, nx0, tabscale, &(td[k]), TRUE);
- for (i = 0; (i < nx); i++)
+ init_table(numRows, nx0, tabscale, &(td[k]), TRUE);
+ for (i = 0; (i < numRows); i++)
{
td[k].x[i] = yy[0][i];
td[k].v[i] = yy[2 * k + 1][i];
td[k].f[i] = yy[2 * k + 2][i];
}
}
- for (i = 0; (i < ny); i++)
- {
- sfree(yy[i]);
- }
- sfree(yy);
}
static void done_tabledata(t_tabledata* td)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
-#include "gromacs/mdtypes/fcdata.h"
-#include "gromacs/mdtypes/forcerec.h"
-#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/utility/real.h"
+struct EwaldCorrectionTables;
+struct bondedtable_t;
+struct interaction_const_t;
+struct t_forcetable;
+
/*! \brief Flag to select user tables for make_tables */
#define GMX_MAKETABLES_FORCEUSER (1 << 0)
/*! \brief Flag to only make 1,4 pair tables for make_tables */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019 by the GROMACS development team.
+ * Copyright (c) 2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/hardware/hardwaretopology.h"
#include "gromacs/hardware/hw_info.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
-#include "gromacs/mdlib/update_constrain_cuda.h"
+#include "gromacs/mdlib/update_constrain_gpu.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
// The graph is needed, but not supported
errorMessage += "Orientation restraints are not supported.\n";
}
- if (inputrec.efep != efepNO)
+ if (inputrec.efep != efepNO
+ && (haveFreeEnergyType(inputrec, efptBONDED) || haveFreeEnergyType(inputrec, efptMASS)))
{
- // Actually all free-energy options except for mass and constraint perturbation are supported
- errorMessage += "Free energy perturbations are not supported.\n";
+ errorMessage += "Free energy perturbation for mass and constraints are not supported.\n";
}
const auto particleTypes = gmx_mtop_particletype_count(mtop);
if (particleTypes[eptShell] > 0)
{
errorMessage += "Non-connecting constraints are not supported";
}
- if (!UpdateConstrainCuda::isNumCoupledConstraintsSupported(mtop))
+ if (!UpdateConstrainGpu::isNumCoupledConstraintsSupported(mtop))
{
errorMessage +=
- "The number of coupled constraints is higher than supported in the CUDA LINCS "
+ "The number of coupled constraints is higher than supported in the GPU LINCS "
"code.\n";
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
namespace gmx
{
-SimulationWorkload createSimulationWorkload(bool useGpuForNonbonded,
- PmeRunMode pmeRunMode,
- bool useGpuForBonded,
- bool useGpuForUpdate,
- bool useGpuForBufferOps,
- bool useGpuHaloExchange,
- bool useGpuPmePpComm,
- bool haveEwaldSurfaceContribution)
+SimulationWorkload createSimulationWorkload(const t_inputrec& inputrec,
+ bool useGpuForNonbonded,
+ PmeRunMode pmeRunMode,
+ bool useGpuForBonded,
+ bool useGpuForUpdate,
+ bool useGpuForBufferOps,
+ bool useGpuHaloExchange,
+ bool useGpuPmePpComm)
{
SimulationWorkload simulationWorkload;
+ simulationWorkload.computeMuTot = inputrecNeedMutot(&inputrec);
simulationWorkload.useCpuNonbonded = !useGpuForNonbonded;
simulationWorkload.useGpuNonbonded = useGpuForNonbonded;
simulationWorkload.useCpuPme = (pmeRunMode == PmeRunMode::CPU);
simulationWorkload.useGpuHaloExchange = useGpuHaloExchange;
simulationWorkload.useGpuPmePpCommunication = useGpuPmePpComm && (pmeRunMode == PmeRunMode::GPU);
simulationWorkload.useGpuDirectCommunication = useGpuHaloExchange || useGpuPmePpComm;
- simulationWorkload.haveEwaldSurfaceContribution = haveEwaldSurfaceContribution;
+ simulationWorkload.haveEwaldSurfaceContribution = haveEwaldSurfaceContribution(inputrec);
return simulationWorkload;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* Build datastructure that contains decisions whether to run different workload
* task on GPUs.
*
+ * \param[in] inputrec The input record
* \param[in] useGpuForNonbonded Whether we have short-range nonbonded interactions
* calculations on GPU(s).
* \param[in] pmeRunMode Run mode indicating what resource is PME execured on.
* \param[in] useGpuForBufferOps Whether buffer ops / reduction are calculated on GPU(s).
* \param[in] useGpuHaloExchange Whether GPU direct communication is used in halo exchange.
* \param[in] useGpuPmePpComm Whether GPU direct communication is used in PME-PP communication.
- * \param[in] haveEwaldSurfaceContribution Whether there is an Ewald surface contribution
* \returns Simulation lifetime constant workload description.
*/
-SimulationWorkload createSimulationWorkload(bool useGpuForNonbonded,
- PmeRunMode pmeRunMode,
- bool useGpuForBonded,
- bool useGpuForUpdate,
- bool useGpuForBufferOps,
- bool useGpuHaloExchange,
- bool useGpuPmePpComm,
- bool haveEwaldSurfaceContribution);
+SimulationWorkload createSimulationWorkload(const t_inputrec& inputrec,
+ bool useGpuForNonbonded,
+ PmeRunMode pmeRunMode,
+ bool useGpuForBonded,
+ bool useGpuForUpdate,
+ bool useGpuForBufferOps,
+ bool useGpuHaloExchange,
+ bool useGpuPmePpComm);
} // namespace gmx
numRanksOnThisNode_, printHostName, useGpuForBonded, pmeRunMode, useGpuForUpdate);
}
-gmx_device_info_t* GpuTaskAssignments::initNonbondedDevice(const t_commrec* cr) const
+DeviceInformation* GpuTaskAssignments::initNonbondedDevice(const t_commrec* cr) const
{
- gmx_device_info_t* deviceInfo = nullptr;
+ DeviceInformation* deviceInfo = nullptr;
const GpuTaskAssignment& gpuTaskAssignment = assignmentForAllRanksOnThisNode_[indexOfThisRank_];
// This works because only one task of each type per rank is currently permitted.
return deviceInfo;
}
-gmx_device_info_t* GpuTaskAssignments::initPmeDevice() const
+DeviceInformation* GpuTaskAssignments::initPmeDevice() const
{
- gmx_device_info_t* deviceInfo = nullptr;
+ DeviceInformation* deviceInfo = nullptr;
const GpuTaskAssignment& gpuTaskAssignment = assignmentForAllRanksOnThisNode_[indexOfThisRank_];
// This works because only one task of each type is currently permitted.
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/gmxmpi.h"
-struct gmx_device_info_t;
+struct DeviceInformation;
struct gmx_hw_info_t;
struct t_commrec;
* \todo This also sets up DLB for device sharing, where
* appropriate, but that responsbility should move
* elsewhere. */
- gmx_device_info_t* initNonbondedDevice(const t_commrec* cr) const;
+ DeviceInformation* initNonbondedDevice(const t_commrec* cr) const;
/*! \brief Return handle to the initialized GPU to use for the
* PME task on this rank, if any.
*
* Returns nullptr if no such task is assigned to this rank. */
- gmx_device_info_t* initPmeDevice() const;
+ DeviceInformation* initPmeDevice() const;
//! Return whether this rank has a PME task running on a GPU
bool thisRankHasPmeGpuTask() const;
//! Return whether this rank has any task running on a GPU
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2006 David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2006 David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#elif defined(_MSC_VER)
# include <windows.h>
-typedef __int64 gmx_cycles_t;
+typedef __int64 gmx_cycles_t;
#elif (defined(__hpux) || defined(__HP_cc)) && defined(__ia64)
/* HP compiler on ia64 */
# include <machine/sys/inline.h>
-typedef unsigned long gmx_cycles_t;
+typedef unsigned long gmx_cycles_t;
#elif (defined(__INTEL_COMPILER) || defined(__ECC)) && defined(__ia64__)
/* Intel compiler on ia64 */
# include <ia64intrin.h>
-typedef unsigned long gmx_cycles_t;
+typedef unsigned long gmx_cycles_t;
#elif defined(__GNUC__) && defined(__ia64__)
/* ia64 with GCC inline assembly */
#elif ((defined(__hppa__) || defined(__hppa)) && defined(__hpux))
/* HP PA-RISC, instruction when using HP compiler */
# include <machine/inline.h>
-typedef unsigned long gmx_cycles_t;
+typedef unsigned long gmx_cycles_t;
#elif defined(__GNUC__) && defined(__s390__)
/* S390, taken from FFTW who got it from James Treacy */
-typedef unsigned long long gmx_cycles_t;
+typedef unsigned long long gmx_cycles_t;
#elif defined(__GNUC__) && defined(__alpha__)
/* gcc inline assembly on alpha CPUs */
#elif defined(__DECC) && defined(__alpha)
/* Digital GEM C compiler on alpha */
# include <c_asm.h>
-typedef unsigned long gmx_cycles_t;
+typedef unsigned long gmx_cycles_t;
#elif (defined(__sgi) && defined(CLOCK_SGI_CYCLE))
/* Irix compilers on SGI hardware. Get nanoseconds from struct timespec */
#elif (defined(__SVR4) && defined(__SUNPRO_CC))
/* Solaris high-resolution timers */
-typedef hrtime_t gmx_cycles_t;
+typedef hrtime_t gmx_cycles_t;
#elif defined(__xlC__) && defined(_AIX)
/* AIX compilers */
#elif ((defined(__GNUC__) || defined(__IBM_GCC_ASM) || defined(__IBM_STDCPP_ASM)) \
&& (defined(__powerpc__) || defined(__ppc__)))
/* PowerPC using gcc inline assembly (also works on xlc>=7.0 with -qasm=gcc) */
-typedef unsigned long long gmx_cycles_t;
+typedef unsigned long long gmx_cycles_t;
#elif (defined(__MWERKS__) && (defined(MAC) || defined(macintosh)))
/* Metrowerks on macintosh */
#elif defined(__sun) && defined(__sparcv9)
-typedef unsigned long gmx_cycles_t;
+typedef unsigned long gmx_cycles_t;
#else
/*! \brief Integer-like datatype for cycle counter values
* the difference between two gmx_cycles_t values returned from this
* routine.
*/
-#if (GMX_CYCLECOUNTERS == 0)
-static __inline__ gmx_cycles_t gmx_cycles_read(void)
-{
- return 0;
-}
-#elif ((defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__PATHSCALE__) || defined(__PGIC__)) \
- && (defined(__i386__) || defined(__x86_64__)) && !defined(_CRAYC))
+#if ((defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__PATHSCALE__) || defined(__PGIC__)) \
+ && (defined(__i386__) || defined(__x86_64__)) && !defined(_CRAYC))
static __inline__ gmx_cycles_t gmx_cycles_read()
{
/* x86 with GCC inline assembly - pentium TSC register */
* one when later linking to the library it might happen that the
* library supports cyclecounters but not the headers, or vice versa.
*/
-#if (GMX_CYCLECOUNTERS == 0)
-static __inline__ bool gmx_cycles_have_counter(void)
-{
- return 0;
-}
-#elif ((defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__PATHSCALE__) \
- || defined(__PGIC__) || defined(_CRAYC)) \
- && (defined(__i386__) || defined(__x86_64__)))
+#if ((defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__PATHSCALE__) \
+ || defined(__PGIC__) || defined(_CRAYC)) \
+ && (defined(__i386__) || defined(__x86_64__)))
static __inline__ bool gmx_cycles_have_counter()
{
/* x86 or x86-64 with GCC inline assembly - pentium TSC register */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
}
-static void chk_bonds(t_idef* idef, int ePBC, rvec* x, matrix box, real tol)
+static void chk_bonds(t_idef* idef, PbcType pbcType, rvec* x, matrix box, real tol)
{
int ftype, k, ai, aj, type;
real b0, blen, deviation;
t_pbc pbc;
rvec dx;
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
for (ftype = 0; (ftype < F_NRE); ftype++)
{
if ((interaction_function[ftype].flags & IF_CHEMBOND) == IF_CHEMBOND)
natoms = new_natoms;
if (tpr)
{
- chk_bonds(&top.idef, ir.ePBC, fr.x, fr.box, tol);
+ chk_bonds(&top.idef, ir.pbcType, fr.x, fr.box, tol);
}
if (fr.bX)
{
{
int natom, i, j, k;
t_topology top;
- int ePBC;
+ PbcType pbcType;
t_atoms* atoms;
rvec * x, *v;
rvec dx;
real* atom_vdw;
fprintf(stderr, "Checking coordinate file %s\n", fn);
- read_tps_conf(fn, &top, &ePBC, &x, &v, box, TRUE);
+ read_tps_conf(fn, &top, &pbcType, &x, &v, box, TRUE);
atoms = &top.atoms;
natom = atoms->nr;
fprintf(stderr, "%d atoms in file\n", atoms->nr);
}
if (bB)
{
- set_pbc(&pbc, ePBC, box);
+ set_pbc(&pbc, pbcType, box);
}
bFirst = TRUE;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
"of atoms in the tpr file (%d)", \
(i), (n))
-static gmx_bool* bKeepIt(int gnx, int natoms, int index[])
+static std::vector<bool> bKeepIt(int gnx, int natoms, int index[])
{
- gmx_bool* b;
- int i;
+ std::vector<bool> b(natoms);
- snew(b, natoms);
- for (i = 0; (i < gnx); i++)
+ for (int i = 0; (i < gnx); i++)
{
RANGECHK(index[i], natoms);
- b[index[i]] = TRUE;
+ b[index[i]] = true;
}
return b;
}
-static int* invind(int gnx, int natoms, int index[])
+static std::vector<int> invind(int gnx, int natoms, int index[])
{
- int* inv;
- int i;
+ std::vector<int> inv(natoms);
- snew(inv, natoms);
- for (i = 0; (i < gnx); i++)
+ for (int i = 0; (i < gnx); i++)
{
RANGECHK(index[i], natoms);
inv[index[i]] = i;
return inv;
}
-static void reduce_block(const gmx_bool bKeep[], t_block* block, const char* name)
+static gmx::ListOfLists<int> reduce_listoflists(gmx::ArrayRef<const int> invindex,
+ const std::vector<bool>& bKeep,
+ const gmx::ListOfLists<int>& src,
+ const char* name)
{
- int* index;
- int i, j, newi, newj;
-
- snew(index, block->nr);
+ gmx::ListOfLists<int> lists;
- newi = newj = 0;
- for (i = 0; (i < block->nr); i++)
+ std::vector<int> exclusionsForAtom;
+ for (gmx::index i = 0; i < src.ssize(); i++)
{
- for (j = block->index[i]; (j < block->index[i + 1]); j++)
+ if (bKeep[i])
{
- if (bKeep[j])
+ exclusionsForAtom.clear();
+ for (const int j : src[i])
{
- newj++;
+ if (bKeep[j])
+ {
+ exclusionsForAtom.push_back(invindex[j]);
+ }
}
- }
- if (newj > index[newi])
- {
- newi++;
- index[newi] = newj;
+ lists.pushBack(exclusionsForAtom);
}
}
- fprintf(stderr, "Reduced block %8s from %6d to %6d index-, %6d to %6d a-entries\n", name,
- block->nr, newi, block->index[block->nr], newj);
- block->index = index;
- block->nr = newi;
-}
-
-static void reduce_blocka(const int invindex[], const gmx_bool bKeep[], t_blocka* block, const char* name)
-{
- int *index, *a;
- int i, j, k, newi, newj;
-
- snew(index, block->nr);
- snew(a, block->nra);
-
- newi = newj = 0;
- for (i = 0; (i < block->nr); i++)
- {
- for (j = block->index[i]; (j < block->index[i + 1]); j++)
- {
- k = block->a[j];
- if (bKeep[k])
- {
- a[newj] = invindex[k];
- newj++;
- }
- }
- if (newj > index[newi])
- {
- newi++;
- index[newi] = newj;
- }
- }
+ fprintf(stderr, "Reduced block %8s from %6zu to %6zu index-, %6d to %6d a-entries\n", name,
+ src.size(), lists.size(), src.numElements(), lists.numElements());
- fprintf(stderr, "Reduced block %8s from %6d to %6d index-, %6d to %6d a-entries\n", name,
- block->nr, newi, block->nra, newj);
- block->index = index;
- block->a = a;
- block->nr = newi;
- block->nra = newj;
+ return lists;
}
static void reduce_rvec(int gnx, const int index[], rvec vv[])
sfree(rinfo);
}
-static void reduce_ilist(const int invindex[], const gmx_bool bKeep[], t_ilist* il, int nratoms, const char* name)
+static void reduce_ilist(gmx::ArrayRef<const int> invindex,
+ const std::vector<bool>& bKeep,
+ t_ilist* il,
+ int nratoms,
+ const char* name)
{
t_iatom* ia;
int i, j, newnr;
static void reduce_topology_x(int gnx, int index[], gmx_mtop_t* mtop, rvec x[], rvec v[])
{
- t_topology top;
- gmx_bool* bKeep;
- int* invindex;
- int i;
+ gmx_localtop_t top;
+ gmx_mtop_generate_local_top(*mtop, &top, false);
+ t_atoms atoms = gmx_mtop_global_atoms(mtop);
- top = gmx_mtop_t_to_t_topology(mtop, false);
- bKeep = bKeepIt(gnx, top.atoms.nr, index);
- invindex = invind(gnx, top.atoms.nr, index);
+ const std::vector<bool> bKeep = bKeepIt(gnx, atoms.nr, index);
+ const std::vector<int> invindex = invind(gnx, atoms.nr, index);
- reduce_block(bKeep, &(top.mols), "mols");
- reduce_blocka(invindex, bKeep, &(top.excls), "excls");
reduce_rvec(gnx, index, x);
reduce_rvec(gnx, index, v);
- reduce_atom(gnx, index, top.atoms.atom, top.atoms.atomname, &(top.atoms.nres), top.atoms.resinfo);
+ reduce_atom(gnx, index, atoms.atom, atoms.atomname, &(atoms.nres), atoms.resinfo);
- for (i = 0; (i < F_NRE); i++)
+ for (int i = 0; (i < F_NRE); i++)
{
reduce_ilist(invindex, bKeep, &(top.idef.il[i]), interaction_function[i].nratoms,
interaction_function[i].name);
}
- top.atoms.nr = gnx;
+ atoms.nr = gnx;
mtop->moltype.resize(1);
mtop->moltype[0].name = mtop->name;
- mtop->moltype[0].atoms = top.atoms;
- for (i = 0; i < F_NRE; i++)
+ mtop->moltype[0].atoms = atoms;
+ mtop->moltype[0].excls = reduce_listoflists(invindex, bKeep, top.excls, "excls");
+ for (int i = 0; i < F_NRE; i++)
{
InteractionList& ilist = mtop->moltype[0].ilist[i];
ilist.iatoms.resize(top.idef.il[i].nr);
ilist.iatoms[j] = top.idef.il[i].iatoms[j];
}
}
- mtop->moltype[0].atoms = top.atoms;
- mtop->moltype[0].excls = top.excls;
mtop->molblock.resize(1);
mtop->molblock[0].type = 0;
mtop->molblock[0].nmol = 1;
- mtop->natoms = top.atoms.nr;
+ mtop->natoms = atoms.nr;
}
static void zeroq(const int index[], gmx_mtop_t* mtop)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int j;
t_atoms atoms;
rvec * x, *v;
- int ePBC;
+ PbcType pbcType;
matrix box;
t_blocka * block, *block2;
char ** gnames, **gnames2;
{
bool haveFullTopology = false;
fprintf(stderr, "\nReading structure file\n");
- readConfAndTopology(stxfile, &haveFullTopology, &mtop, &ePBC, &x, &v, box);
+ readConfAndTopology(stxfile, &haveFullTopology, &mtop, &pbcType, &x, &v, box);
atoms = gmx_mtop_global_atoms(&mtop);
if (atoms.pdbinfo == nullptr)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2017,2018,2019 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real* w_rls = nullptr;
int m, i, d, frame, outframe, natoms, nout, ncent, newstep = 0, model_nr;
#define SKIP 10
- t_topology* top = nullptr;
- gmx_conect gc = nullptr;
- int ePBC = -1;
- t_atoms * atoms = nullptr, useatoms;
+ t_topology* top = nullptr;
+ gmx_conect gc = nullptr;
+ PbcType pbcType = PbcType::Unset;
+ t_atoms * atoms = nullptr, useatoms;
matrix top_box;
int * index = nullptr, *cindex = nullptr;
char* grpnm = nullptr;
if (bTPS)
{
snew(top, 1);
- read_tps_conf(top_file, top, &ePBC, &xp, nullptr, top_box, bReset || bPBCcomRes);
+ read_tps_conf(top_file, top, &pbcType, &xp, nullptr, top_box, bReset || bPBCcomRes);
std::strncpy(top_title, *top->name, 255);
top_title[255] = '\0';
atoms = &top->atoms;
}
if (bRmPBC)
{
- gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr);
+ gpbc = gmx_rmpbc_init(&top->idef, pbcType, top->atoms.nr);
}
}
read_first_frame(oenv, &trxin, in_file, &fr, flags);
}
- set_trxframe_ePBC(&fr, ePBC);
+ setTrxFramePbcType(&fr, pbcType);
natoms = fr.natoms;
if (bSetTime)
}
else if (bCluster)
{
- calc_pbc_cluster(ecenter, ifit, top, ePBC, fr.x, ind_fit, fr.box);
+ calc_pbc_cluster(ecenter, ifit, top, pbcType, fr.x, ind_fit, fr.box);
}
if (bPFit)
switch (unitcell_enum)
{
case euRect:
- put_atoms_in_box(ePBC, fr.box, positionsArrayRef);
+ put_atoms_in_box(pbcType, fr.box, positionsArrayRef);
break;
case euTric:
put_atoms_in_triclinic_unitcell(ecenter, fr.box, positionsArrayRef);
break;
case euCompact:
- put_atoms_in_compact_unitcell(ePBC, ecenter, fr.box, positionsArrayRef);
+ put_atoms_in_compact_unitcell(pbcType, ecenter, fr.box,
+ positionsArrayRef);
break;
}
}
if (bPBCcomRes)
{
put_residue_com_in_box(unitcell_enum, ecenter, natoms, atoms->atom,
- ePBC, fr.box, fr.x);
+ pbcType, fr.box, fr.x);
}
if (bPBCcomMol)
{
put_molecule_com_in_box(unitcell_enum, ecenter, &top->mols, natoms,
- atoms->atom, ePBC, fr.box, fr.x);
+ atoms->atom, pbcType, fr.box, fr.x);
}
/* Copy the input trxframe struct to the output trxframe struct */
frout = fr;
model_nr++;
}
write_pdbfile(out, title.c_str(), &useatoms, frout.x,
- frout.ePBC, frout.box, ' ', model_nr, gc);
+ frout.pbcType, frout.box, ' ', model_nr, gc);
break;
case efG96:
const char* outputTitle = "";
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <algorithm>
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/txtdump.h"
return indent;
}
+static int pr_listoflists_title(FILE* fp, int indent, const char* title, const gmx::ListOfLists<int>* lists)
+{
+ if (available(fp, lists, indent, title))
+ {
+ indent = pr_title(fp, indent, title);
+ pr_indent(fp, indent);
+ fprintf(fp, "numLists=%zu\n", lists->size());
+ pr_indent(fp, indent);
+ fprintf(fp, "numElements=%d\n", lists->numElements());
+ }
+ return indent;
+}
+
static void low_pr_blocka(FILE* fp, int indent, const char* title, const t_blocka* block, gmx_bool bShowNumbers)
{
int i;
}
}
+void pr_listoflists(FILE* fp, int indent, const char* title, const gmx::ListOfLists<int>* lists, gmx_bool bShowNumbers)
+{
+ if (available(fp, lists, indent, title))
+ {
+ indent = pr_listoflists_title(fp, indent, title, lists);
+ for (gmx::index i = 0; i < lists->ssize(); i++)
+ {
+ int size = pr_indent(fp, indent);
+ gmx::ArrayRef<const int> list = (*lists)[i];
+ if (list.empty())
+ {
+ size += fprintf(fp, "%s[%d]={", title, int(i));
+ }
+ else
+ {
+ size += fprintf(fp, "%s[%d][num=%zu]={", title, bShowNumbers ? int(i) : -1, list.size());
+ }
+ bool isFirst = true;
+ for (const int j : list)
+ {
+ if (!isFirst)
+ {
+ size += fprintf(fp, ", ");
+ }
+ if ((size) > (USE_WIDTH))
+ {
+ fprintf(fp, "\n");
+ size = pr_indent(fp, indent + INDENT);
+ }
+ size += fprintf(fp, "%d", j);
+ isFirst = false;
+ }
+ fprintf(fp, "}\n");
+ }
+ }
+}
+
void copy_block(const t_block* src, t_block* dst)
{
dst->nr = src->nr;
namespace gmx
{
+template<typename>
+class ListOfLists;
+
/*! \brief Division of a range of indices into consecutive blocks
*
* A range of consecutive indices 0 to full.range.end() is divided
void pr_block(FILE* fp, int indent, const char* title, const t_block* block, gmx_bool bShowNumbers);
void pr_blocka(FILE* fp, int indent, const char* title, const t_blocka* block, gmx_bool bShowNumbers);
+void pr_listoflists(FILE* fp, int indent, const char* title, const gmx::ListOfLists<int>* block, gmx_bool bShowNumbers);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/topology/block.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
namespace gmx
{
+namespace
+{
+
+//! Converts ListOfLists to a list of ExclusionBlocks
+void listOfListsToExclusionBlocks(const ListOfLists<int>& b, gmx::ArrayRef<ExclusionBlock> b2)
+{
+ for (gmx::index i = 0; i < b.ssize(); i++)
+ {
+ for (int jAtom : b[i])
+ {
+ b2[i].atomNumber.push_back(jAtom);
+ }
+ }
+}
+
+//! Converts a list of ExclusionBlocks to ListOfLists
+void exclusionBlocksToListOfLists(gmx::ArrayRef<const ExclusionBlock> b2, ListOfLists<int>* b)
+{
+ b->clear();
+
+ for (const auto& block : b2)
+ {
+ b->pushBack(block.atomNumber);
+ }
+}
+
+} // namespace
+
void blockaToExclusionBlocks(const t_blocka* b, gmx::ArrayRef<ExclusionBlock> b2)
{
for (int i = 0; (i < b->nr); i++)
b->index[i] = nra;
}
-void mergeExclusions(t_blocka* excl, gmx::ArrayRef<ExclusionBlock> b2)
+namespace
{
- if (b2.empty())
- {
- return;
- }
- GMX_RELEASE_ASSERT(b2.ssize() == excl->nr,
- "Cannot merge exclusions for "
- "blocks that do not describe the same number "
- "of particles");
- /* Convert the t_blocka entries to ExclusionBlock form */
- blockaToExclusionBlocks(excl, b2);
-
- /* Count and sort the exclusions */
+//! Counts and sorts the exclusions
+int countAndSortExclusions(gmx::ArrayRef<ExclusionBlock> b2)
+{
int nra = 0;
for (auto& block : b2)
{
nra += block.nra();
}
}
- excl->nra = nra;
- srenew(excl->a, excl->nra);
- exclusionBlocksToBlocka(b2, excl);
+ return nra;
+}
+
+} // namespace
+
+void mergeExclusions(ListOfLists<int>* excl, gmx::ArrayRef<ExclusionBlock> b2)
+{
+ if (b2.empty())
+ {
+ return;
+ }
+ GMX_RELEASE_ASSERT(b2.ssize() == excl->ssize(),
+ "Cannot merge exclusions for "
+ "blocks that do not describe the same number "
+ "of particles");
+
+ /* Convert the t_blocka entries to ExclusionBlock form */
+ listOfListsToExclusionBlocks(*excl, b2);
+
+ countAndSortExclusions(b2);
+
+ exclusionBlocksToListOfLists(b2, excl);
}
} // namespace gmx
namespace gmx
{
+template<typename>
+class ListOfLists;
/*! \libinternal \brief
* Describes exclusions for a single atom.
* Requires that \c b2 and \c excl describe the same number of
* particles, if \c b2 describes a non-zero number.
*/
-void mergeExclusions(t_blocka* excl, gmx::ArrayRef<ExclusionBlock> b2);
+void mergeExclusions(ListOfLists<int>* excl, gmx::ArrayRef<ExclusionBlock> b2);
/*! \brief
* Convert the exclusions.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
GMX_ASSERT(iparams.size() == functype.size(), "Parameters and function types go together");
- return gmx::ssize(functype);
+ return static_cast<int>(functype.size());
}
/* TODO: Consider merging functype and iparams, either by storing
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
idef->iparams_fbposres = nullptr;
for (int f = 0; f < F_NRE; ++f)
{
- idef->il[f].iatoms = nullptr;
- idef->il[f].nalloc = 0;
- idef->il[f].nr = 0;
- idef->il[f].nr_nonperturbed = 0;
+ idef->il[f].iatoms = nullptr;
+ idef->il[f].nalloc = 0;
+ idef->il[f].nr = 0;
+ idef->numNonperturbedInteractions[f] = 0;
}
idef->cmap_grid = nullptr;
idef->iparams_posres_nalloc = 0;
idef->iparams_fbposres_nalloc = 0;
- idef->ilsort = 0;
+ idef->ilsort = ilsortUNKNOWN;
}
void done_idef(t_idef* idef)
void copy_ilist(const t_ilist* src, t_ilist* dst)
{
- dst->nr = src->nr;
- dst->nr_nonperturbed = src->nr_nonperturbed;
- dst->nalloc = src->nalloc;
+ dst->nr = src->nr;
+ dst->nalloc = src->nr;
- snew(dst->iatoms, dst->nr);
+ snew(dst->iatoms, dst->nalloc);
for (int i = 0; i < dst->nr; ++i)
{
dst->iatoms[i] = src->iatoms[i];
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
struct InteractionList
{
/* Returns the total number of elements in iatoms */
- int size() const { return gmx::ssize(iatoms); }
+ int size() const { return static_cast<int>(iatoms.size()); }
/* List of interactions, see explanation further down */
std::vector<int> iatoms;
int size() const { return nr; }
int nr;
- int nr_nonperturbed;
t_iatom* iatoms;
int nalloc;
};
int iparams_posres_nalloc, iparams_fbposres_nalloc;
t_ilist il[F_NRE];
- int ilsort;
+ /* The number of non-perturbed interactions at the start of each entry in il */
+ int numNonperturbedInteractions[F_NRE];
+ int ilsort;
} t_idef;
/*
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,
- * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2008,2009,2010, The GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2016 The GROMACS development team.
* Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* The cat routines below are old code from src/kernel/topcat.c
*/
-static void blockacat(t_blocka* dest, const t_blocka* src, int copies, int dnum, int snum)
-{
- int i, j, l, size;
- int destnr = dest->nr;
- int destnra = dest->nra;
-
- if (src->nr)
- {
- size = (dest->nr + copies * src->nr + 1);
- srenew(dest->index, size);
- }
- if (src->nra)
- {
- size = (dest->nra + copies * src->nra);
- srenew(dest->a, size);
- }
-
- for (l = destnr, j = 0; (j < copies); j++)
- {
- for (i = 0; (i < src->nr); i++)
- {
- dest->index[l++] = dest->nra + src->index[i];
- }
- dest->nra += src->nra;
- }
- for (l = destnra, j = 0; (j < copies); j++)
- {
- for (i = 0; (i < src->nra); i++)
- {
- dest->a[l++] = dnum + src->a[i];
- }
- dnum += snum;
- dest->nr += src->nr;
- }
- dest->index[dest->nr] = dest->nra;
- dest->nalloc_index = dest->nr;
- dest->nalloc_a = dest->nra;
-}
-
static void ilistcat(int ftype, t_ilist* dest, const InteractionList& src, int copies, int dnum, int snum)
{
int nral, c, i, a;
}
}
-/*! \brief Copy excls from mtop.
- *
- * Makes a deep copy of excls(t_blocka) from gmx_mtop_t.
- * Used to initialize legacy topology types.
+/*! \brief Generate a single list of lists of exclusions for the whole system
*
* \param[in] mtop Reference to input mtop.
- * \param[in] excls Pointer to final excls data structure.
*/
-static void copyExclsFromMtop(const gmx_mtop_t& mtop, t_blocka* excls)
+static gmx::ListOfLists<int> globalExclusionLists(const gmx_mtop_t& mtop)
{
- init_blocka(excls);
- int natoms = 0;
+ gmx::ListOfLists<int> excls;
+
+ int atomIndex = 0;
for (const gmx_molblock_t& molb : mtop.molblock)
{
const gmx_moltype_t& molt = mtop.moltype[molb.type];
- int srcnr = molt.atoms.nr;
- int destnr = natoms;
-
- blockacat(excls, &molt.excls, molb.nmol, destnr, srcnr);
+ for (int mol = 0; mol < molb.nmol; mol++)
+ {
+ excls.appendListOfLists(molt.excls, atomIndex);
- natoms += molb.nmol * srcnr;
+ atomIndex += molt.atoms.nr;
+ }
}
+
+ return excls;
}
/*! \brief Updates inter-molecular exclusion lists
* \param[inout] excls existing exclusions in local topology
* \param[in] ids list of global IDs of atoms
*/
-static void addMimicExclusions(t_blocka* excls, const gmx::ArrayRef<const int> ids)
+static void addMimicExclusions(gmx::ListOfLists<int>* excls, const gmx::ArrayRef<const int> ids)
{
t_blocka inter_excl{};
init_blocka(&inter_excl);
size_t n_q = ids.size();
- inter_excl.nr = excls->nr;
+ inter_excl.nr = excls->ssize();
inter_excl.nra = n_q * n_q;
size_t total_nra = n_q * n_q;
- snew(inter_excl.index, excls->nr + 1);
+ snew(inter_excl.index, excls->ssize() + 1);
snew(inter_excl.a, total_nra);
- for (int i = 0; i < excls->nr; ++i)
+ for (int i = 0; i < inter_excl.nr; ++i)
{
inter_excl.index[i] = 0;
}
inter_excl.index[inter_excl.nr] = n_q * n_q;
- std::vector<gmx::ExclusionBlock> qmexcl2(excls->nr);
+ std::vector<gmx::ExclusionBlock> qmexcl2(excls->size());
gmx::blockaToExclusionBlocks(&inter_excl, qmexcl2);
// Merge the created exclusion list with the existing one
{
copyAtomtypesFromMtop(mtop, &top->atomtypes);
copyIdefFromMtop(mtop, &top->idef, freeEnergyInteractionsAtEnd, bMergeConstr);
- copyExclsFromMtop(mtop, &top->excls);
+ top->excls = globalExclusionLists(mtop);
if (!mtop.intermolecularExclusionGroup.empty())
{
addMimicExclusions(&top->excls, mtop.intermolecularExclusionGroup);
{
copyAtomtypesFromMtop(mtop, &top->atomtypes);
copyIdefFromMtop(mtop, &top->idef, freeEnergyInteractionsAtEnd, bMergeConstr);
- copyExclsFromMtop(mtop, &top->excls);
top->name = mtop.name;
top->atoms = gmx_mtop_global_atoms(&mtop);
gmx_mtop_finalize(mtop);
}
+
+bool haveFepPerturbedNBInteractions(const gmx_mtop_t* mtop)
+{
+ for (size_t mb = 0; mb < mtop->molblock.size(); mb++)
+ {
+ const gmx_molblock_t& molb = mtop->molblock[mb];
+ const gmx_moltype_t& molt = mtop->moltype[molb.type];
+ for (int m = 0; m < molb.nmol; m++)
+ {
+ for (int a = 0; a < molt.atoms.nr; a++)
+ {
+ const t_atom& atom = molt.atoms.atom[a];
+ if (PERTURBED(atom))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
void convertAtomsToMtop(t_symtab* symtab, char** name, t_atoms* atoms, gmx_mtop_t* mtop);
+/*! \brief Checks if the non-bonded FEP should be performed in this run.
+ *
+ * \param[in] mtop Molecular topology.
+ * \returns Whether FEP non-bonded is requested.
+ */
+bool haveFepPerturbedNBInteractions(const gmx_mtop_t* mtop);
+
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ * \brief
+ * Implements new and legacy symbol table routines.
+ *
+ * \author David van der Spoel <david.vanderspoel@icm.uu.se>
+ * \author Paul Bauer <paul.bauer.q@gmail.com>
+ * \ingroup module_topology
+ */
#include "gmxpre.h"
#include "symtab.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/iserializer.h"
#include "gromacs/utility/smalloc.h"
+#include "gromacs/utility/stringutil.h"
#include "gromacs/utility/txtdump.h"
-constexpr int c_trimSize = 1024;
+StringTableEntry StringTableBuilder::addString(const std::string& theString)
+{
+ int size = map_.size();
+ std::string stripped = gmx::stripString(theString);
+
+ const auto foundEntry = map_.insert(StringTablePair(stripped, size));
+ return StringTableEntry(foundEntry.first->first, foundEntry.first->second);
+}
+
+int StringTableBuilder::findEntryByName(const std::string& name) const
+{
+ auto foundEntry = map_.find(name);
+ if (foundEntry != map_.end())
+ {
+ return foundEntry->second;
+ }
+ else
+ {
+ GMX_THROW(gmx::InternalError(
+ gmx::formatString("Could not find string \"%s\" in SymbolTable", name.c_str())));
+ }
+}
+
+StringTable StringTableBuilder::build()
+{
+ std::vector<std::string> table(map_.size());
+ for (const auto& entry : map_)
+ {
+ table[entry.second] = entry.first;
+ }
+ map_.clear();
+ return StringTable(table);
+}
+
+void StringTable::printStringTableStorageToFile(FILE* fp, int indent, const char* title) const
+{
+ indent = pr_title_n(fp, indent, title, table_.size());
+ int i = 0;
+ for (const auto& entry : table_)
+ {
+ pr_indent(fp, indent);
+ fprintf(fp, "%s[%d]=\"%s\"\n", title, i++, entry.c_str());
+ }
+}
+
+StringTable::StringTable(gmx::ISerializer* serializer)
+{
+ GMX_RELEASE_ASSERT(serializer->reading(),
+ "Can not use writing serializer to read string table");
+ int nr = 0;
+ serializer->doInt(&nr);
+ table_.resize(nr);
+ for (auto& entry : table_)
+ {
+ serializer->doString(&entry);
+ }
+}
+
+void StringTable::serializeStringTable(gmx::ISerializer* serializer)
+{
+ GMX_RELEASE_ASSERT(!serializer->reading(),
+ "Can not use reading serializer to write string table");
+ int nr = table_.size();
+ serializer->doInt(&nr);
+ for (auto& entry : table_)
+ {
+ serializer->doString(&entry);
+ }
+}
+
+StringTableEntry StringTable::at(gmx::index index) const
+{
+ if (index >= gmx::ssize(table_))
+ {
+ GMX_THROW(gmx::InternalError("Can't read beyond last entry"));
+ }
+ return StringTableEntry(table_[index], index);
+}
+
+StringTableEntry StringTable::operator[](gmx::index index) const
+{
+ GMX_ASSERT(index < gmx::ssize(table_), "Can't read beyond last entry");
+ return StringTableEntry(table_[index], index);
+}
+
+void StringTableEntry::serialize(gmx::ISerializer* serializer) const
+{
+ GMX_RELEASE_ASSERT(!serializer->reading(),
+ "Can not use reading serializer to write string index");
+ int entry = tableIndex_;
+ serializer->doInt(&entry);
+}
+
+StringTableEntry readStringTableEntry(gmx::ISerializer* serializer, const StringTable& table)
+{
+ GMX_RELEASE_ASSERT(serializer->reading(),
+ "Can not use writing serializer to read string index");
+ int entry = 0;
+ serializer->doInt(&entry);
+ return table.at(entry);
+}
+
+// Old code for legacy data structure starts below.
+//! Maximum size of character string in table.
+constexpr int c_trimSize = 1024;
+//! Maximum number of entries in each element of the linked list.
constexpr int c_maxBufSize = 5;
-static char* trim_string(const char* s, char* out, int maxlen)
-/*
- * Returns a pointer to a static area which contains a copy
- * of s without leading or trailing spaces. Strings are
- * truncated to c_trimSize positions.
+/*! \brief
+ * Remove leading and trailing whitespace from string and enforce maximum length.
*
- * TODO This partially duplicates code in trim(), but perhaps
- * replacing symtab with a std::map is a better fix.
+ * \param[in] s String to trim.
+ * \param[inout] out String to return.
+ * \param[in] maxlen Maximum string length to use.
+ * \returns New pruned string.
*/
+static char* trim_string(const char* s, char* out, int maxlen)
{
int len, i;
gmx_fatal(FARGS, "symtab get_symtab_handle %d not found", name);
}
+//! Returns a new initialized entry into the symtab linked list.
static t_symbuf* new_symbuf()
{
t_symbuf* symbuf;
return symbuf;
}
+/*! \brief
+ * Low level function to enter new string into legacy symtab.
+ *
+ * \param[inout] symtab Symbol table to add entry to.
+ * \param[in] name New string to add to symtab.
+ * \returns Pointer to new entry in the legacy symbol table, or to existing entry if it already existed.
+ */
static char** enter_buf(t_symtab* symtab, char* name)
{
int i;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \file
+ * \brief
+ * Declares modern and legacy symbol table used to store strings of characters.
+ *
+ * \author David van der Spoel <david.vanderspoel@icm.uu.se>
+ * \author Paul Bauer <paul.bauer.q@gmail.com>
+ *
+ * \ingroup module_topology
+ * \inlibraryapi
+ */
#ifndef GMX_TOPOLOGY_SYMTAB_H
#define GMX_TOPOLOGY_SYMTAB_H
#include <stdio.h>
-typedef struct t_symbuf
+#include <functional>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+#include "gromacs/utility/gmxassert.h"
+
+struct t_commrec;
+struct t_fileio;
+
+namespace gmx
+{
+class ISerializer;
+namespace test
+{
+class StringTableTest;
+} // namespace test
+} // namespace gmx
+
+//! Convenience typedef for pair stored in map.
+using StringTablePair = std::pair<std::string, int>;
+//! Convenience typedef for string reference wrapper.
+using StringReference = std::reference_wrapper<const std::string>;
+
+class StringTableBuilder;
+class StringTableEntry;
+/*! \brief
+ * A class to store strings for lookup.
+ *
+ * We store the strings in a dedicated object to avoid
+ * wrong usage of the flat string vector, and forcing people
+ * to use an object that can only be constructed from the transitional
+ * StringTableBuilder or filled during file IO.
+ *
+ * Note that strings are stripped of trailing and leading whitespace.
+ */
+class StringTable
+{
+public:
+ //! Constructor used to generate table object from file reading.
+ StringTable(gmx::ISerializer* serializer);
+ //! Can move construct.
+ StringTable(StringTable&&) = default;
+ //! Can move assign.
+ StringTable& operator=(StringTable&&) = default;
+ //! No copy constructor.
+ StringTable(const StringTable&) = delete;
+ //! No copy assign.
+ StringTable& operator=(const StringTable&) = delete;
+ /*! \brief
+ * Access string at \p index.
+ *
+ * \returns Entry type that constains both the string and the index,
+ * with the index needed during (de-)serialization.
+ * \throws On index being out of range.
+ */
+ StringTableEntry at(gmx::index index) const;
+ //! Bracket operator.
+ StringTableEntry operator[](gmx::index index) const;
+ //! Handle file IO.
+ void serializeStringTable(gmx::ISerializer* serializer);
+
+ //! Print human readable format of storage.
+ void printStringTableStorageToFile(FILE* fp, int indent, const char* title) const;
+
+ friend class StringTableBuilder;
+
+private:
+ /*! \brief
+ * Private constructor so that only builder can create the final table.
+ *
+ * \param[in] table A vector of strings to be stored in the table.
+ */
+ StringTable(const std::vector<std::string>& table) : table_(table) {}
+
+ //! The table is stored as a vector of strings.
+ std::vector<std::string> table_;
+};
+
+/*! \brief
+ * Helper class to access members in StringTable.
+ *
+ * This class is a wrapper around a string reference to access
+ * the actual entry in the table, as well as an index used for
+ * serializing the datastructure.
+ *
+ * This also provides efficient comparison calls between different entries.
+ */
+class StringTableEntry
+{
+public:
+ //! Copy construct.
+ StringTableEntry(const StringTableEntry&) = default;
+ //! Move construct.
+ StringTableEntry(StringTableEntry&&) noexcept = default;
+ //! Copy assign.
+ StringTableEntry& operator=(const StringTableEntry&) = default;
+ //! Move assign.
+ StringTableEntry& operator=(StringTableEntry&&) = default;
+
+ //! Compare entries by indices. Same string should always have same index.
+ bool operator==(const StringTableEntry& o) const { return tableIndex_ == o.tableIndex_; }
+ //! Unequal comparisson.
+ bool operator!=(const StringTableEntry& o) const { return !(*this == o); }
+ //! Access to underlying view.
+ const std::string& operator*() const { return entry_; }
+ //! Access to underlying view.
+ const std::string* operator->() const { return &entry_.get(); }
+ //! Serialize index.
+ void serialize(gmx::ISerializer* serializer) const;
+
+ // We only allow construction from the places that are known to create
+ // valid objects for us.
+ friend StringTableEntry readStringTableEntry(gmx::ISerializer* serializer, const StringTable& table);
+ friend class StringTableBuilder;
+ friend class StringTable;
+
+private:
+ //! Only allow construct with all information present.
+ StringTableEntry(StringReference entry, int tableIndex) : entry_(entry), tableIndex_(tableIndex)
+ {
+ }
+ //! The actual string reference that is stored.
+ StringReference entry_;
+ //! The index into the table.
+ int tableIndex_ = -1;
+};
+
+/*! \brief
+ * De-serialize StringTableEntry using the index into the \p table.
+ *
+ * \param[in] serializer The object containing the serialized index.
+ * \param[in] table The storage object holding all strings.
+ * \returns The entry into the Table as StringTableEntry.
+ */
+StringTableEntry readStringTableEntry(gmx::ISerializer* serializer, const StringTable& table);
+
+/*! \libinternal \brief
+ * Builds a memory efficient storage for strings of characters.
+ *
+ * Allows storing strings of characters with unique entries.
+ */
+class StringTableBuilder
+{
+public:
+ /*! \brief
+ * Place new unique string in storage object.
+ *
+ * Enters new string into the underlying storage or recovers existing entry.
+ * \param[in] theString New string to enter.
+ * \returns New entry object with reference to string and index into storage.
+ * The reference is only valid while the builder is in use, and becomes
+ * invalidated when generating the StringTable.
+ */
+ StringTableEntry addString(const std::string& theString);
+ //! Find matching entry in storage by name as string.
+ int findEntryByName(const std::string& name) const;
+ /*! \brief
+ * Build the StringTable from the internal map of strings.
+ *
+ * The unique indices returned from addString() can be used
+ * to index into the returned StringTable. Clears the
+ * temporary storage so that the StringTableBuilder can be re-used to
+ * build a distinct StringTable.
+ */
+ StringTable build();
+
+private:
+ //! Storage object for entries.
+ std::unordered_map<std::string, int> map_;
+};
+
+// Below this is the legacy code for the old symbol table, only used in
+// deprecated datastructures.
+/*! \libinternal \brief
+ * Legacy symbol table entry as linked list.
+ */
+struct t_symbuf
{
- int bufsize;
- char** buf;
+ //! Number of entries in this item
+ int bufsize;
+ //! Storage for strings in this item.
+ char** buf;
+ //! Next item in linked list.
struct t_symbuf* next;
-} t_symbuf;
+};
-typedef struct t_symtab
+/* \libinternal \brief
+ * Legacy symbol table.
+ */
+struct t_symtab
{
- int nr;
+ //! Total number of entries stored.
+ int nr;
+ //! First item in linked list of storage elements.
t_symbuf* symbuf;
-} t_symtab;
+};
/*
* This module handles symbol table manipulation. All text strings
* back to a text string handle by get_symtab_handle().
*/
+//! Initialises the symbol table symtab.
void open_symtab(t_symtab* symtab);
-/* Initialises the symbol table symtab.
- */
-void close_symtab(t_symtab* symtab);
-/* Undoes the effect of open_symtab(), after invoking this function,
- * no value can be added to the symbol table, only values can be
- * retrieved using get_symtab().
+/*! \brief
+ * Undoes the effect of open_symtab()
+ *
+ * After invoking this function, no value can be added to the
+ * symbol table, only values can be retrieved using get_symtab_handle().
*
* Note that this does no work.
+ * \param[inout] symtab Symbol table to close.
*/
+void close_symtab(t_symtab* symtab);
/*! \brief Returns a deep copy of \c symtab. */
t_symtab* duplicateSymtab(const t_symtab* symtab);
+//! Frees the space allocated by the symbol table itself.
void free_symtab(t_symtab* symtab);
-/* Frees the space allocated by the symbol table itself */
+//! Frees the space allocated by the symbol table, including all entries in it.
void done_symtab(t_symtab* symtab);
-/* Frees the space allocated by the symbol table, including all
- * entries in it */
-
-char** put_symtab(t_symtab* symtab, const char* name);
-/* Enters a string into the symbol table symtab, if it was not
- * available, a reference to a copy is returned else a reference
- * to the earlier entered value is returned. Strings are trimmed
- * of spaces.
- */
-int lookup_symtab(t_symtab* symtab, char** name);
-/* Returns a unique handle for **name, without a memory reference.
- * It is a failure when name cannot be found in the symbol table,
- * it should be entered before with put_symtab().
+/*! \brief
+ * Enters a string into the symbol table.
+ *
+ * If the string \p name was not present before, a reference to a copy is returned,
+ * else a reference to the earlier entered value is returned. Strings are trimmed of spaces.
+ *
+ * \param[inout] symtab Symbol table to add string to.
+ * \param[in] name String to add.
+ * \returns Pointer to entry of string in symtab.
*/
+char** put_symtab(t_symtab* symtab, const char* name);
-char** get_symtab_handle(t_symtab* symtab, int name);
-/* Returns a text string handle for name. Name should be a value
- * returned from lookup_symtab(). So get_symtab_handle() and
- * lookup_symtab() are inverse functions.
+/*! \brief
+ * Returns unique handle for \p name.
+ *
+ * Looks up the string pointer \p name in the symbol table and returns the
+ * index in it to the matching entry. Gives fatal error if \p name is
+ * not found. \p name has to be entered first using put_symtab().
+ *
+ * \param[in] symtab Symbol table to search.
+ * \param[in] name String pointer into \p symtab.
+ * \returns Unique index to position in symbol table.
*/
+int lookup_symtab(t_symtab* symtab, char** name);
-long wr_symtab(FILE* fp, t_symtab* symtab);
-/* Writes the symbol table symtab to the file, specified by fp.
- * The function returns the number of bytes written.
+/*! \brief
+ * Returns text string corresponding to \p index.
+ *
+ * \p index needs to be value obtained from call to lookup_symtab().
+ * get_symtab_handle() and lookup_symtab() are inverse functions.
+ *
+ * \param[in] symtab Symbol table to search.
+ * \param[in] index Entry to find in table.
+ * \returns String pointer into \p symtab corresponding to the entry.
*/
+char** get_symtab_handle(t_symtab* symtab, int index);
-long rd_symtab(FILE* fp, t_symtab* symtab);
-/* Reads the symbol table symtab from the file, specified by fp.
- * This will include allocating the needed space. The function
- * returns the number of bytes read. The symtab is in the closed
- * state afterwards, so no strings can be added to it.
+/*! \brief
+ * Prints human readable form of \p symtab.
+ *
+ * \param[in] fp File to print to.
+ * \param[in] indent Number of spaces to use for indentation.
+ * \param[in] title Name for header text.
+ * \param[in] symtab Symbol table to print out.
*/
-
void pr_symtab(FILE* fp, int indent, const char* title, t_symtab* symtab);
-/* This routine prints out a (human) readable representation of
- * the symbol table symtab to the file fp. Ident specifies the
- * number of spaces the text should be indented. Title is used
- * to print a header text.
- */
#endif
#include "gromacs/topology/exclusionblocks.h"
+#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "gromacs/topology/block.h"
#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/smalloc.h"
#include "testutils/cmdlinetest.h"
addGroupToBlocka(ba, indices);
}
+//! Return ListOfLists filled with some datastructures
+ListOfLists<int> makeTestListOfLists()
+{
+ ListOfLists<int> list;
+
+ std::vector<int> indices = { 12, 11, 9, 6, 2 };
+ list.pushBack(indices);
+ indices = { 10, 8, 5, 1 };
+ list.pushBack(indices);
+ indices = { 7, 4, 0 };
+ list.pushBack(indices);
+
+ return list;
+}
+
class ExclusionBlockTest : public ::testing::Test
{
public:
{
const int natom = 3;
makeTestBlockAData(&ba_);
+ list_ = makeTestListOfLists();
b_.resize(natom);
}
~ExclusionBlockTest() override { done_blocka(&ba_); }
}
}
+ void compareBlocksAndList()
+ {
+ GMX_RELEASE_ASSERT(ssize(b_) == list_.ssize(), "The list counts should match");
+ for (index i = 0; i < ssize(b_); i++)
+ {
+ gmx::ArrayRef<const int> jList = list_[i];
+ ASSERT_EQ(b_[i].nra(), jList.ssize()) << "Block size mismatch at " << i << ".";
+ EXPECT_THAT(b_[i].atomNumber, ::testing::Pointwise(::testing::Eq(), jList));
+ }
+ }
+
protected:
t_blocka ba_;
+ ListOfLists<int> list_;
std::vector<ExclusionBlock> b_;
};
TEST_F(ExclusionBlockTest, MergeExclusions)
{
- mergeExclusions(&ba_, b_);
- compareBlocks();
+ mergeExclusions(&list_, b_);
+ compareBlocksAndList();
}
} // namespace
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <Sequence Name="Complete dump of SymbolTable">
+ <Int Name="Length">8</Int>
+ <String>Symtab[0]="0"</String>
+ <String>Symtab[1]="1"</String>
+ <String>Symtab[2]="2"</String>
+ <String>Symtab[3]="3"</String>
+ <String>Symtab[4]="4"</String>
+ <String>Symtab[5]="5"</String>
+ <String>Symtab[6]="6"</String>
+ <String>Symtab[7]="foobar"</String>
+ </Sequence>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <Sequence Name="Complete dump of SymbolTable">
+ <Int Name="Length">15</Int>
+ <String>Symtab[0]="0"</String>
+ <String>Symtab[1]="1"</String>
+ <String>Symtab[2]="2"</String>
+ <String>Symtab[3]="3"</String>
+ <String>Symtab[4]="4"</String>
+ <String>Symtab[5]="5"</String>
+ <String>Symtab[6]="6"</String>
+ <String>Symtab[7]="baz"</String>
+ <String>Symtab[8]="7"</String>
+ <String>Symtab[9]="8"</String>
+ <String>Symtab[10]="9"</String>
+ <String>Symtab[11]="10"</String>
+ <String>Symtab[12]="11"</String>
+ <String>Symtab[13]="12"</String>
+ <String>Symtab[14]="13"</String>
+ </Sequence>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (8):
+ Test title[0]="0"
+ Test title[1]="1"
+ Test title[2]="2"
+ Test title[3]="3"
+ Test title[4]="4"
+ Test title[5]="5"
+ Test title[6]="6"
+ Test title[7]="foobar"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (1):
+ Test title[0]="foo"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (2):
+ Test title[0]="foo"
+ Test title[1]="Bar"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (1):
+ Test title[0]="foo"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (1):
+ Test title[0]="foo"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (15):
+ Test title[0]="0"
+ Test title[1]="1"
+ Test title[2]="2"
+ Test title[3]="3"
+ Test title[4]="4"
+ Test title[5]="5"
+ Test title[6]="6"
+ Test title[7]="baz"
+ Test title[8]="7"
+ Test title[9]="8"
+ Test title[10]="9"
+ Test title[11]="10"
+ Test title[12]="11"
+ Test title[13]="12"
+ Test title[14]="13"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (1):
+ Test title[0]="foo"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (1):
+ Test title[0]="foo"
+]]></String>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <String Name="Output"><![CDATA[
+ Test title (3):
+ Test title[0]="foo"
+ Test title[1]="Bar"
+ Test title[2]="Foo"
+]]></String>
+</ReferenceData>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <gtest/gtest.h>
+#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/inmemoryserializer.h"
#include "gromacs/utility/strconvert.h"
#include "gromacs/utility/stringutil.h"
+#include "gromacs/utility/textreader.h"
#include "testutils/refdata.h"
+#include "testutils/testfilemanager.h"
namespace gmx
{
namespace test
{
+class StringTableTest : public ::testing::Test
+{
+public:
+ StringTableTest() {}
+ //! Get handle to symbol table.
+ StringTableBuilder& builder() { return stringTableBuilder_; }
+ /* \brief
+ * Check human readable format of the table.
+ * \todo change when table writing to users is done also with serializer.
+ * \parm[in] table The string table to check the serialization.
+ */
+ void checkTable(const StringTable& table);
+
+private:
+ //! Get reference checker using lazy initialization
+ TestReferenceChecker* checker()
+ {
+ if (!checker_)
+ {
+ checker_ = std::make_unique<TestReferenceChecker>(data_.rootChecker());
+ }
+ return checker_.get();
+ }
+ //! Symbol table for testing purposes.
+ StringTableBuilder stringTableBuilder_;
+ //! Handler for reference data.
+ TestReferenceData data_;
+ //! Handler for checking reference data.
+ std::unique_ptr<TestReferenceChecker> checker_;
+};
+
+void StringTableTest::checkTable(const StringTable& table)
+{
+ TestFileManager files;
+ std::string filename(files.getTemporaryFilePath("table.txt"));
+ FILE* fp = fopen(filename.c_str(), "w");
+ table.printStringTableStorageToFile(fp, 4, "Test title");
+ fclose(fp);
+ const std::string text = TextReader::readFileToString(filename);
+ checker()->checkTextBlock(text, "Output");
+}
+
+/*! \brief
+ * Check that symbols obtained from symtab compare correctly.
+ *
+ * Helper function to find out if two entries obtained by a symtab lookup
+ * are equivalent or not, according to testing criteria.
+ * Checks that the indices match before finalizing storage.
+ *
+ * \param[in] builder StringTableBuilder table that contains the entries to validate.
+ * \param[in] firstSymbol Handle into \p builder obtained from placing string in \p builder.
+ * \param[in] otherSymbol Other handle from obtained from separate string deposit.
+ * \param[in] expectedOutcome If the handles should result in equal entries or not.
+ */
+static void compareDifferentIndices(const StringTableBuilder& builder,
+ const StringTableEntry& firstSymbol,
+ const StringTableEntry& otherSymbol,
+ bool expectedOutcome)
+{
+ EXPECT_EQ(expectedOutcome, (firstSymbol == otherSymbol));
+ auto firstIndex = builder.findEntryByName(*firstSymbol);
+ auto otherIndex = builder.findEntryByName(*otherSymbol);
+ EXPECT_EQ(expectedOutcome, (firstIndex == otherIndex))
+ << "Expected was " << expectedOutcome << " firstIndex is " << firstIndex
+ << " otherIndex is " << otherIndex;
+}
+
+/*! \brief
+ * Helper to obtain the integer index from an entry.
+ *
+ * As the index is only used during (de-) serialization, use this machinery
+ * to obtain it.
+ *
+ * \param[in] symbol Single StringTableEntry to obtain the index of.
+ * \returns Integer index to be used to obtain value from StringTable.
+ */
+static int readIndexFromSerializer(const StringTableEntry& symbol)
+{
+ gmx::InMemorySerializer writer;
+ symbol.serialize(&writer);
+ auto buffer = writer.finishAndGetBuffer();
+ gmx::InMemoryDeserializer reader(buffer, false);
+ int index = 0;
+ reader.doInt(&index);
+ return index;
+}
+
+/*! \brief
+ * Helper function to check that a string in matches when looked up in non finalized table.
+ *
+ * Checks that a string looked up by using the index in the symbol table matches
+ * the string stored in the wrapper object obtained by entering a string.
+ *
+ * \param[in] symtab Symbol table that contains the entries.
+ * \param[in] symbol The entry obtained from placing a string in the symbol table.
+ * \param[in] string The string the entry should match.
+ */
+static void stringMatches(const StringTable& symtab, const StringTableEntry& symbol, const char* string)
+{
+ int index = readIndexFromSerializer(symbol);
+ auto entryFromIndex = symtab.at(index);
+
+ EXPECT_EQ(*entryFromIndex, string)
+ << "Index is " << index << " Entry from index is " << entryFromIndex->c_str();
+}
+
+
+TEST_F(StringTableTest, AddSingleEntry)
+{
+ builder().addString("foo");
+ StringTable table = builder().build();
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, CanAccessWithAt)
+{
+ builder().addString("foo");
+ StringTable table = builder().build();
+ EXPECT_NO_THROW(table.at(0));
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, CanAccessWithBracket)
+{
+ builder().addString("foo");
+ StringTable table = builder().build();
+ checkTable(table);
+ auto entry = table[0];
+ EXPECT_EQ(*entry, "foo");
+}
+
+TEST_F(StringTableTest, ThrowsOutOfRange)
+{
+ builder().addString("foo");
+ StringTable table = builder().build();
+ EXPECT_THROW(table.at(1), InternalError);
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, StringCompareIsCorrect)
+{
+ auto fooSymbol = builder().addString("foo");
+ StringTable table = builder().build();
+ stringMatches(table, fooSymbol, "foo");
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, AddTwoDistinctEntries)
+{
+ auto fooSymbol = builder().addString("foo");
+ auto barSymbol = builder().addString("Bar");
+
+ EXPECT_FALSE(fooSymbol == barSymbol);
+ compareDifferentIndices(builder(), fooSymbol, barSymbol, false);
+ EXPECT_TRUE("foo" == *fooSymbol);
+ EXPECT_TRUE("Bar" == *barSymbol);
+ auto table = builder().build();
+ stringMatches(table, fooSymbol, "foo");
+ stringMatches(table, barSymbol, "Bar");
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, TryToAddDuplicates)
+{
+ auto fooSymbol = builder().addString("foo");
+ auto barSymbol = builder().addString("Bar");
+
+ EXPECT_FALSE(fooSymbol == barSymbol);
+ EXPECT_FALSE(fooSymbol->empty());
+ compareDifferentIndices(builder(), fooSymbol, barSymbol, false);
+ EXPECT_TRUE("foo" == *fooSymbol);
+ EXPECT_TRUE("Bar" == *barSymbol);
+
+ // Insert a duplicate element
+ auto anotherFooSymbol = builder().addString("foo");
+ // Insert element with different case
+ auto capitalFooSymbol = builder().addString("Foo");
+
+ // Check that no duplicate is made
+ EXPECT_TRUE(fooSymbol == anotherFooSymbol);
+ // Check case sensitivity
+ EXPECT_FALSE(fooSymbol == capitalFooSymbol);
+
+ // Check that underlying representation is same
+ EXPECT_TRUE("foo" == *anotherFooSymbol);
+ EXPECT_TRUE("foo" == *fooSymbol);
+ EXPECT_FALSE(*fooSymbol == *capitalFooSymbol);
+ EXPECT_TRUE("Bar" == *barSymbol);
+
+ // Check for correct behaviours with new and old symbols
+ compareDifferentIndices(builder(), fooSymbol, anotherFooSymbol, true);
+ compareDifferentIndices(builder(), barSymbol, anotherFooSymbol, false);
+ compareDifferentIndices(builder(), fooSymbol, barSymbol, false);
+ compareDifferentIndices(builder(), fooSymbol, capitalFooSymbol, false);
+ auto table = builder().build();
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, AddLargeNumberOfEntries)
+{
+ int numStringsToAdd = 7; // Random number of strings.
+ std::vector<StringTableEntry> symbolsAdded;
+ symbolsAdded.reserve(numStringsToAdd);
+ for (int i = 0; i < numStringsToAdd; ++i)
+ {
+ symbolsAdded.push_back(builder().addString(toString(i)));
+ }
+ for (int i = 0; i < numStringsToAdd; ++i)
+ {
+ EXPECT_TRUE(toString(i) == *symbolsAdded[i]) << "index is " << i;
+ }
+ // Add something unrelated and check that indices still work afterward.
+ builder().addString("foobar");
+ for (int i = 0; i < numStringsToAdd; ++i)
+ {
+ EXPECT_TRUE(toString(i) == *symbolsAdded[i]) << "index is " << i;
+ }
+ auto table = builder().build();
+ for (int i = 0; i < numStringsToAdd; ++i)
+ {
+ stringMatches(table, symbolsAdded[i], toString(i).c_str());
+ }
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, NoDuplicatesInLargeTable)
+{
+ int halfOfStringsToAdd = 7; // Random number of strings.
+ int totalNumStringsToAdd = 2 * halfOfStringsToAdd;
+ std::vector<StringTableEntry> symbolsAdded;
+ symbolsAdded.reserve(halfOfStringsToAdd);
+ for (int i = 0; i < halfOfStringsToAdd; ++i)
+ {
+ symbolsAdded.push_back(builder().addString(toString(i)));
+ }
+
+ // We now try to mess around in the symtab.
+ auto bazSymbol = builder().addString("baz");
+
+ // Now try to add more symbols, also including those that are already there.
+ for (int i = 0; i < totalNumStringsToAdd; i++)
+ {
+ symbolsAdded.push_back(builder().addString(toString(i)));
+ }
+
+ //! Check that entries that should be equal are, and new ones are not.
+ for (int i = 0; i < halfOfStringsToAdd; i++)
+ {
+ compareDifferentIndices(builder(), symbolsAdded[i], symbolsAdded[halfOfStringsToAdd + i], true);
+ compareDifferentIndices(builder(), symbolsAdded[i], symbolsAdded[2 * halfOfStringsToAdd + i], false);
+ compareDifferentIndices(builder(), symbolsAdded[i], bazSymbol, false);
+ }
+ EXPECT_TRUE("baz" == *bazSymbol);
+ symbolsAdded.emplace_back(bazSymbol);
+ auto table = builder().build();
+ checkTable(table);
+}
+
+TEST_F(StringTableTest, CanWriteToBuffer)
+{
+ builder().addString("foo");
+ builder().addString("bar");
+ builder().addString("baz");
+ auto finalTable = builder().build();
+ InMemorySerializer writer;
+ finalTable.serializeStringTable(&writer);
+
+ auto buffer = writer.finishAndGetBuffer();
+ EXPECT_EQ(buffer.size(), 37); // 4 (size) + 3*(8 (string size) + 3*1 (char size) )
+}
+
+TEST_F(StringTableTest, Roundtrip)
+{
+ // First generate a buffer from a string table
+ builder().addString("foo");
+ builder().addString("bar");
+ builder().addString("baz");
+ auto finalTable = builder().build();
+ InMemorySerializer writer;
+ finalTable.serializeStringTable(&writer);
+
+ auto buffer = writer.finishAndGetBuffer();
+ EXPECT_EQ(buffer.size(), 37); // 4 (size) + 3*(8 (string size) + 3*1 (char size) )
+
+ // Now try to make a new table from it.
+ InMemoryDeserializer reader(buffer, false);
+ StringTable readInTable(&reader);
+ EXPECT_EQ(*(finalTable.at(0)), *(readInTable.at(0)));
+ EXPECT_EQ(*(finalTable.at(1)), *(readInTable.at(1)));
+ EXPECT_EQ(*(finalTable.at(2)), *(readInTable.at(2)));
+}
+
+TEST_F(StringTableTest, RoundtripWithCorrectStringIndices)
+{
+ std::vector<StringTableEntry> testEntries;
+ // First generate a buffer from a string table
+ testEntries.emplace_back(builder().addString("foo"));
+ testEntries.emplace_back(builder().addString("bar"));
+ testEntries.emplace_back(builder().addString("baz"));
+ auto finalTable = builder().build();
+ InMemorySerializer writer;
+ finalTable.serializeStringTable(&writer);
+ for (const auto& stringEntry : testEntries)
+ {
+ stringEntry.serialize(&writer);
+ }
+
+ auto buffer = writer.finishAndGetBuffer();
+ EXPECT_EQ(buffer.size(), 49); // 4 (size) + 3*(8 (string size) + 3*1 (char size) + 3*4 (int size))
+
+ // Now try to make a new table from it.
+ InMemoryDeserializer reader(buffer, false);
+ StringTable readInTable(&reader);
+ std::vector<StringTableEntry> deserializedEntries;
+ for (index gmx_unused i = 0; i < gmx::ssize(testEntries); i++)
+ {
+ deserializedEntries.emplace_back(readStringTableEntry(&reader, readInTable));
+ }
+ EXPECT_EQ(*(finalTable.at(0)), *(deserializedEntries[0]));
+ EXPECT_EQ(*(finalTable.at(1)), *(deserializedEntries[1]));
+ EXPECT_EQ(*(finalTable.at(2)), *(deserializedEntries[2]));
+}
+
+
namespace
{
-class SymtabTest : public ::testing::Test
+class LegacySymtabTest : public ::testing::Test
{
public:
- SymtabTest() { open_symtab(&symtab_); }
- ~SymtabTest() override
+ LegacySymtabTest() { open_symtab(&symtab_); }
+ ~LegacySymtabTest() override
{
done_symtab(&symtab_);
EXPECT_EQ(symtab_.nr, 0);
std::unique_ptr<TestReferenceChecker> checker_;
};
-void SymtabTest::dumpSymtab()
+void LegacySymtabTest::dumpSymtab()
{
int nr = symtab_.nr;
t_symbuf* symbuf = symtab_.symbuf;
EXPECT_EQ(expectedOutcome, entriesAreEqual(symtab, otherSymbol, firstIndex));
}
-TEST_F(SymtabTest, EmptyOnOpen)
+TEST_F(LegacySymtabTest, EmptyOnOpen)
{
ASSERT_EQ(0, symtab()->nr);
ASSERT_EQ(nullptr, symtab()->symbuf);
}
-TEST_F(SymtabTest, AddSingleEntry)
+TEST_F(LegacySymtabTest, AddSingleEntry)
{
auto fooSymbol = put_symtab(symtab(), "Foo");
ASSERT_EQ(1, symtab()->nr);
EXPECT_STREQ("Foo", *fooSymbol);
}
-TEST_F(SymtabTest, AddTwoDistinctEntries)
+TEST_F(LegacySymtabTest, AddTwoDistinctEntries)
{
auto fooSymbol = put_symtab(symtab(), "Foo");
auto barSymbol = put_symtab(symtab(), "Bar");
EXPECT_STREQ("Bar", *barSymbol);
}
-TEST_F(SymtabTest, TryToAddDuplicates)
+TEST_F(LegacySymtabTest, TryToAddDuplicates)
{
auto fooSymbol = put_symtab(symtab(), "Foo");
auto barSymbol = put_symtab(symtab(), "Bar");
compareDifferentHandles(symtab(), fooSymbol, barSymbol, false);
}
-TEST_F(SymtabTest, AddLargeNumberOfEntries)
+TEST_F(LegacySymtabTest, AddLargeNumberOfEntries)
{
int numStringsToAdd = 7; // Larger than c_maxBufSize limit for size of symbuf.
std::vector<char**> symbolsAdded;
dumpSymtab();
}
-TEST_F(SymtabTest, NoDuplicatesInLargeTable)
+TEST_F(LegacySymtabTest, NoDuplicatesInLargeTable)
{
int halfOfStringsToAdd = 7; // Larger than c_maxBufSize limit for size of symbuf.
int totalNumStringsToAdd = 2 * halfOfStringsToAdd;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
init_atom(&(top->atoms));
init_atomtypes(&(top->atomtypes));
init_block(&top->mols);
- init_blocka(&top->excls);
open_symtab(&top->symtab);
}
-gmx_moltype_t::gmx_moltype_t() : name(nullptr), excls()
+gmx_moltype_t::gmx_moltype_t() : name(nullptr)
{
init_t_atoms(&atoms, 0, FALSE);
}
gmx_moltype_t::~gmx_moltype_t()
{
done_atom(&atoms);
- done_blocka(&excls);
}
gmx_mtop_t::gmx_mtop_t()
done_symtab(&(top->symtab));
done_block(&(top->mols));
- done_blocka(&(top->excls));
}
void done_top_mtop(t_topology* top, gmx_mtop_t* mtop)
{
done_idef(&top->idef);
done_atom(&top->atoms);
- done_blocka(&top->excls);
done_block(&top->mols);
done_symtab(&top->symtab);
open_symtab(&mtop->symtab);
gmx_localtop_t::gmx_localtop_t()
{
- init_blocka_null(&excls);
init_idef(&idef);
init_atomtypes(&atomtypes);
}
if (!useInDomainDecomp_)
{
done_idef(&idef);
- done_blocka(&excls);
done_atomtypes(&atomtypes);
}
}
pr_indent(fp, indent);
fprintf(fp, "name=\"%s\"\n", *(molt->name));
pr_atoms(fp, indent, "atoms", &(molt->atoms), bShowNumbers);
- pr_blocka(fp, indent, "excls", &molt->excls, bShowNumbers);
+ pr_listoflists(fp, indent, "excls", &molt->excls, bShowNumbers);
for (j = 0; (j < F_NRE); j++)
{
pr_ilist(fp, indent, interaction_function[j].longname, ffparams->functype.data(),
pr_block(fp, indent, "mols", &top->mols, bShowNumbers);
pr_str(fp, indent, "bIntermolecularInteractions",
gmx::boolToString(top->bIntermolecularInteractions));
- pr_blocka(fp, indent, "excls", &top->excls, bShowNumbers);
pr_idef(fp, indent, "idef", &top->idef, bShowNumbers, bShowParameters);
}
}
}
}
-static void cmp_blocka(FILE* fp, const t_blocka* b1, const t_blocka* b2, const char* s)
+static void cmp_listoflists(FILE* fp,
+ const gmx::ListOfLists<int>& list1,
+ const gmx::ListOfLists<int>& list2,
+ const char* s)
{
char buf[32];
fprintf(fp, "comparing blocka %s\n", s);
- sprintf(buf, "%s.nr", s);
- cmp_int(fp, buf, -1, b1->nr, b2->nr);
- sprintf(buf, "%s.nra", s);
- cmp_int(fp, buf, -1, b1->nra, b2->nra);
+ sprintf(buf, "%s.numLists", s);
+ cmp_int(fp, buf, -1, list1.ssize(), list2.ssize());
+ sprintf(buf, "%s.numElements", s);
+ cmp_int(fp, buf, -1, list1.numElements(), list2.numElements());
}
static void compareFfparams(FILE* fp,
compareAtoms(fp, &mt1[i].atoms, &mt2[i].atoms, relativeTolerance, absoluteTolerance);
compareInteractionLists(fp, &mt1[i].ilist, &mt2[i].ilist);
std::string buf = gmx::formatString("excls[%d]", i);
- cmp_blocka(fp, &mt1[i].excls, &mt2[i].excls, buf.c_str());
+ cmp_listoflists(fp, mt1[i].excls, mt2[i].excls, buf.c_str());
}
}
void copy_moltype(const gmx_moltype_t* src, gmx_moltype_t* dst)
{
- dst->name = src->name;
- copy_blocka(&src->excls, &dst->excls);
+ dst->name = src->name;
+ dst->excls = src->excls;
t_atoms* atomsCopy = copy_t_atoms(&src->atoms);
dst->atoms = *atomsCopy;
sfree(atomsCopy);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/topology/idef.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/utility/enumerationhelpers.h"
+#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/unique_cptr.h"
enum class SimulationAtomGroupType : int
/*! \brief Default copy constructor */
gmx_moltype_t(const gmx_moltype_t&) = default;
- char** name; /**< Name of the molecule type */
- t_atoms atoms; /**< The atoms in this molecule */
- InteractionLists ilist; /**< Interaction list with local indices */
- t_blocka excls; /**< The exclusions */
+ char** name; /**< Name of the molecule type */
+ t_atoms atoms; /**< The atoms in this molecule */
+ InteractionLists ilist; /**< Interaction list with local indices */
+ gmx::ListOfLists<int> excls; /**< The exclusions */
};
/*! \brief Block of molecules of the same type, used in gmx_mtop_t */
*/
int numberOfGroupNumbers(SimulationAtomGroupType group) const
{
- return gmx::ssize(groupNumbers[group]);
+ return static_cast<int>(groupNumbers[group].size());
}
};
//! Atomtype properties
t_atomtypes atomtypes;
//! The exclusions
- t_blocka excls;
+ gmx::ListOfLists<int> excls;
//! Flag for domain decomposition so we don't free already freed memory.
bool useInDomainDecomp_ = false;
};
t_atomtypes atomtypes; /* Atomtype properties */
t_block mols; /* The molecules */
gmx_bool bIntermolecularInteractions; /* Inter.mol. int. ? */
- t_blocka excls; /* The exclusions */
- t_symtab symtab; /* The symbol table */
+ /* Note that the exclusions are not stored in t_topology */
+ t_symtab symtab; /* The symbol table */
} t_topology;
void init_top(t_topology* top);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
}
/* Now we now the number of non-perturbed interactions */
- ilist->nr_nonperturbed = ic;
+ idef->numNonperturbedInteractions[ftype] = ic;
/* Copy the buffer with perturbed interactions to the ilist */
for (a = 0; a < ib; a++)
if (debug)
{
+ const int numNonperturbed = idef->numNonperturbedInteractions[ftype];
fprintf(debug, "%s non-pert %d pert %d\n", interaction_function[ftype].longname,
- ilist->nr_nonperturbed, ilist->nr - ilist->nr_nonperturbed);
+ numNonperturbed, ilist->nr - numNonperturbed);
}
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2013,2014,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return frame_.time;
}
-int TrajectoryFrame::pbc() const
+PbcType TrajectoryFrame::pbc() const
{
- return frame_.ePBC;
+ return frame_.pbcType;
}
ArrayRef<const RVec> TrajectoryFrame::x() const
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/real.h"
struct t_atoms;
+enum class PbcType : int;
typedef struct t_trxframe // NOLINT (clang-analyzer-optin.performance.Padding)
{
gmx_bool bBox;
matrix box; /* the 3 box vectors */
gmx_bool bPBC;
- int ePBC; /* the type of pbc */
+ PbcType pbcType; /* the type of pbc */
gmx_bool bIndex;
int* index; /* atom indices of contained coordinates */
} t_trxframe;
//! Time read from the trajectory file frame.
double time() const;
//! The PBC characteristics of the box.
- int pbc() const;
+ PbcType pbc() const;
//! Get a view of position coordinates of the frame (which could be empty).
ArrayRef<const RVec> x() const;
//! Get a view of velocity coordinates of the frame (which could be empty).
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2013,2014,2015,2018 by the GROMACS development team.
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_trxframe& frame = common_.frame();
if (ppbc != nullptr)
{
- set_pbc(ppbc, topology.ePBC(), frame.box);
+ set_pbc(ppbc, topology.pbcType(), frame.box);
}
selections_.evaluate(&frame, ppbc);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/coordinateio/coordinatefile.h"
#include "gromacs/coordinateio/requirements.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/options/filenameoption.h"
#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/selectionoption.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/coordinateio/coordinatefile.h"
#include "gromacs/coordinateio/requirements.h"
+#include "gromacs/fileio/trxio.h"
#include "gromacs/options/filenameoption.h"
#include "gromacs/options/ioptionscontainer.h"
#include "gromacs/selection/selectionoption.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
}
localTop_ = top.expandedTopology();
- if (localTop_->excls.nr == 0)
+ if (localTop_->excls.empty())
{
GMX_THROW(InconsistentInputError(
"-excl is set, but the file provided to -s does not define exclusions"));
{
box[ZZ][ZZ] = 2 * std::max(box[XX][XX], box[YY][YY]);
}
- rmax_ = std::sqrt(0.99 * 0.99 * max_cutoff2(bXY_ ? epbcXY : epbcXYZ, box));
+ rmax_ = std::sqrt(0.99 * 0.99 * max_cutoff2(bXY_ ? PbcType::XY : PbcType::Xyz, box));
}
else
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2006, The GROMACS development team.
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,2011,2012 by the GROMACS development team.
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
rvec x[],
t_atoms* atoms,
t_symtab* symtab,
- int ePBC,
+ PbcType pbcType,
const matrix box,
gmx_bool bIncludeSolute)
{
}
atoms->nr = i0 + ndots;
atoms->nres = r0 + 1;
- write_sto_conf(fn, title, atoms, xnew, nullptr, ePBC, const_cast<rvec*>(box));
+ write_sto_conf(fn, title, atoms, xnew, nullptr, pbcType, const_cast<rvec*>(box));
atoms->nres = r0;
atoms->nr = i0;
}
aaa.pdbinfo[ii0].occup = 0.0;
}
aaa.nr = ndots;
- write_sto_conf(fn, title, &aaa, xnew, nullptr, ePBC, const_cast<rvec*>(box));
+ write_sto_conf(fn, title, &aaa, xnew, nullptr, pbcType, const_cast<rvec*>(box));
do_conect(fn, ndots, xnew);
done_atom(&aaa);
}
}
please_cite(stderr, "Eisenhaber95");
- // if ((top.ePBC() != epbcXYZ) || (TRICLINIC(fr.box)))
+ // if ((top.pbcType() != PbcType::Xyz) || (TRICLINIC(fr.box)))
//{
// fprintf(stderr, "\n\nWARNING: non-rectangular boxes may give erroneous results or crashes.\n"
// "Analysis based on vacuum simulations (with the possibility of evaporation)\n"
// one else uses the topology after initialization, it may just work
// even with future parallelization.
connolly_plot(fnConnolly_.c_str(), nsurfacedots, surfacedots, fr.x, atoms_.get(),
- &mtop_->symtab, fr.ePBC, fr.box, bIncludeSolute_);
+ &mtop_->symtab, fr.pbcType, fr.box, bIncludeSolute_);
}
ah.startFrame(frnr, fr.time);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2007, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
copy_mat(topInfo_.boxtop_, fr->box);
}
- set_trxframe_ePBC(fr, topInfo_.ePBC());
+ setTrxFramePbcType(fr, topInfo_.pbcType());
if (topInfo_.hasTopology() && settings_.hasRmPBC())
{
gpbc_ = gmx_rmpbc_init(topInfo_);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_pbc pbc;
if (bPBC)
{
- set_pbc(&pbc, epbcXYZ, box_);
+ set_pbc(&pbc, PbcType::Xyz, box_);
}
ASSERT_NO_THROW_GMX({
gmx::SurfaceAreaCalculator calculator;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp.h"
#include "gromacs/math/vectypes.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
ASSERT_TRUE(atoms2);
EXPECT_NE(atoms1.get(), atoms2.get());
EXPECT_EQ(0, atoms1->nr);
- EXPECT_EQ(-1, topInfo.ePBC());
+ EXPECT_EQ(PbcType::Unset, topInfo.pbcType());
EXPECT_THROW(topInfo.x().size(), gmx::APIError);
EXPECT_THROW(topInfo.v().size(), gmx::APIError);
matrix box{ { -2 } };
topInfo.fillFromInputFile(TestFileManager::getInputFilePath("lysozyme.gro"));
EXPECT_FALSE(topInfo.hasFullTopology());
runCommonTests(topInfo, numAtoms);
- EXPECT_EQ(-1, topInfo.ePBC());
+ EXPECT_EQ(PbcType::Unset, topInfo.pbcType());
// Check the per-atom data
auto atoms = topInfo.copyAtoms();
EXPECT_FALSE(topInfo.hasFullTopology());
runCommonTests(topInfo, numAtoms);
// TODO why does this differ from .gro?
- EXPECT_EQ(0, topInfo.ePBC());
+ EXPECT_EQ(PbcType::Xyz, topInfo.pbcType());
// Check the per-atom data
auto atoms = topInfo.copyAtoms();
EXPECT_TRUE(topInfo.hasFullTopology());
runCommonTests(topInfo, numAtoms);
// TODO why does this differ from .gro?
- EXPECT_EQ(0, topInfo.ePBC());
+ EXPECT_EQ(PbcType::Xyz, topInfo.pbcType());
// Check the per-atom data
auto atoms = topInfo.copyAtoms();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/fileio/confio.h"
#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pbcutil/rmpbc.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
expandedTopology_(nullptr),
atoms_(nullptr),
bTop_(false),
- ePBC_(-1)
+ pbcType_(PbcType::Unset)
{
}
// TODO Once there are fewer callers of the file-reading
// functionality, make them read directly into std::vector.
rvec *x, *v;
- readConfAndTopology(filename.c_str(), &bTop_, mtop_.get(), &ePBC_, &x, &v, boxtop_);
+ readConfAndTopology(filename.c_str(), &bTop_, mtop_.get(), &pbcType_, &x, &v, boxtop_);
xtop_.assign(x, x + mtop_->natoms);
vtop_.assign(v, v + mtop_->natoms);
sfree(x);
{
GMX_RELEASE_ASSERT(topInfo.hasTopology(), "Cannot remove PBC without a topology");
- return gmx_rmpbc_init(&topInfo.expandedTopology()->idef, topInfo.ePBC(), topInfo.mtop()->natoms);
+ return gmx_rmpbc_init(&topInfo.expandedTopology()->idef, topInfo.pbcType(), topInfo.mtop()->natoms);
}
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Forward declaration
typedef struct gmx_rmpbc* gmx_rmpbc_t;
+enum class PbcType : int;
namespace gmx
{
/*! \brief Copies the fully expanded atom data arrays, which
* might be valid but empty if no topology is available. */
AtomsDataPtr copyAtoms() const;
- //! Returns the ePBC field from the topology.
- int ePBC() const { return ePBC_; }
+ //! Returns the pbcType field from the topology.
+ PbcType pbcType() const { return pbcType_; }
/*! \brief
* Gets the configuration positions from the topology file.
*
std::vector<RVec> vtop_;
//! The box loaded from the topology file.
matrix boxtop_{};
- //! The ePBC field loaded from the topology file.
- int ePBC_;
+ //! The pbcType field loaded from the topology file.
+ PbcType pbcType_;
// TODO This type is probably movable if we need that.
GMX_DISALLOW_COPY_AND_ASSIGN(TopologyInformation);
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2011,2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+# Copyright (c) 2015,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
install(FILES
arrayref.h
baseversion.h
+ classhelpers.h
enumerationhelpers.h
+ exceptions.h
+ listoflists.h
programcontext.h
range.h
smalloc.h
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{ "Shoot them in the back now", "The Ramones" },
{ "Read me your scripture and I will twist it", "Red Hot Chili Peppers" },
{ "Good Music Saves your Soul", "Lemmy" },
- { "I believe in miracles cause I'm one", "The Ramones" },
- { "Gabba Gabba Hey!", "The Ramones" },
- { "Good Music Saves your Soul", "Lemmy" },
{ "Move about like a Scientist, lay down, get kissed", "Red Hot Chili Peppars" },
{ "California, R.I.P.", "Red Hot Chili Peppars" },
{ "Don't You Wish You Never Met Her, Dirty Blue Gene?", "Captain Beefheart" },
{ "Nobody Never Learnt No-Nothing from No History", "Gogol Bordello" },
{ "I'd be Safe and Warm if I was in L.A.", "The Mamas and the Papas" },
- { "It's Unacceptable That Choclate Makes You Fat", "MI 3" },
+ { "It's Unacceptable That Chocolate Makes You Fat", "MI 3" },
{ "My Brothers are Protons (Protons!), My Sisters are Neurons (Neurons)",
"Gogol Bordello" },
{ "Put Me Inside SSC, Let's Test Superstring Theory, Oh Yoi Yoi Accelerate the Protons",
"takes all the running YOU can do, to keep in the same place. If you want "
"to get somewhere else, you must run at least twice as fast as that!\"",
"Lewis Carroll" },
+ { "More than 10000000 total errors detected. I'm not reporting any more. "
+ "Final error counts will be inaccurate. Go fix your program!",
+ "Valgrind while memory debugging mdrun" },
+ { "If we are going to have SYCL, can we have a hammer as well?", "Joe Jordan" },
+ { "We can make it into a friend class. But I don't like having friends.", "Joe Jordan" },
+ { "A method is more important than a discovery, since the right method will lead to new "
+ "and even more important discoveries.",
+ "Lev Landau" },
+ { "Product of optimism and knowledge is a constant.", "Lev Landau" },
+ { "Why add prime numbers? Prime numbers are made to be multiplied.", "Lev Landau" },
+ { "How wonderful that we have met with a paradox. Now we have some hope of making "
+ "progress.",
+ "Niels Bohr" },
+ { "We must be clear that when it comes to atoms, language can be used only as in poetry. ",
+ "Niels Bohr" },
};
if (beCool())
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Usage examples:
*
- * enum class Foo
+ * enum class Foo : int
* {
- * Bar, Baz, Fooz,
+ * Bar,
+ * Baz,
+ * Fooz,
* Count
* };
*
- * EnumerationWrapper<Foo> iter;
- *
- * for (Foo c : iter)
+ * for (Foo c : EnumerationWrapper<Foo>{})
* {
* // 'c' is a constant from Foo
* }
*
+ *
* const EnumerationArray<Foo, std::string> fooStrings = { { "Bar", "Baz", "Fooz" } };
+ * std::cout << fooStrings[Foo::Baz];
+ * std::cout << fooStrings[Foo::Count]; // Triggers an assertion
*
* for (Foo c : keysOf(fooStrings))
* {
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2019, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \file
+ * \brief
+ * Declares gmx::ListOfLists
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \inpublicapi
+ * \ingroup module_utility
+ */
+#ifndef GMX_UTILITY_LISTOFLISTS_H
+#define GMX_UTILITY_LISTOFLISTS_H
+
+#include <vector>
+
+#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/exceptions.h"
+
+namespace gmx
+{
+
+/*! \brief A list of lists, optimized for performance
+ *
+ * This class holds a list of \p size() lists of elements of type \p T.
+ * To optimize performance, the only modification operation supporting
+ * is adding a new list at the end of the list of lists.
+ *
+ * This implementation stores all data internally in two std::vector objects
+ * and thereby avoids the overhead of managing \p size() separate objects
+ * in memory.
+ *
+ * Internal storage consists of one std::vector<int> listRanges_ of size number
+ * of lists plus one and a std::vector<T> elements_ with the elements of all
+ * lists concatenated. List i is stored in entries listRanges_[i] to
+ * listRanges_[i+1] in elements_.
+ *
+ * \note This class is currently limited to arithmetic types, mainly because
+ * this should only be used for performance critical applications.
+ * When performance is not critical, a std::vector of std::vector can be used.
+ *
+ * \tparam T value type
+ */
+
+template<typename T>
+class ListOfLists
+{
+ static_assert(std::is_arithmetic<T>::value, "This class is limited to arithmetic types");
+
+public:
+ //! Constructs an empty list of lists
+ ListOfLists() = default;
+
+ /*! \brief Constructs a list of list from raw data in internal layout
+ *
+ * Does basic consistency checks and throws when one of those fail.
+ *
+ * \param[in] listRanges Ranges of the lists concatenated (see above), is consumed
+ * \param[in] elements Elements for all lists concatenated, is consumed
+ */
+ ListOfLists(std::vector<int>&& listRanges, std::vector<T>&& elements) :
+ listRanges_(std::move(listRanges)),
+ elements_(std::move(elements))
+ {
+ if (listRanges_.empty() || listRanges_.at(0) != 0)
+ {
+ GMX_THROW(InconsistentInputError(
+ "listRanges does not have a first element with value 0"));
+ }
+ if (int(elements_.size()) != listRanges_.back())
+ {
+ GMX_THROW(InconsistentInputError(
+ "The size of elements does not match the last value in listRanges"));
+ }
+ }
+
+ //! Returns the number of lists
+ std::size_t size() const { return listRanges_.size() - 1; }
+
+ /*! \brief Returns the number of lists
+ *
+ * \note Use ssize for any expression involving arithmetic operations
+ * (including loop indices).
+ */
+ index ssize() const { return index(listRanges_.size()) - 1; }
+
+ //! Returns whether the list holds no lists
+ bool empty() const { return listRanges_.size() == 1; }
+
+ //! Returns the sum of the number of elements over all lists
+ int numElements() const { return listRanges_.back(); }
+
+ //! Appends a new list with elements \p values, pass {} to add an empty list
+ void pushBack(ArrayRef<const T> values)
+ {
+ elements_.insert(elements_.end(), values.begin(), values.end());
+ listRanges_.push_back(int(elements_.size()));
+ }
+
+ //! Appends a new list with \p numElements elements
+ void pushBackListOfSize(int numElements)
+ {
+ // With arithmetic types enforced, this assertion is always true
+ static_assert(std::is_default_constructible<T>::value,
+ "pushBackListOfSize should only be called with default constructable types");
+ elements_.resize(elements_.size() + numElements);
+ listRanges_.push_back(int(elements_.size()));
+ }
+
+ //! Returns an ArrayRef to the elements of the list with the given index
+ ArrayRef<const T> operator[](std::size_t listIndex) const
+ {
+ return ArrayRef<const T>(elements_.data() + listRanges_[listIndex],
+ elements_.data() + listRanges_[listIndex + 1]);
+ }
+
+ //! Returns the list of elements for the list with index \p listIndex, throws an \p out_of_range exception when out of range
+ ArrayRef<const T> at(std::size_t listIndex) const
+ {
+ return ArrayRef<const T>(elements_.data() + listRanges_.at(listIndex),
+ elements_.data() + listRanges_.at(listIndex + 1));
+ }
+
+ /*! \brief Returns a reference to the first list
+ *
+ * \returns a reference to the first list
+ */
+ ArrayRef<T> front()
+ {
+ GMX_ASSERT(size() > 0, "Must contain a list if front() is called");
+ auto beginPtr = elements_.data();
+ auto endPtr = beginPtr + listRanges_[1];
+ return { beginPtr, endPtr };
+ }
+ /*! \brief Returns a reference to the final list
+ *
+ * \returns a reference to the final list
+ */
+ ArrayRef<T> back()
+ {
+ GMX_ASSERT(size() > 0, "Must contain a list if bank() is called");
+ auto endIndex = *(listRanges_.end() - 1);
+ auto beginIndex = *(listRanges_.end() - 2);
+ return { elements_.data() + beginIndex, elements_.data() + endIndex };
+ }
+
+ //! Clears the list
+ void clear()
+ {
+ listRanges_.resize(1);
+ elements_.clear();
+ }
+
+ //! Appends a ListOfLists at the end and increments the appended elements by \p offset
+ void appendListOfLists(const ListOfLists& listOfLists, const T offset = 0)
+ {
+ listRanges_.insert(listRanges_.end(), listOfLists.listRanges_.begin() + 1,
+ listOfLists.listRanges_.end());
+ const int oldNumElements = elements_.size();
+ for (std::size_t i = listRanges_.size() - listOfLists.size(); i < listRanges_.size(); i++)
+ {
+ listRanges_[i] += oldNumElements;
+ }
+ elements_.insert(elements_.end(), listOfLists.elements_.begin(), listOfLists.elements_.end());
+
+ if (offset != 0)
+ {
+ for (std::size_t i = elements_.size() - listOfLists.elements_.size(); i < elements_.size(); i++)
+ {
+ elements_[i] += offset;
+ }
+ }
+ }
+
+ //! Returns concatenated ranges of the lists (see above for details)
+ ArrayRef<const int> listRangesView() const { return listRanges_; }
+
+ //! Returns the a view of the elements of all lists concatenated
+ ArrayRef<const T> elementsView() const { return elements_; }
+
+private:
+ //! The ranges of the lists, list i uses range \p listRanges_[i], \p listRanges_[i+1].
+ std::vector<int> listRanges_ = { 0 };
+ //! The elements in all lists concatenated
+ std::vector<T> elements_;
+};
+
+} // namespace gmx
+
+#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
struct t_commrec;
+enum class PbcType : int;
namespace gmx
{
struct MdModulesCheckpointReadingDataOnMaster;
struct MdModulesCheckpointReadingBroadcast;
struct MdModulesWriteCheckpointData;
-struct PeriodicBoundaryConditionType
-{
- int pbcType;
-};
struct MdModulesEnergyOutputToDensityFittingRequestChecker
{
const double delta_t;
};
+/*! \libinternal
+ * \brief Collection of callbacks to MDModules at differnt run-times.
+ *
+ * MDModules use members of this struct to sign up for callback functionality.
+ *
+ * The members of the struct represent callbacks at these run-times:
+ *
+ * When pre-processing the simulation data
+ * When reading and writing check-pointing data
+ * When setting up simulation after reading in the tpr file
+ *
+ * The template arguments to the members of this struct directly reflect
+ * the callback function signature. Arguments passed as pointers are always
+ * meant to be modified, but never meant to be stored (in line with the policy
+ * everywhere else).
+ */
struct MdModulesNotifier
{
- //! Register callback function types for MdModule
- registerMdModuleNotification<const t_commrec&,
- EnergyCalculationFrequencyErrors*,
- IndexGroupsAndNames,
- KeyValueTreeObjectBuilder,
- const KeyValueTreeObject&,
+ /*! \brief Pre-processing callback functions.
+ *
+ * EnergyCalculationFrequencyErrors* allows modules to check if they match
+ * their required calculation frequency
+ * and add their error message if needed
+ * to the collected error messages
+ * IndexGroupsAndNames provides modules with atom indices and their names
+ * KeyValueTreeObjectBuilder enables writing of module internal data to
+ * .tpr files.
+ */
+ registerMdModuleNotification<EnergyCalculationFrequencyErrors*, IndexGroupsAndNames, KeyValueTreeObjectBuilder>::type preProcessingNotifications_;
+
+ /*! \brief Checkpointing callback functions.
+ *
+ * MdModulesCheckpointReadingDataOnMaster provides modules with their
+ * checkpointed data on the master
+ * node and checkpoint file version
+ * MdModulesCheckpointReadingBroadcast provides modules with a communicator
+ * and the checkpoint file version to
+ * distribute their data
+ * MdModulesWriteCheckpointData provides the modules with a key-value-tree
+ * builder to store their checkpoint data and
+ * the checkpoint file version
+ */
+ registerMdModuleNotification<MdModulesCheckpointReadingDataOnMaster,
+ MdModulesCheckpointReadingBroadcast,
+ MdModulesWriteCheckpointData>::type checkpointingNotifications_;
+
+ /*! \brief Callbacks during simulation setup.
+ *
+ * const KeyValueTreeObject& provides modules with the internal data they
+ * wrote to .tpr files
+ * LocalAtomSetManager* enables modules to add atom indices to local atom sets
+ * to be managed
+ * MdModulesEnergyOutputToDensityFittingRequestChecker* enables modules to
+ * report if they want to write their energy output
+ * to the density fitting field in the energy files
+ * const PbcType& provides modules with the periodic boundary condition type
+ * that is used during the simulation
+ * const SimulationTimeStep& provides modules with the simulation time-step
+ * that allows them to interconvert between step
+ * time information
+ * const t_commrec& provides a communicator to the modules during simulation
+ * setup
+ */
+ registerMdModuleNotification<const KeyValueTreeObject&,
LocalAtomSetManager*,
MdModulesEnergyOutputToDensityFittingRequestChecker*,
- MdModulesCheckpointReadingDataOnMaster,
- MdModulesCheckpointReadingBroadcast,
- MdModulesWriteCheckpointData,
- PeriodicBoundaryConditionType,
- const SimulationTimeStep&>::type notifier_;
+ const PbcType&,
+ const SimulationTimeStep&,
+ const t_commrec&>::type simulationSetupNotifications_;
};
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
inmemoryserializer.cpp
keyvaluetreeserializer.cpp
keyvaluetreetransform.cpp
+ listoflists.cpp
logger.cpp
mutex.cpp
path.cpp
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
EXPECT_EQ(fooStrings[Foo::Fooz], "Fooz");
}
+TEST(EnumerationHelpersTest, EnumerationArrayCountIsSafe)
+{
+ using FooArray = EnumerationArray<Foo, std::string>;
+ const FooArray fooStrings{ { "Bar", "Baz", "Fooz" } };
+
+ // Ensures that the assertions in EnumerationArray::operator[]
+ // would fire if an out-range value (including Count) was used.
+ EXPECT_LE(fooStrings.size(), size_t(Foo::Count));
+#ifndef NDEBUG
+ // Tests (where possible) that those assertions do fire in a build
+ // with debug behavior.
+ EXPECT_DEATH_IF_SUPPORTED(fooStrings[Foo::Count], "index out of range");
+#endif
+}
+
//! Helper function
void func(ArrayRef<const int> a)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Tests for the ListOfLists class.
+ *
+ * \author berk Hess <hess@kth.se>
+ * \ingroup module_utility
+ */
+#include "gmxpre.h"
+
+#include "gromacs/utility/listoflists.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "testutils/testasserts.h"
+
+namespace gmx
+{
+
+namespace
+{
+
+using ::testing::Eq;
+using ::testing::Pointwise;
+
+//! Compares all element between two lists of lists
+template<typename T>
+void compareLists(const ListOfLists<T>& list, const std::vector<std::vector<T>>& v)
+{
+ ASSERT_EQ(list.size(), v.size());
+ for (std::size_t i = 0; i < list.size(); i++)
+ {
+ ASSERT_EQ(list[i].size(), v[i].size());
+ EXPECT_THAT(list[i], Pointwise(Eq(), v[i]));
+ }
+}
+
+TEST(ListOfLists, EmptyListOfListsWorks)
+{
+ ListOfLists<char> list;
+
+ EXPECT_EQ(list.size(), 0);
+ EXPECT_EQ(list.empty(), true);
+ EXPECT_EQ(list.numElements(), 0);
+}
+
+//! Checks whether append works and stores the data correctly
+template<typename T>
+void checkAppend(const std::vector<std::vector<T>> inputLists)
+{
+ ListOfLists<T> list;
+
+ for (const auto& inputList : inputLists)
+ {
+ list.pushBack(inputList);
+ }
+ EXPECT_EQ(list.size(), 2);
+ compareLists(list, inputLists);
+}
+
+TEST(ListOfLists, AppendWorks)
+{
+ const std::vector<std::vector<char>> v = { { 5, 3 }, { char(-1), 7, 4 } };
+
+ checkAppend(v);
+}
+
+TEST(ListOfLists, EmptyListWorks)
+{
+ ListOfLists<char> list;
+
+ std::vector<char> v = { 5, 3 };
+ list.pushBack(v);
+ list.pushBack({});
+ EXPECT_EQ(list.size(), 2);
+ auto a = list[1];
+ EXPECT_EQ(a.empty(), true);
+}
+
+TEST(ListOfLists, AppendAccessWorks)
+{
+ const std::vector<std::vector<char>> v = { { 5, 3 }, { char(-1), 4 } };
+
+ ListOfLists<char> list;
+ list.pushBack(v[0]);
+ list.pushBackListOfSize(v[1].size());
+ std::copy(v[1].begin(), v[1].end(), list.back().begin());
+ compareLists(list, v);
+}
+
+TEST(ListOfLists, ClearWorks)
+{
+ ListOfLists<char> list;
+
+ std::vector<char> v = { 5, 3 };
+ list.pushBack(v);
+ list.pushBack({});
+ list.clear();
+ EXPECT_EQ(list.empty(), true);
+ EXPECT_EQ(list.numElements(), 0);
+}
+
+TEST(ListOfLists, OutOfRangeAccessThrows)
+{
+ ListOfLists<char> list;
+
+ std::vector<char> v = { 5, 3 };
+ EXPECT_THROW(list.at(1), std::out_of_range);
+}
+
+TEST(ListOfLists, FrontAndBackWork)
+{
+ ListOfLists<char> list1;
+ std::vector<char> v1{ { 3, 4 } };
+ list1.pushBack(v1);
+ EXPECT_THAT(list1.front(), Pointwise(Eq(), v1));
+ EXPECT_THAT(list1.back(), Pointwise(Eq(), v1));
+
+ std::vector<char> v2{ { 12, 63, 1 } };
+ list1.pushBack(v2);
+ EXPECT_THAT(list1.front(), Pointwise(Eq(), v1));
+ EXPECT_THAT(list1.back(), Pointwise(Eq(), v2));
+
+ list1.pushBack({});
+ EXPECT_THAT(list1.front(), Pointwise(Eq(), v1));
+ EXPECT_THAT(list1.back(), Pointwise(Eq(), std::vector<char>{}));
+
+ std::vector<char> v3{ { 99, 0, char(-1) } };
+ list1.pushBack(v3);
+ EXPECT_THAT(list1.front(), Pointwise(Eq(), v1));
+ EXPECT_THAT(list1.back(), Pointwise(Eq(), v3));
+
+ ListOfLists<char> list2;
+ list2.pushBack(v2);
+ EXPECT_THAT(list2.front(), Pointwise(Eq(), v2));
+ EXPECT_THAT(list2.back(), Pointwise(Eq(), v2));
+
+ list2.appendListOfLists(list1);
+ EXPECT_THAT(list2.front(), Pointwise(Eq(), v2));
+ EXPECT_THAT(list2.back(), Pointwise(Eq(), v3));
+ EXPECT_EQ(list2.back().size(), v3.size());
+
+ list2.pushBackListOfSize(1);
+ EXPECT_EQ(list2.back().size(), 1);
+}
+
+TEST(ListOfLists, ExtractsAndRestores)
+{
+ const std::vector<std::vector<char>> v({ { 5, 3 }, {}, { char(-1), 4 } });
+
+ ListOfLists<char> list1;
+ for (const auto& vlist : v)
+ {
+ list1.pushBack(vlist);
+ }
+
+ auto listRanges = list1.listRangesView();
+ auto elements = list1.elementsView();
+ std::vector<int> listRangesVector;
+ listRangesVector.insert(listRangesVector.begin(), listRanges.begin(), listRanges.end());
+ std::vector<char> elementsVector;
+ elementsVector.insert(elementsVector.begin(), elements.begin(), elements.end());
+ ListOfLists<char> list2(std::move(listRangesVector), std::move(elementsVector));
+ compareLists(list2, v);
+}
+
+TEST(ListOfLists, AppendsListOfListsWithOffset)
+{
+ std::vector<std::vector<char>> v = { { 5, 3 }, { 2, char(-1) }, { 4 } };
+
+ ListOfLists<char> list1;
+ ListOfLists<char> list2;
+
+ list1.pushBack(v[0]);
+ list2.pushBack(v[1]);
+ list2.pushBack(v[2]);
+ const char offset = 2;
+ list1.appendListOfLists(list2, offset);
+ for (std::size_t i = 1; i < v.size(); i++)
+ {
+ for (auto& elem : v[i])
+ {
+ elem += offset;
+ }
+ }
+ compareLists(list1, v);
+}
+
+} // namespace
+
+} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+# Copyright (c) 2015,2016,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
gmx_target_compile_options(mdrun_objlib)
target_compile_definitions(mdrun_objlib PRIVATE HAVE_CONFIG_H)
target_include_directories(mdrun_objlib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+# Should be possible to remove this when resolving #3290
+target_include_directories(mdrun_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
if(GMX_FAHCORE)
# The lack of a real source file here alongside the object library
add_library(view_objlib OBJECT ${VIEW_SOURCES})
gmx_target_compile_options(view_objlib)
target_compile_definitions(view_objlib PRIVATE HAVE_CONFIG_H)
+ target_include_directories(view_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+ add_library(gmx_objlib OBJECT ${GMX_MAIN_SOURCES})
+ target_include_directories(gmx_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
add_executable(gmx
- ${GMX_MAIN_SOURCES}
+ $<TARGET_OBJECTS:gmx_objlib>
$<TARGET_OBJECTS:mdrun_objlib>
$<TARGET_OBJECTS:view_objlib>)
gmx_target_compile_options(gmx)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
trajectorycomparison.cpp
trajectoryreader.cpp
)
+target_include_directories(mdrun_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
set(testname "MdrunTests")
set(exename "mdrun-test")
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
for (const auto& mode : runModes)
{
+ SCOPED_TRACE("mdrun " + joinStrings(mode.second, " "));
auto modeTargetsGpus = (mode.first.find("Gpu") != std::string::npos);
if (modeTargetsGpus && !s_hasCompatibleGpus)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
snew(man->bHydro, sh.natoms);
snew(bB, sh.natoms);
read_tpx_top(status, nullptr, man->box, &man->natom, nullptr, nullptr, &man->top);
- man->gpbc = gmx_rmpbc_init(&man->top.idef, -1, man->natom);
+ man->gpbc = gmx_rmpbc_init(&man->top.idef, PbcType::Unset, man->natom);
man->natom = read_first_x(man->oenv, &man->status, trajectory, &(man->time), &(man->x), man->box);
man->trajfile = gmx_strdup(trajectory);
put_atoms_in_triclinic_unitcell(ecenterDEF, man->box, atomsArrayRef);
break;
case esbTrunc:
- put_atoms_in_compact_unitcell(man->molw->ePBC, ecenterDEF, man->box, atomsArrayRef);
+ put_atoms_in_compact_unitcell(man->molw->pbcType, ecenterDEF, man->box, atomsArrayRef);
break;
case esbRect:
case esbNone:
int height,
unsigned long fg,
unsigned long bg,
- int ePBC,
+ PbcType pbcType,
matrix box,
gmx_output_env_t* oenv)
{
/* The order of creating windows is important for the stacking order */
/* Mol Window */
- man->molw = init_mw(x11, man->wd.self, 0, 0, 1, 1, WHITE, BLUE, ePBC, box);
+ man->molw = init_mw(x11, man->wd.self, 0, 0, 1, 1, WHITE, BLUE, pbcType, box);
/* Title Window */
InitWin(&(man->title), 0, 0, 1, 1, 0, nullptr);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "xutil.h"
struct gmx_output_env_t;
+enum class PbcType : int;
/* Some window sizes */
#define EWIDTH 200
t_windata wd; /* Mol window structure */
bool bShowHydrogen; /* Show Hydrogens? */
int bond_type; /* Show one of the above bondtypes */
- int ePBC; /* PBC type */
+ PbcType pbcType; /* PBC type */
int boxtype; /* Rectangular, Tric, TruncOct (display)*/
int realbox; /* Property of the real box */
} t_molwin;
int height,
unsigned long fg,
unsigned long bg,
- int ePBC,
+ PbcType pbcType,
matrix box,
gmx_output_env_t* oenv);
/* Initiate the display manager */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return false;
}
-static void set_def(t_molwin* mw, int ePBC, matrix box)
+static void set_def(t_molwin* mw, PbcType pbcType, matrix box)
{
mw->bShowHydrogen = true;
mw->bond_type = eBFat;
- mw->ePBC = ePBC;
+ mw->pbcType = pbcType;
mw->boxtype = esbRect;
mw->realbox = TRICLINIC(box) ? esbTri : esbRect;
}
int height,
unsigned long fg,
unsigned long bg,
- int ePBC,
+ PbcType pbcType,
matrix box)
{
t_molwin* mw;
snew(mw, 1);
- set_def(mw, ePBC, box);
+ set_def(mw, pbcType, box);
InitWin(&mw->wd, x, y, width, height, 1, "Mol Window");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int height,
unsigned long fg,
unsigned long bg,
- int ePBC,
+ PbcType pbcType,
matrix box);
/* Create the molecule window using the x,y etc. */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
case IDEXPORT: ShowDlg(gmx->dlgs[edExport]); break;
case IDDOEXPORT:
write_sto_conf(gmx->confout, *gmx->man->top.name, &(gmx->man->top.atoms), gmx->man->x,
- nullptr, gmx->man->molw->ePBC, gmx->man->box);
+ nullptr, gmx->man->molw->pbcType, gmx->man->box);
break;
case IDQUIT: show_mb(gmx, emQuit); break;
case IDTERM: done_gmx(x11, gmx); return true;
int w0, h0;
int natom, natom_trx;
t_topology top;
- int ePBC;
+ PbcType pbcType;
matrix box;
t_trxframe fr;
t_trxstatus* status;
snew(gmx, 1);
snew(gmx->wd, 1);
- ePBC = read_tpx_top(ftp2fn(efTPR, nfile, fnm), nullptr, box, &natom, nullptr, nullptr, &top);
+ pbcType = read_tpx_top(ftp2fn(efTPR, nfile, fnm), nullptr, box, &natom, nullptr, nullptr, &top);
read_first_frame(oenv, &status, ftp2fn(efTRX, nfile, fnm), &fr, TRX_DONT_SKIP);
close_trx(status);
/* The order of creating windows is important here! */
/* Manager */
- gmx->man = init_man(x11, gmx->wd->self, 0, 0, 1, 1, WHITE, BLACK, ePBC, box, oenv);
+ gmx->man = init_man(x11, gmx->wd->self, 0, 0, 1, 1, WHITE, BLACK, pbcType, box, oenv);
gmx->logo = init_logo(x11, gmx->wd->self, false);
/* Now put all windows in the proper place */
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+# Copyright (c) 2016,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015 by the GROMACS development team.
+ * Copyright (c) 2016,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
probably neither especially elegant nor especially safe. Use of this
module in any remotely critical application is strongly discouraged.
"""
+import errno
import os
import sys
import subprocess
@includepath.setter
def includepath(self, path):
- try: # py2/3 compatibility
- basestring
- except NameError:
- basestring = str
- if isinstance(path, basestring):
+ if isinstance(path, str):
path = [path]
self._includepath = path
devnull = open(os.devnull)
exe_out = subprocess.check_output([exe, '--version'], stderr=devnull)
except OSError as e:
- if e.errno == os.errno.ENOENT:
+ if hasattr(errno, 'ENOENT') and e.errno == errno.ENOENT:
# file not found error.
if not quiet:
print('ERROR: gmx executable not found')